svn commit: r491 - trunk/mapbender/http/javascripts/map.php

uli at osgeo.org uli at osgeo.org
Mon Jun 19 10:40:12 EDT 2006


Author: uli
Date: 2006-06-19 14:40:12+0000
New Revision: 491

Modified:
   trunk/mapbender/http/javascripts/map.php

Log:
license in javascript-code included
deprecated gml-function removed
some commends removed

Modified: trunk/mapbender/http/javascripts/map.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/map.php?view=diff&rev=491&p1=trunk/mapbender/http/javascripts/map.php&p2=trunk/mapbender/http/javascripts/map.php&r1=490&r2=491
==============================================================================
--- trunk/mapbender/http/javascripts/map.php	(original)
+++ trunk/mapbender/http/javascripts/map.php	2006-06-19 14:40:12+0000
@@ -22,6 +22,9 @@
 session_start();
 header('Content-type: application/x-javascript');
 ?>
+/* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
+*  License (>=v2). Read the file COPYING that comes with Mapbender for details. */
+
 /*GLOBALS*/
 var ie = document.all?1:0;
 var n6 = document.getElementById&&!document.all?1:0;
@@ -1159,89 +1162,10 @@
 function Numsort(a,b){
 	return a-b;
 }
-/*
-* Object (Array)
-* this.id
-* this.type
-* this.x = new Array();
-* this.y = new Array();
-* this.label
-* this.epsg
-*/
 function mb_registerGML(frameName,obj){
 	var ind = getMapObjIndexByName(frameName);
 	mb_mapObj[ind].geom = obj;
 }
-//deprecated!
-function mb_obj2gml(frameName){
-	var ind = getMapObjIndexByName(frameName);	
-	var geom = mb_mapObj[ind].geom;
-	
-	var layerName = "MyLayer";
-	
-	var str = "&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;<wfs:FeatureCollection ";
-	str += "xmlns='http://www.ttt.org/myns' ";
-	str += "xmlns:myns='http://www.opengis.net/' ";
-	str += "xmlns:wfs='http://www.opengis.net/wfs/' ";
-	str += "xmlns:gml='http://www.opengis.net/gml/' ";
-	str += "xmlns:ogc='http://www.opengis.net/ogc/' ";
-	str += "xmlns:xsi='http://www.w3.org/' ";
-	str += "xsi:schemaLocation='http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd                         http://www.ttt.org/myns http://localhost/cgi-bin/mapserv44?'>";
-	str += "<gml:boundedBy>";
-		str += "<gml:Box srsName='"+geom[0].epsg.substr(0,4).toLowerCase()+geom[0].epsg.substr(4,geom[0].epsg.length)+"'>";
-			str += "<gml:coordinates>";
-				str += "-1.000000,-1.000000 -1.000000,-1.000000";
-			str += "</gml:coordinates>";
-		str += "</gml:Box>";
-	str += "</gml:boundedBy>";
-	
-	var myType = "";
-	for(var i=0; i<geom.length;i++){
-		if(geom[i].type == "text"){ myType = "point";}
-		if(geom[i].type == "line"){ myType = "lineString";}
-		if(geom[i].type == "polygon"){ myType = "polygon";}
-		var sortx = geom[i].x;
-		var sorty = geom[i].y;
-		//sortx.sort(Numsort);
-		//sorty.sort(Numsort);
-		str += "<gml:featureMember>";
-			str += "<"+layerName+">";
-				str += "<gml:boundedBy>";
-					str += "<gml:Box srsName=&quot;"+geom[i].epsg.substr(0,4).toLowerCase()+geom[i].epsg.substr(4,geom[i].epsg.length)+"&quot;>";
-						str += "<gml:coordinates>";
-							str += sortx[0]+"," + sorty[0] + " " + sortx[sortx.length-1] + "," + sorty[sorty.length-1];
-						str += "</gml:coordinates>";
-					str += "</gml:Box>";
-				str += "</gml:boundedBy>";
-				str += "<gml:"+myType+"Property>";
-					str += "<gml:"+myType.charAt(0).toUpperCase()+myType.substr(1,myType.length);
-					str += " srsName=&quot;"+geom[i].epsg.substr(0,4).toLowerCase()+geom[i].epsg.substr(4,geom[i].epsg.length)+"&quot;>";
-						if(geom[i].type == "polygon"){ str += "<gml:outerBoundaryIs><gml:LinearRing>";} 
-						str += "<gml:coordinates>";
-						for(var j=0; j<geom[i].x.length; j++){
-							str += geom[i].x[j] + "," + geom[i].y[j] + " ";
-							//alert(geom[i].x[j] + "," + geom[i].y[j]);
-						}
-						str += "</gml:coordinates>";
-						if(geom[i].type == "polygon"){ str += "</gml:LinearRing></gml:outerBoundaryIs>";}
-					str += "</gml:"+myType.charAt(0).toUpperCase()+myType.substr(1,myType.length)+">";
-				str += "</gml:"+myType+"Property>";
-				str += "<id>"+i+"</id>";
-			if(geom[i].label != false){
-				str += "<label>"+geom[i].label+"</label>";
-			}
-			str += "</"+layerName+">";
-		str += "</gml:featureMember>";
-	}
-	str += "</wfs:FeatureCollection>";
-	return str;
-	/*
-	document.sendData.target = "_blank";
-	document.sendData.action = "../classes/class_gml2obj.php";
-	document.sendData.data.value = str;
-	document.sendData.submit();
-	*/
-}
 function mb_timestamp(){
 	var d = new Date();
 	var ts = Math.round(Date.parse(d)/1000);
@@ -1265,8 +1189,6 @@
 		}
 	}
 }
-
-
 function mb_getchildsbyname(objInd,wmsInd,lname){
 	var t = mb_mapObj[objInd].wms[wmsInd];
 	var pos = mb_getlayerposbyname(objInd, wmsInd,lname);
@@ -1292,32 +1214,16 @@
 		return false;
 	}
 }
-
-
-/************************************************************************************
- checks if a tag <tagname> with id <id> exists in frame <framename>.
- if yes, the node is returned
- if no, the node is created with attributes <attributes> and returned
- if a node with id <id> exists but the tagname is not <tagname>, false is returned.
-************************************************************************************/
-
 function mb_checkTag(frameName, tagName, elementId, appendAtTagName, attributes){
-
 	var oldElement;
 	var newElement;
-
-	// for both frames and no frames...
 	if(frameName && frameName != ""){
 		oldElement = window.frames[frameName].document.getElementById(elementId);
 	}
 	else if(!frameName || frameName == ""){
 		oldElement = document.getElementById(elementId);
 	}
-
-	// ... check if an element with elementId exists.	 	 
 	if (oldElement == null) {
-		// if no element with elementId exists, a new one is created and appended to appendAtTagName 
-		
 		newElement = window.frames[frameName].document.createElement(tagName);
 		if(frameName && frameName != ""){
 			newElement = window.frames[frameName].document.getElementsByTagName(appendAtTagName)[0].appendChild(newElement);
@@ -1327,10 +1233,6 @@
 		}
 	}
 	else {
-		// if element id is already taken, check if tag name are identical
-		// if yes, the desired element already exists, and is returned
-		// if not, another element with the desired id exists, false is returned
-		
 		if (oldElement.nodeName.toLowerCase() == tagName.toLowerCase()) {
 			for (var i=0; i<attributes.length; i++) {
 				oldElement.setAttribute(attributes[i][0], attributes[i][1]);
@@ -1341,10 +1243,6 @@
 			return false;
 		}
 	}
-
-	//
-	// set element id
-	//
 	var newElementAttributeNode = document.createAttribute("id");
 	newElementAttributeNode.value = elementId;
 	newElement.setAttributeNode(newElementAttributeNode);




More information about the Mapbender_commits mailing list