final Geoshape multiPoint = Geoshape.geoshape(Geoshape.getShapeFactory().multiPoint().pointXY(60.0, 60.0).pointXY(120.0, 60.0).build()); add(store, "doc5", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiPoint, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape multiLine = Geoshape.geoshape(Geoshape.getShapeFactory().multiLineString().add(Geoshape.getShapeFactory().lineString().pointXY(59.0, 60.0).pointXY(61.0, 60.0)) .add(Geoshape.getShapeFactory().lineString().pointXY(119.0, 60.0).pointXY(121.0, 60.0)).build()); add(store, "doc6", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiLine, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true);
ShapeFactory.MultiLineStringBuilder builder = factory.multiLineString(); for(int i=0; i<arr.size(); i++) { ShapeFactory.LineStringBuilder b = builder.lineString();
protected Shape readMultiLineString(JSONParser parser) throws IOException, ParseException { assert (parser.lastEvent() == JSONParser.ARRAY_START); // TODO need Spatial4j LineString interface ShapeFactory.MultiLineStringBuilder builder = shapeFactory.multiLineString(); int evt = parser.nextEvent(); while (true) { switch (evt) { case JSONParser.ARRAY_START: ShapeFactory.LineStringBuilder lineStringBuilder = builder.lineString(); readCoordListXYZ(parser, lineStringBuilder); builder.add(lineStringBuilder); break; case JSONParser.ARRAY_END: return builder.build(); default: throw new ParseException("Unexpected " + JSONParser.getEventString(evt), (int) parser.getPosition()); } evt = parser.nextEvent(); } }
/** * Parses a MULTILINESTRING shape from the raw string -- a collection of line strings. * * <pre> * '(' coordinateSequence (',' coordinateSequence )* ')' * </pre> * * @see #parseLineStringShape(org.locationtech.spatial4j.io.WKTReader.State) */ protected Shape parseMultiLineStringShape(State state) throws ParseException { ShapeFactory.MultiLineStringBuilder multiLineStringBuilder = shapeFactory.multiLineString(); if (!state.nextIfEmptyAndSkipZM()) { state.nextExpect('('); do { multiLineStringBuilder.add(pointList(state, multiLineStringBuilder.lineString())); } while (state.nextIf(',')); state.nextExpect(')'); } return multiLineStringBuilder.build(); }