Search in sources :

Example 11 with Vertex

use of com.revolsys.geometry.model.vertex.Vertex in project com.revolsys.open by revolsys.

the class GeometryEditor method move.

default GeometryEditor<?> move(final double deltaX, final double deltaY) {
    for (final Vertex vertex : vertices()) {
        double x = vertex.getX();
        x += deltaX;
        vertex.setX(x);
        double y = vertex.getY();
        y += deltaY;
        vertex.setY(y);
    }
    return this;
}
Also used : Vertex(com.revolsys.geometry.model.vertex.Vertex)

Example 12 with Vertex

use of com.revolsys.geometry.model.vertex.Vertex in project com.revolsys.open by revolsys.

the class CoordinatesListUtil method getPointArray.

public static Point[] getPointArray(final Geometry geometry, final int vertexCount) {
    final Point[] points = new Point[vertexCount];
    int i = 0;
    for (final Vertex vertex : geometry.vertices()) {
        if (i > vertexCount) {
            break;
        }
        points[i++] = vertex.newPoint();
    }
    return points;
}
Also used : Vertex(com.revolsys.geometry.model.vertex.Vertex) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Example 13 with Vertex

use of com.revolsys.geometry.model.vertex.Vertex in project com.revolsys.open by revolsys.

the class GeometryCollection method addPointVertices.

default void addPointVertices(final List<Vertex> vertices, final GeometryCollection geometryCollection, final int... parentId) {
    for (int partIndex = 0; partIndex < getGeometryCount(); partIndex++) {
        final Geometry part = getGeometry(partIndex);
        if (part instanceof Point) {
            final int[] vertexId = new int[parentId.length + 1];
            System.arraycopy(parentId, 0, vertexId, 0, parentId.length);
            vertexId[parentId.length] = partIndex;
            final Vertex vertex = getVertex(vertexId);
            vertices.add(vertex);
        }
    }
}
Also used : GeometryCollectionVertex(com.revolsys.geometry.model.vertex.GeometryCollectionVertex) Vertex(com.revolsys.geometry.model.vertex.Vertex)

Example 14 with Vertex

use of com.revolsys.geometry.model.vertex.Vertex in project com.revolsys.open by revolsys.

the class VertexError method getVertex.

public Vertex getVertex() {
    final Geometry geometry = getGeometry();
    final Vertex vertex = geometry.getVertex(this.vertexId);
    return vertex;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Vertex(com.revolsys.geometry.model.vertex.Vertex)

Example 15 with Vertex

use of com.revolsys.geometry.model.vertex.Vertex in project com.revolsys.open by revolsys.

the class CommonBitsRemover method add.

/**
 * Add a geometry to the set of geometries whose common bits are
 * being computed.  After this method has executed the
 * common coordinate reflects the common bits of all added
 * geometries.
 *
 * @param geometry a Geometry to test for common bits
 */
public void add(final Geometry geometry) {
    for (final Vertex vertex : geometry.vertices()) {
        this.commonBitsX.add(vertex.getX());
        this.commonBitsY.add(vertex.getY());
    }
    this.commonCoord = new PointDoubleXY(this.commonBitsX.getCommon(), this.commonBitsY.getCommon());
}
Also used : Vertex(com.revolsys.geometry.model.vertex.Vertex) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Aggregations

Vertex (com.revolsys.geometry.model.vertex.Vertex)42 Point (com.revolsys.geometry.model.Point)18 Geometry (com.revolsys.geometry.model.Geometry)16 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)14 LineString (com.revolsys.geometry.model.LineString)10 Polygon (com.revolsys.geometry.model.Polygon)6 Segment (com.revolsys.geometry.model.segment.Segment)6 ArrayList (java.util.ArrayList)6 GeometryEditor (com.revolsys.geometry.model.editor.GeometryEditor)4 AbstractVertex (com.revolsys.geometry.model.vertex.AbstractVertex)4 LineStringVertex (com.revolsys.geometry.model.vertex.LineStringVertex)4 BaseCloseable (com.revolsys.io.BaseCloseable)4 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 DataType (com.revolsys.datatype.DataType)3 LinearRing (com.revolsys.geometry.model.LinearRing)3 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)3 LineSegment (com.revolsys.geometry.model.segment.LineSegment)3 MapPanel (com.revolsys.swing.map.MapPanel)3 WebColors (com.revolsys.awt.WebColors)2 Maps (com.revolsys.collection.map.Maps)2