Java Code Examples for com.vividsolutions.jts.geom.Geometry#clone()
The following examples show how to use
com.vividsolutions.jts.geom.Geometry#clone() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTopology.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public List<Geometry> listToroidalGeometries(final Geometry geom) { final Geometry copy = (Geometry) geom.clone(); final List<Geometry> geoms = new ArrayList<>(); final AffineTransformation at = new AffineTransformation(); geoms.add(copy); for (int cnt = 0; cnt < 8; cnt++) { at.setToTranslation(getAdjustedXYVector()[cnt][0], getAdjustedXYVector()[cnt][1]); geoms.add(at.transform(copy)); } return geoms; }
Example 2
Source File: ShapeInMemFeatureModel.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Override public Geometry getGeometry(Object feature) throws LayerException { Geometry geom = (Geometry) asFeature(feature).getDefaultGeometry(); if (geom instanceof MultiLineString && vectorLayerInfo.getLayerType() == LayerType.LINESTRING) { return (Geometry) geom.getGeometryN(0).clone(); } else if (geom instanceof MultiPolygon && vectorLayerInfo.getLayerType() == LayerType.POLYGON) { return (Geometry) geom.getGeometryN(0).clone(); } else if (geom instanceof MultiPoint && vectorLayerInfo.getLayerType() == LayerType.POINT) { return (Geometry) geom.getGeometryN(0).clone(); } return (Geometry) geom.clone(); }
Example 3
Source File: HibernateFeatureModel.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Override public Geometry getGeometry(Object feature) throws LayerException { Object obj = getAttributeRecursively(feature, getGeometryAttributeName()); if (obj == null) { return null; } else if (Geometry.class.isAssignableFrom(obj.getClass())) { Geometry geom = (Geometry) obj; return (Geometry) geom.clone(); } else { throw new LayerException(ExceptionCode.PROPERTY_IS_NOT_GEOMETRY, getGeometryAttributeName()); } }
Example 4
Source File: GeoToolsFeatureModel.java From geomajas-project-server with GNU Affero General Public License v3.0 | 4 votes |
@Override public Geometry getGeometry(Object feature) throws LayerException { Geometry geometry = (Geometry) asFeature(feature).getDefaultGeometry(); geometry.setSRID(srid); return (Geometry) geometry.clone(); }