[Mapbender-commits] r1890 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Dec 5 06:41:15 EST 2007
Author: verenadiewald
Date: 2007-12-05 06:41:10 -0500 (Wed, 05 Dec 2007)
New Revision: 1890
Modified:
trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
Log:
added functionality for filteroptions intersects and within for select by rectangle and select by polygon;
convert coords of select by point to pix for handling of buffer, convert back afterwards
Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php 2007-12-05 11:38:04 UTC (rev 1889)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php 2007-12-05 11:41:10 UTC (rev 1890)
@@ -43,6 +43,13 @@
if($cnt > 1){ echo "alert('setExtRequest: ID not unique!');\n";}
echo "var mod_wfs_spatialRequest_target = '".$e_target."';\n";
?>
+//element var openLinkFromSearch for opening attribute link directly onclick of searchResult entry
+try{
+ if (openLinkFromSearch){}
+}
+catch(e){
+ openLinkFromSearch =0;
+}
var wfsAreaType_point = "point";
var wfsAreaType_polygon = "polygon";
@@ -439,7 +446,7 @@
}
//mb_wfs_reset();
var ind = getMapObjIndexByName(target);
- var w = [];
+ var db_wfs_conf_id = [];
js_wfs_conf_id = [];
_geomArray = new GeometryArray();
@@ -452,13 +459,13 @@
for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
var o = mb_mapObj[ind].wms[i].objLayer[ii];
if(o.gui_layer_wfs_featuretype != '' && o.gui_layer_querylayer == '1'){
- w[w.length] = o.gui_layer_wfs_featuretype;
+ db_wfs_conf_id[db_wfs_conf_id.length] = o.gui_layer_wfs_featuretype;
}
}
}
- for(var i=0; i<w.length; i++){
+ for(var i=0; i<db_wfs_conf_id.length; i++){
for(var ii=0; ii<wfs_config.length; ii++){
- if(wfs_config[ii]['wfs_conf_id'] == w[i]) js_wfs_conf_id[js_wfs_conf_id.length] = ii;
+ if(wfs_config[ii]['wfs_conf_id'] == db_wfs_conf_id[i]) js_wfs_conf_id[js_wfs_conf_id.length] = ii;
}
}
@@ -470,22 +477,43 @@
url += "service=wfs&request=getFeature&version=1.0.0";
url += "&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name'];
url += "&filter=";
- var filter = '<ogc:Filter xmlns:ogc="http://ogc.org" xmlns:gml="http://www.opengis.net/gml">';
- filter += "<Within><ogc:PropertyName>";
- for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
- if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
- filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+ var filter = "<ogc:Filter xmlns:ogc=\"http://ogc.org\" xmlns:gml=\"http://www.opengis.net/gml\">";
+
+ if(buttonPolygon.filteroption=='within'){
+ filter += "<Within><ogc:PropertyName>";
+ for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
+ if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+ }
}
+ filter += "</ogc:PropertyName><gml:Polygon srsName=\"EPSG:4326\">";
+ filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ for(var k=0; k<queryGeom.count(); k++){
+ if(k>0) filter += " ";
+ filter += queryGeom.get(k).x+","+queryGeom.get(k).y;
+ }
+ filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ filter += "</gml:Polygon></Within>";
}
- filter += "</ogc:PropertyName><gml:Polygon srsName=\"EPSG:4326\">";
- filter += '<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
- for(var k=0; k<queryGeom.count(); k++){
- if(k>0) filter += " ";
- filter += queryGeom.get(k).x+","+queryGeom.get(k).y;
+ else if(buttonPolygon.filteroption=='intersects'){
+ filter += "<Intersects><ogc:PropertyName>";
+ for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
+ if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+ }
+ }
+ filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
+ filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ for(var k=0; k<queryGeom.count(); k++){
+ if(k>0) filter += " ";
+ filter += queryGeom.get(k).x+","+queryGeom.get(k).y;
+ }
+ filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ filter += "</gml:Polygon></Intersects>";
}
- filter += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>';
- filter += '</gml:Polygon></Within></ogc:Filter>';
- mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], w[i]);
+
+ filter += '</ogc:Filter>';
+ mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
}
}
else if(queryGeom.geomType==geomType.line){
@@ -497,22 +525,67 @@
var url = wfs_config[js_wfs_conf_id[i]]['wfs_getfeature'];
param = "service=wfs&request=getFeature&version=1.0.0&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name']+"&filter=";
var filter = "<ogc:Filter xmlns:ogc='http://ogc.org' xmlns:gml='http://www.opengis.net/gml'>";
- filter += "<ogc:BBOX><ogc:PropertyName>";
- for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
- if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
- filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+
+ if(buttonRectangle.filteroption=='within'){
+ filter += "<Within><ogc:PropertyName>";
+ for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
+ if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+ }
}
+ filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
+ filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ filter += rectangle[0].x+","+rectangle[0].y;
+ filter += " ";
+ filter += rectangle[0].x+","+rectangle[1].y;
+ filter += " ";
+ filter += rectangle[1].x+","+rectangle[1].y;
+ filter += " ";
+ filter += rectangle[1].x+","+rectangle[0].y;
+ filter += " ";
+ filter += rectangle[0].x+","+rectangle[0].y;
+ filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ filter += "</gml:Polygon></Within>";
}
- filter += "</ogc:PropertyName><gml:Box srsName='4326'><gml:coordinates>";
- filter += rectangle[0].x+","+rectangle[0].y+ " " + rectangle[1].x+","+rectangle[1].y;
- filter += "</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter>";
+ else if(buttonRectangle.filteroption=='intersects'){
+ filter += "<Intersects><ogc:PropertyName>";
+ for(var j=0; j<wfs_config[js_wfs_conf_id[i]]['element'].length; j++){
+ if(wfs_config[js_wfs_conf_id[i]]['element'][j]['f_geom'] == 1){
+ filter += wfs_config[js_wfs_conf_id[i]]['element'][j]['element_name'];
+ }
+ }
+ filter += "</ogc:PropertyName><gml:Polygon srsName='4326'>";
+ filter += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
+ filter += rectangle[0].x+","+rectangle[0].y;
+ filter += " ";
+ filter += rectangle[0].x+","+rectangle[1].y;
+ filter += " ";
+ filter += rectangle[1].x+","+rectangle[1].y;
+ filter += " ";
+ filter += rectangle[1].x+","+rectangle[0].y;
+ filter += " ";
+ filter += rectangle[0].x+","+rectangle[0].y;
+ filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
+ filter += "</gml:Polygon></Intersects>";
+ }
+
+ filter += "</ogc:Filter>";
url += param;
- mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], w[i]);
+ mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
}
}
else if(queryGeom.geomType == geomType.point){
var tmp = queryGeom.get(0);
+ var mapPos = makeRealWorld2mapPos("mapframe1",tmp.x, tmp.y);
var buffer = mb_wfs_tolerance/2;
+ var mapPosXAddPix = mapPos[0] + buffer;
+ var mapPosYAddPix = mapPos[1] +buffer;
+ var mapPosXRemovePix = mapPos[0] - buffer;
+ var mapPosYRemovePix = mapPos[1] - buffer;
+ var realWorld1 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
+ var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+ var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
+ var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
for(var i=0; i<js_wfs_conf_id.length; i++){
var url = wfs_config[js_wfs_conf_id[i]]['wfs_getfeature'];
param = "service=wfs&request=getFeature&version=1.0.0&typename="+ wfs_config[js_wfs_conf_id[i]]['featuretype_name']+"&filter=";
@@ -524,11 +597,11 @@
}
}
filter += "</ogc:PropertyName><gml:Polygon srsName='4326'><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- filter += (tmp.x - buffer) + "," + (tmp.y - buffer) + " " + (tmp.x + buffer) + "," + (tmp.y - buffer) + " ";
- filter += (tmp.x + buffer) + "," + (tmp.y + buffer) + " " + (tmp.x - buffer) + "," + (tmp.y + buffer) + " " + (tmp.x - buffer) + "," + (tmp.y - buffer);
+ filter += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] + " ";
+ filter += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1];
filter += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></ogc:Filter>";
url += param;
- mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], w[i]);
+ mb_get_geom(url, filter, i, wfs_config[js_wfs_conf_id[i]]['featuretype_name'], js_wfs_conf_id[i], db_wfs_conf_id[i]);
}
}
// highlight = new Highlight(mb_wfs_targets, highlight_tag_id, {"position":"absolute", "top":"0px", "left":"0px", "z-index":generalHighlightZIndex}, generalHighlightLineWidth);
@@ -538,7 +611,6 @@
function mb_get_geom(url, filter, index, typename, js_wfs_conf_id, db_wfs_conf_id) {
mb_ajax_post("../" + wfsResultModulePath + wfsResultModuleFilename,{'url':url,'filter':filter,'typename':typename,'js_wfs_conf_id':js_wfs_conf_id, 'db_wfs_conf_id':db_wfs_conf_id},function(js_code,status){
-// alert(js_code);
if (js_code) {
eval(js_code);
}
@@ -674,11 +746,14 @@
if(currentWfsConf.element[i].f_form_element_html.indexOf("href")!=-1){
var setUrl = currentWfsConf.element[i].f_form_element_html.replace(/href\s*=\s*['|"]\s*['|"]/, "href='"+elementVal+"' target='_blank'");
if(setUrl.match(/><\/a>/)){
- var newLink = setUrl.replace(/><\/a>/, ">"+elementVal+"</a>");
+ var newLink = setUrl.replace(/><\/a>/, ">"+elementVal+"</a>");
}
else{
var newLink = setUrl;
}
+ if(openLinkFromSearch=='1'){
+ window.open(elementVal, elementVal,"width=500, height=400,left=100,top=100,scrollbars=yes");
+ }
resultHtml += newLink;
}
else{
More information about the Mapbender_commits
mailing list