/** * INTERNAL: Creates a {@link Shape} from a JTS {@link Geometry}. Generally, this shouldn't be * called when one of the other factory methods are available, such as for points. The caller * needs to have done some verification/normalization of the coordinates by now, if any. Also, * note that direct instances of {@link GeometryCollection} isn't supported. * * Instead of calling this method, consider {@link #makeShapeFromGeometry(Geometry)} * which */ public JtsGeometry makeShape(Geometry geom) { return makeShape(geom, datelineRule != DatelineRule.none, allowMultiOverlap); }
@Override public Shape build() { return makeShape(geometryFactory.createMultiPolygon(geoms.toArray(new Polygon[geoms.size()]))); } }
@Override public Shape build() { return makeShape(geometryFactory.createMultiLineString(geoms.toArray(new LineString[geoms.size()]))); } }
/** * INTERNAL: Creates a {@link Shape} from a JTS {@link Geometry}. Generally, this shouldn't be * called when one of the other factory methods are available, such as for points. The caller * needs to have done some verification/normalization of the coordinates by now, if any. Also, * note that direct instances of {@link GeometryCollection} isn't supported. * * Instead of calling this method, consider {@link JtsShapeFactory#makeShapeFromGeometry(Geometry)} * which */ @Deprecated public JtsGeometry makeShape(Geometry geom) { return getShapeFactory().makeShape(geom); }
/** * INTERNAL * @see #makeShape(org.locationtech.jts.geom.Geometry) * * @param geom Non-null * @param dateline180Check if both this is true and {@link #isGeo()}, then JtsGeometry will check * for adjacent coordinates greater than 180 degrees longitude apart, and * it will do tricks to make that line segment (and the shape as a whole) * cross the dateline even though JTS doesn't have geodetic support. * @param allowMultiOverlap See {@link #isAllowMultiOverlap()}. */ @Deprecated public JtsGeometry makeShape(Geometry geom, boolean dateline180Check, boolean allowMultiOverlap) { return getShapeFactory().makeShape(geom, dateline180Check, allowMultiOverlap); }
@Override public Shape build() { Geometry geom = buildLineStringGeom(); if (bufDistance != 0.0) { geom = geom.buffer(bufDistance); } return makeShape(geom); }
@Override public Shape build() { return makeShape(geometryFactory.createMultiPoint(getCoordsArray())); } }
@Override public Shape lineString(List<Point> points, double bufferDistance) { if (!useJtsLineString()) return super.lineString(points, bufferDistance); //convert List<Point> to Coordinate[] Coordinate[] coords = new Coordinate[points.size()]; for (int i = 0; i < coords.length; i++) { Point p = points.get(i); if (p instanceof JtsPoint) { JtsPoint jtsPoint = (JtsPoint) p; coords[i] = jtsPoint.getGeom().getCoordinate(); } else { coords[i] = new Coordinate(p.getX(), p.getY()); } } JtsGeometry shape = makeShape(geometryFactory.createLineString(coords)); if(bufferDistance!=0) { return shape.getBuffered(bufferDistance, ctx); } return shape; }
public JtsGeometry toShape(Geometry geometry) { return SHAPE_FACTORY.makeShape(geometry); }
public T fromText(String wkt) throws ParseException { T entity = (T) SPATIAL_CONTEXT.getWktShapeParser().parse(wkt); if (entity instanceof Rectangle) { Geometry geometryFrom = SHAPE_FACTORY.getGeometryFrom(entity); entity = (T) SHAPE_FACTORY.makeShape(geometryFrom); } return entity; }