ImajnetIntegrationDemo Class
Imajnet SDK integration example in an Leaflet based application
Item Index
Methods
- activateImajnet
- addActiveState
- addFeature
- addImajnetLayerToMap
- addMarker
- addMarkerFeature
- addMarkerLayerToMap
- addVectorLayerToMap
- afterImajnetLayersAddedToMap
- centerMapToPosition
- deactivateImajnet
- getCurrentZoomLevel
- getMapScale
- hideImajnetItem
- initMap
- onDragEnd
- onImajnetClose
- onImajnetControlPressed
- onImajnetIsActive
- onImajnetLogin
- onMapClick
- onZoomEnd
- registerMapEvents
- removeActiveState
- removeAllFeatures
- removeAllMarkersFromLayer
- removeFeatures
- removeLayerFromMap
- removeMarker
- removeMarkerFeatures
- selectFeature
- selectMarker
- setFeatureColor
- setLayerZIndex
- setMarkerOpacity
- showImajnetItem
- unregisterMapEvents
- unselectFeature
- unselectMarker
- zoomMapTo
- zoomMapToFetaureWrapper
Methods
activateImajnet
()
Activates the imajnet plugin
addActiveState
-
container
Sets the active state for a map tool. Customizable according to the application needs, usually this is similar to a button press.
Parameters:
-
containerObjectthe html container of the map tool
addFeature
-
pointsArray -
featureOptions
Adds a feature to the given vector layer
If featureOptions.type is LineString or Polygon pointsArray will be an array of objects({x, y}) If featureOptions.type is MultiPolygon pointsArray will be an array of arrays(objects({x, y}).
Parameters:
Returns:
FeatureWrapper object that contains added feature object ex: featureOptions(type: 'Point, LineString, Polygon', 'Multipolygon', zIndex, fillColor: color, fillOpacity: 0.5).
addImajnetLayerToMap
()
Adds the imajnet tile layer to the map.
Returns:
the added layer object
addMarker
-
markerData
Adds a marker to the markerLayer,
Parameters:
-
markerDataWidth, heightobject with properties: lon(wgs84 longitude), lat: wgs84 latitude, imagePath: path to the marker image, size: , objectId: unique identifier for the marker(add this property to marker object), onMouseOver handler function for mouse over, onMouseOut: handler function for mouseout, onClick handler function for click event.
This function will add to map imajbox marker at the specified lon, lat coordinates. Example: function addMarker(markerLayer, markerData) { var marker = L.marker([markerData.lat, markerData.lon], {icon: L.icon({iconUrl: markerData.imagePath, iconSize: [markerData.size.width, markerData.size.height]})}).addTo(map); marker.objectId = markerData.objectId;
marker.on('mouseover', function(event) { markerData.onMouseOver(event, marker.objectId); }); marker.on('mouseout', function(event) { markerData.onMouseOut(event, marker.objectId); }); marker.on('click', function(event) { markerData.onClick(event, marker.objectId); });return marker;}
addMarkerFeature
-
markerLayer -
markerData
Adds a feature to the given marker layer
addMarkerLayerToMap
-
name
Adds a marker layer to the map.
Parameters:
-
nameObjectthe name of the layer
addVectorLayerToMap
-
name -
opacity -
options
Adds a vector layer to the map.
afterImajnetLayersAddedToMap
()
Hook callback called after the imajnet layers are added to the map. It is expected that the application will perform here any additional intialization required by its business logic.
centerMapToPosition
-
position -
onlyIfNotVisible
Centers the map on the given imajnet position
deactivateImajnet
()
Deactivates the imajnet plugin
getCurrentZoomLevel
()
Returns the current map zoom level.
getMapScale
()
Boolean
Returns the current map scale
Returns:
Returns the current map scale;
hideImajnetItem
-
id
Hides the imajnet image container given by it's id
Parameters:
-
idObjectthe id of the html element that contains the imajnet container
initMap
()
Initializes the map component and configures imajnet.
onDragEnd
()
onImajnetClose
()
Optional hook callback provided for implementing actions to execute after imajnet logout is performed/plugin is deactivated.
onImajnetControlPressed
()
onImajnetIsActive
()
Callback to the application called when the imajnet plugin is activated
onImajnetLogin
()
Optional hook callback provided for implementing actions to execute after imajnet login is performed.
onMapClick
-
event
Callback fired on each map click, the calls need to be forwarded to the ImajnetMap module click handler. This is intended to be seen as wrapper call used to convert between the underlying mapping component event data structure and imajnet lat/lon. Here is where any coordinate projection is done(from map projection system to imajnet WGS84)
Parameters:
-
eventObjectthe click event that contains the map coordinates, its contents need to be
onZoomEnd
()
registerMapEvents
()
Registers the imajnet map events to the underlying map component.
removeActiveState
-
container
Sets the active state for a map tool. Customizable according to the application needs, usually this is similar to a button un-press.
Parameters:
-
containerObjectthe html container of the map tool
removeAllFeatures
-
vectorLayer
Removes all the features contained by the given vector layer.
Parameters:
-
vectorLayerObjectthe vector layer
removeAllMarkersFromLayer
()
removeFeatures
-
vectorLayer -
featuresWrapper
Removes a list of features from the given vector layer.
removeLayerFromMap
()
Removes a layer from the map
removeMarker
()
removeMarkerFeatures
-
vectorLayer -
markersWrapper
Removes a list of features(markers) from the given layer.
selectFeature
-
vectorLayer -
featureWrapper
Selects a feature on the map
selectMarker
()
setFeatureColor
-
vectorLayer -
featureWrapper -
color
Sets the feature color for a given feature. Used for selection/unselection and highlight of features.
setLayerZIndex
-
layer -
zIndex
Sets the zIndex for a given map layer
Parameters:
-
layerLayerThe layer for which to set the zIndex
-
zIndexZIndexThe zIndex of the layer
setMarkerOpacity
()
showImajnetItem
-
id -
width -
height
Makes visible the imajnet image component container
unregisterMapEvents
()
Unregisters the imajnet map event handlers
unselectFeature
-
vectorLayer -
featureWrapper
Unselects a map feature
unselectMarker
()
zoomMapTo
-
zoom
Zooms the underying map to the given zoom level
Parameters:
-
zoomObjectthe desired zoom level
zoomMapToFetaureWrapper
-
featureWrapper -
onlyIfNotVisible
Zooms the map on top of the feature described by the given feature wrapper
