/** * Wrapper method for {@link Polygon#contains(double, double)}. */ public boolean contains(GHPoint point) { return contains(point.lat, point.lon); }
@Override public SpatialRule lookupRule(double lat, double lon) { for (Polygon polygon : germany.getBorders()) { if (polygon.contains(lat, lon)) { return germany; } } return SpatialRule.EMPTY; }
@Override public SpatialRule lookupRule(double lat, double lon) { if (lon < bounds.minLon || lon > bounds.maxLon || lat < bounds.minLat || lat > bounds.maxLat) return SpatialRule.EMPTY; int xIndex = getXIndexForLon(lon); int yIndex = getYIndexForLat(lat); int ruleIndex = getRuleContainerIndex(xIndex, yIndex); SpatialRuleContainer ruleContainer = ruleContainers.get(ruleIndex); if (ruleContainer.size() == 1) { if (!exact || !isBorderTile(xIndex, yIndex, ruleIndex)) return ruleContainer.first(); } for (SpatialRule rule : ruleContainer.getRules()) { if (rule.equals(SpatialRule.EMPTY)) continue; for (Polygon p : rule.getBorders()) { if (p.contains(lat, lon)) { return rule; } } } return SpatialRule.EMPTY; }
if (polygon.contains(center) || polygon.contains(center.getLat() - checkDiff, center.getLon() - checkDiff) || polygon.contains(center.getLat() - checkDiff, center.getLon() + checkDiff) || polygon.contains(center.getLat() + checkDiff, center.getLon() - checkDiff) || polygon.contains(center.getLat() + checkDiff, center.getLon() + checkDiff)) {
/** * Wrapper method for {@link Polygon#contains(double, double)}. */ public boolean contains(GHPoint point) { return contains(point.lat, point.lon); }
@Override public SpatialRule lookupRule(double lat, double lon) { if (lon < bounds.minLon || lon > bounds.maxLon || lat < bounds.minLat || lat > bounds.maxLat) return SpatialRule.EMPTY; int xIndex = getXIndexForLon(lon); int yIndex = getYIndexForLat(lat); int ruleIndex = getRuleContainerIndex(xIndex, yIndex); SpatialRuleContainer ruleContainer = ruleContainers.get(ruleIndex); if (ruleContainer.size() == 1) { if (!exact || !isBorderTile(xIndex, yIndex, ruleIndex)) return ruleContainer.first(); } for (SpatialRule rule : ruleContainer.getRules()) { if (rule.equals(SpatialRule.EMPTY)) continue; for (Polygon p : rule.getBorders()) { if (p.contains(lat, lon)) { return rule; } } } return SpatialRule.EMPTY; }
if (polygon.contains(center) || polygon.contains(center.getLat() - checkDiff, center.getLon() - checkDiff) || polygon.contains(center.getLat() - checkDiff, center.getLon() + checkDiff) || polygon.contains(center.getLat() + checkDiff, center.getLon() - checkDiff) || polygon.contains(center.getLat() + checkDiff, center.getLon() + checkDiff)) {