@Test public void parsePolygonWithHoles() throws Exception { List<double[]> rings = (new GeoJSONParser( new ByteArrayInputStream( "[ [[35, 10], [45, 45], [15, 40], [10, 20], [35, 10]], [[20, 30], [35, 35], [30, 20], [20, 30]] ]" .getBytes()), this.fType, null)) .parsePolygonCoordinates(); double[] expRing1 = {35.0f, 10.0f, 45.0f, 45.0f, 15.0f, 40.0f, 10.0f, 20.0f, 35.0f, 10.0f}; double[] expRing2 = {20.0f, 30.0f, 35.0f, 35.0f, 30.0f, 20.0f, 20.0f, 30.0f}; assertArrayEquals(expRing1, rings.get(0), 0.1f); assertArrayEquals(expRing2, rings.get(1), 0.1f); }
public List<double[]> parsePolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<double[]> rings = new ArrayList<double[]>(); this.reader.beginArray(); while (this.reader.hasNext()) { rings.add(this.parseLineStringCoordinates()); } this.reader.endArray(); return rings; }
GeoJSONParser implements SimpleFeatureIterator { public List<double[]> parsePolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<double[]> rings = new ArrayList<double[]>(); this.reader.beginArray(); while (this.reader.hasNext()) { rings.add(this.parseLineStringCoordinates()); } this.reader.endArray(); return rings; } }
GeoJSONParser implements SimpleFeatureIterator { public List<double[]> parsePolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<double[]> rings = new ArrayList<double[]>(); this.reader.beginArray(); while (this.reader.hasNext()) { rings.add(this.parseLineStringCoordinates()); } this.reader.endArray(); return rings; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); }
GeoJSONParser implements SimpleFeatureIterator { public List<double[]> parsePolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<double[]> rings = new ArrayList<double[]>(); this.reader.beginArray(); while (this.reader.hasNext()) { rings.add(this.parseLineStringCoordinates()); } this.reader.endArray(); return rings; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); }
GeoJSONParser implements SimpleFeatureIterator { public List<double[]> parsePolygonCoordinates() throws JsonSyntaxException, IOException, IllegalStateException { List<double[]> rings = new ArrayList<double[]>(); this.reader.beginArray(); while (this.reader.hasNext()) { rings.add(this.parseLineStringCoordinates()); } this.reader.endArray(); return rings; } GeoJSONParser(InputStream iStream, SimpleFeatureType featureTypeIn, Logger loggerIn); @Override void close(); @Override boolean hasNext(); @Override SimpleFeature next(); void parseFeatureCollection(); static double[] listToArray(List<Double> coords); double[] parseCoordinateArray(); double[] parsePointCoordinates(); List<double[]> parseMultiPointCoordinates(); double[] parseLineStringCoordinates(); List<double[]> parseMultiLineStringCoordinates(); List<double[]> parsePolygonCoordinates(); List<List<double[]>> parseMultiPolygonCoordinates(); Geometry parseGeometry(); Map<String, Object> parseProperties(); SimpleFeature parseFeature(); IOException parseError(); static final String ENCODING; static final String DATETIME_FORMAT; static final String ERROR; static final String ERROR_CODE; static final String ERROR_MESSAGE; static final String ERROR_DETAILS; static final String GEOJSON_TYPE; static final String GEOJSON_TYPE_VALUE_FC; static final String GEOJSON_PROPERTIES; static final String GEOJSON_TOTALFEATURES; static final String FEATURES; static final String CRS; static final String CRS_TYPE; static final String CRS_TYPE_VALUE; static final String CRS_PROPERTIES; static final String CRS_PROPERTIES_NAME; static final String FEATURE_TYPE; static final String FEATURE_ID; static final String FEATURE_GEOMETRY; static final String FEATURE_GEOMETRY_TYPE; static final String FEATURE_TYPE_VALUE; static final String FEATURE_GEOMETRY_COORDINATES; static final String FEATURE_PROPERTIES; static final String GEOMETRY_POINT; static final String GEOMETRY_MULTIPOINT; static final String GEOMETRY_LINE; static final String GEOMETRY_MULTILINE; static final String GEOMETRY_POLYGON; static final String GEOMETRY_MULTIPOLYGON; }