Revision 29326 branches/v2_0_0_prep/libraries/libDielmoOpenLiDAR/src/org/gvsig/fmap/dal/store/lidar/LiDARStoreProvider.java
LiDARStoreProvider.java | ||
---|---|---|
13 | 13 |
import java.util.Iterator; |
14 | 14 |
import java.util.List; |
15 | 15 |
|
16 |
import org.gvsig.fmap.dal.DataParameters; |
|
17 | 16 |
import org.gvsig.fmap.dal.DataStoreNotification; |
18 | 17 |
import org.gvsig.fmap.dal.DataTypes; |
19 | 18 |
import org.gvsig.fmap.dal.exception.CloseException; |
... | ... | |
30 | 29 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
31 | 30 |
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices; |
32 | 31 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
33 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
34 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
35 | 32 |
import org.gvsig.fmap.dal.resource.exception.ResourceBeginException; |
36 | 33 |
import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException; |
37 | 34 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
38 | 35 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
39 | 36 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
37 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
40 | 38 |
import org.gvsig.fmap.geom.Geometry; |
41 | 39 |
import org.gvsig.fmap.geom.GeometryLocator; |
42 | 40 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
45 | 43 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
46 | 44 |
import org.gvsig.fmap.geom.primitive.Envelope; |
47 | 45 |
import org.gvsig.tools.ToolsLocator; |
48 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
49 | 46 |
import org.gvsig.tools.dynobject.DynClass; |
50 | 47 |
import org.gvsig.tools.dynobject.DynField; |
51 | 48 |
import org.gvsig.tools.dynobject.DynObjectManager; |
... | ... | |
127 | 124 |
private static final String DYNCLASS_NAME = "LiDARStore"; |
128 | 125 |
protected static DynClass DYNCLASS = null; |
129 | 126 |
private ResourceProvider liDARResource; |
130 |
private LiDARStoreParameters liDARParams; |
|
131 | 127 |
|
128 |
|
|
132 | 129 |
private long counterNewsOIDs = -1; |
133 | 130 |
private boolean isOpen = false; |
134 | 131 |
|
135 | 132 |
|
136 | 133 |
|
137 |
public LiDARStoreProvider() throws InitializeException { |
|
138 |
super(); |
|
139 |
} |
|
140 |
|
|
141 |
public LiDARStoreProvider(DataParameters params) |
|
134 |
public LiDARStoreProvider(LiDARStoreParameters params, |
|
135 |
DataStoreProviderServices storeServices) |
|
142 | 136 |
throws InitializeException { |
143 |
super(); |
|
144 |
this.liDARParams = (LiDARStoreParameters) params; |
|
145 |
this.metadata = (DelegatedDynObject) ToolsLocator |
|
146 |
.getDynObjectManager().createDynObject(DYNCLASS); |
|
137 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
138 |
.createDynObject(DYNCLASS)); |
|
147 | 139 |
|
148 |
this.metadata.setDynValue("DefaultSRS", null); |
|
149 |
this.metadata.setDynValue("Envelope", null); |
|
150 |
|
|
151 | 140 |
m_Fich = getLiDARParameters().getFile(); |
152 | 141 |
liDARResource = this.createResource(FileResource.NAME, |
153 | 142 |
new Object[] { m_Fich.getAbsolutePath() }); |
154 | 143 |
liDARResource.addConsumer(this); |
144 |
this.initFeatureType(); |
|
155 | 145 |
|
156 | 146 |
} |
157 | 147 |
|
158 |
|
|
159 | 148 |
protected static void registerDynClass() { |
160 | 149 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
161 | 150 |
DynClass dynClass; |
... | ... | |
172 | 161 |
|
173 | 162 |
} |
174 | 163 |
private LiDARStoreParameters getLiDARParameters() { |
175 |
return this.liDARParams;
|
|
164 |
return (LiDARStoreParameters) getParameters();
|
|
176 | 165 |
} |
177 | 166 |
|
178 |
public FeatureStoreProvider initialize(FeatureStoreProviderServices store) |
|
179 |
throws InitializeException { |
|
180 |
super.initialize(store); |
|
181 |
this.initFeatureType(); |
|
182 |
return this; |
|
183 |
} |
|
184 |
|
|
185 | 167 |
protected void initFeatureType() throws InitializeException { |
186 | 168 |
try { |
187 | 169 |
this.open(); |
188 | 170 |
} catch (OpenException e) { |
189 | 171 |
throw new InitializeException(NAME, e); |
190 | 172 |
} |
191 |
EditableFeatureType fType = this.store.createFeatureType(); |
|
173 |
LiDARStoreParameters liDARParams = getLiDARParameters(); |
|
174 |
EditableFeatureType fType = this.getStoreServices().createFeatureType(); |
|
192 | 175 |
FeatureType finalFType; |
193 | 176 |
|
194 | 177 |
fType.setHasOID(true); |
... | ... | |
206 | 189 |
List types = new ArrayList(1); |
207 | 190 |
finalFType = fType.getNotEditableCopy(); |
208 | 191 |
types.add(finalFType); |
209 |
this.store.setFeatureTypes(types, finalFType);
|
|
192 |
this.getStoreServices().setFeatureTypes(types, finalFType);
|
|
210 | 193 |
} |
211 | 194 |
|
212 | 195 |
private void getFields(EditableFeatureType fType ){ |
... | ... | |
282 | 265 |
|
283 | 266 |
/* |
284 | 267 |
* (non-Javadoc) |
285 |
*
|
|
268 |
* |
|
286 | 269 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureProviderByReference(org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices) |
287 | 270 |
*/ |
288 | 271 |
public FeatureProvider getFeatureProviderByReference( |
289 | 272 |
FeatureReferenceProviderServices reference) throws DataException { |
290 |
return this.getFeatureProviderByReference(reference, this.store |
|
273 |
return this.getFeatureProviderByReference(reference, this |
|
274 |
.getFeatureStore() |
|
291 | 275 |
.getDefaultFeatureType()); |
292 | 276 |
} |
293 | 277 |
|
... | ... | |
352 | 336 |
// Cargar Metadatos !!! (Envelope, SRS...) |
353 | 337 |
Envelope envelope = geomManager.createEnvelope(hdr.getMinX(), hdr |
354 | 338 |
.getMinY(), hdr.getMaxX(), hdr.getMaxY(), SUBTYPES.GEOM2D); |
355 |
this.metadata.setDynValue("Envelope", envelope);
|
|
339 |
this.setDynValue("Envelope", envelope); |
|
356 | 340 |
} catch (IOException e) { |
357 | 341 |
throw new OpenException(NAME, e); |
358 | 342 |
} catch (ResourceNotifyOpenException e) { |
... | ... | |
426 | 410 |
this.hdr = null; |
427 | 411 |
liDARResource.removeConsumer(this); |
428 | 412 |
liDARResource = null; |
429 |
liDARParams = null; |
|
430 | 413 |
m_Fich = null; |
431 | 414 |
fTemp = null; |
415 |
super.dispose(); |
|
432 | 416 |
} |
433 | 417 |
|
434 | 418 |
@Override |
... | ... | |
448 | 432 |
} |
449 | 433 |
|
450 | 434 |
public void resourceChanged(ResourceProvider resource) { |
451 |
this.store.notifyChange(DataStoreNotification.RESOURCE_CHANGED, |
|
435 |
this.getStoreServices().notifyChange( |
|
436 |
DataStoreNotification.RESOURCE_CHANGED, |
|
452 | 437 |
resource); |
453 | 438 |
} |
454 | 439 |
|
Also available in: Unified diff