private org.locationtech.spatial4j.shape.Point getSpatial4jPoint() { return getShapeFactory().pointXY(longitude, latitude); }
public Point readPoint(ArrayNode arr, ShapeFactory factory) { double x = arr.get(0).asDouble(); double y = arr.get(1).asDouble(); if(arr.size()==3) { double z = arr.get(3).asDouble(); return factory.pointXYZ(x, y, z); } return factory.pointXY(x, y); }
/** * Constructs a point from its latitude and longitude information * @param latitude * @param longitude * @return */ public static Geoshape point(final double latitude, final double longitude) { Preconditions.checkArgument(isValidCoordinate(latitude, longitude), "Invalid coordinate provided"); return new Geoshape(getShapeFactory().pointXY(longitude, latitude)); }
@Override public OnePointsBuilder pointXY(double x, double y) { assert point == null; point = shapeFactory.pointXY(x, y); return this; }
/** Construct a point. */ @Deprecated public Point makePoint(double x, double y) { return shapeFactory.pointXY(x, y); }
.add(Geoshape.getShapeFactory().polygon().pointXY(119.0, 59.0).pointXY(121.0, 59.0).pointXY(121.0, 61.0).pointXY(119.0, 61.0).pointXY(119.0, 59.0)).build()); add(store, "doc7", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), multiPolygon, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true); final Geoshape geometryCollection = Geoshape.geoshape(Geoshape.getGeometryCollectionBuilder().add(Geoshape.getShapeFactory().pointXY(60.0, 60.0)) .add(Geoshape.getShapeFactory().lineString().pointXY(119.0, 60.0).pointXY(121.0, 60.0).build()).build()); add(store, "doc8", getDocument("A Full Yes", -100, -11.2, Geoshape.point(48.0, 8.0), geometryCollection, Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(400)), true);
/** * Parses a POINT shape from the raw string. * * <pre> * '(' coordinate ')' * </pre> * * @see #point(State, ShapeFactory.PointsBuilder) */ protected Shape parsePointShape(State state) throws ParseException { if (state.nextIfEmptyAndSkipZM()) return shapeFactory.pointXY(Double.NaN, Double.NaN); state.nextExpect('('); OnePointsBuilder onePointsBuilder = new OnePointsBuilder(shapeFactory); point(state, onePointsBuilder); state.nextExpect(')'); return onePointsBuilder.getPoint(); }
lastShape = shpFactory.pointXY(shpFactory.normX(reader.readLat()), shpFactory.normY(reader.readLng())); break;
/** * Returns true if the provided vehiclePosition is within the provided shape, false if it is not * * @param vehiclePosition the vehiclePosition to test against the shape * @param bounds the shape to test against the vehiclePosition * @return true if the provided vehiclePosition is within the provided shape, false if it is not */ public static boolean isPositionWithinShape(GtfsRealtime.Position vehiclePosition, Shape bounds) { ShapeFactory sf = GEO.getShapeFactory(); org.locationtech.spatial4j.shape.Point p = sf.pointXY(vehiclePosition.getLongitude(), vehiclePosition.getLatitude()); return bounds.relate(p).equals(SpatialRelation.CONTAINS); }
@Override public Point pointOnBearing(Point from, double distDEG, double bearingDEG, SpatialContext ctx, Point reuse) { Geo3dPointShape geoFrom = (Geo3dPointShape) from; GeoPoint point = (GeoPoint) geoFrom.shape; double dist = DistanceUtils.DEGREES_TO_RADIANS * distDEG; double bearing = DistanceUtils.DEGREES_TO_RADIANS * bearingDEG; GeoPoint newPoint = planetModel.surfacePointOnBearing(point, dist, bearing); double newLat = newPoint.getLatitude() * DistanceUtils.RADIANS_TO_DEGREES; double newLon = newPoint.getLongitude() * DistanceUtils.RADIANS_TO_DEGREES; if (reuse != null) { reuse.reset(newLon, newLat); return reuse; } else { return ctx.getShapeFactory().pointXY(newLon, newLat); } }