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); final Geoshape multiPolygon = Geoshape.geoshape(Geoshape.getShapeFactory().multiPolygon() .add(Geoshape.getShapeFactory().polygon().pointXY(59.0, 59.0).pointXY(61.0, 59.0).pointXY(61.0, 61.0).pointXY(59.0, 61.0).pointXY(59.0, 59.0)) .add(Geoshape.getShapeFactory().polygon().pointXY(119.0, 59.0).pointXY(121.0, 59.0).pointXY(121.0, 61.0).pointXY(119.0, 61.0).pointXY(119.0, 59.0)).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))
ShapeFactory.PolygonBuilder b = buildier.polygon(); fillPolygon(b, (ArrayNode)arr.get(i)); buildier.add(b);
protected Shape readMultiPolygon(JSONParser parser) throws IOException, ParseException { assert (parser.lastEvent() == JSONParser.ARRAY_START); // TODO need Spatial4j Polygon interface ShapeFactory.MultiPolygonBuilder builder = shapeFactory.multiPolygon(); int evt = parser.nextEvent(); while (true) { switch (evt) { case JSONParser.ARRAY_START: ShapeFactory.PolygonBuilder polygonBuilder = readPolygon(parser, builder.polygon()); builder.add(polygonBuilder); break; case JSONParser.ARRAY_END: return builder.build(); default: throw new ParseException("Unexpected " + JSONParser.getEventString(evt), (int) parser.getPosition()); } evt = parser.nextEvent(); } } }
/** * Parses a MULTIPOLYGON shape from the raw string. * * <pre> * '(' polygon (',' polygon )* ')' * </pre> */ protected Shape parseMulitPolygonShape(WKTReader.State state) throws ParseException { ShapeFactory.MultiPolygonBuilder multiPolygonBuilder = shapeFactory.multiPolygon(); if (!state.nextIfEmptyAndSkipZM()) { state.nextExpect('('); do { multiPolygonBuilder.add(polygon(state, multiPolygonBuilder.polygon())); } while (state.nextIf(',')); state.nextExpect(')'); } return multiPolygonBuilder.build(); }