Skip to content

AnsynApi Functions

Tzahi Levi edited this page Apr 13, 2021 · 9 revisions

after we inject the AnsynApi service in our component we can use ansynApi functions for change things in our app.

Properties

activeMapId

the id of the active map.

mapsEntities

key-value from the map id to the mapSettings.

activeAnnotationLayer

the active annotation layer.

defaultLayerId

the id of the active annotation layer.

getMaps$

Observable that emit the maps as array.

onShadowMouseProduce$

Observable that emit the position of the mouse on the map.

onSetLayoutSuccess$

Observable that emit when the application layout was change.

getActiveCenter$

Observable that emit when the center of the map is change from the search box or the go-to tool.

events

the api contain events that we can listen to. all the events are under ansynApi.events.{eventName}

onReady

fire when the app is ready.(map was loaded)

overlaysLoadedSuccess

fire when the overlays search was end. return array of overlay or false if there is no overlays.

displayOverlaySuccess

fire when an overlay was loaded to the map. emit an {overlay: overlay | false, mapId: the map id}

Functions

goToPosition(point)

set the map position to the point coordinate

parameters:

point - a geoJson point

changeMapLayout(layout)

change the layout of the maps

parameters:

layout - could be one of the follow:
layout1 - show one map.
layout2 - show 2 maps side by side horizontally.
layout3 - show 2 maps side by side vertically.
layout4 - show 3 maps, one on left and 2 smaller on the right vertically.
layout5 - show 3 maps one on top and 2 smaller on bottom horizontally.
layout6 - show 4 maps.

displayOverlay(overlay)

display the overlay on the map.

parameters:

overlay - an overlay object

collapseMenu(collapse)

minimize/maximize the side menu

parameters:

collapse - boolean, true for minimize false for maximize.

collapseFooter(collapse)

minimize/maximize the timeline-status-bar

parameters:

collapse - boolean, true for minimize false for maximize.

insertLayer(layerName, layerData, isEditable)

add the layer to app data layers
return the layer id.

parameters:

layerName - string, the display layer name
layerData - a geoJson FeatureCollection
isEditable - boolean, true if the layer could be editable, false otherwise.

removeLayer(layerId)

remove the layer with the layerId from the app data layers

parameters:

layerId - string, the layer id to be remove.

showLayer(layerId, show)

show/hide the layer with the layerId

parameters:

layerId - string, the layer id to be show/hide
show - boolean, true to show the layer, false to hide the layer.

getOverlayData(mapId)

return the overlay data currently display on the map with the mapId.

parameters:

mapId - string, the id of the map which from to get the overlay data or the active map if id not provide.

getMapPosition()

return the current mapPosition

getOverlays()

return all the overlays currently on the timeline.

setAnnotations(features)

draw the annotations on the map.

parameters:

features - click here for more details on the features object.

setOverlays(overlays)

put the overlays on the timeline status bar.

parameters:

overlays - an array of overlays

setMapPositionByRadius(point, radius, search)

set the position of the map to point with radius

parameters:

point - a geoJson point.
radius - number, the radius in meters.
search - boolean, if true the app search for overlays in the position.

setMapPositionByRect(rect)

set the map position to the follow rect.

parameters:

rect - a geoJson polygon

setRotation(radian, mapId)

rotate the map by radian

parameters:

degree - a number between 0-2π
mapId - the id of the map to be rotate or the active map if not provide.

getRotation()

get the map rotation in radian.

setOutSourceMouseShadow(geoPoint)

set a shadow mouse indicator on the geoPoint coordinate

parameters:

geoPoint - a geoJson point

setOverlaysCriteria(criteria, radiusInMetersBuffer)

change the search criteria and apply a new search

parameters:

criteria - a search criteria object.
radiusInMetersBuffer - number, radius to be add to the region criteria.

getOverlaysCriteria()

Observable that emits when the search criteria was change.

getOverlayData()

The overlay that display on the map, or undefined if no overlay was display

parameters:

mapId - the id of the map to be rotate or the active map if not provide.

setMinimalistViewMode(collapse)

set the app to minimalist view

parameters:

collapse - boolean, true to enable minimalist view, false to disable.

deleteAllAnnotations()

clear all the annotations from the map.


click for more information about geoJson object

Clone this wiki locally