From fe682356cf9d8afbc1bf93963a502592d8e9c50c Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Thu, 08 Apr 2010 16:31:14 +0800 Subject: [PATCH] update geotools to 2.6.2 --- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java index 57483a2..b144586 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java @@ -21,12 +21,12 @@ import org.geotools.data.FeatureWriter; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; +import org.geotools.data.shapefile.indexed.IndexType; import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; -import org.geotools.feature.Feature; -import org.geotools.feature.FeatureType; import org.geotools.feature.IllegalAttributeException; import org.geotools.feature.SchemaException; -import org.geotools.feature.SimpleFeature; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; import org.xml.sax.SAXException; import com.vividsolutions.jts.geom.GeometryFactory; @@ -51,7 +51,7 @@ private String dataOut = null; - private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); + private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); private PessimisticMapWrapper txFeaturesContext; @@ -109,8 +109,7 @@ return; } - // �P�_�O�_�ũM���� - Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); + SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); if (feature == null) { FrammeAttributeData linkage = AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); @@ -171,7 +170,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); logger.debug("Begin Save shapefile:" + sfile.toURI()); @@ -186,24 +185,24 @@ */ if (!sfile.exists()) { ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), - null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); + null, true, true, IndexType.QIX, Charset.forName("UTF-8")); shapefileDataStore.createSchema(featureType); writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT); } else { ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), - null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); + null, true, true, IndexType.QIX, Charset.forName("UTF-8")); writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT); } featuresWriterContext.put(featureType.getTypeName(), writer); } - ArrayList<Feature> features = featuresContext.get(featureType); + ArrayList<SimpleFeature> features = featuresContext.get(featureType); Iterator itFeature = features.iterator(); while (itFeature.hasNext()) { - Feature feature = (Feature) itFeature.next(); - ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); + SimpleFeature feature = (SimpleFeature) itFeature.next(); + ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); } //writer.close(); logger.debug("End Save shapefile:" + sfile.toURI()); -- Gitblit v0.0.0-SNAPSHOT