Search in sources :

Example 36 with Geometry

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

the class GeometryFactoryTest method checkCreateGeometryExact.

private void checkCreateGeometryExact(final String wkt) throws ParseException {
    final Geometry g = this.geometryFactory.geometry(wkt);
    final Geometry g2 = this.geometryFactory.geometry(g);
    if (!g.equals(2, g2)) {
        failNotEquals("Geometry not equal exact", g, g2);
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

Example 37 with Geometry

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

the class LineStringImplTest method testEquals10.

public void testEquals10() throws Exception {
    final GeometryFactory geometryFactotyr = GeometryFactory.fixed2d(0, 1.0, 1.0);
    Geometry l1 = geometryFactotyr.geometry("POLYGON((1732328800 519578384, 1732026179 519976285, 1731627364 519674014, 1731929984 519276112, 1732328800 519578384))");
    Geometry l2 = geometryFactotyr.geometry("POLYGON((1731627364 519674014, 1731929984 519276112, 1732328800 519578384, 1732026179 519976285, 1731627364 519674014))");
    l1 = l1.normalize();
    l2 = l2.normalize();
    assertTrue(l1.equals(2, l2));
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory)

Example 38 with Geometry

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

the class PerturbedGridPolygonBuilder method buildGrid.

private Geometry buildGrid() {
    final LineString[] lines = new LineString[this.numLines * 2];
    int index = 0;
    for (int i = 0; i < this.numLines; i++) {
        final Point p0 = new PointDoubleXY(getRandOrdinate(), 0);
        final Point p1 = new PointDoubleXY(getRandOrdinate(), this.gridWidth);
        final LineString line = this.geomFactory.lineString(new Point[] { p0, p1 });
        lines[index++] = line;
    }
    for (int i = 0; i < this.numLines; i++) {
        final Point p0 = new PointDoubleXY(0, getRandOrdinate());
        final Point p1 = new PointDoubleXY(this.gridWidth, getRandOrdinate());
        final LineString line = this.geomFactory.lineString(new Point[] { p0, p1 });
        lines[index++] = line;
    }
    final Lineal ml = this.geomFactory.lineal(lines);
    final Geometry grid = ml.buffer(this.lineWidth);
    // System.out.println(grid);
    return grid;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Lineal(com.revolsys.geometry.model.Lineal) LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 39 with Geometry

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

the class PointLocatorTest method runPtLocator.

private void runPtLocator(final Location expected, final Point pt, final String wkt) throws Exception {
    final Geometry geom = this.geometryFactory.geometry(wkt);
    final PointLocator pointLocator = new PointLocator();
    final double x = pt.getX();
    final double y = pt.getY();
    final Location loc = pointLocator.locate(geom, x, y);
    assertEquals(expected, loc);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) PointLocator(com.revolsys.geometry.algorithm.PointLocator) Location(com.revolsys.geometry.model.Location)

Example 40 with Geometry

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

the class SimpleRectangleIntersector method newTestPoints.

private Point[] newTestPoints(final int nPts) {
    final Point pt = this.geomFact.point(this.baseX, this.baseY);
    final Geometry circle = pt.buffer(2 * this.rectSize, nPts / 4);
    return CoordinatesListUtil.getPointArray(circle);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Point(com.revolsys.geometry.model.Point)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)488 Point (com.revolsys.geometry.model.Point)140 LineString (com.revolsys.geometry.model.LineString)87 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)75 ArrayList (java.util.ArrayList)70 BoundingBox (com.revolsys.geometry.model.BoundingBox)39 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)39 Polygon (com.revolsys.geometry.model.Polygon)34 List (java.util.List)33 Record (com.revolsys.record.Record)32 Iterator (java.util.Iterator)20 RecordDefinition (com.revolsys.record.schema.RecordDefinition)18 LinearRing (com.revolsys.geometry.model.LinearRing)16 Vertex (com.revolsys.geometry.model.vertex.Vertex)16 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)14 LineSegment (com.revolsys.geometry.model.segment.LineSegment)13 GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)13 FieldDefinition (com.revolsys.record.schema.FieldDefinition)12 DataType (com.revolsys.datatype.DataType)10 IOException (java.io.IOException)10