Geoportal Extension for OpenLayers 3 API Reference

Class: ElevationPath

ol.control.ElevationPath

Elevation Path Control. Allows users to draw a path on a OL3 map see the elevation profile computed with geoportal elevation path web service along that path.

new ElevationPath(options)

Ol3/Controls/ElevationPath.js, line 80
Name Type Description
options Object

options for function call.

Name Type Default Description
active Boolean false optional

specify if control should be actived at startup. Default is false.

stylesOptions Object DEFAULT_STYLES optional

styles management

Name Type Default Description
marker Object {} optional

styles management of marker displayed on map when the user follows the elevation path. Specified with an ol.style.Image subclass object

draw Object {} optional

styles used when drawing. Specified with following properties.

Name Type Default Description
pointer Object {} optional

Style for mouse pointer when drawing the line. Specified with an ol.style.Image subclass object.

start Object {} optional

Line Style when drawing. Specified with an ol.style.Stroke object.

finish Object {} optional

Line Style when finished drawing. Specified with an ol.style.Stroke object.

elevationPathOptions Object {} optional

elevation path service options. See Gp.Services.getAltitude() for available options

displayProfileOptions Object {} optional

profile options.

Name Type Default Description
greaterSlope Boolean true optional

display the greater slope into the graph

meanSlope Boolean true optional

display the mean slope into the graph

ascendingElevation Boolean true optional

display the ascending elevation into the graph

descendingElevation Boolean true optional

display the descending elevation into the graph

currentSlope Boolean true optional

display current slope value on profile mouseover

apply function optional

function to display profile if you want to cutomise it. By default, (DISPLAY_PROFILE_BY_DEFAULT()) is used. Helper functions to use with D3 (DISPLAY_PROFILE_LIB_D3()) or AmCharts (DISPLAY_PROFILE_LIB_AMCHARTS()) frameworks are also provided. You may also provide your own function.

target Object optional

DOM container to use to display the profile.

Example
var measure = new ol.control.ElevationPath({
   stylesOptions : {
    draw : {
      finish : new ol.style.Stroke({
           color : "rgba(0, 0, 0, 0.5)",
           width : 2
      })
    },
   }
   displayProfileOptions : {
      apply : ol.control.ElevationPath.DISPLAY_PROFILE_RAW,
   }
});

Exemples :
- displayProfileOptions.apply : null
- displayProfileOptions.apply : function (elevations, container, context) {  // do some stuff... }
- displayProfileOptions.apply : ol.control.ElevationPath.DISPLAY_PROFILE_{LIB_AMCHARTS | LIB_D3 | RAW}

Extends

  • ol.control.Control

Members

staticol.control.ElevationPath.DEFAULT_STYLES

Styles applied by default if stylesOptions property is not set.

Methods

staticDISPLAY_PROFILE_BY_DEFAULT(data, container, context)

Ol3/Controls/ElevationPath.js, line 349

Display Profile function used by default : no additonal framework needed.

Name Type Description
data Object

elevations values for profile

container HTMLElement

html container where to display profile

context Object

this control object

staticDISPLAY_PROFILE_LIB_AMCHARTS(data, container, context)

Ol3/Controls/ElevationPath.js, line 286

display Profile using Amcharts framework. This method needs AmCharts libraries to be loaded.

Name Type Description
data Object

collection elevations

container HTMLElement

container

context Object

this control object

staticDISPLAY_PROFILE_LIB_D3(data, container, context)

Ol3/Controls/ElevationPath.js, line 309

display Profile using D3 javascript framework. This method needs D3 libraries to be loaded.

Name Type Description
data Object

elevations values for profile

container HTMLElement

html container where to display profile

context Object

this control object

staticDISPLAY_PROFILE_RAW(data, container, context)

Ol3/Controls/ElevationPath.js, line 332

display Profile without graphical rendering (raw service response)

Name Type Description
data Object

elevations values for profile

container HTMLElement

html container where to display profile

context Object

this control object

clean()

Ol3/Controls/ElevationPath.js, line 518

clean

getActive(){Boolean}

Ol3/Controls/ElevationPath.js, line 500

Returns true if widget is actived (drawing),
false otherwise

Returns:
- true or false

setActive(active)

Ol3/Controls/ElevationPath.js, line 510

Actived widget drawing or not

Name Type Description
active Boolean

true / false

setMap(map)

Ol3/Controls/ElevationPath.js, line 467

Attach control to map. Overloaded ol.control.Control.setMap() method.

Name Type Description
map ol.Map

Map.