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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Oct 31 04:24:30 EDT 2007


Author: christoph
Date: 2007-10-31 04:24:30 -0400 (Wed, 31 Oct 2007)
New Revision: 1782

Added:
   trunk/mapbender/http/javascripts/mod_renderGML.php
Log:
new module that renders the GML in the session variable 

$_SESSION["GML"]

on start-up

Added: trunk/mapbender/http/javascripts/mod_renderGML.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_renderGML.php	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_renderGML.php	2007-10-31 08:24:30 UTC (rev 1782)
@@ -0,0 +1,64 @@
+<?php
+# http://www.mapbender.org/index.php/Monitor_Capabilities
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../conf/geoportal.conf");
+require_once(dirname(__FILE__)."/../classes/class_gml2.php");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+
+$gui_id = $_SESSION["mb_user_gui"];
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+$sql = "SELECT e_target FROM gui_element WHERE e_id = 'renderGML' AND fkey_gui_id = $1 LIMIT 1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+$row = db_fetch_array($res);
+$e_target = explode(",",$row[0]);
+
+$gml_string = $_SESSION["GML"];
+
+if ($gml_string) {
+	$gml = new gml2();
+	$gml->parse_xml($gml_string);
+	$bbox = $gml->bbox;
+	echo "mb_registerInitFunctions('highlight_init()');\n";
+	echo "function highlight_init() {\n";
+	echo "var mf = new Array(";
+	for ($i=0; $i<count($e_target); $i++) {
+		if ($i>0) echo ", ";
+		echo "'".$e_target[$i]."'";
+	}
+	echo ");\n";
+	echo "hl = new Highlight(mf, 'GML_rendering', {'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':" . GML_HIGHLIGHT_Z_INDEX . "});\n";
+	echo $gml->exportMemberToJS(0, false);
+	echo "hl.add(q);\n";
+	echo "mb_registerSubFunctions('hl.paint()');\n";
+	echo "}\n";
+	$e = new mb_notice("renderGML: GML: " . $_SESSION["GML"] . "; EPSG: " . $_SESSION["epsg"] . "; BBOX: " . implode(", ", $bbox));
+	$_SESSION["GML"] = NULL;
+	$e = new mb_notice("renderGML: deleting GML...");
+	
+}
+else {
+	$e = new mb_notice("renderGML: no GML.");
+}
+
+
+
+?>
\ No newline at end of file



More information about the Mapbender_commits mailing list