use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryImplTest method testEqualsExactForPolygons.
public void testEqualsExactForPolygons() throws Exception {
final Polygon x = (Polygon) this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
final Polygon somethingExactlyEqual = (Polygon) this.geometryFactory.geometry("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
final Polygon somethingNotEqualButSameClass = (Polygon) this.geometryFactory.geometry("POLYGON ((50 50, 50 0, 0 0, 0 50, 50 50))");
final Polygon sameClassButEmpty = (Polygon) this.geometryFactory.geometry("POLYGON EMPTY");
final Polygon anotherSameClassButEmpty = (Polygon) this.geometryFactory.geometry("POLYGON EMPTY");
final CollectionFactory collectionFactory = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.polygonal((Object[]) 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 testEqualsExactForLineStrings.
public void testEqualsExactForLineStrings() throws Exception {
final LineString x = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 100);
final LineString somethingExactlyEqual = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 100);
final LineString somethingNotEqualButSameClass = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 555);
final LineString sameClassButEmpty = this.geometryFactory.lineString();
final LineString anotherSameClassButEmpty = this.geometryFactory.lineString();
final CollectionFactory collectionFactory = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.lineal(geometries);
}
};
doTestEqualsExact(x, somethingExactlyEqual, somethingNotEqualButSameClass, sameClassButEmpty, anotherSameClassButEmpty, collectionFactory);
final CollectionFactory collectionFactory2 = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.lineal(geometries);
}
};
doTestEqualsExact(x, somethingExactlyEqual, somethingNotEqualButSameClass, sameClassButEmpty, anotherSameClassButEmpty, collectionFactory2);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class RectanglePredicateSyntheticTest method newTestGeometries.
public List<Geometry> newTestGeometries(final BoundingBox env, final double inc, final double size) {
final List<Geometry> testGeoms = new ArrayList<>();
for (double y = env.getMinY(); y <= env.getMaxY(); y += inc) {
for (double x = env.getMinX(); x <= env.getMaxX(); x += inc) {
final Point base = new PointDoubleXY(x, y);
testGeoms.add(newAngle(base, size, 0));
testGeoms.add(newAngle(base, size, 1));
testGeoms.add(newAngle(base, size, 2));
testGeoms.add(newAngle(base, size, 3));
}
}
return testGeoms;
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class TriangleTest method checkLongestSideLength.
public void checkLongestSideLength(final String wkt, final double expectedValue) throws Exception {
final Geometry g = this.geometryFactory.geometry(wkt);
final TriangleImpl t = newTriangle(g);
double length = Triangles.longestSideLength(t.p0, t.p1, t.p2);
// System.out.println("(Static) longestSideLength = " + length);
assertEquals(expectedValue, length, 0.00000001);
// Test Instance version
//
length = t.longestSideLength();
// System.out.println("(Instance) longestSideLength = " + length);
assertEquals(expectedValue, length, 0.00000001);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class TriangleTest method checkCircumCentre.
public void checkCircumCentre(final String wkt, final Point expectedValue) throws Exception {
final Geometry g = this.geometryFactory.geometry(wkt);
final TriangleImpl t = newTriangle(g);
Point circumcentre = Triangles.circumcentre(t.p0, t.p1, t.p2);
// System.out.println("(Static) circumcentre = " + circumcentre);
assertEquals(expectedValue.toString(), circumcentre.toString());
// Test Instance version
//
circumcentre = t.circumcentre();
// System.out.println("(Instance) circumcentre = " +
// circumcentre.toString());
assertEquals(expectedValue.toString(), circumcentre.toString());
}
Aggregations