Revision 47633
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/SpatialCache.java | ||
---|---|---|
46 | 46 |
import org.gvsig.tools.i18n.I18nManager; |
47 | 47 |
import org.gvsig.tools.task.AbstractCancellableTask; |
48 | 48 |
import org.gvsig.tools.task.SimpleTaskStatus; |
49 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
49 | 50 |
import org.gvsig.tools.visitor.Visitor; |
50 | 51 |
import org.slf4j.Logger; |
51 | 52 |
import org.slf4j.LoggerFactory; |
... | ... | |
212 | 213 |
status.message(i18n.getTranslation("_Searching_geometries")); |
213 | 214 |
fset = store.getFeatureSet(query); |
214 | 215 |
status.setRangeOfValues(0, fset.size64()); |
215 |
it = fset.fastIterator(); |
|
216 |
while( it.hasNext() ) {
|
|
217 |
if( this.isCancellationRequested() || status.isCancellationRequested() ) {
|
|
216 |
|
|
217 |
fset.accept((Object obj) -> {
|
|
218 |
if (this.isCancellationRequested() || status.isCancellationRequested()) {
|
|
218 | 219 |
status.cancel(); |
219 |
return;
|
|
220 |
throw new VisitCanceledException();
|
|
220 | 221 |
} |
221 |
Geometry geom = it.next().getDefaultGeometry(); |
|
222 |
Feature feat = (Feature) obj; |
|
223 |
Geometry geom = feat.getDefaultGeometry(); |
|
222 | 224 |
insert(geom.getEnvelope(), geom); |
223 | 225 |
status.incrementCurrentValue(); |
224 |
} |
|
226 |
}); |
|
227 |
|
|
225 | 228 |
status.terminate(); |
226 | 229 |
} catch (Exception ex) { |
227 | 230 |
logger.warn("Can't refresh spatial cache of '"+name+"'", ex); |
Also available in: Unified diff