Package com.mapsindoors.mapssdk
Class PolygonGeometry
- java.lang.Object
-
- com.mapsindoors.mapssdk.Geometry
-
- com.mapsindoors.mapssdk.PolygonGeometry
-
- All Implemented Interfaces:
MPModelBase
public class PolygonGeometry extends Geometry
MapsIndoors GeoJSON's Polygon implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.mapsindoors.mapssdk.Geometry
Geometry.GeometryType, Geometry.GeometryTypeName
-
-
Field Summary
-
Fields inherited from class com.mapsindoors.mapssdk.Geometry
BBOX_NE_LAT, BBOX_NE_LNG, BBOX_SW_LAT, BBOX_SW_LNG, GEOMETRYCOLLECTION, LAT, LINESTRING, LNG, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, POINT, POINT_AREA, POLYGON, TYPE_GEOMETRYCOLLECTION, TYPE_LINESTRING, TYPE_MULTILINESTRING, TYPE_MULTIPOINT, TYPE_MULTIPOLYGON, TYPE_POINT, TYPE_POLYGON, Z
-
-
Constructor Summary
Constructors Constructor Description PolygonGeometry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getArea()
double[]
getBBox()
The values of a "bbox" array are "[west, south, east, north]", not "[minx, miny, maxx, maxy]"java.util.List<java.lang.Double>
getBBoxAsList()
double[][][]
getCoordinates()
java.util.List<java.util.List<com.google.android.gms.maps.model.LatLng>>
getGMSPath()
ALatLng
version ofgetPoints()
com.google.android.gms.maps.model.LatLngBounds
getLatLngBounds()
java.util.List<java.util.List<Point>>
getPoints()
Point
getPosition()
Method to get the (average) point of the geometryfloat
getSquaredDistanceToClosestEdge(com.google.android.gms.maps.model.LatLng latLng)
float
getSquaredDistanceToClosestEdge(Point point)
boolean
isInside(com.google.android.gms.maps.model.LatLng latLng)
boolean
isInside(Point point)
void
setBBox(double[] bbox)
void
setCoordinates(double[][][] coordinates)
java.lang.String
toString()
-
-
-
Method Detail
-
getCoordinates
@NonNull public double[][][] getCoordinates()
-
getBBox
@Nullable public double[] getBBox()
The values of a "bbox" array are "[west, south, east, north]", not "[minx, miny, maxx, maxy]"- Returns:
- An optional AABB (axis-aligned bounding box)
- See Also:
- GeoJSON - Bounding Box
-
getGMSPath
@NonNull public java.util.List<java.util.List<com.google.android.gms.maps.model.LatLng>> getGMSPath()
ALatLng
version ofgetPoints()
- Returns:
- First list is the polygon outline, the rest (if any), holes
-
getPoints
@Nullable public java.util.List<java.util.List<Point>> getPoints()
-
setCoordinates
public void setCoordinates(@NonNull double[][][] coordinates)
-
setBBox
public void setBBox(@NonNull double[] bbox)
-
getBBoxAsList
@Nullable public java.util.List<java.lang.Double> getBBoxAsList()
-
getPosition
@Nullable public Point getPosition()
Method to get the (average) point of the geometry- Returns:
- A point describing the geometry (defined here as the average lat/lng)
-
getLatLngBounds
@NonNull public com.google.android.gms.maps.model.LatLngBounds getLatLngBounds()
-
getArea
public float getArea()
- Returns:
- Since:
- 3.0.0
-
isInside
public boolean isInside(@NonNull com.google.android.gms.maps.model.LatLng latLng)
-
isInside
public boolean isInside(@NonNull Point point)
-
getSquaredDistanceToClosestEdge
public float getSquaredDistanceToClosestEdge(@NonNull com.google.android.gms.maps.model.LatLng latLng)
- Parameters:
latLng
-- Returns:
- The distance from the given point to this polygon's closest edge or
-1
if the given point is outside this polygon's bounding box - Since:
- 3.0.0
-
getSquaredDistanceToClosestEdge
public float getSquaredDistanceToClosestEdge(@NonNull Point point)
- Parameters:
point
-- Returns:
- The distance from the given point to this polygon's closest edge or
-1
if the given point is outside this polygon's bounding box - Since:
- 3.0.0
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-