[Mapbender-commits] r3060 - branches/2.5/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Sep 30 09:30:39 EDT 2008
Author: christoph
Date: 2008-09-30 09:30:38 -0400 (Tue, 30 Sep 2008)
New Revision: 3060
Removed:
branches/2.5/http/javascripts/wfs_usemap.js
Modified:
branches/2.5/http/javascripts/wfs.js
Log:
moved to a single file
Modified: branches/2.5/http/javascripts/wfs.js
===================================================================
--- branches/2.5/http/javascripts/wfs.js 2008-09-30 12:20:06 UTC (rev 3059)
+++ branches/2.5/http/javascripts/wfs.js 2008-09-30 13:30:38 UTC (rev 3060)
@@ -1,33 +1,166 @@
-<?php
-#$Id$
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_wfs_spatialRequest.php,v 1.4 2006/03/08 15:26:26 c_baudson Exp $
-# 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.
+// ---------------------------------------------------------------------------------------------------------------
+// --- usemap (begin) --------------------------------------------------------------------------------------------
-session_start();
-import_request_variables("PG");
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../../conf/mapbender.conf");
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+function mod_usemap(wfs_name) {
+ if (wfs_name == "") {
+ usemap = "";
+ }
+ var ind = getMapObjIndexByName(mb_wfs_target);
+ var myImg = window.frames[mb_wfs_target].document.getElementById("um_img").style;
+ myImg.width = mb_mapObj[ind].width;
+ myImg.height = mb_mapObj[ind].height;
-$e_id_css = "wfs";
-include '../include/dyn_js.php';
-require_once(dirname(__FILE__) . "/wfs_usemap.js");
-?>
+ for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
+ if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
+
+ if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
+ usemap += mod_usemap_polygon(i);
+ }
+ else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
+ usemap += mod_usemap_circle(i);
+ }
+ else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
+ usemap += mod_usemap_line(i);
+ }
+ }
+ }
+ writeUsemap(usemap);
+}
+
+function mod_usemap_circle(ind){
+ var str = "";
+ var coord = "";
+
+ var title = "";
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+ if (i>0) title += " ";
+ title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+ }
+
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+ var p = mb_wfs_fetch.getPoint(ind, i, 0);
+ var pos = realToMap(mb_wfs_target,p);
+ coord += pos.x + ", " + pos.y;
+
+ str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+ str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle' coords='";
+ str += coord + ", " + mod_usemap_radius + "' href='#'>";
+ }
+
+ return str;
+}
+
+function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
+ var coord = "";
+
+ var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
+ var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
+
+ var vec = p2.minus(p1);
+
+ if (vec.x != 0 || vec.y != 0) {
+ var n_vec;
+ if (vec.x != 0) {
+ if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
+ else n_vec = new Point(vec.y/vec.x, 1);
+ }
+ else {
+ if (vec.y > 0) n_vec = new Point(1,0);
+ else n_vec = new Point(-1,0);
+ }
+ n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
+
+ lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
+
+ if (cnt > 0) coord += ", ";
+
+ coord += parseInt(lp.x) + ", " + parseInt(lp.y);
+ coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
+ }
+ return coord;
+}
+
+function mod_usemap_line(ind){
+ var str = "";
+ var title = "";
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+ if (i>0) title += " ";
+ title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+ }
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+ var coord = "";
+ var cnt = 0;
+
+ for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1 ; j ++) {
+ var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
+ if (result != "") {
+ coord += result;
+ cnt++;
+ }
+ }
+
+ for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
+ var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
+ if (result != "") {
+ coord += result;
+ cnt++;
+ }
+ }
+
+ if (coord != "") {
+ str += "<AREA title='"+title+"'";
+ str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+ str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
+ str += "shape='poly' coords='";
+ str += coord + "' href='#'>";
+ }
+ else {
+ //display circle
+ var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
+ coord += pos.x + ", " + pos.y;
+
+ str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
+ str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle' coords='";
+ str += coord + ", " + mod_usemap_radius + "' href='#'>";
+ }
+ }
+
+ return str;
+}
+
+function mod_usemap_polygon(ind){
+ var str = "";
+ var coord = "";
+ var title = "";
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+ if (i>0) title += " ";
+ title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+ }
+
+ for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+ var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
+ coord += pos.x + ", " + pos.y;
+
+ for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
+ pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
+ coord += ", " + pos.x + ", " + pos.y;
+ }
+
+ str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+ str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly' coords='";
+ str += coord + "' href='#'>";
+ }
+
+ return str;
+}
+
+function writeUsemap(str) {
+ writeTag(mb_wfs_targets[0], 'um', str);
+}
+// --- usemap (end) ----------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------
+
+
var highlight_tag_id = "wfs_highlight_tag";
var mb_wfs_fetched = [];
Deleted: branches/2.5/http/javascripts/wfs_usemap.js
===================================================================
--- branches/2.5/http/javascripts/wfs_usemap.js 2008-09-30 12:20:06 UTC (rev 3059)
+++ branches/2.5/http/javascripts/wfs_usemap.js 2008-09-30 13:30:38 UTC (rev 3060)
@@ -1,167 +0,0 @@
-/*
-* $Id$
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details.
-*/
-
-// ---------------------------------------------------------------------------------------------------------------
-// --- usemap (begin) --------------------------------------------------------------------------------------------
-
-function mod_usemap(wfs_name) {
- if (wfs_name == "") {
- usemap = "";
- }
- var ind = getMapObjIndexByName(mb_wfs_target);
- var myImg = window.frames[mb_wfs_target].document.getElementById("um_img").style;
- myImg.width = mb_mapObj[ind].width;
- myImg.height = mb_mapObj[ind].height;
-
- for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
- if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
-
- if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
- usemap += mod_usemap_polygon(i);
- }
- else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
- usemap += mod_usemap_circle(i);
- }
- else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
- usemap += mod_usemap_line(i);
- }
- }
- }
- writeUsemap(usemap);
-}
-
-function mod_usemap_circle(ind){
- var str = "";
- var coord = "";
-
- var title = "";
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
- if (i>0) title += " ";
- title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
- }
-
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
- var p = mb_wfs_fetch.getPoint(ind, i, 0);
- var pos = realToMap(mb_wfs_target,p);
- coord += pos.x + ", " + pos.y;
-
- str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle' coords='";
- str += coord + ", " + mod_usemap_radius + "' href='#'>";
- }
-
- return str;
-}
-
-function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
- var coord = "";
-
- var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
- var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
-
- var vec = p2.minus(p1);
-
- if (vec.x != 0 || vec.y != 0) {
- var n_vec;
- if (vec.x != 0) {
- if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
- else n_vec = new Point(vec.y/vec.x, 1);
- }
- else {
- if (vec.y > 0) n_vec = new Point(1,0);
- else n_vec = new Point(-1,0);
- }
- n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
-
- lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
-
- if (cnt > 0) coord += ", ";
-
- coord += parseInt(lp.x) + ", " + parseInt(lp.y);
- coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
- }
- return coord;
-}
-
-function mod_usemap_line(ind){
- var str = "";
- var title = "";
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
- if (i>0) title += " ";
- title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
- }
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
- var coord = "";
- var cnt = 0;
-
- for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1 ; j ++) {
- var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
- if (result != "") {
- coord += result;
- cnt++;
- }
- }
-
- for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
- var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
- if (result != "") {
- coord += result;
- cnt++;
- }
- }
-
- if (coord != "") {
- str += "<AREA title='"+title+"'";
- str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
- str += "shape='poly' coords='";
- str += coord + "' href='#'>";
- }
- else {
- //display circle
- var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
- coord += pos.x + ", " + pos.y;
-
- str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle' coords='";
- str += coord + ", " + mod_usemap_radius + "' href='#'>";
- }
- }
-
- return str;
-}
-
-function mod_usemap_polygon(ind){
- var str = "";
- var coord = "";
- var title = "";
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
- if (i>0) title += " ";
- title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
- }
-
- for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
- var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
- coord += pos.x + ", " + pos.y;
-
- for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
- pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
- coord += ", " + pos.x + ", " + pos.y;
- }
-
- str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly' coords='";
- str += coord + "' href='#'>";
- }
-
- return str;
-}
-
-function writeUsemap(str) {
- writeTag(mb_wfs_targets[0], 'um', str);
-}
-// --- usemap (end) ----------------------------------------------------------------------------------------------
-// ---------------------------------------------------------------------------------------------------------------
More information about the Mapbender_commits
mailing list