Java Code Examples for com.vividsolutions.jts.geom.Geometry#copy()

The following examples show how to use com.vividsolutions.jts.geom.Geometry#copy() . 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: GeometryResult.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean equals(Result other, double tolerance) {
  if (!(other instanceof GeometryResult)) {
    return false;
  }
  GeometryResult otherGeometryResult = (GeometryResult) other;
  Geometry otherGeometry = otherGeometryResult.geometry;

  Geometry thisGeometryClone = geometry.copy();
  Geometry otherGeometryClone = otherGeometry.copy();
  thisGeometryClone.normalize();
  otherGeometryClone.normalize();
  return thisGeometryClone.equalsExact(otherGeometryClone, tolerance);
}
 
Example 2
Source File: AffineTransformationTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
void checkTransformation(String geomStr) throws IOException, ParseException,
    NoninvertibleTransformationException {
  Geometry geom = rdr.read(geomStr);
  AffineTransformation trans = AffineTransformation
      .rotationInstance(Math.PI / 2);
  AffineTransformation inv = trans.getInverse();
  Geometry transGeom = geom.copy();
  transGeom.apply(trans);
  // System.out.println(transGeom);
  transGeom.apply(inv);
  // check if transformed geometry is equal to original
  boolean isEqual = geom.equalsExact(transGeom, 0.0005);
  assertTrue(isEqual);
}
 
Example 3
Source File: MiscellaneousTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testEnvelopeCloned() throws Exception {
    Geometry a = reader.read("LINESTRING(0 0, 10 10)");
    //Envelope is lazily initialized [Jon Aquino]
    a.getEnvelopeInternal();
    Geometry b = a.copy();
    assertTrue(a.getEnvelopeInternal() != b.getEnvelopeInternal());
}