Tim's big refactoring of the Geometry modules. Fixes #590. All tests pass in FF (except the PanZoomBar stuff, which wasn't touched by this patch) and IE.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2931 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-03-30 21:42:32 +00:00
parent 91ec16c81a
commit 313704b844
16 changed files with 374 additions and 177 deletions

View File

@@ -16,6 +16,14 @@ OpenLayers.Geometry.Polygon = OpenLayers.Class.create();
OpenLayers.Geometry.Polygon.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
/**
* An array of class names representing the types of components that
* the collection can include. A null value means the component types
* are not restricted.
* @type Array(String)
*/
componentTypes: ["OpenLayers.Geometry.LinearRing"],
/**
* @constructor
*
@@ -25,24 +33,6 @@ OpenLayers.Geometry.Polygon.prototype =
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
arguments);
},
/**
* adds a component to the Polygon, checking type
*
* @param {OpenLayers.Geometry.LinearRing} point to add
* @param {int} index Index into the array to insert the component
*/
addComponent: function(component, index) {
if (!(component instanceof OpenLayers.Geometry.LinearRing)) {
var throwStr = "component should be an " +
"OpenLayers.Geometry.LinearRing but is a " +
component.CLASS_NAME;
throw throwStr;
}
OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,
arguments);
},
/** Calculated by subtracting the areas of the internal holes from the
* area of the outer hole.