@Override public boolean equals(final Object o) { if (!(o instanceof BasePlanetObject)) return false; return planetModel.equals(((BasePlanetObject)o).planetModel); }
/** * Add a shape to the composite. * * @param shape is the shape to add. */ public void addShape(final T shape) { if (!shape.getPlanetModel().equals(planetModel)) { throw new IllegalArgumentException("Cannot add a shape into a composite with different planet models."); } shapes.add(shape); }
/** The lats/lons must be clockwise or counter-clockwise. */ public PointInGeo3DShapeQuery(String field, GeoShape shape) { this.field = field; this.shape = shape; this.shapeBounds = new XYZBounds(); shape.getBounds(shapeBounds); if (shape instanceof BasePlanetObject) { BasePlanetObject planetObject = (BasePlanetObject) shape; if (planetObject.getPlanetModel().equals(PlanetModel.WGS84) == false) { throw new IllegalArgumentException("this qurey requires PlanetModel.WGS84, but got: " + planetObject.getPlanetModel()); } } }
@Override public int getRelationship(GeoShape geoShape) { if (!geoShape.getPlanetModel().equals(planetModel)) { 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 (insideGeoAreaShape == ALL_INSIDE && insideShape==ALL_INSIDE) { return GeoArea.OVERLAPS; } if (intersects(geoShape)){ return GeoArea.OVERLAPS; } if (insideGeoAreaShape == ALL_INSIDE) { return GeoArea.WITHIN; } if (insideShape==ALL_INSIDE) { return GeoArea.CONTAINS; } return GeoArea.DISJOINT; }
@Override public int getRelationship(GeoShape geoShape) { if (!geoShape.getPlanetModel().equals(planetModel)) { throw new IllegalArgumentException("Cannot relate shapes with different planet models.");