OpenLayers OpenLayers

Ticket #1037: project-geometries.patch

File project-geometries.patch, 1.8 kB (added by crschmidt, 1 year ago)

add geometry transformation support

  • lib/OpenLayers/Geometry/Point.js

    old new  
    167167        this.y = origin.y + (scale * (this.y - origin.y)); 
    168168        this.clearBounds(); 
    169169    }, 
     170     
     171    /** 
     172     * APIMethod: transform 
     173     * Translate the x,y properties of the point from source to dest. 
     174     *  
     175     * Parameters: 
     176     * source - {<OpenLayers.Projection>}  
     177     * dest - {<OpenLayers.Projection>} 
     178     */ 
     179    transform: function(source, dest) { 
     180        if ((source && dest)) { 
     181            OpenLayers.Projection.transform( 
     182                this, source, dest);  
     183        }         
     184    }, 
    170185 
    171186    CLASS_NAME: "OpenLayers.Geometry.Point" 
    172187}); 
  • lib/OpenLayers/Geometry/Collection.js

    old new  
    304304        return equivalent; 
    305305    }, 
    306306 
     307    /** 
     308     * APIMethod: transform 
     309     * Reproject the components geometry from source to dest. 
     310     *  
     311     * Parameters: 
     312     * source - {<OpenLayers.Projection>}  
     313     * dest - {<OpenLayers.Projection>} 
     314     */ 
     315    transform: function(source, dest) { 
     316        if (source && dest) { 
     317            for (var i = 0; i < this.components.length; i++) {   
     318                var component = this.components[i]; 
     319                    component.transform(source, dest); 
     320            } 
     321        }     
     322    }, 
     323 
    307324    /** @final @type String */ 
    308325    CLASS_NAME: "OpenLayers.Geometry.Collection" 
    309326});