private void parseErrorWithLine(String msg) throws ParseException { throw new ParseException(msg + " (line " + tokenizer.lineno() + ")"); }
/** * Reads a Well-Known Text representation of a {@link Geometry} * from a {@link Reader}. * *@param reader a Reader which will return a <Geometry Tagged Text> * string (see the OpenGIS Simple Features Specification) *@return a <code>Geometry</code> read from <code>reader</code> *@throws ParseException if a parsing problem occurs */ public Geometry read(Reader reader) throws ParseException { tokenizer = new StreamTokenizer(reader); // set tokenizer to NOT parse numbers tokenizer.resetSyntax(); tokenizer.wordChars('a', 'z'); tokenizer.wordChars('A', 'Z'); tokenizer.wordChars(128 + 32, 255); tokenizer.wordChars('0', '9'); tokenizer.wordChars('-', '-'); tokenizer.wordChars('+', '+'); tokenizer.wordChars('.', '.'); tokenizer.whitespaceChars(0, ' '); tokenizer.commentChar('#'); try { return readGeometryTaggedText(); } catch (IOException e) { throw new ParseException(e.toString()); } }
private MultiLineString readMultiLineString() throws IOException, ParseException { int numGeom = dis.readInt(); LineString[] geoms = new LineString[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof LineString)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiLineString"); geoms[i] = (LineString) g; } return factory.createMultiLineString(geoms); }
private MultiPoint readMultiPoint() throws IOException, ParseException { int numGeom = dis.readInt(); Point[] geoms = new Point[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Point)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPoint"); geoms[i] = (Point) g; } return factory.createMultiPoint(geoms); }
private MultiPolygon readMultiPolygon() throws IOException, ParseException { int numGeom = dis.readInt(); Polygon[] geoms = new Polygon[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Polygon)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPolygon"); geoms[i] = (Polygon) g; } return factory.createMultiPolygon(geoms); }
/** * Get the name of the FeatureElement tag. */ public String getFeatureElementName() throws ParseException { if (loaded_) { return featureTag_; } throw new ParseException("requested FeatureCollectionElementName w/o loading the template"); }
/** * Get the name of the FeatureCollectionElement tag. */ public String getFeatureCollectionElementName() throws ParseException { if (loaded_) { return collectionTag_; } throw new ParseException("requested FeatureCollectionElementName w/o loading the template"); }
/** * m-values sicherstellen * * @throws ParseException */ private void setHasM(boolean hasM) throws ParseException { if (this.hasM == null) { this.hasM = hasM; } else if (this.hasM != hasM) { throw new ParseException("Inkonsistent use of m-values."); } }
/** * Returns the column name for the 'index'th column. * * @param _index 0=first */ public String columnName(final int _index) throws ParseException { if (loaded_) { return ((ColumnDescription) columnDefinitions_.get(_index)).columnName_; } throw new ParseException("requested columnName w/o loading the template"); }
private void parseErrorWithLine(String msg) throws ParseException { throw new ParseException(msg + " (line " + tokenizer.lineno() + ")"); }
public Geometry read( Reader reader ) throws ParseException { try { return read( IOUtils.toString( reader ) ); } catch ( IOException e ) { // wrap the exception nicely as to not break 172643521 API calls throw new ParseException( e ); } }
break; default: throw new ParseException("Unknown WKB type " + geometryType);
private GMLInputTemplate inputTemplate(final java.io.Reader _r) throws IOException, ParseException, SAXException, ParserConfigurationException { final GMLInputTemplate gmlTemplate = new GMLInputTemplate(); gmlTemplate.load(_r); _r.close(); if (!(gmlTemplate.loaded_)) { throw new ParseException("Failed to load GML input template"); } return gmlTemplate; }
private MultiPolygon readMultiPolygon() throws IOException, ParseException { int numGeom = dis.readInt(); Polygon[] geoms = new Polygon[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Polygon)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPolygon"); geoms[i] = (Polygon) g; } return factory.createMultiPolygon(geoms); }
private MultiPoint readMultiPoint() throws IOException, ParseException { int numGeom = dis.readInt(); Point[] geoms = new Point[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Point)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPoint"); geoms[i] = (Point) g; } return factory.createMultiPoint(geoms); }
private MultiLineString readMultiLineString() throws IOException, ParseException { int numGeom = dis.readInt(); LineString[] geoms = new LineString[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof LineString)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiLineString"); geoms[i] = (LineString) g; } return factory.createMultiLineString(geoms); }
private MultiPoint readMultiPoint() throws IOException, ParseException { int numGeom = dis.readInt(); Point[] geoms = new Point[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Point)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPoint"); geoms[i] = (Point) g; } return factory.createMultiPoint(geoms); }
private MultiLineString readMultiLineString() throws IOException, ParseException { int numGeom = dis.readInt(); LineString[] geoms = new LineString[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof LineString)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiLineString"); geoms[i] = (LineString) g; } return factory.createMultiLineString(geoms); }
private MultiPolygon readMultiPolygon() throws IOException, ParseException { int numGeom = dis.readInt(); Polygon[] geoms = new Polygon[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (! (g instanceof Polygon)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPolygon"); geoms[i] = (Polygon) g; } return factory.createMultiPolygon(geoms); }
public Geometry read( String wkt ) throws ParseException { try { org.postgis.Geometry g = org.postgis.PGgeometry.geomFromString( wkt ); byte[] bs = new BinaryWriter().writeBinary( g ); return WKBReader.read( bs, crs ); } catch ( SQLException e ) { e.printStackTrace(); // wrap the exception nicely as to not break 172643521 API calls throw new ParseException( e ); } }