Search in sources :

Example 76 with LineString

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

the class ConvexHullTest method test5.

public void test5() throws Exception {
    final Geometry geometry = GEOMETRY_FACTORY_1M.punctual(2, 0, 0, 5, 0, 10, 0);
    final LineString convexHull = (LineString) GEOMETRY_FACTORY_1M.geometry("LINESTRING(0 0,10 0)");
    assertTrue(convexHull.equals(2, geometry.convexHull()));
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LineString(com.revolsys.geometry.model.LineString)

Example 77 with LineString

use of com.revolsys.geometry.model.LineString 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);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LineString(com.revolsys.geometry.model.LineString)

Example 78 with LineString

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

the class SegmentDensifier method densify.

public Geometry densify(final double segLength) {
    this.newCoords = new PointList();
    final LineString seq = this.inputLine;
    this.newCoords.add(seq.getPoint(0));
    for (int i = 0; i < seq.getVertexCount() - 1; i++) {
        final Point p0 = seq.getPoint(i);
        final Point p1 = seq.getPoint(i + 1);
        densify(p0, p1, segLength);
    }
    final Point[] newPts = this.newCoords.toPointArray();
    return this.inputLine.getGeometryFactory().lineString(newPts);
}
Also used : PointList(com.revolsys.geometry.model.PointList) LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Example 79 with LineString

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

the class TriangleTest method newTriangle.

public TriangleImpl newTriangle(final Polygon g) {
    final LineString line = g.getShell();
    final TriangleImpl t = newTriangle(line);
    return t;
}
Also used : LineString(com.revolsys.geometry.model.LineString) TriangleImpl(com.revolsys.geometry.model.util.TriangleImpl)

Example 80 with LineString

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

the class RobustLineIntersectionTest method checkIntersection.

void checkIntersection(final String wkt1, final String wkt2, final int expectedIntersectionNum, final double distanceTolerance, final Point... intPt) throws ParseException {
    final LineString l1 = (LineString) this.geometryFactory.geometry(wkt1);
    final LineString l2 = (LineString) this.geometryFactory.geometry(wkt2);
    final Point[] pt = new Point[] { l1.getPoint(0), l1.getPoint(1), l2.getPoint(0), l2.getPoint(1) };
    checkIntersection(pt, expectedIntersectionNum, distanceTolerance, intPt);
}
Also used : 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