private void readShapes() throws IOException { int numberOfShapes; Shape[] shapesMetadata; numberOfShapes = dis.readInt(); shapesMetadata = new Shape[numberOfShapes]; for (int i = 0; i < numberOfShapes; i++) { int parentOffset = dis.readInt(); int figureOffset = dis.readInt(); int shapeType = dis.readByte(); shapesMetadata[i] = new Shape(parentOffset, figureOffset, shapeType); } binary.setShapes(shapesMetadata); }
private void readFigures() throws IOException { int numberOfFigures; Figure[] figuresMetadata; numberOfFigures = dis.readInt(); figuresMetadata = new Figure[numberOfFigures]; for (int i = 0; i < numberOfFigures; i++) { byte figureAttribute = dis.readByte(); int figurePointOffset = dis.readInt(); figuresMetadata[i] = new Figure(figureAttribute, figurePointOffset); } binary.setFigures(figuresMetadata); }
private LinearRing readLinearRing() throws IOException { int size = dis.readInt(); CoordinateSequence pts = readCoordinateSequenceRing(size); return factory.createLinearRing(pts); }
private Geometry readCircularString() throws IOException { int size = dis.readInt(); CoordinateSequence pts = readCoordinateSequenceCircularString(size); return factory.createCurvedGeometry(pts); }
private Geometry readCompoundCurve() throws IOException, ParseException { int numGeom = dis.readInt(); List<LineString> geoms = new ArrayList<>(); for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (!(g instanceof LineString)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "CompoundCurve"); geoms.add((LineString) g); } return factory.createCurvedGeometry(geoms); }
private GeometryCollection readGeometryCollection() throws IOException, ParseException { int numGeom = dis.readInt(); Geometry[] geoms = new Geometry[numGeom]; for (int i = 0; i < numGeom; i++) { geoms[i] = readGeometry(); } return factory.createGeometryCollection(geoms); }
private LineString readLineString() throws IOException { int size = dis.readInt(); CoordinateSequence pts = readCoordinateSequenceLineString(size); return factory.createLineString(pts); }
private GeometryCollection readGeometryCollection() throws IOException, ParseException { int numGeom = dis.readInt(); Geometry[] geoms = new Geometry[numGeom]; for (int i = 0; i < numGeom; i++) { geoms[i] = readGeometry(); } return factory.createGeometryCollection(geoms); }
private LineString readLineString() throws IOException { int size = dis.readInt(); CoordinateSequence pts = readCoordinateSequence(size); return factory.createLineString(pts); }
private LinearRing readLinearRing() throws IOException { int size = dis.readInt(); CoordinateSequence pts = readCoordinateSequence(size); return factory.createLinearRing(pts); }
private Polygon readPolygon() throws IOException { int numRings = dis.readInt(); LinearRing[] holes = null; if (numRings > 1) holes = new LinearRing[numRings - 1]; LinearRing shell = readLinearRing(); for (int i = 0; i < numRings - 1; i++) { holes[i] = readLinearRing(); } return factory.createPolygon(shell, holes); }
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); }
protected Polygon readCurvePolygon() throws IOException, ParseException { int numRings = dis.readInt(); LinearRing[] holes = null; if (numRings > 1) holes = new LinearRing[numRings - 1]; LinearRing shell = readRing(); for (int i = 0; i < numRings - 1; i++) { holes[i] = readRing(); } return factory.createPolygon(shell, holes); }
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); }
protected Polygon readPolygon() throws IOException { int numRings = dis.readInt(); LinearRing[] holes = null; if (numRings > 1) holes = new LinearRing[numRings - 1]; LinearRing shell = readLinearRing(); for (int i = 0; i < numRings - 1; i++) { holes[i] = readLinearRing(); } return factory.createPolygon(shell, holes); }
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 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 void readNumberOfPoints() throws IOException { if (binary.isSinglePoint()) { binary.setNumberOfPoints(1); } else if (binary.hasSingleLineSegment()) { binary.setNumberOfPoints(2); } else { binary.setNumberOfPoints(dis.readInt()); } }