svn commit: r324 - trunk/mapbender/http/javascripts/wfs.js
vera_schulze at osgeo.org
vera_schulze at osgeo.org
Thu May 18 08:14:06 EDT 2006
Author: vera_schulze
Date: 2006-05-18 12:14:06+0000
New Revision: 324
Modified:
trunk/mapbender/http/javascripts/wfs.js (contents, props changed)
Log:
Code cleaning ready
Modified: trunk/mapbender/http/javascripts/wfs.js
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/wfs.js?view=diff&rev=324&p1=trunk/mapbender/http/javascripts/wfs.js&p2=trunk/mapbender/http/javascripts/wfs.js&r1=323&r2=324
==============================================================================
--- trunk/mapbender/http/javascripts/wfs.js (original)
+++ trunk/mapbender/http/javascripts/wfs.js 2006-05-18 12:14:06+0000
@@ -1,3 +1,21 @@
+// $Id$
+// http://www.mapbender.org/index.php/wfs.js
+// 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.
+
var digiFrame = "digitize";
var mb_wfs_fetched = new Array();
var mb_wfs_fetch = new Array();
@@ -23,32 +41,29 @@
var useCheckboxForHighlighting = true;
var useUsemap = false;
-if (useCheckboxForHighlighting) {
+if (useCheckboxForHighlighting){
mb_registerSubFunctions('highlightGeometry()');
}
-
-if (useUsemap) {
+if (useUsemap){
mb_registerSubFunctions('mod_usemap("")');
}
-
if (useExtentIsSet()) {
mb_registerSubFunctions("mb_setwfsrequest_extent()");
}
-function mb_setwfsrequest_extent() {
-
- if (useExtentIsSet()) {
+function mb_setwfsrequest_extent(){
+ if (useExtentIsSet()){
var ind = getMapObjIndexByName(mb_wfs_targets[0]);
var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
-
+
var x = new Array();
var y = new Array();
x[0] = pos_a[0];
x[1] = pos_b[0];
y[0] = pos_a[1];
y[1] = pos_b[1];
-
+
mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
}
}
@@ -95,27 +110,27 @@
path += "&filter=";
var filter = '<ogc:Filter xmlns:ogc="http://ogc.org" xmlns:gml="http://www.opengis.net/gml">';
filter += "<Within>";
- filter += '<ogc:PropertyName>';
- for(var j=0; j<wfs_conf[w_[i]]['element'].length; j++){
- if(wfs_conf[w_[i]]['element'][j]['f_geom'] == 1){
- filter += wfs_conf[w_[i]]['element'][j]['element_name'];
- }
- }
- filter += "</ogc:PropertyName>";
- filter += '<gml:Polygon srsName="EPSG:4326">';
- filter += '<gml:outerBoundaryIs>';
- filter += '<gml:LinearRing>';
- filter += '<gml:coordinates>';
- for(var k=0; k<x.length; k++){
- if(k>0){
- filter += " ";
- }
- filter += x[k]+","+y[k];
- }
- filter += '</gml:coordinates>';
- filter += '</gml:LinearRing>';
- filter += '</gml:outerBoundaryIs>';
- filter += '</gml:Polygon>';
+ filter += '<ogc:PropertyName>';
+ for(var j=0; j<wfs_conf[w_[i]]['element'].length; j++){
+ if(wfs_conf[w_[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_conf[w_[i]]['element'][j]['element_name'];
+ }
+ }
+ filter += "</ogc:PropertyName>";
+ filter += '<gml:Polygon srsName="EPSG:4326">';
+ filter += '<gml:outerBoundaryIs>';
+ filter += '<gml:LinearRing>';
+ filter += '<gml:coordinates>';
+ for(var k=0; k<x.length; k++){
+ if(k>0){
+ filter += " ";
+ }
+ filter += x[k]+","+y[k];
+ }
+ filter += '</gml:coordinates>';
+ filter += '</gml:LinearRing>';
+ filter += '</gml:outerBoundaryIs>';
+ filter += '</gml:Polygon>';
filter += '</Within>';
filter += '</ogc:Filter>';
path += filter;
@@ -135,16 +150,16 @@
var filter = '<ogc:Filter xmlns:ogc="http://ogc.org" xmlns:gml="http://www.opengis.net/gml">';
filter += "<ogc:BBOX>";
filter += '<ogc:PropertyName>';
- for(var j=0; j<wfs_conf[w_[i]]['element'].length; j++){
- if(wfs_conf[w_[i]]['element'][j]['f_geom'] == 1){
- filter += wfs_conf[w_[i]]['element'][j]['element_name'];
- }
+ for(var j=0; j<wfs_conf[w_[i]]['element'].length; j++){
+ if(wfs_conf[w_[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_conf[w_[i]]['element'][j]['element_name'];
}
+ }
filter += "</ogc:PropertyName>";
filter += '<gml:Box srsName="4326"><gml:coordinates>';
- filter += x[0]+","+y[0];
- filter += " ";
- filter += x[1]+","+y[1];
+ filter += x[0]+","+y[0];
+ filter += " ";
+ filter += x[1]+","+y[1];
filter += '</gml:coordinates></gml:Box></ogc:BBOX>';
filter += '</ogc:Filter>';
path += filter;
@@ -157,8 +172,8 @@
// ---------------------------------------------------------------------------------------------------------------
// --- usemap (begin) --------------------------------------------------------------------------------------------
-function mod_usemap (wfs_name) {
- if (wfs_name == "") {
+function mod_usemap (wfs_name){
+ if (wfs_name == ""){
usemap = "";
}
var ind = getMapObjIndexByName(mb_wfs_targets[0]);
@@ -166,14 +181,12 @@
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 == "") {
-
- if (mb_wfs_fetch[i]['geomtype'] == "Polygon") {
+ for (var i = 0 ; i < mb_wfs_fetch.length ; i ++){
+ if (mb_wfs_fetch[i]['wfs_conf'] == wfs_name || wfs_name == ""){
+ if (mb_wfs_fetch[i]['geomtype'] == "Polygon"){
usemap += mod_usemap_polygon(i);
}
- else if (mb_wfs_fetch[i]['geomtype'] == "Point") {
+ else if (mb_wfs_fetch[i]['geomtype'] == "Point"){
usemap += mod_usemap_circle(i);
}
else if (mb_wfs_fetch[i]['geomtype'] == "Line") {
@@ -187,23 +200,22 @@
function mod_usemap_circle(ind){
var str = "";
var coord = "";
-
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
+
+ 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];
-
+
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 += coord + ", " + mod_usemap_radius + "' href='#'>";
}
-
return str;
}
-function mod_usemap_line_calculate (xArray, yArray, j, orientation, cnt) {
+function mod_usemap_line_calculate (xArray, yArray, j, orientation, cnt){
var coord = "";
var p1 = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[j],yArray[j]);
@@ -212,8 +224,8 @@
var vec = new Array();
vec[0] = p2[0] - p1[0];
vec[1] = p2[1] - p1[1];
-
- if (vec[0] != 0 || vec[1] != 0) {
+
+ if (vec[0] != 0 || vec[1] != 0){
n_vec = new Array();
if (vec[0] != 0) {
if (vec[0] > 0) {
@@ -225,8 +237,8 @@
n_vec[1] = 1;
}
}
- else {
- if (vec[1] > 0) {
+ else{
+ if (vec[1] > 0){
n_vec[0] = 1;
n_vec[1] = 0;
}
@@ -244,19 +256,18 @@
lp[0] = p1[0] + n_vec[0];
lp[1] = p1[1] - n_vec[1];
- if (cnt > 0) {
+ if (cnt > 0){
coord += ", ";
}
coord += parseInt(lp[0]) + ", " + parseInt(lp[1]);
- coord += ", " + parseInt(lp[0]+vec[0]) + ", " + parseInt(lp[1]+vec[1]);
-
+ coord += ", " + parseInt(lp[0]+vec[0]) + ", " + parseInt(lp[1]+vec[1]);
}
return coord;
}
function mod_usemap_line(ind){
var str = "";
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
+ for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++){
var coord = "";
var cnt = 0;
@@ -264,25 +275,22 @@
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 ++) {
+
+ for (var j = 0 ; j < xArray.length - 1 ; j ++){
var result = mod_usemap_line_calculate(xArray, yArray, j, 1, cnt);
if (result != "") {
coord += result;
cnt++;
}
}
-
- for (var j = (xArray.length - 1) ; j > 0 ; j--) {
+ for (var j = (xArray.length - 1) ; j > 0 ; j--){
var result = mod_usemap_line_calculate(xArray, yArray, j, -1, cnt);
- if (result != "") {
+ if (result != ""){
coord += result;
cnt++;
}
}
-
- if (coord != "") {
+ 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+"])' ";
@@ -293,51 +301,48 @@
//display circle
var pos = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[0],yArray[0]);
coord += pos[0] + ", " + pos[1];
-
+
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 += coord + ", " + mod_usemap_radius + "' href='#'>";
}
}
-
return str;
}
function mod_usemap_polygon(ind){
var str = "";
var coord = "";
-
- for (var i = 0 ; i < mb_wfs_fetch[ind]['geometry'].length ; i ++) {
+
+ 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 ++) {
+
+ for (var j = 1 ; j < xArray.length ; j ++){
pos = makeRealWorld2mapPos(mb_wfs_targets[0],xArray[j],yArray[j]);
coord += ", " + pos[0] + ", " + pos[1];
}
-
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 += coord + "' href='#'>";
}
-
return str;
}
-function writeUsemap(str) {
+function writeUsemap(str){
writeTag(mb_wfs_targets[0], 'um', str);
}
// --- usemap (end) ----------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------------
-function mb_repaint() {
- for (var i = 0 ; i < mb_wfs_targets.length ; i ++) {
+function mb_repaint(){
+ for (var i = 0 ; i < mb_wfs_targets.length ; i ++){
mf = mb_wfs_targets[i];
- if (canvas[mf]) {
+ if (canvas[mf]){
canvas[mf].paint();
}
}
@@ -353,10 +358,7 @@
tmp.style.visibility = 'hidden';
}
-//
-// x- and y- coordinates are put in different arrays, the old arrays are being deleted
-//
-function rearrangeXY (cnt) {
+function rearrangeXY (cnt){
for(var j=0; j<mb_wfs_fetch[cnt]['geometry'].length; j++){
var g = mb_wfs_sortXY(mb_wfs_fetch[cnt]['geometry'][j]);
mb_wfs_fetch[cnt]['geometry'][j] = new Array();
@@ -369,7 +371,7 @@
var tmp = n.split("_");
var current_wfs_name = tmp[3];
var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
-// alert("response from " + wfs_conf[tmp[3]]['wfs_conf_abstract']);
+ // alert("response from " + wfs_conf[tmp[3]]['wfs_conf_abstract']);
if(a && a.length){
var str = n + ": \n";
for(var i=0; i<a.length; i++){
@@ -378,16 +380,16 @@
var ind = getMapObjIndexByName(mb_wfs_targets[0]);
var wfs_tmp = wfs_conf[current_wfs_name]['featuretype_srs'] + " - " + mb_mapObj[ind].epsg;
- if (wfs_conf[current_wfs_name]['featuretype_srs'] == mb_mapObj[ind].epsg) {
+ if (wfs_conf[current_wfs_name]['featuretype_srs'] == mb_mapObj[ind].epsg){
mb_wfs_fetch[cnt] = a[i];
mb_wfs_fetch[cnt]['wfs_conf'] = current_wfs_name;
rearrangeXY(cnt);
var check = mb_wfs_cntBasePoint(mb_wfs_fetch[cnt]['geometry']);
if(check == false){
-
+
var newGeom = mb_wfs_getBBOX(mb_wfs_fetch[cnt]['geometry']);
-
+
mb_wfs_fetch[cnt]['geometry'] = new Array();
mb_wfs_fetch[cnt]['geometry'][0] = new Array();
mb_wfs_fetch[cnt]['geometry'][0]['x'] = new Array();
@@ -407,64 +409,59 @@
else {
alert("EPSG mismatch. Invalid WFS result. Press OK to continue.");
}
- }
+ }
checkMbWfsFetch();
}
mb_wfs_listMember(current_wfs_name);
}
-//
-// checks if the mb_wfs_fetch array is valid. If not, a pop up window will display the error(s).
-//
-function checkMbWfsFetch() {
+function checkMbWfsFetch(){
var error = "";
- for (var i = 0 ; i < mb_wfs_fetch.length ; i++) {
+ for (var i = 0 ; i < mb_wfs_fetch.length ; i++){
error += checkWfsObj(i);
}
- if (error) {
+ if (error){
var wfsWindow = open("about:blank", "wfsattributes", "width=300, height=300, resizable, dependent=yes, scrollbars=yes");
wfsWindow.document.open("text/html");
wfsWindow.document.write("An error occured:<br><hr>" + error);
wfsWindow.document.close();
}
}
-//
-// checks if a wfs object at index index is valid. if not, alerts will be displayed
-//
-function checkWfsObj (index) {
+
+function checkWfsObj (index){
var obj = mb_wfs_fetch[index];
var geometry = false;
var element = false;
var geomtype = false;
var wfs_conf = false;
var error = "";
-
- for (attr in obj) {
- if (attr == "geometry") {
+
+ for (attr in obj){
+ if (attr == "geometry"){
geometry = true;
var objGeom = obj['geometry'];
var objGeomLength = objGeom.length;
- if (objGeomLength == 0) {
+ if (objGeomLength == 0){
error += "object " + index + " doesn't contain any geometries.<br>";
}
else {
- for (var i = 0 ; i < objGeomLength ; i ++) {
+ for (var i = 0 ; i < objGeomLength ; i ++){
var objGeomAtIndex = objGeom[i];
var x = false;
var y = false;
- for (attrib in objGeomAtIndex) {
- if (attrib == "x") {
+ for (attrib in objGeomAtIndex){
+ if (attrib == "x"){
x = true;
}
- else if (attrib == "y") {
+ else if (attrib == "y"){
y = true;
}
else {
error += "object " + index + ": unknown geometry attribute: " + attrib + ".<br>";
}
}
- if (x == true && y == true) {
- if (objGeomAtIndex['x'].length != objGeomAtIndex['y'].length || objGeomAtIndex['x'].length == 0) {
+ if (x == true && y == true){
+ if (objGeomAtIndex['x'].length != objGeomAtIndex['y'].length || objGeomAtIndex['x'].length == 0){
error += "object " + index + " has an invalid geometry.<br>";
}
}
@@ -474,60 +471,58 @@
}
}
}
- else if (attr == "element") {
+ else if (attr == "element"){
elements = true;
-
+
var objElem = obj['element'];
var objElemLength = objElem.length;
- for (var i = 0 ; i < objElemLength ; i ++) {
+ for (var i = 0 ; i < objElemLength ; i ++){
var objElemAtIndex = objElem[i];
var elemName = false;
var elemVal = false;
- for (attrib in objElemAtIndex) {
- if (attrib == "name") {
+ for (attrib in objElemAtIndex){
+ if (attrib == "name"){
elemName = true;
}
- else if (attrib == "val") {
+ else if (attrib == "val"){
elemVal = true;
}
else {
error += "object " + index + ": unknown element attributes: " + attrib + ".<br>";
}
}
- if (elemName != true || elemVal != true) {
+ if (elemName != true || elemVal != true){
error += "object " + index + ": missing object attributes.<br>";
}
else {
- if (objElemAtIndex['name'] == "name") {
- if (!objElemAtIndex['val']) {
+ if (objElemAtIndex['name'] == "name"){
+ if (!objElemAtIndex['val']){
error += "object " + index + " doesn't have a name.<br>";
}
}
}
}
}
- else if (attr == "geomtype") {
+ else if (attr == "geomtype"){
geomtype = true;
- if (obj['geomtype'] != "Point" && obj['geomtype'] != "Line" && obj['geomtype'] != "Polygon") {
+ if (obj['geomtype'] != "Point" && obj['geomtype'] != "Line" && obj['geomtype'] != "Polygon"){
error += "object " + index + ": wrong geometry type.<br>";
}
}
- else if (attr == "wfs_conf") {
+ else if (attr == "wfs_conf"){
wfs_conf = true;
- if (!obj['wfs_conf']) {
+ if (!obj['wfs_conf']){
error += "object " + index + ": no wfs conf.<br>";
}
}
else {
error += "object " + index + ": unknown attribute: " + attr + ".<br>";
}
-
}
- if (geometry == false || geomtype == false || elements == false) {
+ if (geometry == false || geomtype == false || elements == false){
error += "object " + index + " is corrupted.<br>";
}
-
- if (error) {
+ if (error){
error += displayObject(mb_wfs_fetch[index]);
error += "<hr>";
}
@@ -559,18 +554,14 @@
return true;
}
-//
-// displays an object
-//
-
-function displayObject (someArray) {
+function displayObject(someArray){
var a = someArray;
var str = "";
- for (attr in a) {
+ for (attr in a){
b = a[attr];
- if (typeof(b) == "object") {
+ if (typeof(b) == "object"){
str += "<br>[" + attr + "]<br>";
str += displayObject(b);
}
@@ -581,13 +572,10 @@
return str;
}
-//
-// returns an element value by name
-//
-function getElementValueByName(member, memberIndex, elementName) {
+function getElementValueByName(member, memberIndex, elementName){
var arrayLength = member[memberIndex]['element'].length;
for (var j = 0 ; j < arrayLength ; j++) {
- if (member[memberIndex]['element'][j]['name'] == elementName) {
+ if (member[memberIndex]['element'][j]['name'] == elementName){
return member[memberIndex]['element'][j]['val'];
}
}
@@ -600,22 +588,19 @@
var str = "<table>";
for(var i=0; i<mb_wfs_fetch.length; i++){
var t = wfs_conf[mb_wfs_fetch[i]['wfs_conf']];
-// str += t['g_label']+ ": <br>";
+ // str += t['g_label']+ ": <br>";
for(var j=0; j<t['element'].length; j++){
if(t['element'][j]['f_show'] > 0){
-
for(var k=0; k<mb_wfs_fetch[i]['element'].length; k++){
if(t['element'][j]['element_name'] == mb_wfs_fetch[i]['element'][k]['name']){
//str += mb_wfs_fetch[i]['element'][k]['name'] + ": ";
str += "<tr><td><img src = '../img/wfs_digitize.png' onClick = 'tab_open(digiFrame);parent.window.frames[digiFrame].addMember(mb_wfs_fetch["+i+"])'></td>";
-
str += "<td>";
- if (useCheckboxForHighlighting) {
+ if (useCheckboxForHighlighting){
str += "<input type=checkbox id=highlightCheckbox" + i + " onClick='highlightGeometry()'></td><td>";
}
-
str += "<div";
- if (!useCheckboxForHighlighting) {
+ if (!useCheckboxForHighlighting){
str += " onmouseover='mb_wfs_perform(\"over\",mb_wfs_fetch["+i+"])' ";
str += " onmouseout='mb_wfs_perform(\"out\",mb_wfs_fetch["+i+"])' ";
}
@@ -628,23 +613,22 @@
}
str += "</table>";
mb_wfs_objwin.innerHTML = str;
- if (useUsemap) {
+ if (useUsemap){
mod_usemap(wfs_name);
}
}
-
-function highlightGeometry() {
+function highlightGeometry(){
var l = mb_wfs_fetch.length;
-// if (l > 0) {
- mb_wfs_wzClean();
- mb_wfs_checkTag();
-// }
- for (var i = 0; i < l ; i++) {
+ // if (l > 0){
+ mb_wfs_wzClean();
+ mb_wfs_checkTag();
+ // }
+ for (var i = 0; i < l ; i++){
var id = "highlightCheckbox"+i;
var cb = document.getElementById(id);
- if (cb) {
- if (cb.checked) {
+ if (cb){
+ if (cb.checked){
mb_wfs_draw(mb_wfs_fetch[i]);
}
}
@@ -652,12 +636,12 @@
mb_repaint();
}
-function get_wfs_conf(index) {
+function get_wfs_conf(index){
var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
return wfs_conf[index];
}
-function get_complete_wfs_conf() {
+function get_complete_wfs_conf(){
var wfs_conf = window.frames["wfs_conf"].get_wfs_conf();
return wfs_conf;
}
@@ -670,7 +654,7 @@
mb_repaint();
}
if(type=='out'){
- if (useCheckboxForHighlighting) {
+ if (useCheckboxForHighlighting){
highlightGeometry();
}
else {
@@ -683,11 +667,12 @@
var b = parseFloat(wfs_conf[m['wfs_conf']]['g_buffer']);
mb_calculateExtent(mb_wfs_targets[0],parseFloat(tmp[0])-b,parseFloat(tmp[1])-b,parseFloat(tmp[2])+b,parseFloat(tmp[3])+b);
zoom(mb_wfs_targets[0], 'true', 1.0);
- if (!useCheckboxForHighlighting) {
+ if (!useCheckboxForHighlighting){
mb_wfs_draw(m);
}
}
}
+
function mb_wfs_cntBasePoint(g){
var c = 0;
for(var i=0; i<g.length;i++){
@@ -700,6 +685,7 @@
return false;
}
}
+
function mb_wfs_getBBOX(g){
var tmp_x = new Array();
var tmp_y = new Array();
@@ -708,27 +694,26 @@
tmp_x = tmp_x.concat(g[i]['x']);
tmp_y = tmp_y.concat(g[i]['y']);
}
-
var min_x = parseFloat(tmp_x[0]);
var min_y = parseFloat(tmp_y[0]);
var max_x = parseFloat(tmp_x[0]);
var max_y = parseFloat(tmp_y[0]);
var x,y;
-
+
for(var i=1; i<tmp_x.length; i++){
x = parseFloat(tmp_x[i]);
y = parseFloat(tmp_y[i]);
- if (x < min_x) {
+ if (x < min_x){
min_x = x;
}
- else if (x > max_x) {
+ else if (x > max_x){
max_x = x;
}
- if (y < min_y) {
+ if (y < min_y){
min_y = y;
}
- else if (y > max_y) {
+ else if (y > max_y){
max_y = y;
}
}
@@ -807,7 +792,7 @@
var apos = mb_wfs_toPix(mf,g[i]);
canvas[mf].setColor(mb_wfs_lineColor);
canvas[mf].drawPolyline(apos[0],apos[1]);
- }
+ }
}
else if(t=='Polygon'){
for(var i=0; i<g.length; i++){
More information about the Mapbender_commits
mailing list