From 7218fe6ea82f5298da82d31d6aa53a133d0f7fbe Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 26 Mar 2007 23:06:54 +0000 Subject: [PATCH] take toString away from Geometry.LineString and Geometry.LinearRing, give it to Geometry.Collection, and make sure the IE hack doesn't clobber toString during inheritance - see #552 and #565 git-svn-id: http://svn.openlayers.org/trunk/openlayers@2901 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/BaseTypes.js | 2 +- lib/OpenLayers/Geometry/Collection.js | 9 +++++++++ lib/OpenLayers/Geometry/LineString.js | 8 -------- lib/OpenLayers/Geometry/LinearRing.js | 9 --------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js index edcf84db3a..695ac9d034 100644 --- a/lib/OpenLayers/BaseTypes.js +++ b/lib/OpenLayers/BaseTypes.js @@ -32,7 +32,7 @@ OpenLayers.Class = { // // to be revisited in 3.0 // - if (arguments[i].toString) { + if (arguments[i].hasOwnProperty('toString')) { proto.toString = arguments[i].toString; } } diff --git a/lib/OpenLayers/Geometry/Collection.js b/lib/OpenLayers/Geometry/Collection.js index e932b03221..cc579cca5c 100644 --- a/lib/OpenLayers/Geometry/Collection.js +++ b/lib/OpenLayers/Geometry/Collection.js @@ -46,6 +46,15 @@ OpenLayers.Geometry.Collection.prototype = this.components = null; }, + /** + * @returns The coordinates components as a string + * @type String + */ + toString: function() { + return this.components.toString(); + }, + + /** * @returns An exact clone of this collection * @type OpenLayers.Geometry.Collection diff --git a/lib/OpenLayers/Geometry/LineString.js b/lib/OpenLayers/Geometry/LineString.js index 43aaf03257..ae7910ec69 100644 --- a/lib/OpenLayers/Geometry/LineString.js +++ b/lib/OpenLayers/Geometry/LineString.js @@ -24,14 +24,6 @@ OpenLayers.Geometry.LineString.prototype = arguments); }, - /** - * @returns The coordinates components as a string - * @type String - */ - toString: function() { - return this.components.toString(); - }, - /** * @returns An exact clone of this OpenLayers.Feature * @type OpenLayers.Feature diff --git a/lib/OpenLayers/Geometry/LinearRing.js b/lib/OpenLayers/Geometry/LinearRing.js index 78aec0620d..e8a2f58d55 100644 --- a/lib/OpenLayers/Geometry/LinearRing.js +++ b/lib/OpenLayers/Geometry/LinearRing.js @@ -108,15 +108,6 @@ OpenLayers.Geometry.LinearRing.prototype = return area; }, - - /** - * @returns The coordinates components as a string - * @type String - */ - toString: function() { - return this.components.toString(); - }, - /** @final @type String */ CLASS_NAME: "OpenLayers.Geometry.LinearRing" });