Revision 35482
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java | ||
---|---|---|
210 | 210 |
featureStore.getDefaultFeatureType() |
211 | 211 |
.getDefaultGeometryAttributeIndex()); |
212 | 212 |
Envelope fullEnvelope = null; |
213 |
try { |
|
214 |
fullEnvelope = GeometryLocator.getGeometryManager().createEnvelope( |
|
215 |
attr.getGeometrySubType()); |
|
216 |
} catch (Exception e) { |
|
217 |
// FIXME Exception |
|
218 |
throw new RuntimeException(e); |
|
219 |
} |
|
213 |
|
|
220 | 214 |
FeatureSet set = null; |
221 | 215 |
DisposableIterator iterator = null; |
222 | 216 |
try { |
223 | 217 |
set = featureStore.getFeatureSet(); |
224 | 218 |
iterator = set.fastIterator(); |
219 |
//First while to initialize the feature envelope |
|
225 | 220 |
while (iterator.hasNext()) { |
221 |
Feature feature = (Feature) iterator.next(); |
|
222 |
Envelope envelope = feature.getDefaultEnvelope(); |
|
223 |
if (envelope != null){ |
|
224 |
fullEnvelope = (Envelope)envelope.clone(); |
|
225 |
break; |
|
226 |
} |
|
227 |
} |
|
228 |
//Second while to add new evelopes tho the full envelope |
|
229 |
while (iterator.hasNext()) { |
|
226 | 230 |
Feature feature = (Feature) iterator.next(); |
227 |
Envelope envelope = feature.getDefaultEnvelope(); |
|
231 |
Envelope envelope = feature.getDefaultEnvelope();
|
|
228 | 232 |
if(envelope!=null){ |
229 | 233 |
fullEnvelope.add(envelope); |
230 | 234 |
} |
231 | 235 |
} |
232 |
} finally { |
|
236 |
//Creating an empty envelope by default |
|
237 |
if (fullEnvelope == null){ |
|
238 |
fullEnvelope = GeometryLocator.getGeometryManager().createEnvelope( |
|
239 |
attr.getGeometrySubType()); |
|
240 |
} |
|
241 |
} catch (Exception e) { |
|
242 |
throw new RuntimeException(e); |
|
243 |
} finally { |
|
233 | 244 |
if (iterator != null) { |
234 | 245 |
iterator.dispose(); |
235 | 246 |
} |
Also available in: Unified diff