svn commit: r600 - trunk/mapbender/http/javascripts
christoph at osgeo.org
christoph at osgeo.org
Wed Jun 21 13:29:14 EDT 2006
Author: christoph
Date: 2006-06-21 17:29:13+0000
New Revision: 600
Modified:
trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
trunk/mapbender/http/javascripts/wfs.js
trunk/mapbender/http/javascripts/wfs_usemap.js
Log:
added usemap to wfs results
Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php?view=diff&rev=600&p1=trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php&p2=trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php&r1=599&r2=600
==============================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php (original)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php 2006-06-21 17:29:13+0000
@@ -177,15 +177,17 @@
mb_zF = mod_wfs_spatialRequest_target;
}
function mod_selAreaExt_setValidClipping(coords){
- mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[0],coords[1]));
- mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[2],coords[3]));
-
- if(mod_wfs_spatialRequest_geometry.count() == 2){
- mod_getAreaExt_send();
- }
- else{
- alert("Ausschnitt ungültig!")
- mb_disableThisButton(activeButton.id);
+ if (mod_wfs_spatialRequest_geometry != null) {
+ mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[0],coords[1]));
+ mod_wfs_spatialRequest_geometry.addPoint(new Point(coords[2],coords[3]));
+
+ if(mod_wfs_spatialRequest_geometry.count() == 2){
+ mod_getAreaExt_send();
+ }
+ else{
+ alert("Ausschnitt ungültig!")
+ mb_disableThisButton(activeButton.id);
+ }
}
}
// ----------------------------------------------------------------------------------------------
Modified: trunk/mapbender/http/javascripts/wfs.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/wfs.js?view=diff&rev=600&p1=trunk/mapbender/http/javascripts/wfs.js&p2=trunk/mapbender/http/javascripts/wfs.js&r1=599&r2=600
==============================================================================
--- trunk/mapbender/http/javascripts/wfs.js (original)
+++ trunk/mapbender/http/javascripts/wfs.js 2006-06-21 17:29:13+0000
@@ -1,5 +1,6 @@
<?php
require_once("mod_geometryArray.js");
+require_once("wfs_usemap.js");
?>
var digiFrame = "digitize";
var mb_wfs_fetched = new Array();
@@ -25,7 +26,10 @@
var canvas = new Array();
var canvasHasDrawing = new Array();
var useCheckboxForHighlighting = true;
-var useUsemap = false;
+if (parseInt(useUsemap) == 1) {
+ mb_registerSubFunctions('mod_usemap("")');
+}
+
var wfsResultToDigitizeModule = false;
if (isSetWfsResultToDigitize()) {
@@ -36,9 +40,6 @@
mb_registerSubFunctions('highlightGeometry()');
}
-if (useUsemap) {
- mb_registerSubFunctions('mod_usemap("")');
-}
/*
if (useExtentIsSet()) {
mb_registerSubFunctions("mb_setwfsrequest_extent()");
@@ -280,7 +281,7 @@
}
str += "</table>";
mb_wfs_objwin.innerHTML = str;
- if (useUsemap) {
+ if (parseInt(useUsemap) == 1) {
mod_usemap(wfs_name);
}
}
Modified: trunk/mapbender/http/javascripts/wfs_usemap.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/wfs_usemap.js?view=diff&rev=600&p1=trunk/mapbender/http/javascripts/wfs_usemap.js&p2=trunk/mapbender/http/javascripts/wfs_usemap.js&r1=599&r2=600
==============================================================================
--- trunk/mapbender/http/javascripts/wfs_usemap.js (original)
+++ trunk/mapbender/http/javascripts/wfs_usemap.js 2006-06-21 17:29:13+0000
@@ -2,26 +2,25 @@
// ---------------------------------------------------------------------------------------------------------------
// --- usemap (begin) --------------------------------------------------------------------------------------------
-function mod_usemap (wfs_name) {
+function mod_usemap(wfs_name) {
if (wfs_name == "") {
usemap = "";
}
- var ind = getMapObjIndexByName(mb_wfs_targets[0]);
- var myImg = window.frames[mb_wfs_targets[0]].document.getElementById("um_img").style;
+ 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.length ; i ++) {
-
- if (mb_wfs_fetch[i]['wfs_conf'] == wfs_name || wfs_name == "") {
+ 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[i]['geomtype'] == geomTypePolygon) {
+ if (mb_wfs_fetch.get(i).geomtype == geomTypePolygon) {
usemap += mod_usemap_polygon(i);
}
- else if (mb_wfs_fetch[i]['geomtype'] == geomTypePoint) {
+ else if (mb_wfs_fetch.get(i).geomtype == geomTypePoint) {
usemap += mod_usemap_circle(i);
}
- else if (mb_wfs_fetch[i]['geomtype'] == geomTypeLine) {
+ else if (mb_wfs_fetch.get(i).geomtype == geomTypeLine) {
usemap += mod_usemap_line(i);
}
}
@@ -33,94 +32,76 @@
var str = "";
var coord = "";
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
- var xArray = mb_wfs_fetch[ind]['geometry'][i]['x'];
- var yArray = mb_wfs_fetch[ind]['geometry'][i]['y'];
- var title = getElementValueByName(mb_wfs_fetch, ind, "name") + " (Pt)";
- var pos = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[0],yArray[0]);
- coord += pos[0] + ", " + pos[1];
+ 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 onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch["+ind+"])' shape='circle' coords='";
+ 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 (xArray, yArray, j, orientation, cnt) {
+function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
var coord = "";
- var p1 = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[j],yArray[j]);
- var p2 = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[j+orientation],yArray[j+orientation]);
+ var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
+ var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
- var vec = new Array();
- vec[0] = p2[0] - p1[0];
- vec[1] = p2[1] - p1[1];
+ var vec = p2.minus(p1);
- if (vec[0] != 0 || vec[1] != 0) {
- n_vec = new Array();
- if (vec[0] != 0) {
- if (vec[0] > 0) {
- n_vec[0] = (-vec[1])/vec[0];
- n_vec[1] = -1;
- }
- else {
- n_vec[0] = (vec[1])/vec[0];
- n_vec[1] = 1;
- }
+ 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[1] > 0) {
- n_vec[0] = 1;
- n_vec[1] = 0;
- }
- else {
- n_vec[0] = -1;
- n_vec[1] = 0;
- }
+ 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)))
- n_vec_length = Math.sqrt(Math.pow(n_vec[0], 2) + Math.pow(n_vec[1], 2));
- n_vec[0] = (n_vec[0]*mod_usemap_line_tolerance)/n_vec_length;
- n_vec[1] = (n_vec[1]*mod_usemap_line_tolerance)/n_vec_length;
-
- lp = new Array();
- lp[0] = p1[0] + n_vec[0];
- lp[1] = p1[1] - n_vec[1];
+ lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
- if (cnt > 0) {
- coord += ", ";
- }
- coord += parseInt(lp[0]) + ", " + parseInt(lp[1]);
- coord += ", " + parseInt(lp[0]+vec[0]) + ", " + parseInt(lp[1]+vec[1]);
-
+ 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 = "";
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
+ 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;
- xArray = new Array();
- xArray = mb_wfs_fetch[ind]['geometry'][i]['x'];
- yArray = new Array();
- yArray = mb_wfs_fetch[ind]['geometry'][i]['y'];
-
-
- for (var j = 0 ; j < xArray.length - 1 ; j ++) {
- var result = mod_usemap_line_calculate(xArray, yArray, j, 1, cnt);
+ 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 = (xArray.length - 1) ; j > 0 ; j--) {
- var result = mod_usemap_line_calculate(xArray, yArray, j, -1, 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++;
@@ -128,19 +109,19 @@
}
if (coord != "") {
- str += "<AREA ";
- str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch["+ind+"])' ";
+ 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 = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[0],yArray[0]);
- coord += pos[0] + ", " + pos[1];
+ var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
+ coord += pos.x + ", " + pos.y;
- str += "<AREA onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch["+ind+"])' shape='circle' coords='";
+ 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='#'>";
}
}
@@ -151,21 +132,23 @@
function mod_usemap_polygon(ind){
var str = "";
var coord = "";
-
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
- var xArray = mb_wfs_fetch[ind]['geometry'][i]['x'];
- var yArray = mb_wfs_fetch[ind]['geometry'][i]['y'];
- var title = getElementValueByName(mb_wfs_fetch, ind, "name") + " (Py)";
- var pos = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[0],yArray[0]);
- coord += pos[0] + ", " + pos[1];
-
- for (var j = 1 ; j < xArray.length ; j ++) {
- pos = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[j],yArray[j]);
- coord += ", " + pos[0] + ", " + pos[1];
+ 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 onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
- str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch["+ind+"])' shape='poly' coords='";
+ 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='#'>";
}
More information about the Mapbender_commits
mailing list