Adding multi property to the DrawFeature control. If true, geometries will be cast to multi-part counterparts before features are added to the target layer. r=ahocevar (closes #2542)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10142 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-03-23 17:49:13 +00:00
parent ff8b356638
commit 3de62b703a
4 changed files with 41 additions and 3 deletions

View File

@@ -38,6 +38,13 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
*/
EVENT_TYPES: ["featureadded"],
/**
* APIProperty: multi
* {Boolean} Cast features to multi-part geometries before passing to the
* layer. Default is false.
*/
multi: false,
/**
* APIProperty: featureAdded
* {Function} Called after each feature is added
@@ -84,9 +91,12 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
this.callbacks
);
this.layer = layer;
this.handlerOptions = this.handlerOptions || {};
if (!("multi" in this.handlerOptions)) {
this.handlerOptions.multi = this.multi;
}
var sketchStyle = this.layer.styleMap && this.layer.styleMap.styles.temporary;
if(sketchStyle) {
this.handlerOptions = this.handlerOptions || {};
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
this.handlerOptions.layerOptions,
{styleMap: new OpenLayers.StyleMap({"default": sketchStyle})}