private void writeGeometry(JsonWriter out, Feature value) throws IOException { out.name(GEOMETRY_NAME); geometryAdapter.write(out, value.geometry()); }
private void writeGeometry(JsonWriter out, Feature value) throws IOException { out.name(GEOMETRY_NAME); geometryAdapter.write(out, value.geometry()); }
private void fetchLineStrings() { for (Feature feature : fc.features()) { if (debug) { // LOGGER.log(Level.INFO,feature.toString()); } Geometry<?> geometry = feature.geometry(); if (geometry instanceof MultiPolygon) { MultiPolygon mpolygon = (MultiPolygon) geometry; for (Polygon polygon : mpolygon.polygons()) { addLineString(polygon); } } if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; addLineString(polygon); } } }
private static Boolean isPointInside(Feature feature, Coordinates location) { Polygon polygon = (Polygon) feature.geometry(); List<SinglePosition> positions = Lists.newArrayList(polygon.perimeter().positions().children()); if ((positions == null) || (location == null)) { return false; } int wn = 0; for (int i = 0; i < positions.size() - 1; i++) { if (positions.get(i).coordinates().getLat() <= location.getLat()) { if (positions.get(i + 1).coordinates().getLat() > location.getLat()) { if (isLeft(positions.get(i).coordinates(), positions.get(i + 1).coordinates(), location) > 0.0) { ++wn; } } } else { if (positions.get(i + 1).coordinates().getLat() <= location.getLat()) { if (isLeft(positions.get(i).coordinates(), positions.get(i + 1).coordinates(), location) < 0.0) { --wn; } } } } return (wn != 0); }