Geoportal Extension for Itowns API Reference

Class: MousePosition

itowns.control.MousePosition

MousePosition Control.

new MousePosition(options)

Itowns/Controls/MousePosition.js, line 75
Name Type Description
options Object

options for function call.

Name Type Default Description
ssl Boolean true optional

use of ssl or not (default true, service requested using https protocol)

collapsed Boolean true optional

Specify if MousePosition control should be collapsed at startup. Default is true.

systems Array optional

list of projection systems, default are Geographical ("EPSG:4326"), Web Mercator ("EPSG:3857"), Lambert 93 ("EPSG:2154") and extended Lambert 2 ("EPSG:27572").
Each array element (=system) is an object with following properties :

Name Type Description
crs String

Proj4 crs alias (from proj4 defs). e.g. : "EPSG:4326". Required

label String optional

CRS label to be displayed in control. Default is crs code (e.g. "EPSG:4326")

type String

CRS units type for coordinates conversion : "Geographical" or "Metric". Default: "Metric"

geoBBox Object optional

Aera covered by the system (WGS84 coordinates).

Name Type Description
right Number

Right bound.

left Number

Left bound.

top Number

Top bound.

bottom Number

Bottom bound.

units Array optional

list of coordinates units, to be displayed in control units list.
Values may be "DEC" (decimal degrees), "DMS" (sexagecimal), "RAD" (radians) and "GON" (grades) for geographical coordinates,
and "M" or "KM" for metric coordinates

displayAltitude Array true optional

activate (true) or deactivate (false) the altitude panel. True by default

displayCoordinates Array true optional

activate (true) or deactivate (false) the coordinates panel. True by default

altitude Object optional

elevation configuration

Name Type Description
serviceOptions Object optional

options of elevation service

responseDelay Number optional

latency for altitude request, 500 ms by default

triggerDelay Number optional

immobilisation time of movement on the globe to trigger the elevation calculation, 200 ms by default

Example
var mousePosition = new itowns.control.MousePosition({
     collapsed : false,
     displayCoordinates : true,
     displayAltitude : true,
     altitude : {
          triggerDelay : 100,
          responseDelay : 500,
          serviceOptions : {}
     },
     systems : [
      {
         crs : "EPSG:3857",
         label : "Mercator",
         type : "Metric"
       },
      {
         crs : "EPSG:32620",
         label : "UTM 20N (Guadeloupe, Martinique)",
         type : "Metric",
         geoBBox : {
             left: -66.00,
             bottom : 0.00,
             right : -60.00,
             top : 84.00
         }
       }
     ],
     units : ["DEC", "DMS"]
 });

Extends

  • itowns.control.Control

Members

collapsed

{Boolean} specify if MousePosition control is collapsed (true) or not (false)

constructor

Constructor (alias)

Methods

addSystem(system)

Itowns/Controls/MousePosition.js, line 162

Sets additional projection system

Name Type Description
system Object

Projection system defined in the Itowns/CRS/CRS.js class

Name Type Description
crs String

Proj4 crs alias (from proj4 defs) e.g. "EPSG:4326"

label String optional

CRS label to be displayed in control. Default is system.crs alias

type String optional

CRS units type for coordinates conversion (one of control options.units). Default is "Metric"

addSystems(systems)

Itowns/Controls/MousePosition.js, line 210

Sets additional projection systems

Name Type Description
systems Array

Array of system object, with following properties :

Name Type Description
crs String

Proj4 CRS alias (from proj4 defs) e.g. "EPSG:4326"

label String

CRS label (for coordinates conversion)

type String

CRS units type to be displayed in control (one of control options.units). Default is "Metric"

displayAltitude(displayAltitude)

Itowns/Controls/MousePosition.js, line 327

Displays or hides elevation panel

Name Type Description
displayAltitude Boolean

true to display elevation panel, false to hide it

displayCoordinates(displayCoordinates)

Itowns/Controls/MousePosition.js, line 340

Displays or hides coordinates panel

Name Type Description
displayCoordinates Boolean

true to display coordinates panel, false to hide it

removeSystem(systemCrs)

Itowns/Controls/MousePosition.js, line 228

Removes projection system (in case there are several system with same code, only the first one will be removed)

Name Type Description
systemCrs String

CRS alias (from proj4 defs)

setAltitudeOptions(options)

Itowns/Controls/MousePosition.js, line 307

Sets control altitude options (useless if displayAltitude == false)

Name Type Description
options Object

altitude options

Name Type Description
serviceOptions Object optional

options of elevation service

responseDelay Number optional

latency for elevation request, 500 ms by default

triggerDelay Number optional

immobilisation time of movement on the globe to trigger the elevation calculation, 200 ms by default

setCollapsed(collapsed)

Itowns/Controls/MousePosition.js, line 354

Collapses or displays control main container

Name Type Description
collapsed Boolean

True to collapse control, False to display it

setGlobe(globe)

Itowns/Controls/MousePosition.js, line 120

Bind globe to control

Name Type Description
globe GlobeViewExtended

the globe

setUnits(units)

Itowns/Controls/MousePosition.js, line 287

Sets control units (to be displayed)

Name Type Description
units Array

list of all coordinates units, to be displayed in control units list.
Values may be "DEC" (decimal degrees), "DMS" (sexagecimal), "RAD" (radians) and "GON" (grades) for geographical coordinates,
and "M" or "KM" for metric coordinates