|
|
|
svn_geotools
|
Author: aaime
Date: 2009-11-11 09:27:11 -0500 (Wed, 11 Nov 2009) New Revision: 34360 Added: branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.dbf branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.prj branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shp branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shx Modified: branches/2.6.x/modules/plugin/shapefile/ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java Log: GEOT-2683, Speed up dbf reading when the target charset is not multibyte Copied: branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.dbf (from rev 34359, trunk/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.dbf) =================================================================== (Binary files differ) Copied: branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.prj (from rev 34359, trunk/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.prj) =================================================================== --- branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.prj (rev 0) +++ branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.prj 2009-11-11 14:27:11 UTC (rev 34360) @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file Copied: branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shp (from rev 34359, trunk/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shp) =================================================================== (Binary files differ) Copied: branches/2.6.x/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shx (from rev 34359, trunk/modules/library/sample-data/src/main/resources/org/geotools/test-data/shapes/rus-windows-1251.shx) =================================================================== (Binary files differ) Property changes on: branches/2.6.x/modules/plugin/shapefile ___________________________________________________________________ Modified: svn:mergeinfo - /branches/2.5.x/modules/plugin/shapefile:33331,33337-33338,33349,33351,33354,33601,33614,33682,33788 /trunk/modules/plugin/shapefile:34241,34255,34258,34309-34310 + /branches/2.5.x/modules/plugin/shapefile:33331,33337-33338,33349,33351,33354,33601,33614,33682,33788 /trunk/modules/plugin/shapefile:34241,34255,34258,34309-34310,34359 Modified: branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-11 14:22:46 UTC (rev 34359) +++ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-11 14:27:11 UTC (rev 34360) @@ -26,7 +26,6 @@ import java.nio.channels.FileChannel; import java.nio.channels.ReadableByteChannel; import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; import java.util.Calendar; import org.geotools.data.shapefile.FileReader; @@ -185,9 +184,9 @@ bytes = new byte[header.getRecordLength() - 1]; - // check if we working with a 1 byte == 1 char Charset - final CharsetEncoder encoder = stringCharset.newEncoder(); - oneBytePerChar = encoder.maxBytesPerChar() == 1.0f; + // check if we working with a latin-1 char Charset + final String cname = stringCharset.name(); + oneBytePerChar = "ISO-8869-1".equals(cname) || "US-ASCII".equals(cname); row = new Row(); } Modified: branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java 2009-11-11 14:22:46 UTC (rev 34359) +++ branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java 2009-11-11 14:27:11 UTC (rev 34360) @@ -78,6 +78,7 @@ final static String STREAM = "shapes/stream.shp"; final static String DANISH = "shapes/danish_point.shp"; final static String CHINESE = "shapes/chinese_poly.shp"; + final static String RUSSIAN = "shapes/rus-windows-1251.shp"; final static FilterFactory2 ff = CommonFactoryFinder .getFilterFactory2(null); @@ -137,16 +138,32 @@ SimpleFeature first = firstFeature(fc); String s = (String) first.getAttribute("NAME"); assertEquals("\u9ed1\u9f99\u6c5f\u7701", s); - } catch (UnsupportedCharsetException notInstalledInJRE){ - // this just means you have not installed - // chinese support into your JRE - // (as such it represents a bad configuration - // rather than a test failure) - // we only wanted to ensure that if you have Chinese support - // available - GeoTools can use it - } + } catch (UnsupportedCharsetException notInstalledInJRE) { + // this just means you have not installed + // chinese support into your JRE + // (as such it represents a bad configuration + // rather than a test failure) + // we only wanted to ensure that if you have Chinese support + // available - GeoTools can use it } + } + public void testLoadRussianChars() throws Exception { + try { + FeatureCollection<SimpleFeatureType, SimpleFeature> fc = loadFeatures(RUSSIAN, Charset + .forName("CP1251"), null); + FeatureIterator<SimpleFeature> features = fc.features(); + SimpleFeature f = features.next(); + assertEquals("\u041A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0430", f.getAttribute("TEXT")); + f = features.next(); + assertEquals("\u0421\u043C\u0435\u0448\u0430\u043D\u044B\u0439 12345", f.getAttribute("TEXT")); + features.close(); + } catch (UnsupportedCharsetException notInstalledInJRE) { + // this just means you have not installed Russian support into your JRE + // (as such it represents a bad configuration rather than a test failure) + } + } + public void testNamespace() throws Exception { ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory(); ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ GeoTools-commits mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-commits |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |