Class GeofenceShape
java.lang.Object
com.cercalia.sdk.model.geofencing.GeofenceShape
Geofence shape definition (polygon or circle in WKT format).
Supported WKT formats:
- CIRCLE(lng lat, radiusMeters) - e.g., "CIRCLE(2.17 41.38, 1000)"
- POLYGON((lng lat, lng lat, ...)) - e.g., "POLYGON((2.15 41.37, 2.19 41.37, 2.19 41.40, 2.15 41.40, 2.15 41.37))"
-
Constructor Summary
ConstructorsConstructorDescriptionGeofenceShape(@NotNull String id, @NotNull String wkt) Creates a newGeofenceShape. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull GeofenceShapeCreates a circular geofence shape.@NotNull StringgetId()Returns the unique identifier for the shape.@NotNull StringgetWkt()Returns the shape geometry in WKT format.static @NotNull GeofenceShapeCreates a rectangular (polygon) geofence shape.toString()
-
Constructor Details
-
GeofenceShape
Creates a newGeofenceShape.- Parameters:
id- unique identifier for the shape.wkt- shape geometry in WKT format.
-
-
Method Details
-
getId
Returns the unique identifier for the shape.- Returns:
- the shape ID.
-
getWkt
Returns the shape geometry in WKT format.- Returns:
- the WKT geometry.
-
circle
@NotNull public static @NotNull GeofenceShape circle(@NotNull @NotNull String id, double centerLng, double centerLat, double radiusMeters) Creates a circular geofence shape.- Parameters:
id- unique identifier.centerLng- center longitude.centerLat- center latitude.radiusMeters- radius in meters.- Returns:
- a new
GeofenceShapewith circle WKT.
-
rectangle
@NotNull public static @NotNull GeofenceShape rectangle(@NotNull @NotNull String id, double swLng, double swLat, double neLng, double neLat) Creates a rectangular (polygon) geofence shape.- Parameters:
id- unique identifier.swLng- southwest corner longitude.swLat- southwest corner latitude.neLng- northeast corner longitude.neLat- northeast corner latitude.- Returns:
- a new
GeofenceShapewith polygon WKT.
-
toString
-