Search in sources :

Example 66 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class NormalizeTest method testNormalizeLineString1.

// public void testNormalizeGeometryCollection() throws Exception {
// GeometryCollection actualValue =
// (GeometryCollection)geometryFactory.geometry("GEOMETRYCOLLECTION
// (LINESTRING (200 300,200 280,220 280,220 320,180 320),POINT (140
// 220),POLYGON ((100 80,100 160,20 160,20 80,100 80),(40 140,40 100,80 100,80
// 140,40 140)),POINT (100 240))");
// actualValue = actualValue.normalize();
// final GeometryCollection expectedValue =
// (GeometryCollection)geometryFactory.geometry("GEOMETRYCOLLECTION (POINT
// (100 240),POINT (140 220),LINESTRING (180 320,220 320,220 280,200 280,200
// 300),POLYGON ((20 80,20 160,100 160,100 80,20 80),(40 100,80 100,80 140,40
// 140,40 100)))");
// assertEqualsExact(expectedValue,actualValue);
// }
public void testNormalizeLineString1() throws Exception {
    LineString l = (LineString) this.geometryFactory.geometry("LINESTRING(20 20,160 40,160 100,100 120,60 60)");
    l = l.normalize();
    final LineString expectedValue = (LineString) this.geometryFactory.geometry("LINESTRING(20 20,160 40,160 100,100 120,60 60)");
    assertEqualsExact(expectedValue, l);
}
Also used : LineString(com.revolsys.geometry.model.LineString)

Example 67 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class NormalizeTest method testNormalizeLineString4.

public void testNormalizeLineString4() throws Exception {
    LineString l = (LineString) this.geometryFactory.geometry("LINESTRING(200 240,140 160,80 160,160 80,80 80)");
    l = l.normalize();
    final LineString expectedValue = (LineString) this.geometryFactory.geometry("LINESTRING(80 80,160 80,80 160,140 160,200 240)");
    assertEqualsExact(expectedValue, l);
}
Also used : LineString(com.revolsys.geometry.model.LineString)

Example 68 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class RectanglePredicateTest method testAngleOnBoundary.

@Test
public void testAngleOnBoundary() throws Exception {
    final Polygon polygon = this.geometryFactory.polygon(2, 10.0, 10, 30, 10, 30, 30, 10, 30, 10, 10);
    final LineString line = this.geometryFactory.lineString(2, 10.0, 30, 10, 10, 30, 10);
    runRectanglePred(polygon, line);
}
Also used : LineString(com.revolsys.geometry.model.LineString) Polygon(com.revolsys.geometry.model.Polygon) Test(org.junit.Test)

Example 69 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsStressTest method test.

public void test(final Geometry g) {
    int count = 0;
    while (count < MAX_ITER) {
        count++;
        final LineString line = newTestLine(g.getBoundingBox(), 10, 20);
        // System.out.println("Test # " + count);
        // System.out.println(line);
        testResultsEqual(g, line);
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point)

Example 70 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class TriangleFunctions method angleBisectors.

public static Geometry angleBisectors(final Geometry g) {
    final Point[] pts = trianglePts(g);
    final Point cc = Triangles.inCentre(pts[0], pts[1], pts[2]);
    final GeometryFactory geomFact = FunctionsUtil.getFactoryOrDefault(g);
    final LineString[] line = new LineString[3];
    line[0] = geomFact.lineString(pts[0], cc);
    line[1] = geomFact.lineString(pts[1], cc);
    line[2] = geomFact.lineString(pts[2], cc);
    return geomFact.lineal(line);
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point)

Aggregations

LineString (com.revolsys.geometry.model.LineString)380 Point (com.revolsys.geometry.model.Point)184 Geometry (com.revolsys.geometry.model.Geometry)65 ArrayList (java.util.ArrayList)62 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)51 Polygon (com.revolsys.geometry.model.Polygon)37 LineStringGraph (com.revolsys.geometry.graph.linestring.LineStringGraph)24 Edge (com.revolsys.geometry.graph.Edge)22 List (java.util.List)22 BoundingBox (com.revolsys.geometry.model.BoundingBox)20 Lineal (com.revolsys.geometry.model.Lineal)20 Test (org.junit.Test)20 LinearRing (com.revolsys.geometry.model.LinearRing)19 Record (com.revolsys.record.Record)17 Iterator (java.util.Iterator)14 LineStringEditor (com.revolsys.geometry.model.editor.LineStringEditor)13 Punctual (com.revolsys.geometry.model.Punctual)12 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)12 LineSegment (com.revolsys.geometry.model.segment.LineSegment)10 Polygonal (com.revolsys.geometry.model.Polygonal)9