1.0.0 • Published 6 years ago

@jibestream-dev/jmap-geofence-kit v1.0.0

Weekly downloads
21
License
ISC
Repository
github
Last release
6 years ago

Classes

Typedefs

Geofence

Kind: global class

new Geofence()

Class representing a Geofence

geofence.name : String

Kind: instance property of Geofence

geofence.description : String

Kind: instance property of Geofence

geofence.color : String

Kind: instance property of Geofence

geofence.geofenceInstances : Array.<GeofenceInstance>

Kind: instance property of Geofence

geofence.geofenceInstances : Array.<String>

Kind: instance property of Geofence

GeofenceCollection ⇐ jmap.core.BaseCollection

Class representing a collection of geofences

Kind: global class
Extends: jmap.core.BaseCollection

new GeofenceCollection()

Create a collection of geofences

geofenceCollection.getByName(name) ⇒ Array

Get a specific set of geofences by their name

Kind: instance method of GeofenceCollection
Returns: Array - An array of geofences

ParamTypeDescription
nameStringA geofence name

geofenceCollection.getByMap(map) ⇒ Array

Get any geofences which appear on the specific map

Kind: instance method of GeofenceCollection
Returns: Array - An array of geofences

ParamTypeDescription
mapjmap.core.MapAny map to query with

geofenceCollection.getByFloor(map) ⇒ Array

Get any geofences which appear on the specific map

Kind: instance method of GeofenceCollection
Returns: Array - An array of geofences

ParamTypeDescription
mapjmap.core.MapAny map to query with

geofenceCollection.isGeofence(item) ⇒ Boolean

Returns a boolean for whether or not argument is constructed as a Geofence object

Kind: instance method of GeofenceCollection
Returns: Boolean - Boolean based on evaluation result

ParamTypeDescription
itemObjectItem to evaluate

GeofenceInstance

Kind: global class

new GeofenceInstance(options)

Class representing a Geofence Instance

ParamTypeDescription
optionsObjectGeofenceInstance options
options.parentGeofenceThe parent geofence
options.coordinatesArray.<Array.<Array>>The set of coordinates that define the geofence instance's polygon. Is a triple nested array to allow for holes within polygons, for example: [[10, 20, 12, 21, 15, 14], [22, 43, 30, 21, 33, 23]
options.localCoordinatesArray.<Array.<Array>>The set of local coordinates that define the geofence instance's polygon. Is a triple nested array to allow for holes within polygons, for example: [[10, 20, 12, 21, 15, 14], [22, 43, 30, 21, 33, 23]
options.nameStringThe name of the geofence instance
options.idNumberThe ID of the geofence instance
options.floorjCore.FloorThe floor that the current geofence instance is placed on

GeofenceKit

Kit for working with Jibestream Zones

Kind: global class

new GeofenceKit(core, control)

Create a ZoneKit.

ParamTypeDescription
corejmap.coreinstantiated JCore
controljmap.JControllerinstantiated JController

geofenceKit.getGeofences(callback)

Load the geofence data for the current activeVenue and save it to the geofenceKit object

Kind: instance method of GeofenceKit
Access: public

ParamTypeDescription
callbackfunctionThe callback that will be fun once the API endpoint has been loaded

geofenceKit.getBoundsOfGeofenceOnMap(geofence, map) ⇒ jmap.Bounds

Calculate the bounds of a given geofence on a specific map Will return null if there are no instances of the geofence on the specified map or if an invalid geofence/map are provided

Kind: instance method of GeofenceKit
Returns: jmap.Bounds - The calculated bounds object (or null if unable to caluclate bounds)
Access: public

ParamTypeDefaultDescription
geofenceGeofenceThe geofence that we wish to gind the boudns of
mapjcore.Mapthis._control.currentMapThe map we will use to calculate bounds Defaults to the currently shown map

geofenceKit.getPolygonsOfGeofence(geofence, map) ⇒ Array.<jungle.Polygon>

Generates an array of polygons for the instances of the geofence on the specified map If there are no instances of the geofence on the map, this will return an empty array

Kind: instance method of GeofenceKit
Returns: Array.<jungle.Polygon> - An array of polygons
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence with which we wish to generate polygons
mapjcore.MapThe map with which we wish to generate polygons

geofenceKit.drawPolygonsOfGeofence(geofence, map, style) ⇒ Array.<jungle.Polygon>

Draw polygons for each instance of the geofence on the specified map with the specified style. If no style is given, use the geofence's color as the style of the polygons

Kind: instance method of GeofenceKit
Returns: Array.<jungle.Polygon> - The generated polygons
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence with which we wish to generate polygons
mapjcore.MapThe map on which we wish to place the polygons
stylejmap.StyleHow the polygons should be styled

geofenceKit.drawPolygonOfGeofenceInstance(instance, style) ⇒ jungle.Polygon

Draws a polygon for a specific geofence instance on the map where theinstance resides

Kind: instance method of GeofenceKit
Returns: jungle.Polygon - A polygon (or null if a polygon is unable to be created)
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe instance with which we width to generate a polygon
stylejmap.StyleHow the polygon should be styled. Defaults to using the geofence's color

geofenceKit.watchMovingObjects(geoExitedCallback, geoEnteredCallback) ⇒ GeofenceKit

Add event handlers for when moving objects enter or exit geofences

Kind: instance method of GeofenceKit
Returns: GeofenceKit - The current geofence kit
Access: public

ParamTypeDescription
geoExitedCallbackfunctionThe function that will be fired when a moving object exits a geofence
geoEnteredCallbackfunctionThe function that will be fired when a moving object enters a geofence

geofenceKit.unwatchMovingObjects() ⇒ GeofenceKit

Unsubscribe the event handlers from the moving objects entering/exiting geofences

Kind: instance method of GeofenceKit
Returns: GeofenceKit - The current geofence kit
Access: public

geofenceKit.getGeofenceInstancesByPoint(point) ⇒ Array.<GeofenceInstance>

Get all of the geofence instances that contain a specified point

Kind: instance method of GeofenceKit
Returns: Array.<GeofenceInstance> - An array of instances that contain the specified point
Access: public

ParamTypeDescription
pointJMapPointThe point we're querying

geofenceKit.getGeofenceInstancesByWaypoint(waypoint) ⇒ Array.<GeofenceInstance>

Get all geofence instances that contain a specified waypoint

Kind: instance method of GeofenceKit
Returns: Array.<GeofenceInstance> - An array of instances that contain the specified waypoint
Access: public

ParamTypeDescription
waypointjmap.core.WaypointThe waypoint that we're querying

geofenceKit.getWaypointsInGeofence(geofence, map) ⇒ Array.<jmap.core.Waypoint>

Get all waypoints within a specified geofence, either on all maps or on a specifed map

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.Waypoint> - An array of waypoints that are contained within the specified geofece
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getDestinationsInGeofenceInstance(instance) ⇒ Array.<jmap.core.Destination>

Get all destinations within a specified geofence instance

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.Destination> - An array of destinations that contained within the specified geofence instance
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance that we're querying

geofenceKit.getDestinationsInGeofence(geofence, map) ⇒ Array.<jmap.core.Destination>

Get all destinations within a specified geofence

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.Destination> - An array of destinations that contained within the specified geofence
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getAmenitiesInGeofenceInstance(instance) ⇒ Array.<jmap.core.Amenity>

Get all amenities within a specified geofence instance

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.Amenity> - An array of amenities that contained within the specified geofence instance
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance that we're querying

geofenceKit.getAmenitiesInGeofence(geofence, map) ⇒ Array.<jmap.core.Amenity>

Get all amenities within a specified geofence

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.Amenity> - The amenities that are currently within the specified geofence on the specified map
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getPathTypesInGeofenceInstance(instance) ⇒ Array.<jmap.core.PathType>

Get all path types within a specified geofence instance

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.PathType> - The path types that are currently within the specified geofence instance
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance that we're querying

geofenceKit.getPathTypesInGeofence(geofence, map) ⇒ Array.<jmap.core.PathType>

Get all path types within a specified geofence

Kind: instance method of GeofenceKit
Returns: Array.<jmap.core.PathType> - The path types that are currently within the specified geofence on the specified map
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getMovingObjectsInGeofenceInstance(instance) ⇒ Array.<jungle.MovingObject>

Get all moving objects within a specified geofence instance

Kind: instance method of GeofenceKit
Returns: Array.<jungle.MovingObject> - The moving objects that are currently within the specified geofence instance
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance that we're querying

geofenceKit.getMovingObjectsInGeofence(geofence, map) ⇒ Array.<jungle.MovingObject>

Get all moving objects within a specified geofence

Kind: instance method of GeofenceKit
Returns: Array.<jungle.MovingObject> - The moving objects that are currently within the specified geofence on the specific map
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getClosestWaypointInGeofenceInstance(point, instance) ⇒ jmap.core.Waypoint

Get the closest waypoint to a specified point within a specified geofence instance

Kind: instance method of GeofenceKit
Returns: jmap.core.Waypoint - The closest waypoint to the specified point that's contained in specified geofence instance
Access: public

ParamTypeDescription
pointJMapPointThe point on the map that we're starting from
instanceGeofenceInstanceThe geofence instance that we're querying

geofenceKit.getClosestWaypointInGeofence(point, geofence, map) ⇒ jmap.core.Waypoint

Get the closest waypoint to a specified point within a specified geofence on a specified map

Kind: instance method of GeofenceKit
Returns: jmap.core.Waypoint - The closest waypoint to the specified point that's contained in the specified geofence
Access: public

ParamTypeDescription
pointJMapPointThe point on the map that we're starting from
geofenceGeofenceThe geofence that we're querying
mapjmap.core.MapThe map that we're querying. If not supplied, all maps with be queried

geofenceKit.getGeofenceInstanceByIdWithMapId(instanceId, geofence) ⇒ GeofenceInstance

Get the instance that has the provided instance ID and which is located on the map with the provided map ID

Kind: instance method of GeofenceKit
Returns: GeofenceInstance - The instance that has the provided instance ID located on the map with the provided map ID (or null, if not found)
Access: public

ParamTypeDescription
instanceIdNumberThe instance ID we're searching for
geofenceNumberThe map ID we're using to search

GeofenceKit.getPolygonOfGeofenceInstance(instance) ⇒ jungle.Polygon

Generates a polygon for a specific geofence instance

Kind: static method of GeofenceKit
Returns: jungle.Polygon - A polygon (or null if a polygon is unable to be created)
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe instance with which we width to generate a polygon

GeofenceKit.getCentroidsOfGeofenceOnMap(geofence, map) ⇒ Array.<Array.<Number>>

Calculate the centroids of all instances of a geofence on a specific map

Kind: static method of GeofenceKit
Returns: Array.<Array.<Number>> - An array of points (x, y) that correspond to the geofence's instances on the specific map. Ordered in the same order as the instances in the geofence object
Access: public

ParamTypeDescription
geofenceGeofenceThe geofence with which we wish to calculate the centroids
mapjcore.MapThe map on which we wish to calculate the centroids

GeofenceKit.getCentroidOfGeofenceInstance(instance) ⇒ Array.<Number>

Calculate the centroid of a specific geofence instance

Kind: static method of GeofenceKit
Returns: Array.<Number> - A point (x, y) that is the centroid of the specified geofence instance. If no centroid is able to be calculated, null will be returned
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance with which we wish to calculate the centroid

GeofenceKit.getWaypointsInGeofenceInstance(instance) ⇒ Array.<jmap.core.Waypoint>

Get all waypoints within a specified geofence instance

Kind: static method of GeofenceKit
Returns: Array.<jmap.core.Waypoint> - An array of waypoints that are contained within the specified geofece instance
Access: public

ParamTypeDescription
instanceGeofenceInstanceThe geofence instance we're querying

JMapPoint : Object

A point in the venue, defined by x and y coordinates with a map ID

Kind: global typedef
Properties

NameTypeDescription
xNumberThe x value of the coordinate
yNumberThe x value of the coordinate
mapIdNumberThe map ID of the map where the point is located