[Mapbender-commits] r1207 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Mar 9 10:05:02 EST 2007


Author: christoph
Date: 2007-03-09 10:05:01 -0500 (Fri, 09 Mar 2007)
New Revision: 1207

Modified:
   trunk/mapbender/http/classes/class_gml2.php
Log:
updated export of gml to js object

Modified: trunk/mapbender/http/classes/class_gml2.php
===================================================================
--- trunk/mapbender/http/classes/class_gml2.php	2007-03-09 15:00:55 UTC (rev 1206)
+++ trunk/mapbender/http/classes/class_gml2.php	2007-03-09 15:05:01 UTC (rev 1207)
@@ -43,8 +43,7 @@
 		$data = $this->char_encode($x->file);
 		$this->parse_xml($data);		 		
 	}
-	function parsestring($req){
-		$data = $req;
+	function parsestring($data){
 		$this->parse_xml($data);		 		
 	}
 	function parse_xml($data){
@@ -182,29 +181,38 @@
 		return $s;
 	}
 	
-	function exportGeometriesToJS () {
+	function exportGeometriesToJS ($isInFrame) {
+		$prefix = "";
+		if ($isInFrame == true) {
+			$prefix = "parent.";
+		}
 		$js = "";
-		$js .= "var geom = new GeometryArray();\n";
+		$js .= "var geom = new ".$prefix."GeometryArray();\n";
 		for ($i=0; $i<count($this->geometry); $i++) {
-			$js .= $this->exportMember($i);
+			$js .= $this->exportMemberToJS($i, $isInFrame);
 			$js .= "geom.addCopy(q);\n";
 		}
+		return $js;
 	}
 	
-	function exportMemberToJS ($i) {
+	function exportMemberToJS ($i, $isInFrame) {
+		$prefix = "";
+		if ($isInFrame == true) {
+			$prefix = "parent.";
+		}
 		$js = "";
 		if ($this->getGeometryTypeFromMember($i) == $this->geomtype_point) {
-			$js .= "var current_geomtype = geomType.point;\n";
+			$js .= "var current_geomtype = ".$prefix."geomType.point;\n";
 		}
 		elseif ($this->getGeometryTypeFromMember($i) == $this->geomtype_line || $this->getGeometryTypeFromMember($i) == $this->geomtype_multiline) {
-			$js .= "var current_geomtype = geomType.line;\n";
+			$js .= "var current_geomtype = ".$prefix."geomType.line;\n";
 		}
 		elseif ($this->getGeometryTypeFromMember($i) == $this->geomtype_polygon || $this->getGeometryTypeFromMember($i) == $this->geomtype_multipolygon) {
-			$js .= "var current_geomtype = geomType.polygon;\n";
+			$js .= "var current_geomtype = ".$prefix."geomType.polygon;\n";
 		}
 		else die("unknown geometry type: '".$this->getGeometryTypeFromMember($i)."'");
 		
-		$js .= "var q = new MultiGeometry(current_geomtype);\n";
+		$js .= "var q = new ".$prefix."MultiGeometry(current_geomtype);\n";
 		
 		for ($j=0; $j<count($this->geometry[$i]); $j++) {
 			$js .= "q.addGeometry(current_geomtype);\n";



More information about the Mapbender_commits mailing list