Revision 24248 branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/store/dxf/DXFStoreProvider.java
DXFStoreProvider.java | ||
---|---|---|
36 | 36 |
import org.gvsig.fmap.data.exceptions.ReadException; |
37 | 37 |
import org.gvsig.fmap.data.exceptions.WriteException; |
38 | 38 |
import org.gvsig.fmap.data.feature.EditableFeatureType; |
39 |
import org.gvsig.fmap.data.feature.FeatureReference; |
|
40 | 39 |
import org.gvsig.fmap.data.feature.FeatureSet; |
41 | 40 |
import org.gvsig.fmap.data.feature.FeatureType; |
42 | 41 |
import org.gvsig.fmap.data.feature.exceptions.PerformEditingException; |
... | ... | |
64 | 63 |
import org.gvsig.fmap.geom.primitive.Surface2DZ; |
65 | 64 |
import org.gvsig.fmap.geom.util.Converter; |
66 | 65 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
66 |
import org.gvsig.tools.exception.NotYetImplemented; |
|
67 | 67 |
import org.gvsig.tools.operations.OperationNotSupportedException; |
68 |
import org.gvsig.tools.persistence.AbstractPersistenceManager; |
|
68 | 69 |
import org.gvsig.tools.persistence.PersistenceException; |
69 | 70 |
import org.gvsig.tools.persistence.PersistentState; |
70 | 71 |
|
... | ... | |
89 | 90 |
private ResourceProvider resource; |
90 | 91 |
private LegendBuilder leyendBuilder; |
91 | 92 |
|
93 |
private int counterNewsOIDs; |
|
94 |
|
|
92 | 95 |
private DXFStoreParameters getParameters() { |
93 | 96 |
return (DXFStoreParameters) this.store.getParameters(); |
94 | 97 |
} |
... | ... | |
97 | 100 |
throws InitializeException { |
98 | 101 |
super.initialize(store); |
99 | 102 |
|
103 |
counterNewsOIDs = 0; |
|
100 | 104 |
// projection = CRSFactory.getCRS(getParameters().getSRSID()); |
101 | 105 |
|
102 | 106 |
resource = this.createResource( |
... | ... | |
147 | 151 |
this.data = (ArrayList) this.resource.getData(); |
148 | 152 |
} else { |
149 | 153 |
Reader reader = new Reader().initialice( |
150 |
(File) this.resource |
|
151 |
.get(), |
|
152 |
projection, this.leyendBuilder |
|
154 |
this, |
|
155 |
(File) this.resource.get(), |
|
156 |
projection, |
|
157 |
this.leyendBuilder |
|
153 | 158 |
); |
154 | 159 |
reader.begin(this.store); |
155 | 160 |
this.store.setFeatureTypes(reader.getTypes(), reader |
... | ... | |
245 | 250 |
writer.end(); |
246 | 251 |
resource.notifyClose(); |
247 | 252 |
features.dispose(); |
253 |
counterNewsOIDs = 0; |
|
248 | 254 |
|
249 | 255 |
} catch (Exception e) { |
250 | 256 |
throw new PerformEditingException(fileName, e); |
... | ... | |
287 | 293 |
private IProjection projection; |
288 | 294 |
private List types; |
289 | 295 |
private LegendBuilder leyendBuilder; |
296 |
private AbstractMemoryStoreProvider store; |
|
290 | 297 |
|
291 |
public Reader initialice(File file, IProjection projection, |
|
298 |
public Reader initialice(AbstractMemoryStoreProvider store, File file, |
|
299 |
IProjection projection, |
|
292 | 300 |
LegendBuilder leyendBuilder) { |
301 |
this.store = store; |
|
293 | 302 |
this.file = file; |
294 | 303 |
this.fileName = file.getAbsolutePath(); |
295 | 304 |
this.projection = projection; |
... | ... | |
444 | 453 |
|
445 | 454 |
for (int i = 0; i < features.size(); i++) { |
446 | 455 |
|
447 |
FeatureData feature = createFeatureData(store |
|
448 |
.getDefaultFeatureType(), new Long(featureDatas.size()));
|
|
456 |
FeatureData feature = store.createFeatureData(store
|
|
457 |
.getStoreServices().getDefaultFeatureType());
|
|
449 | 458 |
|
450 | 459 |
try { |
451 | 460 |
Feature fea = (Feature) features.get(i); |
... | ... | |
466 | 475 |
.getProp("thickness"))); |
467 | 476 |
// FIXME: Abria que pillar el resto de atributos del DXF. |
468 | 477 |
|
469 |
featureDatas.add(feature);
|
|
478 |
store.addFeatureData(feature);
|
|
470 | 479 |
|
471 | 480 |
|
472 | 481 |
// FIXME: Habia una incongruencia en el codigo ya que al |
... | ... | |
1292 | 1301 |
return true; |
1293 | 1302 |
} |
1294 | 1303 |
|
1295 |
public int getFeatureReferenceIdType() {
|
|
1304 |
public int getFeatureReferenceOIDType() {
|
|
1296 | 1305 |
return DataTypes.LONG; |
1297 | 1306 |
} |
1298 | 1307 |
|
1299 |
public FeatureData getFeatureData(Object refId) |
|
1300 |
throws DataException { |
|
1301 |
this.open(); |
|
1302 |
Long id = (Long) refId; |
|
1303 |
return (FeatureData) this.data.get(id.intValue()); |
|
1304 |
|
|
1308 |
public boolean supportsAppendMode() { |
|
1309 |
return false; |
|
1305 | 1310 |
} |
1306 | 1311 |
|
1307 | 1312 |
public void append(org.gvsig.fmap.data.feature.Feature feature) { |
1308 |
// TODO Auto-generated method stub |
|
1309 |
|
|
1313 |
throw new UnsupportedOperationException(); |
|
1310 | 1314 |
} |
1311 | 1315 |
|
1312 | 1316 |
public void beginAppend() { |
1313 |
// TODO Auto-generated method stub |
|
1314 |
|
|
1317 |
throw new UnsupportedOperationException(); |
|
1315 | 1318 |
} |
1316 | 1319 |
|
1317 |
public FeatureReference createFeatureReference(Object frefid) { |
|
1318 |
// TODO Auto-generated method stub |
|
1319 |
return null; |
|
1320 |
} |
|
1321 |
|
|
1322 | 1320 |
public void endAppend() { |
1323 |
// TODO Auto-generated method stub |
|
1324 |
|
|
1321 |
throw new UnsupportedOperationException(); |
|
1325 | 1322 |
} |
1326 | 1323 |
|
1327 | 1324 |
public PersistentState getState() throws PersistenceException { |
1328 |
// TODO Auto-generated method stub |
|
1329 |
return null; |
|
1325 |
return AbstractPersistenceManager.getState(this); |
|
1330 | 1326 |
} |
1331 | 1327 |
|
1332 | 1328 |
public void loadState(PersistentState state) throws PersistenceException { |
1333 | 1329 |
// TODO Auto-generated method stub |
1334 |
|
|
1330 |
throw new NotYetImplemented(); |
|
1335 | 1331 |
} |
1336 | 1332 |
|
1337 | 1333 |
public void setState(PersistentState state) throws PersistenceException { |
1338 | 1334 |
// TODO Auto-generated method stub |
1339 |
|
|
1335 |
throw new NotYetImplemented(); |
|
1340 | 1336 |
} |
1341 | 1337 |
|
1342 |
public boolean supportsAppendMode() { |
|
1343 |
Object obj = new Object[] { "a", "b" }; |
|
1344 |
return false; |
|
1338 |
public Object createNewOID() { |
|
1339 |
return new Integer(this.data.size() + ++counterNewsOIDs); |
|
1345 | 1340 |
} |
1346 | 1341 |
|
1342 |
|
|
1347 | 1343 |
} |
Also available in: Unified diff