Revision 38208
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java | ||
---|---|---|
43 | 43 |
package org.gvsig.fmap.dal.feature.impl; |
44 | 44 |
|
45 | 45 |
import java.util.ArrayList; |
46 |
import java.util.ConcurrentModificationException; |
|
46 | 47 |
import java.util.Iterator; |
47 | 48 |
|
48 |
import org.slf4j.Logger; |
|
49 |
import org.slf4j.LoggerFactory; |
|
50 |
|
|
51 | 49 |
import org.gvsig.fmap.dal.exception.DataException; |
52 | 50 |
import org.gvsig.fmap.dal.feature.Feature; |
53 | 51 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
... | ... | |
60 | 58 |
import org.gvsig.fmap.geom.GeometryLocator; |
61 | 59 |
import org.gvsig.fmap.geom.primitive.Envelope; |
62 | 60 |
import org.gvsig.tools.dispose.DisposableIterator; |
61 |
import org.slf4j.Logger; |
|
62 |
import org.slf4j.LoggerFactory; |
|
63 | 63 |
|
64 | 64 |
/** |
65 | 65 |
* DOCUMENT ME! |
... | ... | |
119 | 119 |
} |
120 | 120 |
} |
121 | 121 |
|
122 |
if (featureIndex == null) { |
|
123 |
try{ |
|
124 |
featureIndex = featureStore.createIndex(fType, attr.getName(), |
|
125 |
"QuadtreeJts", null); |
|
126 |
}catch (Exception e) { |
|
127 |
LOG.info("It can not create an index", e); |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 | 122 |
if (featureIndex instanceof DefaultFeatureIndex) { |
132 | 123 |
((DefaultFeatureIndex) featureIndex).setValid(true); |
133 | 124 |
} |
... | ... | |
145 | 136 |
if (noSpatialData) { |
146 | 137 |
return; |
147 | 138 |
} |
148 |
if (featureIndex != null) { |
|
149 | 139 |
try { |
150 |
featureIndex.delete(oldFeature); |
|
140 |
if (featureIndex != null) { |
|
141 |
featureIndex.delete(oldFeature); |
|
142 |
} |
|
151 | 143 |
feaOperation.add(new FeatureOperation(((DefaultFeature) oldFeature) |
152 | 144 |
.getReference(), FeatureOperation.DELETE)); |
153 |
featureIndex.insert(feature); |
|
145 |
if (featureIndex != null) { |
|
146 |
featureIndex.insert(feature); |
|
147 |
} |
|
154 | 148 |
feaOperation.add(new FeatureOperation(((DefaultFeature) feature) |
155 | 149 |
.getReference(), FeatureOperation.INSERT)); |
156 | 150 |
} catch (DataException e) { |
... | ... | |
159 | 153 |
} |
160 | 154 |
// } else { |
161 | 155 |
// fullEnvelope.add(feature.getDefaultEnvelope()); |
162 |
} |
|
163 | 156 |
isFullExtentDirty = true; |
164 | 157 |
} |
165 | 158 |
|
... | ... | |
172 | 165 |
if (noSpatialData) { |
173 | 166 |
return; |
174 | 167 |
} |
175 |
if (featureIndex != null) { |
|
176 | 168 |
try { |
177 |
featureIndex.insert(feature); |
|
169 |
if (featureIndex != null) { |
|
170 |
featureIndex.insert(feature); |
|
171 |
} |
|
178 | 172 |
feaOperation.add(new FeatureOperation( |
179 | 173 |
((DefaultFeature) feature).getReference(), |
180 | 174 |
FeatureOperation.INSERT)); |
... | ... | |
183 | 177 |
+ feature, e); |
184 | 178 |
} |
185 | 179 |
isFullExtentDirty = true; |
186 |
} else if (!isFullExtentDirty) { |
|
187 |
fullEnvelope.add(feature.getDefaultEnvelope()); |
|
188 |
} |
|
180 |
// } else if (!isFullExtentDirty) {
|
|
181 |
// fullEnvelope.add(feature.getDefaultEnvelope());
|
|
182 |
// }
|
|
189 | 183 |
} |
190 | 184 |
|
191 | 185 |
/** |
... | ... | |
197 | 191 |
if (noSpatialData) { |
198 | 192 |
return; |
199 | 193 |
} |
200 |
if (featureIndex != null) { |
|
201 | 194 |
try { |
202 |
featureIndex.delete(feature); |
|
195 |
if (featureIndex != null) { |
|
196 |
featureIndex.delete(feature); |
|
197 |
} |
|
203 | 198 |
feaOperation.add(new FeatureOperation(((DefaultFeature) feature) |
204 | 199 |
.getReference(), FeatureOperation.DELETE)); |
205 | 200 |
} catch (DataException e) { |
206 | 201 |
throw new RuntimeException("Exception deleting feature: " |
207 | 202 |
+ feature, e); |
208 | 203 |
} |
209 |
} |
|
210 | 204 |
isFullExtentDirty = true; |
211 | 205 |
} |
212 | 206 |
|
... | ... | |
259 | 253 |
fullEnvelope = GeometryLocator.getGeometryManager().createEnvelope( |
260 | 254 |
attr.getGeometrySubType()); |
261 | 255 |
} |
256 |
} catch (ConcurrentModificationException e) { |
|
257 |
throw e; |
|
262 | 258 |
} catch (Exception e) { |
263 | 259 |
throw new RuntimeException(e); |
264 | 260 |
} finally { |
Also available in: Unified diff