cgxp.plugins.ScaleChooser

ptype
cgxp_scalechooser
class cgxp.plugins.ScaleChooser(config)

ip: if this tool must be placed in the map.bbar, the bbar must be nitialized in the map object definition: “bbar: []”.

Example Use

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

new gxp.Viewer({
    ...
    tools: [{
        ptype: 'cgxp_scalechooser',
        actionTarget: 'center.bbar'
    }]
    ...
});

If we add:

roundValues: [10, 20, 50, 100, 250, 500]

The following scales [4, 9, 22, 48, 103, 231, 478, 978] will be display as [10, 10, 20, 50, 100, 250, 500, 500]

If we add:

roundValues: [1, 2.5, 5, 10],
power10: true

The following scales [4, 9, 22, 48, 103, 231, 478, 978] will be display as [5, 10, 25, 50, 100, 250, 500, 1000]

If you need something more specific, you can overwrite the method round like this:

round: function(value) {
    // your code
}

Config Options

Configuration properties.

formatValue

Function Callback function to format the value of the selected scale in the scale combobox.

labelText

String Text shown before the combo box (i18n).

power10

Boolean If true, the possible roundValues will be multiples of 10, 100, ... of the submitted roundValues. The latter values should then be contained between 1 and 10 and they should start with 1 and end with 10.

For example if it’s true and roundValues is [1, 2.5, 5, 10] than all the possible values are [..., 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 50, 100, ...].

Defaults to false.

roundValues

Array(Number) The possible values on witch we want to round. Defaults to undefined (disabled).

scaleStoreListeners

Object Ext listener config to be applied on the scale store.

tpl

String Ext template to format the scale value in the scale combobox.

width

Number Combo box width in px.

Public Methods

Public methods.

ScaleChooser.round()
Parameters:valueNumber a scale value to round

This method is used to round a scale value.

Table Of Contents

Previous topic

cgxp.plugins.Routing

Next topic

cgxp.plugins.StreetView

This Page

Fork me on GitHub