cgxp.plugins.Editing.GetFeature

ptype
cgxp_editing
class cgxp.plugins.Editing.Editing(config)

Plugin to add an editing tool to the map.

This plugin works with the c2cgeoportal “layers” web service. It requires a cgxp.plugins.LayerTree plugin in the viewer.

Example Use

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

// without snapping
new gxp.Viewer({
    ...
    tools: [{
        ptype: 'cgxp_editing',
        layerTreeId: 'layertree',
        layersURL: "${request.route_url('layers_root') | n}",
        metadataParams: ${dumps(version_role_params) | n}
    }, {
        ptype: "cgxp_layertree",
        id: "layertree",
        outputConfig: {
            ...
        },
        outputTarget: 'left-panel'
    }]
    ...
});

// with snapping and several other options enabled
new gxp.Viewer({
    ...
    tools: [{
        ptype: 'cgxp_editing',
        layerTreeId: 'layertree',
        layersURL: "${request.route_url('layers_root') | n}",
        metadataParams: ${dumps(version_role_params) | n},
        mapserverUrl: "${request.route_url('mapserverproxy') | n}",
        snapLayers: {
            "layer_A": {
                tolerance: 15,
                edge: false,
                ...
            },
            "layer_B": {}
        },
        snapOptions: {
            defaults: {
                ...
            },
            greedy: false
        },
        selectionColors: {
            23: '#FF0022'
        },
        allowDrag: false,
        differenceServiceUrl: "${request.route_url('difference') | n}"
    }, {
        ptype: "cgxp_layertree",
        id: "layertree",
        outputConfig: {
            ...
        },
        outputTarget: 'left-panel'
    }]
    ...
});

Config Options

Configuration properties.

allowDrag

Boolean Whether or not to allow users to drag the lines or polygons when editing the geometry. Defaults to true.

attributesWindowOptions

Object Additional options given to the attributes form window constructor.

copyToBtnText

String The text for the copy to another layer button (i18n).

copyToBtnTooltip

String The tooltip for the copy to another layer button (i18n).

createBtnText

String The text for the create button (i18n).

cutActionText

String i18n Cut menu item text.

cutWizardDrawButtonText

String i18n “Draw a polygon” button text in the cut wizard.

cutWizardSelectButtonText

String i18n “Select on map” button text in the cut wizard.

cutWizardSubtitle

String i18n Message to show as subtitle in the cut wizard.

cutWizardTitle

String i18n Message to show as title in the cut wizard.

differenceServiceUrl

String The URL to the difference service. Used by the cut wizard. Typically set to "${request.route_url('difference')}"

enableCutWizard

Boolean If true, the cut wizard is enabled.

enableUndo

Boolean If true, the undo feature is enabled.

forbiddenText

String The text displayed when not allowed action is done (i18n).

getFeatureTolerance

Integer Click tolerance for the filter query in pixels. Default is 5 (as in OpenLayers).

helpText

String The text to the top of the editing window (i18n).

hideWhenNoLayer

‘Boolean’ If true, the edition window will be hidden instead of just disabled when there is no editable layer.

layerMenuText

String The text to the top of the layer menu (displayed when the create button is pressed) (i18n).

layersURL

String URL to the layers web service. Typically set to "${request.route_url('layers_root')}".

layersWindowOptions

Object Additional options given to the layer selector window constructor.

layerTreeId

String Id of the layertree tool.

mapserverUrl

String The mapserver proxy URL, required when snapping is used. Typically set to "${request.route_url('mapserverproxy')}"

metadataParams

Object Optional additional params given to metadata request.

pointRecenterZoom

Number Zoom level to use when recentering to a single point feature. Default is 9. Optional.

queryServerErrorText

String Message display when the query failed

readParams

Object Default params given to the read request

saveServerErrorText

String Message display when the save failed

saveValidationErrorText

String Message display when the validation failed

selectionColors

Object The keys are the layer id and the values are the color that will be used when a feature from the corresponding layer is selected.

snapLayers

Object The keys are the layer id and the values are configuration objects. Those configuration objects are similar to the OpenLayers.Control.Snapping target properties with two main differences:

  • the key layer must no be specidied,
  • the key resFactor is added to specify to the resFactor of the WFS target layer. It defaults to 1 when no value is specified which is a safe value. It is possible to pass a higher value when the WFS layer does not contain too many features.
snapOptions

Object An object containing the options for the snap control. It might contain up to 2 keys:

  • defaults,
  • greedy.
stateId

String Prefix of the permalink parameters. Default is “edit”. Optional.

titleText

String Message display title

titleValidationErrorText

String Message display title for validation error

undoButtonText

String The text for the undo button (i18n).

undoButtonTooltip

String The tooltip text for the undo button (i18n)

usedMapParams

Array[String] The map params used in the query.

Table Of Contents

Previous topic

cgxp.plugins.Disclaimer

Next topic

cgxp.plugins.FeaturesGrid

This Page

Fork me on GitHub