throw new IllegalArgumentException("Cannot relate shapes with different planet models."); final int insideGeoAreaShape = isShapeInsideGeoAreaShape(geoShape); if (insideGeoAreaShape == SOME_INSIDE) { return GeoArea.OVERLAPS; final int insideShape = isGeoAreaShapeInsideShape(geoShape); if (insideShape == SOME_INSIDE) { return GeoArea.OVERLAPS; if (intersects(geoShape)){ return GeoArea.OVERLAPS;
/** Determine the relationship between the GeoAreaShape's edgepoints and the * provided shape. *@param geoshape is the shape. *@return the relationship. */ protected int isGeoAreaShapeInsideShape(final GeoShape geoshape) { boolean foundOutside = false; boolean foundInside = false; for (GeoPoint p : getEdgePoints()) { if (geoshape.isWithin(p)) { foundInside = true; } else { foundOutside = true; } if (foundInside && foundOutside) { return SOME_INSIDE; } } if (!foundInside && !foundOutside) return NONE_INSIDE; if (foundInside && !foundOutside) return ALL_INSIDE; if (foundOutside && !foundInside) return NONE_INSIDE; return SOME_INSIDE; }
/** Determine the relationship between the GeoAreShape and the * shape's edgepoints. *@param geoShape is the shape. *@return the relationship. */ protected int isShapeInsideGeoAreaShape(final GeoShape geoShape) { boolean foundOutside = false; boolean foundInside = false; for (GeoPoint p : geoShape.getEdgePoints()) { if (isWithin(p)) { foundInside = true; } else { foundOutside = true; } if (foundInside && foundOutside) { return SOME_INSIDE; } } if (!foundInside && !foundOutside) return NONE_INSIDE; if (foundInside && !foundOutside) return ALL_INSIDE; if (foundOutside && !foundInside) return NONE_INSIDE; return SOME_INSIDE; }