[OpenLayers-Commits] r2325 - sandbox/vector-2.4/lib/OpenLayers

commits at openlayers.org commits at openlayers.org
Mon Mar 5 12:50:40 EST 2007


Author: euzuro
Date: 2007-03-05 12:50:36 -0500 (Mon, 05 Mar 2007)
New Revision: 2325

Modified:
   sandbox/vector-2.4/lib/OpenLayers/Geometry.js
Log:
coding standards Geometry.js

Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry.js	2007-03-05 17:45:23 UTC (rev 2324)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry.js	2007-03-05 17:50:36 UTC (rev 2325)
@@ -21,6 +21,7 @@
      * Cross reference back to the feature that owns this geometry so
      * that that the feature can be identified after the geometry has been
      * selected by a mouse click.
+     * 
      * @type OpenLayers.Feature */
     feature: null,
     
@@ -38,21 +39,23 @@
     
     /**
      * Set the bounds for this Geometry.
+     * 
      * @param {OpenLayers.Bounds} bounds
      */
-    setBounds: function(bounds){
-        this.bounds=bounds;
+    setBounds: function(bounds) {
+        this.bounds = bounds;
     },
     
     /**
      * Extend the existing bounds to include the new bounds. If existing
      * bounds=null, then set a new Bounds.
+     * 
      * @param {Object} bounds
      */
     extendBounds: function(bounds){
-        if(!this.bounds){
+        if (!this.bounds) {
             this.setBounds(bounds);
-        }else{
+        } else {
             this.bounds.extendBounds(bounds);
         }
     },
@@ -62,42 +65,48 @@
      * not been set.
      * Once the bounds is set, it is not calculated again, this makes queries
      * faster.
-     * @return {OpenLayers.Bounds}
+     * 
+     * @type OpenLayers.Bounds
      */
     getBounds: function(){
         return this.bounds;
     },
     
     /**
-     * Takes an lonLat point and returns true if the geometry is at this location.
-     * This is only an approximation based on the bounds of the geometry.
+     * Takes an lonLat point and returns true if the geometry is at this 
+     * location. This is only an approximation based on the bounds of the 
+     * geometry.
+     * 
      * @param {OpenLayers.LonLat} lonlat
-     * @param toleranceLon Optional tolerance in Geometric Coords
-     * @param toleranceLat Optional tolerance in Geographic Coords
-     * @return Boolean
+     * @param {float} toleranceLon Optional tolerance in Geometric Coords
+     * @param {float} toleranceLat Optional tolerance in Geographic Coords
+     * 
+     * @type Boolean
      */
-    atPoint: function(lonlat,toleranceLon,toleranceLat){
-        var atPoint=false;
-		toleranceLon=(toleranceLon)?toleranceLon:0;
-		toleranceLat=(toleranceLat)?toleranceLat:0;
-        if(this.bounds){
-            atPoint=((this.bounds.bottom-toleranceLat)<=lonlat.lat)
-                && (lonlat.lat<=(this.bounds.top+toleranceLat))
-                && ((this.bounds.left-toleranceLon)<=lonlat.lon)
-                && (lonlat.lon<=(this.bounds.right+toleranceLon));
+    atPoint: function(lonlat, toleranceLon, toleranceLat) {
+        var atPoint = false;
+		toleranceLon = (toleranceLon) ? toleranceLon : 0;
+		toleranceLat = (toleranceLat) ? toleranceLat : 0;
+        if (this.bounds) {
+            atPoint = ((this.bounds.bottom-toleranceLat) <= lonlat.lat)
+                        && (lonlat.lat <= (this.bounds.top+toleranceLat))
+                        && ((this.bounds.left-toleranceLon) <= lonlat.lon)
+                        && (lonlat.lon <= (this.bounds.right+toleranceLon));
         }
         return atPoint;
     },
     
     /**
-     * Returns the length of the geometry
+     * @returns The length of the geometry
+     * @type float
      */
     getLength: function() {
         return 0.0;
     },
 
     /**
-     * Returns the area of the geometry
+     * @returns The area of the geometry
+     * @type float
      */
     getArea: function() {
         return 0.0;
@@ -107,15 +116,12 @@
      * Set the "events" attribute.
      */
     setEvents: function() {
-        if (this.id == null)
-            return;
-
-        var domElement = $(this.id);
-
-        if (domElement == null)
-            return;
-
-        this.events = new OpenLayers.Events(this, domElement, null);
+        if (this.id != null) { 
+            var domElement = $(this.id);
+            if (domElement != null) {
+                this.events = new OpenLayers.Events(this, domElement, null);
+            }
+        }
     },
 
     /**



More information about the Commits mailing list