cgxp.plugins.Measure

ptype
cgxp_measure
class cgxp.plugins.Measure(config)

This plugin adds a menu with menu items for selecting measure tools.

The menu div is assigned the cgxp-menu-measure class name, which can be useful for styling.

Example Use

Sample code showing how to add a Measure plugin to a gxp.Viewer:

new gxp.Viewer({
    ...
    tools: [{
        ptype: 'cgxp_measure',
        actionTarget: 'center.tbar',
        toggleGroup: 'maptools'
    }]
    ...
});

Config Options

Configuration properties.

actionConfig

Object Config object for the action created by this plugin.

areaMenuText

String Text for measure area menu item (i18n).

areaTooltip

String Text for measure area action tooltip (i18n).

azimuthMenuText

String Text for azimuth menu item (i18n).

azimuthSymbolizers

Object (optional) Styles of the features drawn on the map when measuring azimuths. If provided they will override the default styles. Possible symbolizer types are “Point”, “Line” and “Polygon”. See symbolizers for an example.

azimuthTemplate

String The template string to be used to display the azimut (i18n).

Here is an example of how it can look like:

azimuthTemplate: '<table class="measure">' +
    '<tr><td>Distance : </td><td>{distance} {units}</td></tr>' +
    '<tr><td>Azimut : </td><td>{azimuth}&deg;</td></tr>' +
    '<tr><td>Altitude diff. : </td>' +
    '<tpl if="raster != false">' +
        '<td>{[Math.round(values.raster[1].mnt - values.raster[0].mnt, 2)]} {mapUnits}</td></tr>' +
    '</tpl>' +
    '<tpl if="raster == false">' +
        '<td> ... </td></tr>' +
    '</tpl>' +
    '</table>'
azimuthText

String Text to display in point azimuth tooltip. Not taken into account if azimuthTemplate is set.

azimuthTooltip

String Text for azimuth action tooltip (i18n).

controlOptions

Object Allow to customise the handler behavior.

To enable on-the-fly measurement (ie. not only after mouse click), set the attribute ‘immediate’ to true. On-the-fly measurement is compatible with both ‘follow’ and ‘fixed’ popup positionning.

Example:

controlOptions: {
   immediate: true
}
coordinateText

String Text to display in point mesure tooltip.

distanceText

String Text to display in point azimuth tooltip. Not taken into account if azimuthTemplate is set.

easternText

String Text to display in point mesure tooltip.

lengthMenuText

String Text for measure length menu item (i18n).

lengthTooltip

String Text for measure length action tooltip (i18n).

measureTooltip

String Text for measure action tooltip (i18n).

minAzimuth

Number the minimum azimuth value, e.g. -180, default is 0.

northernText

String Text to display in point mesure tooltip.

outputTarget

String Popups created by this tool are added to the map by default.

pointMenuText

String Text for measure point menu item (i18n).

pointMeterTemplate

Ext.Template The template object used to display metric coordinates.

Standard value is:

this.pointMeterTemplate = new Ext.Template(
        '<table class="measure point"><tr>',
        '<td>', this.coordinateText, '</td>',
        '<td>{lonm}  {latm} m</td>',
        '</tr><tr>',
        '<td>WGS 84: </td>',
        '<td>{lond} {latd}</td>',
        '</tr></table>', {compiled: true});
pointTemplate

Ext.Template The template object used to display coordinates.

Standard value is:

this.pointTemplate = new Ext.Template(
    this.easternText, ' {lon} {unit}<br />',
    this.northernText, ' {lat} {unit}',
    {compiled: true});
pointTooltip

String Text for measure point action tooltip (i18n).

popupPosition

Object (optional) Set the position behaviour for the popup. By default the popup follow the mouse click (GeoExt.Popup), but it can also be fixed to a specific position in the viewport (Ext.Window) with predefined positionning which can be adjusted in x and/or y

position: ‘follow’ or ‘fixed’ Default: ‘follow’

if position is ‘fixed’, the additionals parameters are supported:

anchor: one of ‘tl’,’t’,’tr’,’l’,’c’,’r’,’bl’,’b’,’br’ Default: ‘t’

offsetx: int Default: 0

offsety: int Default: 0

Example:

popupPosition: {
    'position': 'fixed',
    'anchor': 'tl',
    'offsetx': 30,
    'offsety': 10
}
symbolizers

Object (optional) Styles of the features drawn on the map when measuring. If provided they will override the default styles. Possible symbolizer types are “Point”, “Line” and “Polygon”.

Example:

symbolizers: {
    "Point": {
        pointRadius: 10,
        graphicName: "square",
        fillColor: "blue",
        strokeWidth: 1,
        strokeColor: "red"
    }
}

Table Of Contents

Previous topic

cgxp.plugins.MapQuery

Next topic

cgxp.plugins.Menu

This Page

Fork me on GitHub