Methods
-
staticaddControls(controlsOptions)
Interface/IMapControls.js, line 150 -
Add the list of controls to the map
Name Type Description controlsOptions Object Controls to add to the map and their options. Associative array mapping the control's name (keys) with a Boolean (value) for activating / deactivating or with their properties (values given as Gp.ControlOptions).
Common 2D/3D controls :
Key Control Description 'layerswitcher' Adds layers selector widget to the map. See options availables 'graphicscale' Adds scale line widget to the map. See options availables 'mouseposition' Adds mouse position widget to the map. See options availables 'overview' Adds mini overview map to the map. See options availables 'attributions' Adds layers originators display to the map. See options availables Specific 2D controls :
Key Control Description 'draggable' Enable (true) / disable (false) map dragging/zoomming by mouse or pointer interaction. 'keyboard' Enable (true) / disable (false) map dragging/zoomming by keybord interaction. 'selectable' Enable (true) / disable (false) feature selection on the map. [DEPRECATED] : use 'getfeatureinfo' control instead to allow users to interact with features. 'zoom' Adds Zoom widget to the map. See options availables 'orientation' Adds orientation widget to the map. See options availables 'length' Adds length measurement widget to the map. See options availables. 'area' Adds area measurment widget to the map. See options availables 'azimuth' Adds azimuth measurment to the map. See options availables 'elevationpath' Adds elevationpath computation widget to the map. See options availables 'search' Adds search widget to the map. See options availables 'reversesearch' Adds reverse search widget to the map. See options availables 'layerimport' Adds layer import widget to the map. See options availables 'drawing' Adds drawing tools widget to the map. See options availables 'route' Adds route control to the map. See options availables 'isocurve' Adds isocurve control to the map. See options availables 'graticule' Adds graticule control to the map. See options availables 'getfeatureinfo' Adds capability to retrieve and display information about layer features. See options availables -
staticaddLayers(layersOptions)
Interface/IMapLayers.js, line 122 -
Adds a list of layers to the map.
The layersOptions parameter is an associative array mapping ids of layers to display and their properties.
For each layer, the id may be either the name of a Geoportal layer (eg : "ORTHOIMAGERY.ORTHOPHOTOS") available with the given apiKey used to initialize the map or an id of your choice for external resources.
The properties associated to each ID are given as Gp.LayerOptions objects.
For Geoportal Layers availables with the given apiKey, values are automaticaly fetched from key configuration. You only need to specify a Gp.LayerOptions object with properties you want to overide or an empty object if you don't want to overide anything.Name Type Description layersOptions Object Layers to add to the map and their options. Associative array mapping ids of layers to add (keys) and their properties (values given as Gp.LayerOptions).
-
staticforget(eventId, action){Boolean}
Interface/IMapListeners.js, line 160 -
Cancels an event listening previousely set with Gp.Map.listen() method.
Name Type Description eventId String The map's event to forget. Possible values are :
Common 2D/3D events
eventId description mapLoaded fired when map has finished loading geolocated fired when map has finished centering by geolocation located fired when map has finished centering by geocoding configured fired when map has finished loading geoportal configuration centerChanged fired when map center has changed zoomChanged fired when map zoom has changed azimuthChanged fired when map orientation has changed layerChanged fired when map's layer(s) has changed someway Specific 3D events
eventId description tiltChanged fired when map tilt has changed action function The function associated to the event.
Returns:
if an event has been forgotten
-
staticgetAzimuth(){Number}
Interface/IMapView.js, line 239 -
Returns the current map's azimuth.
Returns:
current map's azimuth expressed in decimal degrees clockwise to the north.
-
staticgetCenter(){Gp.Point}
Interface/IMapView.js, line 117 -
Returns the current coordinates of the map's center in the current projection.
Returns:
current map's center.
-
staticgetControlsOptions(controlIds){Object}
Interface/IMapControls.js, line 73 -
Returns the current control options. If controlIds is precised, returns just the options of the controls listed. If controlIds = null, returns the options of all the map's controls.
Name Type Description controlIds Array.<String> | null A list of control's id or null.
Returns:
options of the map's controls : Associative Array, mapping given controls Ids with their Gp.ControlOptions properties.
-
staticgetLayersOptions(layerIds){Object}
Interface/IMapLayers.js, line 85 -
Returns the current layers options. If layerIds is precised, returns just the options of the layers listed. If layerIds = null, returns the options of all the map's layers.
Name Type Description layerIds Array.<String> | null A list of layer's id or null.
Returns:
options of map's layers. Associative array mapping given layers ids with their Gp.LayerOptions properties.
-
staticgetLibMap(){Object}
Interface/IMapBase.js, line 744 -
Returns wrapped map object implemented by the underlying library. Can be :
- an ol.Map object with current OpenLayers 3 implementation if the current map is in 2D.
- an Itowns.GlobeView object, ie the iTowns GlobeView object overloaded by Geoportal Extension for iTowns, if the current map is in 3D.
Returns:
map object.
-
staticgetLibMapControl(controlId){Object}
Interface/IMapControls.js, line 105 -
Returns underlying implementation of the control identified by controlId. Can be :
- an ol.control.Control subclass with current OpenLayers 3 implementation if the current map is in 2D.
- an itowns.control.Widget subclass with current OpenLayers 3 implementation if the current map is in 2D.
Name Type Description controlId String identifier of the control
Returns:
object of the control if it is on the map. null otherwise.
-
staticgetLSLayerContainerDivId(layerId){String}
Interface/IMapControls.js, line 632 -
Gets Layer Container div ID for a given layerId.
Name Type Description layerId String layer identifier
Returns:
Container div Id in the LayerSwitcher
-
staticgetMarkersOptions()
Interface/IMapLayers.js, line 396 -
2D : Gets the markers options currently added to the map
3D : Return the markerOptions saved from the 2D map -
staticgetProjection(){String}
Interface/IMapView.js, line 196Specific 2D function
-
Returns the current map's projection code (EPSG or IGNF).
Returns:
current map's projection.
-
staticgetResolution(){Number}
Interface/IMapView.js, line 294Specific 2D function
-
Returns the current map's resolution.
Returns:
current map's resolution (in meter per pixel).
-
staticgetTilt(){Number}
Interface/IMapView.js, line 219Specific 3D function
-
Returns the current camera's tilt.
Returns:
current camera's tilt. 90 by default.
-
staticgetViewExtent(projection){Object}
Interface/IMapView.js, line 185Specific 2D function
-
Returns the current bounding box of the map in the current projection.
Name Type Default Description projection String map projection optional Coordinate Reference System of returned extent.
Returns:
current map's extent.
-
staticgetViewMode(){String}
Interface/IMapBase.js, line 732 -
Returns the current viewing mode (either 2D or 3d).
Returns:
current viewing mode
-
staticgetZoom(){Number}
Interface/IMapView.js, line 258 -
Returns the current map's zoom level.
Returns:
current map's zoom.
-
staticlisten(eventId, action, context){Boolean}
Interface/IMapListeners.js, line 85 -
Associate a function to trigger when an event is received.
Name Type Description eventId String The map's event listened. Possible values are :
Common 2D/3D events
eventId description mapLoaded fired when map has finished loading. Callback function handles a Gp.MapLoadedEvent object. geolocated fired when map has finished centering by geolocation. Callback function handles a Gp.GeolocatedEvent object. located fired when map has finished centering by geocoding. Callback function handles a Gp.LocatedEvent object. configured fired when map has finished loading geoportal configuration. Callback function handles a Gp.ConfiguredEvent object centerChanged fired when map center has changed. Callback function handles a Gp.CenterChangedEvent object zoomChanged fired when map zoom has changed. Callback function handles a Gp.ZoomChangedEvent object azimuthChanged fired when map orientation has changed. Callback function handles a Gp.AzimuthChangedEvent object layerChanged fired when map's layer(s) has changed someway. Callback function handles a Gp.LayerChangedEvent object Specific 3D events
eventId description tiltChanged fired when map tilt has changed. Callback function handles a Gp.TiltChangedEvent object action function The function to execute when the event occures.
context Object The object that will be used as "this" in the action function
Returns:
if an event has been listened
-
staticmodifyControls(controlsOptions)
Interface/IMapControls.js, line 289 -
Modify the control'options listed to the map
Name Type Description controlsOptions Object Controls to modify on the map and their options. Associative array mapping the control's name (keys) with a Boolean (value) for activating / deactivating or with their properties (values given as Gp.ControlOptions). See Gp.Map.addControls() for availables controls keys.
-
staticmodifyLayers(layersOptions){Boolean}
Interface/IMapLayers.js, line 290 -
Modify the layers given with layersOptions parameter
Name Type Description layersOptions Object Layers to modify and their options. Associative array mapping official name of the Geoportal layer or the id of a personal layer (keys) with their properties (values given as Gp.LayerOptions). Only following options are modified : opacity, visibility, maxZoom and minZoom.
Returns:
if the le parameter layersOptions has the correct format
-
staticremoveControls(controlIds)
Interface/IMapControls.js, line 279 -
Removes given controls from the map.
Name Type Description controlIds Array.<String> A list of control's id to be removed.
-
staticremoveLayers(layerIds){Boolean}
Interface/IMapLayers.js, line 272 -
Remove layers from the map.
Name Type Description layerIds Array.<String> A list of layer's id to be removed.
Returns:
if OK, false otherwise.
-
staticsetAzimuth(azimuth)
Interface/IMapView.js, line 249 -
Sets a new map's azimuth.
Name Type Description azimuth Float The new map's azimuth expressed in decimal degrees clockwise to the north.
-
staticsetCenter(center)
Interface/IMapView.js, line 131 -
Sets new center to the map.
- Use x, y and projection properties to center the map with coordinates;
- Use location and locationType properties to center the map thanks to Geoportal geocoding web service.
- Use geolocate to center the map with user position.
Name Type Description center Gp.Center options for centering the map
-
staticsetMarkersOptions(markersOptions)
Interface/IMapLayers.js, line 407 -
2D : Replaces the overlays already added to the map with the given markersOptions
3D : Replaces the markerOptions saved from the 2D mapName Type Description markersOptions Array.<Gp.MarkerOptions> Markers to add to the Map.
-
staticsetProxy(url){String}
Interface/IMapBase.js, line 722 -
ajoute un proxy aux url des couches vecteurs si besoin.
Name Type Description url String url
Returns:
url
-
staticsetResolution(resolution)
Interface/IMapView.js, line 305Specific 2D function
-
Sets a new map's resolution.
Name Type Description resolution Float The new map's resolution (in meter per pixel).
-
staticsetTilt(tilt)
Interface/IMapView.js, line 230Specific 3D function
-
Sets a new camera's tilt (3D only).
Name Type Description tilt Float The camera's tilt.
-
staticsetZoom(zoom)
Interface/IMapView.js, line 268 -
Sets a new map's zoom level.
Name Type Description zoom Integer The new map's zoom.
-
staticzoomIn()
Interface/IMapView.js, line 276 -
Increases the current map's zoom level by 1.
-
staticzoomOut()
Interface/IMapView.js, line 284 -
Decreases the current map's zoom level by 1.