[OpenLayers-Commits] r2348 - in sandbox/vector-2.4/lib: . OpenLayers/Geometry
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 16:39:11 EST 2007
Author: sderle
Date: 2007-03-05 16:39:05 -0500 (Mon, 05 Mar 2007)
New Revision: 2348
Added:
sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js
Removed:
sandbox/vector-2.4/lib/OpenLayers/Geometry/Aggregate.js
Modified:
sandbox/vector-2.4/lib/OpenLayers.js
Log:
Finished renaming Geometry.Aggregate to Collection.
Deleted: sandbox/vector-2.4/lib/OpenLayers/Geometry/Aggregate.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/Aggregate.js 2007-03-05 21:36:24 UTC (rev 2347)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/Aggregate.js 2007-03-05 21:39:05 UTC (rev 2348)
@@ -1,171 +0,0 @@
-/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
- * for the full text of the license. */
-
-/**
- * @class
- *
- * @requires OpenLayers/Geometry.js
- */
-OpenLayers.Geometry.Collection = function() {}
-OpenLayers.Geometry.Collection.prototype = OpenLayers.Class.inherit( OpenLayers.Geometry, {
-
- /**
- * @returns An exact clone of this OpenLayers.Feature
- * @type OpenLayers.Feature
- */
- clone: function (obj) {
- if (obj == null) {
- obj = eval ("new " + this.CLASS_NAME + "()");
- }
-
- for (var i = 0; i < this.components.length; i++) {
- obj.addComponents(this.components[i].clone());
- }
-
- // catch any randomly tagged-on properties
- OpenLayers.Util.applyDefaults(obj, this);
-
- return obj;
- },
-
- /**
- * @returns the components of the geometry
- */
- getComponents: function(){
- return this.components ? this.components : null;
- },
-
- /**
- *
- */
- addComponents: function(components){
- if(!(components instanceof Array)) {
- components = [components];
- }
-
- if(this.components) {
- this.components = this.components.concat(components);
- } else {
- this.components = [].concat(components);
- }
-
- for (var i = 0; i < components.length; i++) {
- this.extendBounds(components[i].bounds);
- }
- },
-
- /**
- *
- */
- removeComponents: function(components) {
- if(!(components instanceof Array)) {
- components = [components];
- }
-
- for (var i = 0; i < components.length; i++) {
- this.components = OpenLayers.Util.removeItem(this.components, components[i]);
- }
-
- // TBD restrain the bounds
- },
-
-// /**
-// * Takes an lonLat point and returns true if the feature is at this location.
-// * @param {OpenLayers.LonLat} lonlat
-// * @return Boolean
-// */
-// atPoint: function(lonlat){
-// var atPoint=false;
-// var bounds;
-// if(this.components){
-// for(var i=0;!atPoint&&(i<this.components.length);i++){
-// atPoint=this.components[i].atPoint(lonlat);
-// }
-// }else{
-// // The following code is probably not required as
-// // agregate geometries will always have components. Right?
-// // Cameron Shorter.
-// if(this.bounds){
-// atPoint=(this.bounds.bottom<=lonlat.lat)
-// && (lonlat.lat<=this.bounds.top)
-// && (this.bounds.left<=lonlat.lon)
-// && (lonlat.lon<=this.bounds.right);
-// }
-// }
-// return atPoint;
-// },
-
- /**
- * Returns the length of the geometry
- */
- getLength: function() {
- var length = 0.0;
- for (var i = 0; i < this.components.length; i++) {
- length += this.components[i].getLength();
- }
- return length;
- },
-
- /**
- * Returns the area of the geometry
- */
- getArea: function() {
- var area = 0.0;
- for (var i = 0; i < this.components.length; i++) {
- area += this.components[i].getArea();
- }
- return area;
- },
-
- /**
- * Sets the "events" attribute.
- *
- * If this aggregate geometry doesn't have an associate DOM element
- * we call setEvents on our components.
- */
- setEvents: function() {
- OpenLayers.Geometry.prototype.setEvents.call(this);
-
- if (this.events != null) {
- /* done */
- return;
- }
-
- /* Previous call to our parent's setEvents() didn't
- * set the "events" attribute. This most probably
- * means this geometry doesn't have an associate
- * DOM element, try our components.
- */
-
- for (var i = 0; i < this.components.length; i++) {
- this.components[i].setEvents();
- }
- },
-
- /**
- * Register an event callback.
- *
- * If the "events" attribute is set we call our parent to do the actual
- * registration. Otherwise, we call registerEventCallback on our
- * components.
- */
- registerEventCallback: function(type, obj, callback) {
- if (this.events != null) {
- OpenLayers.Geometry.prototype.registerEventCallback.apply(this, arguments);
- return;
- }
-
- for (var i = 0; i < this.components.length; i++) {
- this.components[i].registerEventCallback(type, obj, callback);
- }
- },
-
- destroy: function () {
- this.components.length = 0;
- this.components = null;
- },
-
- /** @final @type String */
- CLASS_NAME: "OpenLayers.Geometry.Collection"
-});
Copied: sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js (from rev 2347, sandbox/vector-2.4/lib/OpenLayers/Geometry/Aggregate.js)
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js (rev 0)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js 2007-03-05 21:39:05 UTC (rev 2348)
@@ -0,0 +1,171 @@
+/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
+ * for the full text of the license. */
+
+/**
+ * @class
+ *
+ * @requires OpenLayers/Geometry.js
+ */
+OpenLayers.Geometry.Collection = function() {}
+OpenLayers.Geometry.Collection.prototype = OpenLayers.Class.inherit( OpenLayers.Geometry, {
+
+ /**
+ * @returns An exact clone of this OpenLayers.Feature
+ * @type OpenLayers.Feature
+ */
+ clone: function (obj) {
+ if (obj == null) {
+ obj = eval ("new " + this.CLASS_NAME + "()");
+ }
+
+ for (var i = 0; i < this.components.length; i++) {
+ obj.addComponents(this.components[i].clone());
+ }
+
+ // catch any randomly tagged-on properties
+ OpenLayers.Util.applyDefaults(obj, this);
+
+ return obj;
+ },
+
+ /**
+ * @returns the components of the geometry
+ */
+ getComponents: function(){
+ return this.components ? this.components : null;
+ },
+
+ /**
+ *
+ */
+ addComponents: function(components){
+ if(!(components instanceof Array)) {
+ components = [components];
+ }
+
+ if(this.components) {
+ this.components = this.components.concat(components);
+ } else {
+ this.components = [].concat(components);
+ }
+
+ for (var i = 0; i < components.length; i++) {
+ this.extendBounds(components[i].bounds);
+ }
+ },
+
+ /**
+ *
+ */
+ removeComponents: function(components) {
+ if(!(components instanceof Array)) {
+ components = [components];
+ }
+
+ for (var i = 0; i < components.length; i++) {
+ this.components = OpenLayers.Util.removeItem(this.components, components[i]);
+ }
+
+ // TBD restrain the bounds
+ },
+
+// /**
+// * Takes an lonLat point and returns true if the feature is at this location.
+// * @param {OpenLayers.LonLat} lonlat
+// * @return Boolean
+// */
+// atPoint: function(lonlat){
+// var atPoint=false;
+// var bounds;
+// if(this.components){
+// for(var i=0;!atPoint&&(i<this.components.length);i++){
+// atPoint=this.components[i].atPoint(lonlat);
+// }
+// }else{
+// // The following code is probably not required as
+// // agregate geometries will always have components. Right?
+// // Cameron Shorter.
+// if(this.bounds){
+// atPoint=(this.bounds.bottom<=lonlat.lat)
+// && (lonlat.lat<=this.bounds.top)
+// && (this.bounds.left<=lonlat.lon)
+// && (lonlat.lon<=this.bounds.right);
+// }
+// }
+// return atPoint;
+// },
+
+ /**
+ * Returns the length of the geometry
+ */
+ getLength: function() {
+ var length = 0.0;
+ for (var i = 0; i < this.components.length; i++) {
+ length += this.components[i].getLength();
+ }
+ return length;
+ },
+
+ /**
+ * Returns the area of the geometry
+ */
+ getArea: function() {
+ var area = 0.0;
+ for (var i = 0; i < this.components.length; i++) {
+ area += this.components[i].getArea();
+ }
+ return area;
+ },
+
+ /**
+ * Sets the "events" attribute.
+ *
+ * If this aggregate geometry doesn't have an associate DOM element
+ * we call setEvents on our components.
+ */
+ setEvents: function() {
+ OpenLayers.Geometry.prototype.setEvents.call(this);
+
+ if (this.events != null) {
+ /* done */
+ return;
+ }
+
+ /* Previous call to our parent's setEvents() didn't
+ * set the "events" attribute. This most probably
+ * means this geometry doesn't have an associate
+ * DOM element, try our components.
+ */
+
+ for (var i = 0; i < this.components.length; i++) {
+ this.components[i].setEvents();
+ }
+ },
+
+ /**
+ * Register an event callback.
+ *
+ * If the "events" attribute is set we call our parent to do the actual
+ * registration. Otherwise, we call registerEventCallback on our
+ * components.
+ */
+ registerEventCallback: function(type, obj, callback) {
+ if (this.events != null) {
+ OpenLayers.Geometry.prototype.registerEventCallback.apply(this, arguments);
+ return;
+ }
+
+ for (var i = 0; i < this.components.length; i++) {
+ this.components[i].registerEventCallback(type, obj, callback);
+ }
+ },
+
+ destroy: function () {
+ this.components.length = 0;
+ this.components = null;
+ },
+
+ /** @final @type String */
+ CLASS_NAME: "OpenLayers.Geometry.Collection"
+});
Modified: sandbox/vector-2.4/lib/OpenLayers.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers.js 2007-03-05 21:36:24 UTC (rev 2347)
+++ sandbox/vector-2.4/lib/OpenLayers.js 2007-03-05 21:39:05 UTC (rev 2348)
@@ -103,7 +103,7 @@
"OpenLayers/Control/Scale.js",
"OpenLayers/Control/LayerSwitcher.js",
"OpenLayers/Geometry.js",
- "OpenLayers/Geometry/Aggregate.js",
+ "OpenLayers/Geometry/Collection.js",
"OpenLayers/Geometry/Point.js",
"OpenLayers/Geometry/Curve.js",
"OpenLayers/Geometry/LineString.js",
More information about the Commits
mailing list