use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class MiscellaneousTest2 method testZeroAreaPolygon.
public void testZeroAreaPolygon() throws Exception {
final Geometry g = this.geometryFactory.geometry("POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))");
g.isValid();
// No exception thrown [Jon Aquino]
assertTrue(true);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class AbstractIndexedLineTest method runIndicesOfThenExtract.
protected void runIndicesOfThenExtract(final String inputStr, final String subLineStr) // throws Exception
{
final Geometry input = read(inputStr);
final Geometry subLine = read(subLineStr);
final Geometry result = indicesOfThenExtract(input, subLine);
checkExpected(result, subLineStr);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class AbstractIndexedLineTest method checkExpected.
protected void checkExpected(final Geometry result, final String expected) {
final Geometry subLine = read(expected);
final boolean isEqual = result.equalsExact(subLine, 1.0e-5);
if (!isEqual) {
// System.out.println("Computed result is: " + result);
}
assertTrue(isEqual);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class LinearLocationTest method testRepeatedCoordsLineString.
public void testRepeatedCoordsLineString() throws Exception {
final Geometry line = this.geometryFactory.geometry("LINESTRING (10 0, 10 0, 20 0)");
final LocationIndexedLine indexedLine = new LocationIndexedLine(line);
final LinearLocation loc0 = indexedLine.indexOf(new PointDoubleXY(11, 0));
assertTrue(loc0.compareTo(new LinearLocation(1, 0.1)) == 0);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class LinearLocationTest method testSameSegmentLineString.
public void testSameSegmentLineString() throws Exception {
final Geometry line = this.geometryFactory.geometry("LINESTRING (0 0, 10 0, 20 0, 30 0)");
final LocationIndexedLine indexedLine = new LocationIndexedLine(line);
final LinearLocation loc0 = indexedLine.indexOf(new PointDoubleXY(0, 0));
final LinearLocation loc0_5 = indexedLine.indexOf(new PointDoubleXY(5, 0));
final LinearLocation loc1 = indexedLine.indexOf(new PointDoubleXY(10, 0));
final LinearLocation loc2 = indexedLine.indexOf(new PointDoubleXY(20, 0));
final LinearLocation loc2_5 = indexedLine.indexOf(new PointDoubleXY(25, 0));
final LinearLocation loc3 = indexedLine.indexOf(new PointDoubleXY(30, 0));
assertTrue(loc0.isOnSameSegment(loc0));
assertTrue(loc0.isOnSameSegment(loc0_5));
assertTrue(loc0.isOnSameSegment(loc1));
assertTrue(!loc0.isOnSameSegment(loc2));
assertTrue(!loc0.isOnSameSegment(loc2_5));
assertTrue(!loc0.isOnSameSegment(loc3));
assertTrue(loc0_5.isOnSameSegment(loc0));
assertTrue(loc0_5.isOnSameSegment(loc1));
assertTrue(!loc0_5.isOnSameSegment(loc2));
assertTrue(!loc0_5.isOnSameSegment(loc3));
assertTrue(!loc2.isOnSameSegment(loc0));
assertTrue(loc2.isOnSameSegment(loc1));
assertTrue(loc2.isOnSameSegment(loc2));
assertTrue(loc2.isOnSameSegment(loc3));
assertTrue(loc2_5.isOnSameSegment(loc3));
assertTrue(!loc3.isOnSameSegment(loc0));
assertTrue(loc3.isOnSameSegment(loc2));
assertTrue(loc3.isOnSameSegment(loc2_5));
assertTrue(loc3.isOnSameSegment(loc3));
}
Aggregations