🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis β†’
Socket
Book a DemoInstallSign in
Socket

@jibestream-dev/jmap-zone-kit

Package Overview
Dependencies
Maintainers
12
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jibestream-dev/jmap-zone-kit

Kit for the Jibestream SDK to utilize Zones plotted in the CMS

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
28
-40.43%
Maintainers
12
Weekly downloads
Β 
Created
Source

Classes

Zone
ZoneCollection ⇐ jmap.core.BaseCollection

Class representing a collection of Devices.

ZoneKit

Kit for working with Jibestream Zones

Zone

Kind: global class

new Zone()

Class representing a Zone

zone.name : String

Kind: instance property of Zone

zone.description : String

Kind: instance property of Zone

zone.color : String

Kind: instance property of Zone

ZoneCollection ⇐ jmap.core.BaseCollection

Class representing a collection of Devices.

Kind: global class
Extends: jmap.core.BaseCollection

new ZoneCollection()

Create a collection of Devices.

zoneCollection.isZone(item) β‡’ Boolean

Returns a boolean for whather or not argument is constructed as an Device object

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

ParamTypeDescription
itemObjectItem to evaluate

zoneCollection.getByName(name) β‡’ Array.<Zone>

  • Returns Zone/s by their name (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if name is invalid)
Access: public

ParamTypeDescription
namestringThe name of the desired Zone/s

Example

const name = 'Food Court'
const zone = e(name)

zoneCollection.getByWaypoint(waypoint) β‡’ Array.<Zone>

  • Returns Zone/s by a given waypoint (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if waypoint is invalid)
Access: public

ParamTypeDescription
waypointWaypointThe waypoint to search with

Example

const waypoint = control.currentMap.waypoints[0]
const zone = getByWaypoint(waypoint)

zoneCollection.getByMap(map) β‡’ Array.<Zone>

  • Returns Zone/s by a given map (or returns an empty array)

Kind: instance method of ZoneCollection
Returns: Array.<Zone> - - The desired Zone/s (or an empty array if map is invalid)
Access: public

ParamTypeDescription
mapMapThe map on which we're searching

Example

const map = control.currentMap
const zone = getByMap(map)

ZoneKit

Kit for working with Jibestream Zones

Kind: global class

new ZoneKit(core, control)

Create a ZoneKit.

ParamTypeDescription
corejmap.coreinstantiated JCore
controljmap.JControllerinstantiated JController

zoneKit.getWaypointsInZone(zone) β‡’ Array.<jmap.core.Waypoint>

  • Returns all waypoints associated with a given Zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Waypoint> - - The waypoints associated with a given zone (or an empty array)
Access: public

ParamTypeDescription
zoneZoneThe Zone we're using to search for waypoints

Example

const zone = zoneKit.zones.getAll()[0]
const waypoints = zoneKit.getWaypointsInZone(zone)

zoneKit.getDestinationsInZone(zone) β‡’ Array.<jmap.core.Destination>

  • Returns all destinations associated with waypoints within an zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Destination> - - The destinations associated with a given zone (or an empty array)
Access: public

ParamTypeDescription
zoneZoneThe Zone we're using to search for destinations

Example

const zone = zoneKit.zones.getAll()[0]
const destinations = zoneKit.getDestinationsInZone(zone)

zoneKit.getAmenitiesInZone(zone) β‡’ Array.<jmap.core.Amentity>

  • Returns all amenity instances associated with waypoints within an zone (or returns an empty array)

Kind: instance method of ZoneKit
Returns: Array.<jmap.core.Amentity> - - The amenities associated with a given zone (or an empty array)
Access: public

ParamTypeDescription
zoneZoneThe Zone we're using to search for destinations

Example

const zone = zoneKit.zones.getAll()[0]
const amentities = zoneKit.getAmenitiesInZone(zone)

zoneKit.getBoundsOfZoneOnMap(zone, map) β‡’ jmap.Bounds

  • For a given Zone, return the bounding box for the associated waypoints on the specified map If an invalid zone or map is given, null is returned

Kind: instance method of ZoneKit
Returns: jmap.Bounds - - A Bounds object
Access: public

ParamTypeDescription
zoneZoneThe Zone we're using to calculate bounding boxes
mapjmap.core.MapThe map we'll use to calculate the bounding box

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const bounds = zoneKit.getBoundsOfZone(zone, map)

zoneKit.getPolygonOfZoneOnMap(zone, map) β‡’ jmap.jungle.shape.Polygon

  • Returns a polygon shape, based on the waypoints associated with the specified zone on the specified map. The zone must have three or more waypoints associated with it on the given map, otherwise null will be returned

Kind: instance method of ZoneKit
Returns: jmap.jungle.shape.Polygon - - A Polygon object
Access: public

ParamTypeDescription
zoneZoneThe Zone we're using to calculate polygons
mapjmap.core.MapThe map we'll use to calculate the polygon

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const polygon = zoneKit.getPolygonOfZone(zone, map)

zoneKit.drawPolygonOfZoneOnMap(zone, map, style) β‡’ Polygon

  • Given a specific Zone, draw a polygon the encompasses all of its waypoints on the specified map

Kind: instance method of ZoneKit
Returns: Polygon - - The polygon that was drawn
Access: public

ParamTypeDescription
zoneZoneThe Zone we wish to highlight using a polygon
mapjmap.core.MapThe map we wish to draw the polygon on
stylejmap.StyleThe way in which the polygon should be styled. Default style uses zone.color

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const polygon = zoneKit.drawPolygonOfZone(zone, map)

zoneKit.getZones([cb]) β‡’ ZoneKit

  • Returns all zones for the currently loaded building

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

ParamTypeDescription
[cb]functionThe callback function, which will run once the Zones have been retrieved. The Zones will be stored in this.zones

Example

const fn = (error, zones) => console.log(zones)
zoneKit.getZones(fn)

zoneKit.getCentroidOfZoneOnMap(zone, map) β‡’ Array.<Number>

  • Return the coordinates of the centroid of a given zone on the given map The zone must have three or more waypoints associated with it on the given map otherwise null will be returned

Kind: instance method of ZoneKit
Returns: Array.<Number> - - The centroid in the form of [x, y]
Access: public

ParamTypeDescription
zoneZoneThe zone we wish to find the centroid of
mapjmap.core.MapThe map on which we'll use to find the centroid

Example

const zone = zoneKit.zones.getAll()[0]
const map = control.currentMap
const centroid = zoneKit.getCentroidOfZone(zone, map)

zoneKit.getClosestWaypointInZoneToPoint(zone, jMapPoint, [searchType]) β‡’ jmap.core.Waypoint

  • Given a specific point on the a map, return the closest waypoint associated with the given Zone

Kind: instance method of ZoneKit
Returns: jmap.core.Waypoint - - The closest waypoint within the specified Zone to the provided point
Access: public

ParamTypeDefaultDescription
zoneZoneThe zone we wish to search within
jMapPointjMapPointThe point we wish to search with
[searchType]String'proximity'Either 'proximity' or 'grid'

Example

const jMapPoint = { x: 2750, y: 2750, mapId: control.currentMap.id }
const zone = zoneKit.zones.getAll()[0]
const waypoint = zoneKit.getClosestWaypointInZoneToPoint(zone, jMapPoint)

zoneKit.highlightUnitsInZone(zone, style) β‡’ ZoneKit

  • Highlight all units associated to a specific zone using either the color specified in the CMS or the color override provided

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

ParamTypeDescription
zoneZoneThe zone we wish to highlight
stylejmap.StyleThe way in which the unit will be styled

Example

const zone = zoneKit.zones.getAll()[0]
const style = new jmap.Style({ fill: '#4a85e2' })
zoneKit.highlightUnitsInZone(zone, style)

zoneKit.watchMovingObjects(zonesExitedCallback, zonesEnteredCallback) β‡’ ZoneKit

  • Subscribe to animation complete callback for moving objects and send back zones exited/entered

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public

ParamTypeDescription
zonesExitedCallbackfunctionCallback for zones being exited
zonesEnteredCallbackfunctionCallback for zones being entered

Example

function watchMovingObjCallback(zones) {
}
zoneKit.watchMovingObjects(watchMovingObjCallback, watchMovingObjCallback)

zoneKit.unwatchMovingObjects() β‡’ ZoneKit

  • Unsubscribe to animation complete callback for moving objects

Kind: instance method of ZoneKit
Returns: ZoneKit - - The current ZoneKit instance
Access: public
Example

zonKit.unwatchMovingObjects()

Keywords

jmap

FAQs

Package last updated on 26 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts