From c2fcb22d98499e687a237450ce26424d4a971f4e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 6 Jul 2007 20:32:22 +0000 Subject: [PATCH] #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 --- lib/OpenLayers/Geometry/Collection.js | 18 ++++++++++++ lib/OpenLayers/Geometry/Point.js | 17 +++++++++++ tests/Geometry/test_LineString.html | 42 +++++++++++++++++++++++++++ tests/Geometry/test_Point.html | 24 +++++++++++++++ tests/Geometry/test_Polygon.html | 40 +++++++++++++++++++++++++ 5 files changed, 141 insertions(+) diff --git a/lib/OpenLayers/Geometry/Collection.js b/lib/OpenLayers/Geometry/Collection.js index 63b8fe51e8..859515f811 100644 --- a/lib/OpenLayers/Geometry/Collection.js +++ b/lib/OpenLayers/Geometry/Collection.js @@ -260,6 +260,24 @@ OpenLayers.Geometry.Collection.prototype = } }, + /** + * APIMethod: resize + * Resize a geometry relative to some origin. Use this method to apply + * a uniform scaling to a geometry. + * + * Parameters: + * scale - {Float} Factor by which to scale the geometry. A scale of 2 + * doubles the size of the geometry in each dimension + * (lines, for example, will be twice as long, and polygons + * will have four times the area). + * origin - {OpenLayers.Geometry.Point} Point of origin for resizing + */ + resize: function(scale, origin) { + for(var i=0; i