/** * Constructs a new box shape which is identified by its south-west and north-east corner points * @param southWestLatitude * @param southWestLongitude * @param northEastLatitude * @param northEastLongitude * @return */ public static Geoshape box(final double southWestLatitude, final double southWestLongitude, final double northEastLatitude, final double northEastLongitude) { Preconditions.checkArgument(isValidCoordinate(southWestLatitude, southWestLongitude), "Invalid south-west coordinate provided"); Preconditions.checkArgument(isValidCoordinate(northEastLatitude, northEastLongitude), "Invalid north-east coordinate provided"); return new Geoshape(getShapeFactory().rect(southWestLongitude, northEastLongitude, southWestLatitude, northEastLatitude)); }
/** Construct a rectangle. */ @Deprecated public Rectangle makeRectangle(Point lowerLeft, Point upperRight) { return shapeFactory.rect(lowerLeft, upperRight); }
/** * Construct a rectangle. If just one longitude is on the dateline (+/- 180) (aka anti-meridian) * then potentially adjust its sign to ensure the rectangle does not cross the * dateline. */ @Deprecated public Rectangle makeRectangle(double minX, double maxX, double minY, double maxY) { return shapeFactory.rect(minX, maxX, minY, maxY); }
double lat1 = shpFactory.normX(reader.readLat()); double lon1 = shpFactory.normY(reader.readLng()); lastShape = shpFactory.rect(lat1, shpFactory.normX(reader.readLat()), lon1, shpFactory.normY(reader.readLng())); break;
/** * Parses an ENVELOPE (aka Rectangle) shape from the raw string. The values are normalized. * <p> * Source: OGC "Catalogue Services Specification", the "CQL" (Common Query Language) sub-spec. * <em>Note the inconsistent order of the min & max values between x & y!</em> * * <pre> * '(' x1 ',' x2 ',' y2 ',' y1 ')' * </pre> */ protected Shape parseEnvelopeShape(State state) throws ParseException { // FYI no dimension or EMPTY state.nextExpect('('); double x1 = state.nextDouble(); state.nextExpect(','); double x2 = state.nextDouble(); state.nextExpect(','); double y2 = state.nextDouble(); state.nextExpect(','); double y1 = state.nextDouble(); state.nextExpect(')'); return shapeFactory.rect(shapeFactory.normX(x1), shapeFactory.normX(x2), shapeFactory.normY(y1), shapeFactory.normY(y2)); }
@Override public SpatialRelation relateXRange(double minX, double maxX) { Rectangle r = spatialcontext.getShapeFactory().rect(minX, maxX, -90, 90); return relate(r); }
@Override public SpatialRelation relateYRange(double minY, double maxY) { Rectangle r = spatialcontext.getShapeFactory().rect(-180, 180, minY, maxY); return relate(r); }