Optionalcollapsed?: booleanSpecify if Drawing control should be collapsed at startup. Default is true.
Optionaldraggable?: booleanSpecify if widget is draggable
Optionalid?: numberAbility to add an identifier on the widget (advanced option)
Optionallabels?: stringLabels for Control
Optionallayer?: anyOpenlayers layer that will hosts created features. If none, an empty vector layer will be created.
OptionallayerDescription?: { description?: string; title?: string }Layer informations to be displayed in LayerSwitcher widget (only if a LayerSwitcher is also added to the map)
Optionaldescription?: stringLayer description to be displayed in LayerSwitcher
Optionaltitle?: stringLayer title to be displayed in LayerSwitcher
Optionalpopup?: { display?: boolean; function?: Function }Popup informations
Optionaldisplay?: booleanSpecify if popup is displayed when create a drawing
Optionalfunction?: FunctionFunction to display popup informations if you want to cutomise it. You may also provide your own function with params : {geomType / feature / saveFunc(message) / closeFunc()}. This function must return the DOM object of the popup content.
Tools to display in the drawing toolbox. All by default.
Optionaldisplay?: booleanDisplay style editing tool
Optionaledit?: booleanDisplay editing tool
Optionalexport?: booleanDisplay exporting tool
Optionalholes?: booleanDisplay polygons with holes drawing tool
Optionallines?: booleanDisplay lines drawing tool
Optionalmeasure?: booleanDisplay measure drawing into popup info
Optionalpoints?: booleanDisplay points drawing tool
Optionalpolygons?: booleanDisplay polygons drawing tool
Optionalremove?: booleanDisplay feature removing tool
Optionaltext?: booleanDisplay text drawing tool
Optionaltooltip?: booleanDisplay text editing tool
var drawing = new ol.control.Drawing({
collapsed : false,
draggable : true,
layerswitcher : {
title : "Dessins",
description : "Mes dessins..."
},
markersList : [{
src : "http://api.ign.fr/api/images/api/markers/marker_01.png",
anchor : [0.5, 1]
}],
defaultStyles : {},
cursorStyle : {},
tools : {
points : true,
lines : true,
polygons :true,
holes : true,
text : false,
remove : true,
display : true,
tooltip : true,
export : true,
measure : true
},
popup : {
display : true,
function : function (params) {
var container = document.createElement("div");
// - params.geomType;
// - params.feature;
// Les 2 fonctions ferment la popup avec ou sans sauvegarde des informations
// dans les properties de la feature (key : description)
// - params.saveFunc(message);
// - params.closeFunc();
return container;
}
});
ProtecteddisposedThe object has already been disposed.
ProtectedlistenerKey name.
Listener.
Type.
Listener.
ProtectedapplyProtectedApply any properties from another object without triggering events.
The source object.
Disable interaction
Dispatches an event and calls all listeners listening for events
of this type. The event parameter can either be a string or an
Object with a type property.
Event object.
false if anyone called preventDefault on the
event object or if any of the listeners returned false.
Clean up.
ProtecteddisposeProtectedExtension point for disposable objects.
Export features of current drawing layer (KML by default).
a representation of drawn features (KML, GPX or GeoJSON) or null if not possible.
Get container
container
getter for Export format.
export format
getter for Export Name.
export name
Get vector layer
layer - isocurve layer
Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.
Type.
Listeners.
Get an object of all property names and values.
Object.
Optionaltype: stringType. If not provided,
true will be returned if this event target has any listeners.
Has listeners.
The object has properties.
Key name.
Old value.
ProtectedonceProtectedonKey name.
Listener.
Type.
Listener.
Collapse or display control main container
True to collapse control, False to display it
Setter for Export format (KML, GPX or GeoJSON).
Export format. By default, "KML".
Setter for Export Name.
Export Name. By default, "Croquis".
Sets vector layer to hosts feature.
vector layer
Overload of ol.control.Control.setMap() method, called when control is added to or removed from map.
ol.Map object.
This function is used to set a target element for the control. It has no
effect if it is called after the control has been added to the map (i.e.
after setMap is called on the control). If no target is set in the
options passed to the control constructor and if setTarget is not called
then the control is added to the map's overlay container.
Target.
ProtectedunProtectedUnlisten for a certain type of event.
Type.
Listener.
options for function call.