/** * Constructs a line from list of coordinates * @param coordinates Coordinate (lon,lat) pairs * @return */ public static Geoshape line(List<double[]> coordinates) { Preconditions.checkArgument(coordinates.size() >= 2, "Too few coordinate pairs provided"); final LineStringBuilder builder = getShapeFactory().lineString(); for (double[] coordinate : coordinates) { Preconditions.checkArgument(isValidCoordinate(coordinate[1], coordinate[0]), "Invalid coordinate provided"); builder.pointXY(coordinate[0], coordinate[1]); } return new Geoshape(builder.build()); }
add(store, "doc7", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiPolygon, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape geometryCollection = Geoshape.geoshape(Geoshape.getGeometryCollectionBuilder().add(Geoshape.getShapeFactory().pointXY(60.0, 60.0)) .add(Geoshape.getShapeFactory().lineString().pointXY(119.0, 60.0).pointXY(121.0, 60.0).build()).build()); add(store, "doc8", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), geometryCollection, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true);
@Override public MultiLineStringBuilder add(LineStringBuilder lineStringBuilder) { shapes.add(lineStringBuilder.build()); return this; }
lineBuilder.pointXY(p.getLon(), p.getLat()); mTripShapes.put(tripId, lineBuilder.build());
@Override public Shape lineString(List<Point> list, double distance) { LineStringBuilder builder = lineString(); for (Point point : list) { builder.pointXY(point.getX(), point.getY()); } builder.buffer(distance); return builder.build(); }
@SuppressWarnings("unchecked") @Override public Shape build() { GeoCompositeAreaShape areaShape = new GeoCompositeAreaShape(planetModel); for (LineStringBuilder builder : builders) { Geo3dShape<GeoPolygon> shape = (Geo3dShape<GeoPolygon>) builder.build(); areaShape.addShape(shape.shape); } return new Geo3dShape<>(areaShape, context); } }
fillPoints(builder, arr); builder.buffer(buffer); return builder.build();
lineBuilder.buffer(shpFactory.normDist(arg)); lastShape = lineBuilder.build(); break;
/** * Parses a LINESTRING shape from the raw string -- an ordered sequence of points. * * <pre> * coordinateSequence * </pre> * * @see #pointList(State, ShapeFactory.PointsBuilder) */ protected Shape parseLineStringShape(State state) throws ParseException { ShapeFactory.LineStringBuilder lineStringBuilder = shapeFactory.lineString(); if (state.nextIfEmptyAndSkipZM()) return lineStringBuilder.build(); return pointList(state, lineStringBuilder).build(); }
protected Shape readLineString(JSONParser parser) throws IOException, ParseException { assert (parser.lastEvent() == JSONParser.ARRAY_START); ShapeFactory.LineStringBuilder builder = shapeFactory.lineString(); readCoordListXYZ(parser, builder); // check for buffer field builder.buffer(readDistance(BUFFER, BUFFER_UNITS, parser)); Shape out = builder.build(); readUntilEvent(parser, JSONParser.OBJECT_END); return out; }