Search in sources :

Example 1 with GeomCollectionIterator

use of org.geotools.geometry.jts.GeomCollectionIterator in project hale by halestudio.

the class StyledInstanceMarker method getPathIterator.

/**
 * Returns a path iterator.
 *
 * @param shape a shape to determine the iterator
 * @return the path iterator
 */
private PathIterator getPathIterator(final LiteShape2 shape) {
    // DJB: changed this to handle multi* geometries and line and
    // polygon geometries better
    GeometryCollection gc;
    if (shape.getGeometry() instanceof GeometryCollection)
        gc = (GeometryCollection) shape.getGeometry();
    else {
        Geometry[] gs = new Geometry[1];
        gs[0] = shape.getGeometry();
        // make a Point,Line, or Poly into a GC
        gc = shape.getGeometry().getFactory().createGeometryCollection(gs);
    }
    AffineTransform IDENTITY_TRANSFORM = new AffineTransform();
    GeomCollectionIterator citer = new GeomCollectionIterator(gc, IDENTITY_TRANSFORM, false, 1.0);
    return citer;
}
Also used : GeometryCollection(org.locationtech.jts.geom.GeometryCollection) Geometry(org.locationtech.jts.geom.Geometry) AffineTransform(java.awt.geom.AffineTransform) GeomCollectionIterator(org.geotools.geometry.jts.GeomCollectionIterator)

Aggregations

AffineTransform (java.awt.geom.AffineTransform)1 GeomCollectionIterator (org.geotools.geometry.jts.GeomCollectionIterator)1 Geometry (org.locationtech.jts.geom.Geometry)1 GeometryCollection (org.locationtech.jts.geom.GeometryCollection)1