コード例 #1
0
ファイル: TestCase.java プロジェクト: topobyte/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);
 }
コード例 #2
0
ファイル: LineStringImplTest.java プロジェクト: topobyte/jts
 public void testEquals10() throws Exception {
   WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
   Geometry l1 =
       reader.read(
           "POLYGON((1732328800 519578384, 1732026179 519976285, 1731627364 519674014, 1731929984 519276112, 1732328800 519578384))");
   Geometry l2 =
       reader.read(
           "POLYGON((1731627364 519674014, 1731929984 519276112, 1732328800 519578384, 1732026179 519976285, 1731627364 519674014))");
   l1.normalize();
   l2.normalize();
   assertTrue(l1.equalsExact(l2));
 }
コード例 #3
0
ファイル: GeometryImplTest.java プロジェクト: neilireson/jts
 private void doTestEquals(
     Geometry a,
     Geometry b,
     boolean equalsGeometry,
     boolean equalsObject,
     boolean equalsExact,
     boolean equalsHash) {
   assertEquals(equalsGeometry, a.equals(b));
   assertEquals(equalsObject, a.equals((Object) b));
   assertEquals(equalsExact, a.equalsExact(b));
   assertEquals(equalsHash, a.hashCode() == b.hashCode());
 }
コード例 #4
0
 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 = (Geometry) geom.clone();
   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);
 }
コード例 #5
0
ファイル: GeometryImplTest.java プロジェクト: neilireson/jts
  private void doTestEqualsExact(
      Geometry x,
      Geometry somethingExactlyEqual,
      Geometry somethingEqualButNotExactly,
      Geometry somethingNotEqualButSameClass)
      throws Exception {
    Geometry differentClass;

    if (x instanceof Point) {
      differentClass = reader.read("POLYGON ((0 0, 0 50, 50 43949, 50 0, 0 0))");
    } else {
      differentClass = reader.read("POINT ( 2351 1563 )");
    }

    assertTrue(x.equalsExact(x));
    assertTrue(x.equalsExact(somethingExactlyEqual));
    assertTrue(somethingExactlyEqual.equalsExact(x));
    assertTrue(!x.equalsExact(somethingEqualButNotExactly));
    assertTrue(!somethingEqualButNotExactly.equalsExact(x));
    assertTrue(!x.equalsExact(somethingEqualButNotExactly));
    assertTrue(!somethingEqualButNotExactly.equalsExact(x));
    assertTrue(!x.equalsExact(differentClass));
    assertTrue(!differentClass.equalsExact(x));
  }
コード例 #6
0
ファイル: GeometryUtils.java プロジェクト: ebocher/jts
 public static boolean isEqual(Geometry a, Geometry b) {
   Geometry a2 = normalize(a);
   Geometry b2 = normalize(b);
   return a2.equalsExact(b2);
 }