Revision 29326 branches/v2_0_0_prep/extensions/extDwg/src/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java
DWGStoreProvider.java | ||
---|---|---|
33 | 33 |
import org.gvsig.fmap.dal.feature.exception.CreateGeometryException; |
34 | 34 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
35 | 35 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
36 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
37 | 36 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
38 | 37 |
import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider; |
39 | 38 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
... | ... | |
43 | 42 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
44 | 43 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
45 | 44 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
45 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
46 | 46 |
import org.gvsig.fmap.geom.Geometry; |
47 | 47 |
import org.gvsig.fmap.geom.GeometryLocator; |
48 | 48 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
51 | 51 |
import org.gvsig.fmap.geom.primitive.Envelope; |
52 | 52 |
import org.gvsig.fmap.geom.primitive.Point; |
53 | 53 |
import org.gvsig.tools.ToolsLocator; |
54 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
55 | 54 |
import org.gvsig.tools.dynobject.DynClass; |
56 | 55 |
import org.gvsig.tools.dynobject.DynField; |
57 | 56 |
import org.gvsig.tools.dynobject.DynObjectManager; |
... | ... | |
102 | 101 |
|
103 | 102 |
|
104 | 103 |
|
105 |
private DWGStoreParameters getDWGParameters() { |
|
106 |
return (DWGStoreParameters) this.parameters; |
|
107 |
} |
|
108 | 104 |
|
109 |
public DWGStoreProvider(DWGStoreParameters parameters) { |
|
110 |
super(parameters); |
|
111 |
} |
|
105 |
public DWGStoreProvider(DWGStoreParameters parameters, |
|
106 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
107 |
super(parameters,storeServices,ToolsLocator |
|
108 |
.getDynObjectManager() |
|
109 |
.createDynObject(DYNCLASS)); |
|
112 | 110 |
|
113 |
public FeatureStoreProvider initialize(FeatureStoreProviderServices store) |
|
114 |
throws InitializeException { |
|
115 |
super.initialize(store); |
|
116 |
|
|
117 |
this.metadata = (DelegatedDynObject) ToolsLocator |
|
118 |
.getDynObjectManager().createDynObject(DYNCLASS); |
|
119 |
|
|
120 | 111 |
counterNewsOIDs = 0; |
121 | 112 |
// projection = CRSFactory.getCRS(getParameters().getSRSID()); |
122 | 113 |
|
... | ... | |
141 | 132 |
} |
142 | 133 |
|
143 | 134 |
this.initializeFeatureTypes(); |
144 |
return this; |
|
135 |
|
|
136 |
|
|
145 | 137 |
} |
146 | 138 |
|
139 |
private DWGStoreParameters getDWGParameters() { |
|
140 |
return (DWGStoreParameters) this.getParameters(); |
|
141 |
} |
|
142 |
|
|
143 |
|
|
147 | 144 |
public String getName() { |
148 | 145 |
return NAME; |
149 | 146 |
} |
... | ... | |
208 | 205 |
} |
209 | 206 |
try { |
210 | 207 |
DWGData dwgData = null; |
208 |
FeatureStoreProviderServices store = getStoreServices(); |
|
211 | 209 |
if (this.resource.getData() != null) { |
212 | 210 |
dwgData = (DWGData) ((Map) this.resource.getData()) |
213 | 211 |
.get(this.projection |
... | ... | |
227 | 225 |
projection, |
228 | 226 |
this.legendBuilder |
229 | 227 |
); |
230 |
reader.begin(this.store);
|
|
228 |
reader.begin(store); |
|
231 | 229 |
dwgData.defaultFType = reader.getDefaultType() |
232 | 230 |
.getNotEditableCopy(); |
233 | 231 |
ArrayList types = new ArrayList(); |
... | ... | |
245 | 243 |
dwgData.legendBuilder = this.legendBuilder; |
246 | 244 |
|
247 | 245 |
resource.notifyOpen(); |
248 |
this.store |
|
249 |
.setFeatureTypes(dwgData.fTypes, dwgData.defaultFType); |
|
246 |
store.setFeatureTypes(dwgData.fTypes, dwgData.defaultFType); |
|
250 | 247 |
reader.load(); |
251 | 248 |
// this.envelope = reader.getEnvelope(); |
252 | 249 |
|
... | ... | |
262 | 259 |
} |
263 | 260 |
|
264 | 261 |
this.data = dwgData.data; |
265 |
this.store.setFeatureTypes(dwgData.fTypes, dwgData.defaultFType);
|
|
262 |
store.setFeatureTypes(dwgData.fTypes, dwgData.defaultFType); |
|
266 | 263 |
this.legendBuilder = dwgData.legendBuilder; |
267 |
this.metadata.setDynValue("Envelope", dwgData.getEnvelopeCopy()); |
|
268 |
this.metadata |
|
269 |
.setDynValue("DefaultSRS", this.projection.getAbrev()); |
|
264 |
this.setDynValue("Envelope", dwgData.getEnvelopeCopy()); |
|
265 |
this.setDynValue("DefaultSRS", this.projection.getAbrev()); |
|
270 | 266 |
this.counterNewsOIDs = this.data.size(); |
271 | 267 |
} catch (Exception e) { |
272 | 268 |
this.data = null; |
... | ... | |
648 | 644 |
|
649 | 645 |
public Envelope getEnvelope() throws DataException { |
650 | 646 |
this.open(); |
651 |
return (Envelope) this.metadata.getDynValue("Envelope");
|
|
647 |
return (Envelope) this.getDynValue("Envelope"); |
|
652 | 648 |
} |
653 | 649 |
|
654 |
public Iterator getChilds() { |
|
655 |
// TODO Auto-generated method stub |
|
656 |
return null; |
|
657 |
} |
|
658 | 650 |
|
659 |
|
|
660 | 651 |
/* |
661 | 652 |
* (non-Javadoc) |
662 | 653 |
* |
... | ... | |
665 | 656 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
666 | 657 |
*/ |
667 | 658 |
public void resourceChanged(ResourceProvider resource) { |
668 |
this.store.notifyChange(DataStoreNotification.RESOURCE_CHANGED, |
|
659 |
this.getStoreServices().notifyChange( |
|
660 |
DataStoreNotification.RESOURCE_CHANGED, |
|
669 | 661 |
resource); |
670 | 662 |
} |
671 | 663 |
|
Also available in: Unified diff