[Mapbender-commits] r1388 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 30 08:09:34 EDT 2007


Author: christoph
Date: 2007-05-30 08:09:34 -0400 (Wed, 30 May 2007)
New Revision: 1388

Modified:
   trunk/mapbender/http/javascripts/geometry.js
   trunk/mapbender/http/javascripts/map.js
Log:
more JSDoc

Modified: trunk/mapbender/http/javascripts/geometry.js
===================================================================
--- trunk/mapbender/http/javascripts/geometry.js	2007-05-30 11:46:41 UTC (rev 1387)
+++ trunk/mapbender/http/javascripts/geometry.js	2007-05-30 12:09:34 UTC (rev 1388)
@@ -17,8 +17,31 @@
  * @constructor
  */
 function GeomType(){
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a polygon, write
+	 * if (someGeometry.geomType == geomType.polygon
+	 * 
+	 * @type String
+	 */
 	this.polygon = "polygon";
+
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a line, write
+	 * if (someGeometry.geomType == geomType.line
+	 * 
+	 * @type String
+	 */
 	this.line = "line";
+
+	/**
+	 * An identifier for polygons. If you want to check if a {@link MultiGeometry}
+	 * or {@link Geometry} is a point, write
+	 * if (someGeometry.geomType == geomType.point
+	 * 
+	 * @type String
+	 */
 	this.point = "point";
 }
 var geomType = new GeomType();
@@ -44,14 +67,23 @@
 		this.add(new MultiGeometry(geomType));
 	};
 	
+	/**
+	 * @ignore
+	 */
 	this.name = nameGeometryArray;
+	
+	/**
+	 * A {@link List} of {@link MultiGeometry} objects.
+	 * 
+	 * @type List
+	 */
 	this.list = [];
 }
 
 GeometryArray.prototype = new List();
 	
 /**
- * gets the j-th {link Geometry} object of the i-th {@link MultiGeometry} object
+ * gets the j-th {@link Geometry} object of the i-th {@link MultiGeometry} object
  *
  * @param {Integer} i index of the MultiGeometry
  * @param {Integer} j index of the Geometry
@@ -77,7 +109,7 @@
 /**
  * gets an Array of indices; the {@link MultiGeometry} objects at these indices are equal to geom
  *
- * @type Array of Integer
+ * @type Integer[]
  * @param {MultiGeometry} geom 
  * @returns an Array of indices
  */
@@ -112,7 +144,7 @@
 };
 	
 /**
- * closes the current {@link MultiGeometry}. Calls {@link Geometry#close}.
+ * closes the current {@link MultiGeometry}. Calls method close of the {@link Geometry} class.
  *
  */
 GeometryArray.prototype.close = function(){
@@ -308,19 +340,24 @@
 
 
 /**
- * @class a Geometry is a List of Point objects. If it is a polygon, the last point has to equal the first point.
+ * @class a Geometry is a List of Point objects. If it is a polygon, the last point has 
+ * to equal the first point.
  *
- * @ extends List
- * @ requires Point
- * @ constructor
+ * @extends List
+ * @requires Point
+ * @constructor
+ * @param {String} a string representing a geometry type, see @see GeomType.
  */
 function Geometry(aGeomtype){
 
 	/**
-	 * deletes the {@link Point} object at index i; -1 refers to the last {@link Point} object in the list
-	 * overwrites the del function of {@link List}.
+	 * deletes the {@link Point} object at index i; -1 refers to the last 
+	 * {@link Point} object in the list. Overwrites the del function of 
+	 * {@link List}.
 	 *
 	 * @param {Integer} i index
+	 * @return false if deletion is not yet finished. It is cascaded to 
+	 *         {@link MultiGeometry}. True if the deletion is finished.
 	 */
 	this.del = function(i){
 		i = this.getIndex(i);
@@ -486,8 +523,8 @@
 /**
  * gets the bounding box of this {@link Geometry}
  *
- * @return the bounding box
- * @type Array of two Point objects
+ * @return the bounding box (array of two Point objects)
+ * @type Point[]
  */
 Geometry.prototype.getBBox = function(){
 	var q = this.get(0);
@@ -641,11 +678,12 @@
 
 
 /**
- * @class a {@link Canvas} is a {@link DivTag} that contains graphics rendered by {@link jsGraphics}
+ * @class a {@link Canvas} contains a {@link DivTag} that holds graphics rendered by {@link jsGraphics}
  *
  * @constructor
  * @requires DivTag
  * @requires jsGraphics
+ * @requires GeometryArray
  * @requires MultiGeometry
  * @requires Geometry
  * @param {String} aMapFrame name of the target mapframe
@@ -658,10 +696,10 @@
 	/**
 	 * draws the geometry of the canvas
 	 *
-	 * @private
-	 * @param {String} t geometry type
+	 * @param {String} t geometry type (@see GeomType)
 	 * @param {MultiGeometry} g a MultiGeometry object
 	 * @param {String} col a color
+	 * @private
 	 */
  	this.drawGeometry = function(t,g,col){ 
 		var mapObjInd = getMapObjIndexByName(mapframe);
@@ -706,6 +744,17 @@
 	};
 	
 	/**
+	 * gets the jsGraphics.
+	 *
+	 * @private
+	 * @return the jsGraphics
+	 * @type jsGraphics
+	 */
+	this.getCanvas = function(){
+		return canvas;
+	};
+	
+	/**
 	 * draws a circle with {@link jsGraphics}.
 	 *
 	 * @private
@@ -733,24 +782,19 @@
 	};
 
 	/**
-	 * gets the jsGraphics.
-	 *
-	 * @private
-	 * @return the jsGraphics
-	 * @type jsGraphics
+	 * This is the {@link DivTag} that contains the output by {@link jsGraphics}.
+	 * 
+	 * @type DivTag
 	 */
-	this.getCanvas = function(){
-		return canvas;
-	};
-	
+	this.canvasDivTag = new DivTag(aTagName, aMapframe, aStyle);
+
+	var that = this;
+
 	var diameter = 8;
 	var minWidth = 8;
 	var lineWidth = aLineWidth;
 	var mapframe = aMapframe;
 	var style = aStyle;
-
-	var that = this;
-	this.canvasDivTag = new DivTag(aTagName, mapframe, style);
 	var canvas = new jsGraphics(aTagName, window.frames[mapframe]);
 	canvas.setStroke(lineWidth);
 	mb_registerPanSubElement(aTagName);

Modified: trunk/mapbender/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js	2007-05-30 11:46:41 UTC (rev 1387)
+++ trunk/mapbender/http/javascripts/map.js	2007-05-30 12:09:34 UTC (rev 1388)
@@ -5,7 +5,7 @@
 var mb_feature_count = 100;
 
 var mb_resolution = 28.35;
-var mb_mapObj = new Array();
+var mb_mapObj = [];
 var mb_fiWin = null;
 var mb_panActive = false;
 var clickX;
@@ -20,13 +20,13 @@
 var mb_offset_left = 0;
 var mb_log = null;
 
-var mb_PanSubElements = new Array();
+var mb_PanSubElements = [];
 function mb_registerPanSubElement(elName){
 	var ind = mb_PanSubElements.length;
 	mb_PanSubElements[ind] = elName;
 }
 
-var mb_vendorSpecific = new Array();
+var mb_vendorSpecific = [];
 function mb_registerVendorSpecific(stringFunction){
 	mb_vendorSpecific[mb_vendorSpecific.length] = stringFunction;
 }
@@ -48,12 +48,12 @@
 }
 
 function deleteWmsObject() {
-	wms = new Array();
+	wms = [];
 	wms_layer_count = 0;
 }
 
 function deleteMapObj() {
-	mb_mapObj = new Array();
+	mb_mapObj = [];
 }
 
 function mb_registerMapObj(frameName, elementName,wms_index,width, height){
@@ -66,13 +66,13 @@
    this.height = height;
    this.frameName = frameName;
    this.elementName = elementName;
-   this.layers = new Array();
-   this.styles = new Array();
-   this.querylayers = new Array();
+   this.layers = [];
+   this.styles = [];
+   this.querylayers = [];
    this.geom = "";
    this.gml = ""; 
    if(wms_index != null){
-      this.wms = new Array();
+      this.wms = [];
       this.wms[0] = wms[wms_index];
       this.wms[0].mapURL = false;
       var cnt_layers = 0;
@@ -98,7 +98,7 @@
       this.querylayers[0] = querylayers;   
    }
    else{
-	this.wms = new Array();
+	this.wms = [];
 	for(i=0; i<wms.length; i++){
 		this.wms[i] = wms[i];
 		this.wms[i].mapURL = false;
@@ -129,7 +129,7 @@
    }
    this.epsg = wms[0].gui_wms_epsg;
    this.extent = setExtent(this.width,this.height,this.epsg);
-   this.mapURL = new Array();
+   this.mapURL = [];
    for(var i=0; i<mb_MapObjectSubFunctions.length; i++){
       eval(mb_MapObjectSubFunctions[i]);
    }  
@@ -257,11 +257,11 @@
 function mb_mapObjremoveWMS(objind,wmsind){
 	var wms_ID = null;
 	
-	var new_wmsarray = new Array();
-	var new_layerarray = new Array();
-	var new_querylayerarray = new Array();
-	var new_stylesarray = new Array();
-	var new_mapURLarray = new Array();
+	var new_wmsarray = [];
+	var new_layerarray = [];
+	var new_querylayerarray = [];
+	var new_stylesarray = [];
+	var new_mapURLarray = [];
 	
 	for	(var i=0;i<mb_mapObj[objind].wms.length; i++){
 		if(i != wmsind){
@@ -281,7 +281,7 @@
 	mb_mapObj[objind].styles = new_stylesarray; 
 	mb_mapObj[objind].mapURL = new_mapURLarray;
 
-	var another_new_wmsarray = new Array();
+	var another_new_wmsarray = [];
 	for	(var i=0;i<wms.length; i++){
 		if(wms[i].wms_id != wms_ID){
 			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
@@ -559,7 +559,7 @@
 			}
 		}
 	}
-	var str_layerstyles = new Array();
+	var str_layerstyles = [];
 	str_layerstyles[0] = str_layer;
 	str_layerstyles[1] = str_styles;
 	str_layerstyles[2] = str_titles;
@@ -1005,7 +1005,7 @@
 function mb_markResult(frameName,geom,col){
 	var x = "";
 	var y = "";
-	var tmp = new Array();
+	var tmp = [];
 	var ind = getMapObjIndexByName(frameName);
 	for(var i=0; i < geom.length; i++){
 		if(i > 0){
@@ -1061,10 +1061,10 @@
 function mb_getchildsbyname(objInd,wmsInd,lname){
 	var t = mb_mapObj[objInd].wms[wmsInd];
 	var pos = mb_getlayerposbyname(objInd, wmsInd,lname);
-	var l = new Array();
-	l["name"] = new Array();
-	l["title"] = new Array();
-	l["legendurl"] = new Array();
+	var l = [];
+	l["name"] = [];
+	l["title"] = [];
+	l["legendurl"] = [];
 	for(var i=0; i < t.objLayer.length; i++){
 		if(t.objLayer[i].layer_parent == pos){
 			l["name"][l["name"].length] = t.objLayer[i].layer_name;
@@ -1090,11 +1090,33 @@
  ***************************************************************************************
  */
 
+/**
+ * @class Represents a div tag. May be located in any frame of Mapbender.
+ * 
+ * @constructor
+ * @param aTagName {String} the name of the tag
+ * @param aFrameName {String} the name of frame where the div tag is being created
+ * @param aStyle {Object} an object containing a set of name value pairs, like
+ *                        {position:absolute,top:30,z-Index:30}
+ */
 function DivTag (aTagName, aFrameName, aStyle) {
+	/**
+	 * @ignore
+	 */
 	this.exists = function () { 
 		return (rootNode.getElementById(tagName)) ? true : false;
 	};
 	
+	/**
+	 * @ignore
+	 */
+	this.getTag = function() {
+		return rootNode.getElementById(tagName);
+	};
+	
+	/**
+	 * @private
+	 */
 	var determineRootNode = function () {
 		node = document;
 		if (frameName !== "") {
@@ -1104,6 +1126,9 @@
 		return node;	
 	};
 	
+	/**
+	 * @private
+	 */
 	var toCamelCase = function(aString) {
 		var newString = "";
 		for (var i = 0; i < aString.length; i++) {
@@ -1118,6 +1143,9 @@
 		return newString;
 	}
 	
+	/**
+	 * @private
+	 */
 	var setStyle = function () {
 		if (that.exists()) {
 			var node = rootNode.getElementById(tagName);
@@ -1132,6 +1160,9 @@
 		}
 	}
 	
+	/**
+	 * @private
+	 */
 	var create = function () {
 		if (!that.exists()) {
 			var divTag = rootNode.createElement("div");
@@ -1143,6 +1174,10 @@
 		}
 		setStyle();
 	};
+
+	/**
+	 * @private
+	 */
 	var checkFrame = function () {
 		if (frameName !== "") {
 			return (typeof(window.frames[frameName]) != 'undefined');
@@ -1150,10 +1185,6 @@
 		return true;
 	};
 	
-	this.getTag = function() {
-		return rootNode.getElementById(tagName);
-	};
-	
 	var that = this;
 	var tagName = aTagName;
 	var frameName = aFrameName;
@@ -1162,12 +1193,20 @@
 
 	create();
 }
-
+/**
+ * Writes a text into the div tag, while removing existing content.
+ * 
+ * @param {String} someText the text that is inserted into the tag.
+ */
 DivTag.prototype.write = function (someText) {
 	if (this.exists()) {
 		this.getTag().innerHTML = someText;
 	}
 };
+
+/**
+ * Deletes the div tag content.
+ */
 DivTag.prototype.clean = function () {
 	this.write("");
 };
@@ -1232,8 +1271,8 @@
  * @param message the message that is being logged
  */	
 function Mb_exception(message) {
-	this.level = "error";
-	this.throwException(message, this.level);
+	 var level = "error";
+	this.throwException(message, level);
 }
 Mb_exception.prototype = new Mb_log();
 
@@ -1244,8 +1283,8 @@
  * @param message the message that is being logged
  */	
 function Mb_warning(message) {
-	this.level = "warning";
-	this.throwException(message, this.level);
+	var level = "warning";
+	this.throwException(message, level);
 }
 Mb_warning.prototype = new Mb_log();
 
@@ -1258,8 +1297,8 @@
  * A wrapper for an AJAX request via GET 
  *
  * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
  */
 function mb_ajax_get(url, param, callback) {
 	try {
@@ -1274,8 +1313,8 @@
  * A wrapper for an AJAX request via POST 
  *
  * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
  */
 function mb_ajax_post(url, param, callback) {
 	try {
@@ -1290,8 +1329,8 @@
  * A wrapper for an AJAX request via GET 
  *
  * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error". 
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error". 
  */
 function mb_ajax_json(url, param, callback) {
 	try {
@@ -1308,7 +1347,7 @@
  ***************************************************************************************
  */
  
-var mb_button = new Array();
+var mb_button = [];
 
 function mb_regButton_frame(wii, frameName, param){
 	var ind = mb_button.length;
@@ -1453,7 +1492,6 @@
 	/**
 	 * gets the number of elements in this {@link List}
 	 *
-	 * @member List
 	 * @returns number of elements in this {@link List}
 	 * @type Integer
 	 */
@@ -1464,7 +1502,6 @@
 	/**
 	 * deletes the object at index i; -1 refers to the last object in this {@link List}
 	 *
-	 * @member List
 	 * @param {Integer} i index
 	 */
 	this.del = function(i){
@@ -1477,8 +1514,6 @@
 
 	/**
 	 * empties this {@link List}
-	 *
-	 * @member List
 	 */
 	this.empty = function() {
 		while (this.list != null && this.count() > 0) {
@@ -1487,7 +1522,6 @@
 	}
 	
 	/**
-	 * @member List
 	 * @param {Integer} i index
 	 * @returns the object at index i; -1 refers to the last object in this {@link List}
 	 * @type Integer or false
@@ -1500,7 +1534,6 @@
 	/**
 	 * adds a reference to item to this {@link List}.
 	 *
-	 * @member List
 	 * @param {Object} item an object
 	 */
 	this.add = function(item) {
@@ -1509,7 +1542,6 @@
 	/**
 	 * adds a copy of item to this {@link List}.
 	 *
-	 * @member List
 	 * @param {Object} item an object
 	 */
 	this.addCopy = function(item) {
@@ -1518,7 +1550,6 @@
 	/**
 	 * attaches the {@link List} aList to this {@link List}
 	 *
-	 * @member List
 	 * @param {List} aList another list
 	 */
 	this.union = function(aList) {
@@ -1527,7 +1558,6 @@
 	/**
 	 * checks if the index is valid and returns it if it is; if i == -1, the correct index is retrieved.
 	 *
-	 * @member List
 	 * @private
 	 * @return Integer or false
 	 * @type Integer
@@ -1542,7 +1572,6 @@
 		}
 	};
 	/**
-	 * @member List
 	 * @returns a {String} representation of this List
 	 * @type String
 	 */
@@ -1565,15 +1594,15 @@
  ***************************************************************************************
  */
 
-var mb_MapRequestSubFunctions = new Array();
-var mb_WfsReadSubFunctions = new Array();
-var mb_WfsWriteSubFunctions = new Array();
-var mb_MapRequestPreFunctions = new Array();
-var mb_FeatureInfoPreFunctions = new Array();
-var mb_InitFunctions = new Array();
-var mb_MapObjectSubFunctions = new Array();
-var mb_GetScalePreFunctions = new Array();
-var mb_loadWmsSubFunctions = new Array();
+var mb_MapRequestSubFunctions = [];
+var mb_WfsReadSubFunctions = [];
+var mb_WfsWriteSubFunctions = [];
+var mb_MapRequestPreFunctions = [];
+var mb_FeatureInfoPreFunctions = [];
+var mb_InitFunctions = [];
+var mb_MapObjectSubFunctions = [];
+var mb_GetScalePreFunctions = [];
+var mb_loadWmsSubFunctions = [];
 
 function mb_registerInitFunctions(stringFunction){
 	mb_InitFunctions[mb_InitFunctions.length] = stringFunction;



More information about the Mapbender_commits mailing list