Search in sources :

Example 41 with Geometry

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

the class JTSFunctions method logoBuffer.

public static Geometry logoBuffer(final Geometry g, final double distance) {
    final Geometry lines = logoLines(g);
    final BufferParameters bufParams = new BufferParameters();
    bufParams.setEndCapStyle(LineCap.SQUARE);
    return lines.buffer(distance, bufParams);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Example 42 with Geometry

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

the class GeometryFactoryExpTest method readGoodCheckCoordinate.

private void readGoodCheckCoordinate(final String wkt, final double x, final double y) throws IOException, ParseException {
    final Geometry g = this.geometryFactory.geometry(wkt);
    final Point pt = g.getPoint();
    assertEquals(pt.getX(), x, 0.0001);
    assertEquals(pt.getY(), y, 0.0001);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Point(com.revolsys.geometry.model.Point)

Example 43 with Geometry

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

the class GeometryFactoryWktTest method testReadPolygon.

public void testReadPolygon() throws Exception {
    final Geometry geometry = this.geometryFactory.geometry("POLYGON((10 10,10 20,20 20,20 15,10 10))");
    final String ewkt = geometry.toEwkt();
    assertEquals("POLYGON((10 10,20 15,20 20,10 20,10 10))", ewkt);
    assertEquals("POLYGON EMPTY", this.geometryFactory.geometry("POLYGON EMPTY").toEwkt());
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

Example 44 with Geometry

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

the class WKBReaderTest method checkWKBGeometry.

private void checkWKBGeometry(final String wkbHex, final String expectedWKT) throws ParseException {
    final WKBReader wkbReader = new WKBReader(this.geometryFactory);
    final byte[] wkb = WKBReader.hexToBytes(wkbHex);
    final Geometry g2 = wkbReader.read(wkb);
    final Geometry expected = this.geometryFactory.geometry(expectedWKT);
    final boolean isEqual = expected.equals(2, g2);
    assertTrue(isEqual);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) WKBReader(com.revolsys.geometry.wkb.WKBReader)

Example 45 with Geometry

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

the class PredicateShortCircuitTest method doPredicates.

public void doPredicates(final String[] wkt) throws Exception {
    final Geometry a = this.geometryFactory.geometry(wkt[0]);
    final Geometry b = this.geometryFactory.geometry(wkt[1]);
    doPredicates(a, b);
    doPredicates(b, a);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

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