svn commit: r764 - trunk/mapbender/http/javascripts/mod_highlightPOI.php
astrid_emde at osgeo.org
astrid_emde at osgeo.org
Fri Sep 1 09:27:22 EDT 2006
Author: astrid_emde
Date: 2006-09-01 13:27:22+0000
New Revision: 764
Added:
trunk/mapbender/http/javascripts/mod_highlightPOI.php (contents, props changed)
Log:
new modul to highlight 1 to n pois in your individula style
more about the modul in the wiki : http://www.mapbender.org/index.php?title=HighlightPOI
Added: trunk/mapbender/http/javascripts/mod_highlightPOI.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_highlightPOI.php?view=auto&rev=764
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/javascripts/mod_highlightPOI.php 2006-09-01 13:27:22+0000
@@ -0,0 +1,144 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_highlightPOI.php
+# 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.
+
+$gui_id = $_REQUEST["gui_id"];
+include("../../conf/mapbender.conf");
+
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+$sql = "SELECT e_target FROM gui_element WHERE e_id = 'highlightPOI' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+$cnt = 0;
+
+/* Mapbender version lower 2.4
+$sql = "SELECT e_target FROM gui_element WHERE e_id = 'highlightPOI' AND fkey_gui_id = '".$gui_id."'";
+$res = db_query($sql);
+$cnt = 0;
+*/
+
+while($row = db_fetch_array($res)){
+ $e_target = $row["e_target"];
+ $cnt++;
+}
+if($cnt > 1){
+ echo "alert('highlightPOI: ID not unique!');";
+}
+echo "var mod_highlightPOI_target = '".$e_target."';";
+
+$e_id_css = 'highlightPOI';
+include('../include/dyn_js.php');
+
+?>
+try{
+ if (poi_image){}
+}
+catch(e){
+ poi_image = '../img/redball.gif';
+}
+
+try{
+ if (poi_style){}
+}
+catch(e){
+ poi_style = 'background-color:white;font-weight: bold;color:black;font-family:Arial;';
+}
+
+mb_registerInitFunctions('mod_highlightPOI_init()');
+mb_registerPanSubElement('highlight');
+mb_registerSubFunctions('mod_highlightPOI_draw()');
+
+var mod_highlightPOI_minx;
+var mod_highlightPOI_miny;
+var mod_highlightPOI_maxx;
+var mod_highlightPOI_maxy;
+var mod_highlightPOI_name = new Array();
+var mod_highlightPOI_x = new Array();
+var mod_highlightPOI_y = new Array();
+var mod_highlightPOI_params = new Array();
+var myPOI;
+
+function mod_highlightPOI_init(){
+ var myPOI = "<?php echo $_SESSION['mb_myPOI'] ?>";
+ //alert ("myPOI: "+myPOI+" target:"+mod_highlightPOI_target);
+ if(myPOI != ""){
+ mod_highlightPOI_params = myPOI.split(",");
+
+
+ for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
+ if(i==0){
+ mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
+ mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
+ mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
+ mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
+ mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
+ }
+ else{
+ mod_highlightPOI_name[i] = mod_highlightPOI_params[i];
+ if(mod_highlightPOI_params[i+1] < mod_highlightPOI_minx){
+ mod_highlightPOI_minx = parseInt(mod_highlightPOI_params[i+1]);
+ }
+ if(mod_highlightPOI_params[i+2] < mod_highlightPOI_miny){
+ mod_highlightPOI_miny = parseInt(mod_highlightPOI_params[i+2]);
+ }
+ if(mod_highlightPOI_params[i+1] > mod_highlightPOI_maxx){
+ mod_highlightPOI_maxx = parseInt(mod_highlightPOI_params[i+1]);
+ }
+ if(mod_highlightPOI_params[i+2] > mod_highlightPOI_maxy){
+ mod_highlightPOI_maxy = parseInt(mod_highlightPOI_params[i+2]);
+ }
+ }
+ }
+ if((mod_highlightPOI_maxx - mod_highlightPOI_minx) < 100){
+ mod_highlightPOI_minx -= 50;
+ mod_highlightPOI_maxx += 50;
+ }
+ if((mod_highlightPOI_maxy - mod_highlightPOI_miny) < 100){
+ mod_highlightPOI_miny -= 50;
+ mod_highlightPOI_maxy += 50;
+ }
+ mod_highlightPOI_minx -= 50;
+ mod_highlightPOI_maxx += 50;
+ mod_highlightPOI_miny -= 50;
+ mod_highlightPOI_maxy += 50;
+ //mb_calculateExtent( mod_highlightPOI_target,mod_highlightPOI_minx,mod_highlightPOI_miny,mod_highlightPOI_maxx,mod_highlightPOI_maxy);
+ }
+}
+
+
+function mod_highlightPOI_draw(){
+ var ind = getMapObjIndexByName(mod_highlightPOI_target);
+ window.frames['mapframe1'].document.getElementById('highlight').style.width = mb_mapObj[ind].width;
+ window.frames['mapframe1'].document.getElementById('highlight').style.height = mb_mapObj[ind].height;
+ window.frames['mapframe1'].document.getElementById('highlight').style.top = 0;
+ window.frames['mapframe1'].document.getElementById('highlight').style.left = 0;
+ var tagSource = "";
+ for(var i=0; i<mod_highlightPOI_params.length; i=i+3){
+ var pos = makeRealWorld2mapPos(mod_highlightPOI_target,mod_highlightPOI_params[i+1], mod_highlightPOI_params[i+2]);
+ tagSource += "<div style='position:absolute;left:"+(pos[0]-7)+"px;top:"+(pos[1]-7)+"px'>";
+ tagSource += "<img src='"+poi_image+"'><span style='"+poi_style+"'>"+mod_highlightPOI_params[i]+"<span></div>";
+ }
+ writeTag(mod_highlightPOI_target, "highlight", tagSource);
+}
+function mod_highlightPOI_pan(){
+//image bewegen
+}
+
+
More information about the Mapbender_commits
mailing list