if (shell.contains(hole)) { ((List<LinearRing>) shell.getUserData()).add(hole); break outer;
if (shell.contains(hole)) { ((List<LinearRing>) shell.getUserData()).add(hole); break outer;
if (!ring.toJtsPolygon().contains(area.toJTSMultiPolygon())) { continue;
public boolean contains(Geometry g) { return polygon.contains(g); }
/** * Splits a Polygon using a LineString. * * @param polygon * @param lineString * @return */ public static Collection<Polygon> polygonWithLineSplitter(Polygon polygon, LineString lineString) { Collection<Polygon> polygons = splitPolygonizer(polygon, lineString); if (polygons != null && polygons.size() > 1) { List<Polygon> pols = new ArrayList<Polygon>(); for (Polygon pol : polygons) { if (polygon.contains(pol.getInteriorPoint())) { pols.add(pol); } } return pols; } return null; }
/** * Splits a Polygon using a LineString. * * @param polygon * @param lineString * @return */ private static Collection<Polygon> polygonWithLineSplitter(Polygon polygon, LineString lineString) throws SQLException { Collection<Polygon> polygons = splitPolygonizer(polygon, lineString); if (polygons != null && polygons.size() > 1) { List<Polygon> pols = new ArrayList<Polygon>(); for (Polygon pol : polygons) { if (polygon.contains(pol.getInteriorPoint())) { pols.add(pol); } } return pols; } return null; }
/** * Splits a Polygon using a LineString. * * @param polygon * @param lineString * @return */ private static Collection<Polygon> polygonWithLineSplitter(Polygon polygon, LineString lineString) throws SQLException { Collection<Polygon> polygons = splitPolygonizer(polygon, lineString); if (polygons != null && polygons.size() > 1) { List<Polygon> pols = new ArrayList<Polygon>(); for (Polygon pol : polygons) { if (polygon.contains(pol.getInteriorPoint())) { pols.add(pol); } } return pols; } return null; }
@SuppressWarnings("unchecked") private void one2OneJoin(List<JSONObject> polygons, Map<JSONObject, JSONObject> result) { for(JSONObject placeV : polygons) { Polygon polyg = GeoJsonWriter.getPolygonGeometry(placeV); Envelope polygonEnvelop = polyg.getEnvelopeInternal(); for (JSONObject pnt : (List<JSONObject>)addrPointsIndex.query(polygonEnvelop)) { JSONArray pntg = pnt.getJSONObject(GeoJsonWriter.GEOMETRY).getJSONArray(GeoJsonWriter.COORDINATES); if(polyg.contains(factory.createPoint(new Coordinate(pntg.getDouble(0), pntg.getDouble(1))))){ result.put(pnt, placeV); } } } }
public <T extends IZone> ZoneMatcher(IDeviceLocation location, List<T> zones) { this.location = location; for (IZone zone : zones) { Polygon zonePoly = GeoUtils.createPolygonForZone(zone); ZoneContainment containment = (zonePoly.contains(GeoUtils.createPointForLocation(location))) ? ZoneContainment.Inside : ZoneContainment.Outside; ZoneRelationship relationship = new ZoneRelationship(location, zone, containment); relationships.put(zone.getToken(), relationship); } }
public <T extends IZone> ZoneMatcher(IDeviceLocation location, List<T> zones) { this.location = location; for (IZone zone : zones) { Polygon zonePoly = GeoUtils.createPolygonForZone(zone); ZoneContainment containment = (zonePoly.contains(GeoUtils.createPointForLocation(location))) ? ZoneContainment.Inside : ZoneContainment.Outside; ZoneRelationship relationship = new ZoneRelationship(location, zone, containment); relationships.put(zone.getToken(), relationship); } }
if (pp != null) { Coordinate c = getCoordinateFromGJSON(pp); if(polygon.contains(fatory.createPoint(c))) {
private boolean intersects(Polygon polygon) { if (intersects(polygon.getExteriorRing())) { return true; } if (polygon.contains(factory.createPoint(centerPoint))) { return true; } if (polygon.getNumInteriorRing() == 0) { return false; } for (int i = 0; i < polygon.getNumInteriorRing(); i++) { if (intersects(polygon.getInteriorRingN(i))) { return true; } } return false; }
private boolean intersects(Polygon polygon) { if (intersects(polygon.getExteriorRing())) { return true; } if (polygon.contains(factory.createPoint(centerPoint))) { return true; } if (polygon.getNumInteriorRing() == 0) { return false; } for (int i = 0; i < polygon.getNumInteriorRing(); i++) { if (intersects(polygon.getInteriorRingN(i))) { return true; } } return false; }
"{\"type\":\"Polygon\", \"coordinates\":" + multiPolygonJson + "}" ) ); contains = polygon.contains( point );
if (polygon.contains(p.getInteriorPoint())) output.add(p);
public double calculate(Polygon polygon, Coordinate coordinate, double precisionKilometers, GeometryFactory geometryFactory) { Point point = new Point(new CoordinateArraySequence(new Coordinate[]{coordinate}), geometryFactory); if (polygon.contains(point)) { // todo distance to border? well if that should be the case then factor this method out of this class! return 0; } double smallestDistance = Double.MAX_VALUE; Coordinate[] coordinates = polygon.getCoordinates(); for (int i = 1; i < coordinates.length; i++) { for (Coordinate interpolated : new LineInterpolation().interpolate(precisionKilometers, coordinates[i - 1], coordinates[i])) { double distance = calculate(interpolated, coordinate); if (distance < smallestDistance) { smallestDistance = distance; } } } return smallestDistance; }
Geometry geo=(Geometry)ft.getDefaultGeometry(); if(!clippingBox.contains(geo)) { try { Geometry clippedGeometry=clippingBox.intersection(geo);
@Override public void onLocation(IDeviceEventContext context, IDeviceLocation location) throws SiteWhereException { for (ZoneTest test : zoneTests) { Polygon poly = getZonePolygon(test.getZoneToken()); ZoneContainment containment = (poly.contains(GeoUtils.createPointForLocation(location))) ? ZoneContainment.Inside : ZoneContainment.Outside; if (test.getCondition() == containment) { DeviceAlertCreateRequest alert = new DeviceAlertCreateRequest(); alert.setType(test.getAlertType()); alert.setLevel(test.getAlertLevel()); alert.setMessage(test.getAlertMessage()); alert.setUpdateState(false); alert.setEventDate(new Date()); getDeviceEventManagement().addDeviceAlerts(location.getDeviceAssignmentId(), alert); } } }
@Override public void onLocationNotFiltered(IDeviceLocation location) throws SiteWhereException { for (ZoneTest test : zoneTests) { Polygon poly = getZonePolygon(test.getZoneToken()); ZoneContainment containment = (poly.contains(GeoUtils.createPointForLocation(location))) ? ZoneContainment.Inside : ZoneContainment.Outside; if (test.getCondition() == containment) { DeviceAlertCreateRequest alert = new DeviceAlertCreateRequest(); alert.setType(test.getAlertType()); alert.setLevel(test.getAlertLevel()); alert.setMessage(test.getAlertMessage()); alert.setUpdateState(false); alert.setEventDate(new Date()); SiteWhere.getServer().getDeviceEventManagement(getTenant()) .addDeviceAlert(location.getDeviceAssignmentToken(), alert); } } }