use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class AreaLengthTest method checkArea.
public void checkArea(final String wkt, final double expectedValue) throws Exception {
final Geometry g = this.geometryFactory.geometry(wkt);
assertEquals(expectedValue, g.getArea(), TOLERANCE);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryCollectionImplTest method testGetDimension.
public void testGetDimension() throws Exception {
final Geometry g = this.geometryFactory.geometry("GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))");
assertEquals(1, g.getDimension());
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryImplTest method doTestEqualsExact.
private void doTestEqualsExact(final Geometry x, final Geometry somethingExactlyEqual, final Geometry somethingEqualButNotExactly, final Geometry somethingNotEqualButSameClass) throws Exception {
Geometry differentClass;
if (x instanceof Point) {
differentClass = this.geometryFactory.geometry("POLYGON((0 0,0 50,50 43949,50 0,0 0))");
} else {
differentClass = this.geometryFactory.geometry("POINT(2351 1563)");
}
assertTrue(x.equals(2, x));
assertTrue(x.equals(2, somethingExactlyEqual));
assertTrue(somethingExactlyEqual.equals(2, x));
// assertTrue(!x.equalsExact(somethingEqualButNotExactly));
// assertTrue(!somethingEqualButNotExactly.equalsExact(x));
// assertTrue(!x.equalsExact(somethingEqualButNotExactly));
// assertTrue(!somethingEqualButNotExactly.equalsExact(x));
assertTrue(!x.equals(2, differentClass));
assertTrue(!differentClass.equals(2, x));
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryImplTest method testEqualsExactForGeometryCollections.
public void testEqualsExactForGeometryCollections() throws Exception {
final Geometry polygon1 = this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
final Geometry polygon2 = this.geometryFactory.geometry("POLYGON ((50 50, 50 0, 0 0, 0 50, 50 50))");
final Geometry x = this.geometryFactory.geometry(polygon1, polygon2);
final Geometry somethingExactlyEqual = this.geometryFactory.geometry(polygon1, polygon2);
final Geometry somethingNotEqualButSameClass = this.geometryFactory.geometry(polygon2);
final Geometry sameClassButEmpty = this.geometryFactory.geometryCollection();
final Geometry anotherSameClassButEmpty = this.geometryFactory.geometryCollection();
final CollectionFactory collectionFactory = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.geometry(geometries);
}
};
doTestEqualsExact(x, somethingExactlyEqual, somethingNotEqualButSameClass, sameClassButEmpty, anotherSameClassButEmpty, collectionFactory);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryImplTest method testEquals.
public void testEquals() throws Exception {
final Geometry g = this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
final Geometry same = this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
final Geometry differentStart = this.geometryFactory.geometry("POLYGON ((0 50, 50 50, 50 0, 0 0, 0 50))");
final Geometry differentFourth = this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 -99, 0 0))");
final Geometry differentSecond = this.geometryFactory.geometry("POLYGON ((0 0, 0 99, 50 50, 50 0, 0 0))");
doTestEquals(g, same, true, true, true, true);
doTestEquals(g, differentStart, true, false, false, true);
doTestEquals(g, differentFourth, false, false, false, false);
doTestEquals(g, differentSecond, false, false, false, false);
}
Aggregations