OpenLayers OpenLayers

Changeset 7601

Show
Ignore:
Timestamp:
07/29/08 23:41:22 (4 months ago)
Author:
tschaub
Message:

Adding a featureadded event to the draw feature control event types. First tests ever for the draw feature control. Thanks sbenthall for the patch. r=me (closes #1508)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/DrawFeature.js

    r5614 r7601  
    3131     
    3232    /** 
     33     * Constant: EVENT_TYPES 
     34     * 
     35     * Supported event types: 
     36     *  - *featureadded* Triggered when a feature is added 
     37     */ 
     38    EVENT_TYPES: ["featureadded"], 
     39     
     40    /** 
    3341     * APIProperty: featureAdded 
    3442     * {Function} Called after each feature is added 
     
    5159     */ 
    5260    initialize: function(layer, handler, options) { 
     61         
     62        // concatenate events specific to vector with those from the base 
     63        this.EVENT_TYPES = 
     64            OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat( 
     65            OpenLayers.Control.prototype.EVENT_TYPES 
     66        ); 
     67         
    5368        OpenLayers.Control.prototype.initialize.apply(this, [options]); 
    5469        this.callbacks = OpenLayers.Util.extend({done: this.drawFeature}, 
     
    6580        this.layer.addFeatures([feature]); 
    6681        this.featureAdded(feature); 
     82        this.events.triggerEvent("featureadded",{feature : feature}); 
    6783    }, 
    6884 
  • trunk/openlayers/tests/list-tests.html

    r7590 r7601  
    9191    <li>Control/DragFeature.html</li> 
    9292    <li>Control/DragPan.html</li> 
     93    <li>Control/DrawFeature.html</li> 
    9394    <li>Control/LayerSwitcher.html</li> 
    9495    <li>Control/ModifyFeature.html</li>