本文整理了Java中org.locationtech.jts.geom.Geometry.clone()
方法的一些代码示例,展示了Geometry.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.clone()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:clone
[英]Creates and returns a full copy of this Geometry object (including all coordinates contained by it). Subclasses are responsible for overriding this method and copying their internal data. Overrides should call this method first.
[中]
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
/**
* Sets the geometry contained in this lite shape. Convenient to reuse this object instead of creating it again and again during rendering
*
* @param g
*/
public void setGeometry(Geometry g) {
this.geometry = (Geometry) g.clone();
}
代码示例来源:origin: locationtech/jts
private static Geometry cloneGeometry(Geometry geom)
{
if (geom == null) return null;
return (Geometry) geom.clone();
}
代码示例来源:origin: geosolutions-it/jai-ext
/**
* Sets the geometry contained in this lite shape. Convenient to reuse this object instead of creating it again and again during rendering
*
* @param g
*/
public void setGeometry(Geometry g) {
this.geometry = (Geometry) g.clone();
}
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
/**
* Creates a new LiteShape object.
*
* @param geom - the wrapped geometry
*
*/
public LiteShape(Geometry geom) {
if (geom != null) {
this.geometry = (Geometry) geom.clone();
}
}
代码示例来源:origin: geosolutions-it/jai-ext
/**
* Creates a new LiteShape object.
*
* @param geom - the wrapped geometry
*
*/
public LiteShape(Geometry geom) {
if (geom != null) {
this.geometry = (Geometry) geom.clone();
}
}
代码示例来源:origin: locationtech/jts
public static Geometry normalize(Geometry g)
{
Geometry gNorm = (Geometry) g.clone();
gNorm.normalize();
return gNorm;
}
代码示例来源:origin: locationtech/jts
public boolean equals(Result other, double tolerance) {
if (!(other instanceof GeometryResult)) {
return false;
}
GeometryResult otherGeometryResult = (GeometryResult) other;
Geometry otherGeometry = otherGeometryResult.geometry;
Geometry thisGeometryClone = (Geometry)geometry.clone();
Geometry otherGeometryClone =(Geometry) otherGeometry.clone();
thisGeometryClone.normalize();
otherGeometryClone.normalize();
return thisGeometryClone.equalsExact(otherGeometryClone, tolerance);
}
代码示例来源:origin: locationtech/jts
public boolean match(Geometry a, Geometry b)
{
Geometry aClone = (Geometry)a.clone();
Geometry bClone =(Geometry) b.clone();
aClone.normalize();
bClone.normalize();
return aClone.equalsExact(bClone, tolerance);
}
代码示例来源:origin: locationtech/jts
public Geometry combine(Geometry orig, Geometry geom)
{
List origList = extractElements(orig, true);
List geomList = extractElements(geom, true);
origList.addAll(geomList);
if (origList.size() == 0) {
// return a clone of the orig geometry
return (Geometry) orig.clone();
}
// return the "simplest possible" geometry
return geomFactory.buildGeometry(origList);
}
代码示例来源:origin: locationtech/jts
void assertEqualsExact(Geometry g1, Geometry g2, String msg) {
Geometry g1Clone = (Geometry) g1.clone();
Geometry g2Clone = (Geometry) g2.clone();
g1Clone.normalize();
g2Clone.normalize();
assertTrue(g1Clone.equalsExact(g2Clone), msg);
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* Creates a new Geometry out of this one by invoking the given transform
* on each control point of this geometry.
*/
@Override
public final Geometry transform(final CoordinateReferenceSystem newCRS,
final MathTransform transform) throws TransformException {
// Get the JTS geometry
org.locationtech.jts.geom.Geometry jtsGeom = getJTSGeometry();
// Make a copy since we're going to modify its values
jtsGeom = (org.locationtech.jts.geom.Geometry) jtsGeom.clone();
// Get a local variable that has the src CRS
CoordinateReferenceSystem oldCRS = getCoordinateReferenceSystem();
// Do the actual work of transforming the vertices
jtsGeom.apply(new MathTransformFilter(transform, oldCRS, newCRS));
// Then convert back to a GO1 geometry
return JTSUtils.toISO(jtsGeom, getCoordinateReferenceSystem());
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* Transforms the geometry using the default transformer.
*
* @param geom The geom to transform
* @param transform the transform to use during the transformation.
* @return the transformed geometry. It will be a new geometry.
* @throws MismatchedDimensionException if the geometry doesn't have the
* expected dimension for the specified transform.
* @throws TransformException if a point can't be transformed.
*/
public static Geometry transform(final Geometry geom, final MathTransform transform)
throws MismatchedDimensionException, TransformException {
if (geom.isEmpty()) {
Geometry g = (Geometry) geom.clone();
g.setSRID(0);
g.setUserData(null);
return g;
}
final CoordinateSequenceTransformer cstrs = new CoordinateSequenceMathTransformer(transform);
final GeometryCSTransformer transformer = new GeometryCSTransformer(cstrs);
return transformer.transform(geom);
}
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
Geometry g = (Geometry) ((Geometry) obj).clone();
pg = PreparedGeometryFactory.prepare(g);
代码示例来源:origin: geosolutions-it/jai-ext
Geometry g = (Geometry) ((Geometry) obj).clone();
pg = PreparedGeometryFactory.prepare(g);
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
/**
* Returns a new ROI created by applying the given transform to
* this ROI.
*
* @param at the transform
*
* @return the new ROI
*/
@Override
public ROI transform(AffineTransform at) {
Geometry cloned = (Geometry) theGeom.getGeometry().clone();
cloned.apply(new AffineTransformation(at.getScaleX(), at.getShearX(), at.getTranslateX(),
at.getShearY(), at.getScaleY(), at.getTranslateY()));
if (useFixedPrecision){
Geometry fixed = PRECISE_FACTORY.createGeometry(cloned);
Coordinate[] coords = fixed.getCoordinates();
for (Coordinate coord : coords) {
Coordinate precise = coord;
PRECISION.makePrecise(precise);
}
cloned = fixed;
}
return buildROIGeometry(cloned);
}
代码示例来源:origin: geosolutions-it/jai-ext
/**
* Returns a new ROI created by applying the given transform to
* this ROI.
*
* @param at the transform
*
* @return the new ROI
*/
@Override
public ROI transform(AffineTransform at) {
Geometry cloned = (Geometry) theGeom.getGeometry().clone();
cloned.apply(new AffineTransformation(at.getScaleX(), at.getShearX(), at.getTranslateX(),
at.getShearY(), at.getScaleY(), at.getTranslateY()));
if (useFixedPrecision){
Geometry fixed = PRECISE_FACTORY.createGeometry(cloned);
Coordinate[] coords = fixed.getCoordinates();
for (Coordinate coord : coords) {
Coordinate precise = coord;
PRECISION.makePrecise(precise);
}
cloned = fixed;
}
return buildROIGeometry(cloned);
}
内容来源于网络,如有侵权,请联系作者删除!