use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class ValidSelfTouchingRingFormingHoleTest method checkIsValidDefault.
private void checkIsValidDefault(final String wkt, final boolean expected) {
final Geometry geom = fromWKT(wkt);
final IsValidOp validator = new IsValidOp(geom);
final boolean isValid = validator.isValid();
assertTrue(isValid == expected);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class SimpleRayCrossingStressTest method testGrid.
public void testGrid() {
// Use fixed PM to try and get at least some points hitting the boundary
final GeometryFactory geomFactory = GeometryFactory.fixed2d(0, 1.0, 1.0);
// GeometryFactoryI geomFactory = new GeometryFactoryI();
final PerturbedGridPolygonBuilder gridBuilder = new PerturbedGridPolygonBuilder(geomFactory);
gridBuilder.setNumLines(20);
gridBuilder.setLineWidth(10.0);
final Geometry area = gridBuilder.getGeometry();
final SimpleRayCrossingPointInAreaLocator pia = new SimpleRayCrossingPointInAreaLocator(area);
final PointInAreaStressTester gridTester = new PointInAreaStressTester(geomFactory, area);
gridTester.setNumPoints(100000);
gridTester.setPIA(pia);
final boolean isCorrect = gridTester.run();
assertTrue(isCorrect);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class PreparedGeometryThreadSafeTest method setup.
@Override
public void setup() {
final Geometry sinePoly = newSineStar(new PointDoubleXY(0, 0), 100000.0, this.nPts);
this.pg = sinePoly.prepare();
this.g = newSineStar(new PointDoubleXY(10, 10), 100000.0, 100);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeoPackageGeometryJdbcFieldDefinition method parseCollection.
private Geometry parseCollection(final GeometryFactory geometryFactory, final ByteBuffer data) {
final int count = data.getInt();
final Geometry[] geoms = new Geometry[count];
parseGeometryArray(geometryFactory, data, geoms);
return geometryFactory.geometry(geoms);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class ArcSdeStGeometryFieldDefinition method getParts.
public static List<List<Geometry>> getParts(final Geometry geometry) {
final List<List<Geometry>> partsList = new ArrayList<>();
if (geometry != null) {
final ClockDirection expectedRingOrientation = ClockDirection.COUNTER_CLOCKWISE;
for (final Geometry part : geometry.geometries()) {
if (!part.isEmpty()) {
if (part instanceof Point) {
final Point point = (Point) part;
partsList.add(Collections.<Geometry>singletonList(point));
} else if (part instanceof LineString) {
final LineString line = (LineString) part;
partsList.add(Collections.<Geometry>singletonList(line));
} else if (part instanceof Polygon) {
final Polygon polygon = (Polygon) part;
final List<Geometry> ringList = new ArrayList<>();
ClockDirection partExpectedRingOrientation = expectedRingOrientation;
for (LinearRing ring : polygon.rings()) {
final ClockDirection ringOrientation = ring.getClockDirection();
if (ringOrientation != partExpectedRingOrientation) {
ring = ring.reverse();
}
ringList.add(ring);
if (partExpectedRingOrientation == expectedRingOrientation) {
partExpectedRingOrientation = expectedRingOrientation.opposite();
}
}
partsList.add(ringList);
}
}
}
}
return partsList;
}
Aggregations