From 04e271570bff44cea3b9be02589653ede036e3f7 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Wed, 22 Aug 2012 23:52:12 +0200 Subject: [PATCH 1/2] Document the VERSION_NUMBER "constant". --- lib/OpenLayers.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index cca76a78d8..69d8b5b0fd 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -416,5 +416,10 @@ /** * Constant: VERSION_NUMBER + * + * This constant identifies the version of OpenLayers. + * + * When asking questions or reporting issues, make sure to inlude the output of + * OpenLayers.VERSION_NUMBER in the question or issue-description. */ OpenLayers.VERSION_NUMBER="Release 2.13 dev"; From 287e9caf4659384ede92e86006311777cfc051b4 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Wed, 22 Aug 2012 23:59:11 +0200 Subject: [PATCH 2/2] Code docs for the Bounds-class. --- lib/OpenLayers/BaseTypes/Bounds.js | 120 ++++++++++++++++++++++------- 1 file changed, 91 insertions(+), 29 deletions(-) diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index 35f2b6e3dc..d7aeeacc32 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -128,6 +128,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: toString + * Returns a string representation of the bounds object. * * Returns: * {String} String representation of bounds object. @@ -138,6 +139,11 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: toArray + * Returns an array representation of the bounds object. + * + * Returns an array of left, bottom, right, top properties, or -- when the + * optional parameter is true -- an array of the bottom, left, top, + * right properties. * * Parameters: * reverseAxisOrder - {Boolean} Should we reverse the axis order? @@ -155,6 +161,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: toBBOX + * Returns a boundingbox-string representation of the bounds object. * * Parameters: * decimal - {Integer} How many significant digits in the bbox coords? @@ -163,7 +170,7 @@ OpenLayers.Bounds = OpenLayers.Class({ * * Returns: * {String} Simple String representation of bounds object. - * (e.g. "5,42,10,45") + * (e.g. "5,42,10,45") */ toBBOX:function(decimal, reverseAxisOrder) { if (decimal== null) { @@ -202,9 +209,10 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: getWidth + * Returns the width of the bounds. * * Returns: - * {Float} The width of the bounds + * {Float} The width of the bounds (right minus left). */ getWidth:function() { return (this.right - this.left); @@ -212,6 +220,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: getHeight + * Returns the height of the bounds. * * Returns: * {Float} The height of the bounds (top minus bottom). @@ -222,9 +231,10 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: getSize + * Returns an object of the bounds. * * Returns: - * {} The size of the box. + * {} The size of the bounds. */ getSize:function() { return new OpenLayers.Size(this.getWidth(), this.getHeight()); @@ -232,6 +242,8 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: getCenterPixel + * Returns the object which represents the center of the + * bounds. * * Returns: * {} The center of the bounds in pixel space. @@ -243,7 +255,9 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: getCenterLonLat - * + * Returns the object which represents the center of the + * bounds. + * * Returns: * {} The center of the bounds in map space. */ @@ -297,11 +311,24 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: add - * + * Shifts the coordinates of the bound by the given horizontal and vertical + * deltas. + * + * (start code) + * var bounds = new OpenLayers.Bounds(0, 0, 10, 10); + * bounds.toString(); + * // => "0,0,10,10" + * + * bounds.add(-1.5, 4).toString(); + * // => "-1.5,4,8.5,14" + * (end) + * + * This method will throw a TypeError if it is passed null as an argument. + * * Parameters: - * x - {Float} - * y - {Float} - * + * x - {Float} horizontal delta + * y - {Float} vertical delta + * * Returns: * {} A new bounds whose coordinates are the same as * this, but shifted by the passed-in x and y values. @@ -316,11 +343,16 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: extend - * Extend the bounds to include the point, lonlat, or bounds specified. - * Note, this function assumes that left < right and bottom < top. - * - * Parameters: - * object - {Object} Can be LonLat, Point, or Bounds + * Extend the bounds to include the , + * or specified. + * + * Please note that this function assumes that left < right and + * bottom < top. + * + * Parameters: + * object - {, or + * } The object to be included in the new bounds + * object. */ extend:function(object) { var bounds = null; @@ -361,6 +393,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: containsLonLat + * Returns whether the bounds object contains the given . * * Parameters: * ll - {|Object} OpenLayers.LonLat or an @@ -399,6 +432,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: containsPixel + * Returns whether the bounds object contains the given . * * Parameters: * px - {} @@ -414,6 +448,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: contains + * Returns whether the bounds object contains the given x and y. * * Parameters: * x - {Float} @@ -535,7 +570,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: containsBounds - * Determine whether the target bounds is contained within this bounds. + * Returns whether the bounds object contains the given . * * bounds - {} The target bounds. * partial - {Boolean} If any of the target corners is within this bounds @@ -565,10 +600,12 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: determineQuadrant - * + * Returns the the quadrant ("br", "tr", "tl", "bl") in which the given + * lies. + * * Parameters: * lonlat - {} - * + * * Returns: * {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the * coordinate lies. @@ -615,6 +652,7 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIMethod: wrapDateLine + * Wraps the bounds object around the dateline. * * Parameters: * maxExtent - {} @@ -681,12 +719,18 @@ OpenLayers.Bounds = OpenLayers.Class({ /** * APIFunction: fromString * Alternative constructor that builds a new OpenLayers.Bounds from a - * parameter string - * + * parameter string. + * + * (begin code) + * OpenLayers.Bounds.fromString("5,42,10,45"); + * // => equivalent to ... + * new OpenLayers.Bounds(5, 42, 10, 45); + * (end) + * * Parameters: - * str - {String}Comma-separated bounds string. (e.g. "5,42,10,45") + * str - {String} Comma-separated bounds string. (e.g. "5,42,10,45") * reverseAxisOrder - {Boolean} Does the string use reverse axis order? - * + * * Returns: * {} New bounds object built from the * passed-in String. @@ -698,11 +742,16 @@ OpenLayers.Bounds.fromString = function(str, reverseAxisOrder) { /** * APIFunction: fromArray - * Alternative constructor that builds a new OpenLayers.Bounds - * from an array - * + * Alternative constructor that builds a new OpenLayers.Bounds from an array. + * + * (begin code) + * OpenLayers.Bounds.fromArray( [5, 42, 10, 45] ); + * // => equivalent to ... + * new OpenLayers.Bounds(5, 42, 10, 45); + * (end) + * * Parameters: - * bbox - {Array(Float)} Array of bounds values (e.g. [5,42,10,45]) + * bbox - {Array(Float)} Array of bounds values (e.g. [5,42,10,45]) * reverseAxisOrder - {Boolean} Does the array use reverse axis order? * * Returns: @@ -716,12 +765,17 @@ OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) { /** * APIFunction: fromSize - * Alternative constructor that builds a new OpenLayers.Bounds - * from a size - * + * Alternative constructor that builds a new OpenLayers.Bounds from a size. + * + * (begin code) + * OpenLayers.Bounds.fromSize( new OpenLayers.Size(10, 20) ); + * // => equivalent to ... + * new OpenLayers.Bounds(0, 20, 10, 0); + * (end) + * * Parameters: - * size - {|Object} OpenLayers.Size or an object with - * a 'w' and 'h' properties. + * size - { or Object} or an object with + * both 'w' and 'h' properties. * * Returns: * {} New bounds object built from the passed-in size. @@ -737,6 +791,14 @@ OpenLayers.Bounds.fromSize = function(size) { * Function: oppositeQuadrant * Get the opposite quadrant for a given quadrant string. * + * (begin code) + * OpenLayers.Bounds.oppositeQuadrant( "tl" ); + * // => "br" + * + * OpenLayers.Bounds.oppositeQuadrant( "tr" ); + * // => "bl" + * (end) + * * Parameters: * quadrant - {String} two character quadrant shortstring *