/** * Sets the geometry contained in this lite shape. Convenient to reuse this object instead of * creating it again and again during rendering * * @param g * @throws TransformException * @throws FactoryException */ public void setGeometry(Geometry g) throws TransformException, FactoryException { if (g != null) { this.geometry = getGeometryFactory().createGeometry(g); transformGeometry(geometry); } }
private void transformGeometry(Geometry geometry) throws TransformException, FactoryException { if (mathTransform == null || mathTransform.isIdentity()) return; if (geometry instanceof GeometryCollection) { GeometryCollection collection = (GeometryCollection) geometry; for (int i = 0; i < collection.getNumGeometries(); i++) { transformGeometry(collection.getGeometryN(i)); } } else if (geometry instanceof Point) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((Point) geometry).getCoordinateSequence(); double[] coords = seq.getArray(); double[] newCoords = new double[coords.length]; mathTransform.transform(coords, 0, newCoords, 0, seq.size()); seq.setArray(newCoords); } else if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; transformGeometry(polygon.getExteriorRing()); for (int i = 0; i < polygon.getNumInteriorRing(); i++) { transformGeometry(polygon.getInteriorRingN(i)); } } else if (geometry instanceof LineString) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((LineString) geometry).getCoordinateSequence(); double[] coords = seq.getArray(); mathTransform.transform(coords, 0, coords, 0, seq.size()); seq.setArray(coords); } }
transformGeometry(geometry); this.geometry.geometryChanged();
/** * Sets the geometry contained in this lite shape. Convenient to reuse this * object instead of creating it again and again during rendering * * @param g * @throws TransformException * @throws FactoryException */ public void setGeometry(Geometry g) throws TransformException, FactoryException { if (g != null) { this.geometry = getGeometryFactory().createGeometry(g); transformGeometry(geometry); } }
/** * Sets the geometry contained in this lite shape. Convenient to reuse this * object instead of creating it again and again during rendering * * @param g * @throws TransformException * @throws FactoryException */ public void setGeometry(Geometry g) throws TransformException, FactoryException { if (g != null) { this.geometry = getGeometryFactory().createGeometry(g); transformGeometry(geometry); } }
private void transformGeometry(Geometry geometry) throws TransformException, FactoryException { if (mathTransform == null || mathTransform.isIdentity()) return; if (geometry instanceof GeometryCollection) { GeometryCollection collection = (GeometryCollection) geometry; for (int i = 0; i < collection.getNumGeometries(); i++) { transformGeometry(collection.getGeometryN(i)); } } else if (geometry instanceof Point) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((Point) geometry) .getCoordinateSequence(); double[] coords = seq.getArray(); double[] newCoords = new double[coords.length]; mathTransform.transform(coords, 0, newCoords, 0, seq.size()); seq.setArray(newCoords); } else if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; transformGeometry(polygon.getExteriorRing()); for (int i = 0; i < polygon.getNumInteriorRing(); i++) { transformGeometry(polygon.getInteriorRingN(i)); } } else if (geometry instanceof LineString) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((LineString) geometry) .getCoordinateSequence(); double[] coords = seq.getArray(); mathTransform.transform(coords, 0, coords, 0, seq.size()); seq.setArray(coords); } }
private void transformGeometry(Geometry geometry) throws TransformException, FactoryException { if (mathTransform == null || mathTransform.isIdentity()) return; if (geometry instanceof GeometryCollection) { GeometryCollection collection = (GeometryCollection) geometry; for (int i = 0; i < collection.getNumGeometries(); i++) { transformGeometry(collection.getGeometryN(i)); } } else if (geometry instanceof Point) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((Point) geometry) .getCoordinateSequence(); double[] coords = seq.getArray(); double[] newCoords = new double[coords.length]; mathTransform.transform(coords, 0, newCoords, 0, seq.size()); seq.setArray(newCoords); } else if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; transformGeometry(polygon.getExteriorRing()); for (int i = 0; i < polygon.getNumInteriorRing(); i++) { transformGeometry(polygon.getInteriorRingN(i)); } } else if (geometry instanceof LineString) { LiteCoordinateSequence seq = (LiteCoordinateSequence) ((LineString) geometry) .getCoordinateSequence(); double[] coords = seq.getArray(); mathTransform.transform(coords, 0, coords, 0, seq.size()); seq.setArray(coords); } }
new Decimator(mathTransform.inverse()).decimate(this.geometry); if (geometry != null) transformGeometry(geometry);
transformGeometry(geometry); this.geometry.geometryChanged();