JSDOC / coding standards for Util.LatLon

git-svn-id: http://svn.openlayers.org/trunk/openlayers@91 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-17 13:44:47 +00:00
parent f7b33fb581
commit 169dbb3755

View File

@@ -119,7 +119,7 @@ OpenLayers.Size.prototype = {
* @type String * @type String
*/ */
toString:function() { toString:function() {
return ("w="+this.w+",h="+this.h); return ("w=" + this.w + ",h=" + this.h);
}, },
/** /**
@@ -145,32 +145,89 @@ OpenLayers.Size.prototype = {
CLASS_NAME: "OpenLayers.Size" CLASS_NAME: "OpenLayers.Size"
}; };
/**
* @class This class represents a latitude and longitude pair
*/
OpenLayers.LatLon = Class.create(); OpenLayers.LatLon = Class.create();
OpenLayers.LatLon.prototype = { OpenLayers.LatLon.prototype = {
initialize: function(lat,lon) {
this.lat=lat; /**
this.lon=lon; * @constructor
*
* @param {float} lat
* @param {float} lon
*/
initialize: function(lat, lon) {
this.lat = lat;
this.lon = lon;
}, },
toString:function(){
return ("lat="+this.lat+",lon="+this.lon); /**
* @return String representation of OpenLayers.LatLon object.
* (ex. "lat=42,lon=5")
* @type String
*/
toString:function() {
return ("lat=" + this.lat + ",lon=" + this.lon);
}, },
copyOf:function(){
/**
* @return Shortened String representation of OpenLayers.LatLon object.
* (ex. "42,5")
* @type String
*/
toShortString:function() {
return (this.lat + ", " + this.lon);
},
/**
* @return New OpenLayers.LatLon object with the same lat and lon values
* @type OpenLayers.Size
*/
copyOf:function() {
return new OpenLayers.LatLon(this.lat, this.lon); return new OpenLayers.LatLon(this.lat, this.lon);
}, },
toShortString:function(){
return (this.lat+", "+this.lon); /**
* @param {OpenLayers.LatLon} ll
*
* @return a LatLon object with the difference between the two coords
* @type OpenLayers.Pixel
*/
diff:function(ll) {
return new OpenLayers.LatLon(this.lat - ll.lat, this.lon - ll.lon);
}, },
diff:function(pt){ // subtract pt from this
return new OpenLayers.LatLon(this.lat - pt.lat,this.lon - pt.lon); /**
* @param {OpenLayers.LatLon} ll
* @returns Boolean value indicating whether the passed-in OpenLayers.LatLon
* object has the same lat and lon components as this
*
* @type bool
*/
equals:function(ll) {
return ((this.lat == ll.lat) && (this.lon == ll.lon));
}, },
samePT:function(pt){
return (this.lat==pt.lat && this.lon==pt.lon); /** @type String */
} CLASS_NAME: "OpenLayers.LatLon"
}; };
OpenLayers.LatLon.fromString=function(str){
var pairs=str.split(","); /**
return new OpenLayers.LatLon(pairs[1],pairs[0]); * @constructor
*
* @param {String} str Comma-separated coordinate string. (ex. "40,5")
*
* @returns New OpenLayers.LatLon object built from the passed-in String.
* @type OpenLayers.LatLon
*/
OpenLayers.LatLon.fromString = function(str) {
var pair = str.split(",");
return new OpenLayers.LatLon(pair[1], pair[0]);
}; };
OpenLayers.Bounds = Class.create(); OpenLayers.Bounds = Class.create();
OpenLayers.Bounds.prototype = { OpenLayers.Bounds.prototype = {
initialize: function(minlat,minlon,maxlat,maxlon){ initialize: function(minlat,minlon,maxlat,maxlon){