#807 - give geometries a resize method - examples and tests for demonstration

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3631 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-07-06 20:32:22 +00:00
parent 0d596fbb03
commit c2fcb22d98
5 changed files with 141 additions and 0 deletions

View File

@@ -148,6 +148,23 @@ OpenLayers.Geometry.Point.prototype =
this.y = origin.y + (radius * Math.sin(theta));
},
/**
* APIMethod: resize
* Resize a point relative to some origin. For points, this has the effect
* of scaling a vector (from the origin to the point). This method is
* more useful on geometry collection subclasses.
*
* Parameters:
* scale - {Float} Ratio of the new distance from the origin to the old
* distance from the origin. A scale of 2 doubles the
* distance between the point and origin.
* origin - {OpenLayers.Geometry.Point} Point of origin for resizing
*/
resize: function(scale, origin) {
this.x = origin.x + (scale * (this.x - origin.x));
this.y = origin.y + (scale * (this.y - origin.y));
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Geometry.Point"
});