[Schmitzm-commits] r323 - in branches/1.0-gt2-2.6/src: schmitzm/geotools/io skrueger/geotools/io

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 26 16:49:32 CEST 2009


Author: alfonx
Date: 2009-08-26 16:49:32 +0200 (Wed, 26 Aug 2009)
New Revision: 323

Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
Log:
Migrating to GT2.6

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java	2009-08-26 14:12:17 UTC (rev 322)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java	2009-08-26 14:49:32 UTC (rev 323)
@@ -56,6 +56,8 @@
 import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;
 import org.geotools.data.DataStore;
 import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.shapefile.ShpFiles;
+import org.geotools.data.shapefile.indexed.IndexType;
 import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
 import org.geotools.data.shapefile.shp.ShapefileReader;
 import org.geotools.factory.Hints;
@@ -253,13 +255,13 @@
 	 */
 	public static DataStore readDataStoreFromShape(URL shpURL, URL prjURL)
 			throws IOException {
-		Map map = new HashMap();
+		Map<Object,Object> map = new HashMap<Object,Object>();
 		map.put("url", shpURL);
 		map.put("create spatial index", true);
 
 		// DataStore dataStore = DataStoreFinder.getDataStore( map );
 		DataStore dataStore = new IndexedShapefileDataStore(shpURL, null,
-				false, true, IndexedShapefileDataStore.TREE_QIX);
+				false, true, IndexType.QIX);
 		// DataStore dataStore = new ShapefileDataStore(shpURL);
 		System.out.println("DataStore = " + dataStore.getClass().toString());
 		IndexedShapefileDataStore dataStoreIndex = (IndexedShapefileDataStore) dataStore;
@@ -288,8 +290,11 @@
 	 */
 	public static Vector<Geometry> readGeometriesFromShapeFile(File file)
 			throws Exception {
-		FileChannel in = new FileInputStream(file).getChannel();
-		ShapefileReader r = new ShapefileReader(in, new Lock());
+//		FileChannel in = new FileInputStream(file).getChannel();
+//		ShapefileReader r = new ShapefileReader(in, new Lock());
+
+		ShapefileReader r = new ShapefileReader(new ShpFiles(file), true, false);
+		
 		Vector<Geometry> geomList = new Vector<Geometry>();
 		for (int i = 1; r.hasNext(); i++) {
 			// org.geotools.renderer.geom.Geometry shape =
@@ -460,7 +465,7 @@
 			File file, CoordinateReferenceSystem crs) throws Exception {
 		// Versuchen Geo-Information aus Tiff zu lesen
 		try {
-			Hints hints = new Hints(null);
+			Hints hints = new Hints();
 			// Wenn CRS angegeben, dieses durch Hint erzwingen
 			if (crs != null)
 				hints.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);
@@ -490,7 +495,7 @@
 		// @todo check the work of WorldImageReader with colorization!
 		throw new UnsupportedOperationException(
 				"WorldImageReader does not work well, yet... AbstractGridCoverage2DReader can not be created from this Tiff!");
-		// Hints hints = new Hints(null);
+		// Hints hints = new Hints();
 		// // Wenn CRS angegeben, dieses durch Hint erzwingen
 		// if ( crs != null )
 		// hints.put( Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs );
@@ -534,7 +539,7 @@
 		GridCoverage2D gc = null;
 		// Versuchen Geo-Information aus Tiff zu lesen
 		try {
-			Hints hints = new Hints(null);
+			Hints hints = new Hints();
 
 			// Wenn CRS angegeben, dieses durch Hint erzwingen
 			if (crs != null)

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-08-26 14:12:17 UTC (rev 322)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java	2009-08-26 14:49:32 UTC (rev 323)
@@ -153,7 +153,7 @@
 		try {
 
 			// Wenn CRS angegeben, dieses durch Hint erzwingen
-			Hints hints = new Hints(null);
+			Hints hints = new Hints();
 
 			if (crs != null)
 				hints.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs);



More information about the Schmitzm-commits mailing list