OpenLayers OpenLayers

Changeset 8583

Show
Ignore:
Timestamp:
01/06/09 17:23:19 (1 year ago)
Author:
tschaub
Message:

Add a modify callback to the sketch handlers to alert any control each time a sketch is modified.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/topp/editing/lib/OpenLayers/Handler/Path.js

    r7964 r8583  
    127127        this.line.geometry.components[index].x = this.point.geometry.x; 
    128128        this.line.geometry.components[index].y = this.point.geometry.y; 
     129        this.callback("modify", [this.point.geometry, this.line.geometry]); 
    129130        this.line.geometry.components[index].clearBounds(); 
    130131    }, 
  • sandbox/topp/editing/lib/OpenLayers/Handler/Point.js

    r7964 r8583  
    233233     
    234234    /** 
     235     * Method: modifyFeature 
     236     * Modify the existing geometry given a pixel location. 
     237     * 
     238     * Parameters: 
     239     * pixel - {<OpenLayers.Pixel>} A pixel location on the map. 
     240     */ 
     241    modifyFeature: function(pixel) { 
     242        var lonlat = this.map.getLonLatFromPixel(pixel); 
     243        this.point.geometry.x = lonlat.lon; 
     244        this.point.geometry.y = lonlat.lat; 
     245        this.callback("modify", [this.point.geometry]); 
     246        this.point.geometry.clearBounds(); 
     247    }, 
     248 
     249    /** 
    235250     * Method: drawFeature 
    236251     * Render features on the temporary layer. 
     
    295310        this.lastDown = evt.xy; 
    296311        this.drawing = true; 
    297         var lonlat = this.map.getLonLatFromPixel(evt.xy); 
    298         this.point.geometry.x = lonlat.lon; 
    299         this.point.geometry.y = lonlat.lat; 
    300         this.point.geometry.clearBounds(); 
     312        this.modifyFeature(evt.xy); 
    301313        this.drawFeature(); 
    302314        return false; 
     
    316328    mousemove: function (evt) { 
    317329        if(this.drawing) { 
    318             var lonlat = this.map.getLonLatFromPixel(evt.xy); 
    319             this.point.geometry.x = lonlat.lon; 
    320             this.point.geometry.y = lonlat.lat; 
    321             this.point.geometry.clearBounds(); 
     330            this.modifyFeature(evt.xy); 
    322331            this.drawFeature(); 
    323332        } 
  • sandbox/topp/editing/lib/OpenLayers/Handler/Polygon.js

    r7964 r8583  
    8181        this.line.geometry.components[index].x = this.point.geometry.x; 
    8282        this.line.geometry.components[index].y = this.point.geometry.y; 
     83        this.callback( 
     84            "modify", 
     85            [this.point.geometry, this.line.geometry, this.polygon.geometry] 
     86        ); 
    8387        this.line.geometry.components[index].clearBounds(); 
    8488    },