I implemented a quick and dirty solution.
I am not satisfied by it but it works.
The code of setAoi is made like ZoomIn widget except that
it calls a function getFeatures with parameter an array which
contains the ul and lr coordinates.
Here is the code:
========= SetAoi.js =====
mapbuilder.loadScript(baseDir+"/widget/ButtonBase.js");
function SetAoi(widgetNode,model){
ButtonBase.apply(this,new Array(widgetNode,model));
this.cursor="crosshair";
this.doSelect = function(ref, selected) {
}
this.doAction=function(objRef,targetNode){
if(objRef.enabled){
var bbox=objRef.targetModel.getParam("aoi");
if(bbox){
var ul=bbox[0];
var lr=bbox[1];
getFeatures([ul[0], ul[1], lr[0], lr[1]]);
}
}
}
this.setMouseListener=function(objRef){
if(objRef.mouseHandler){
objRef.mouseHandler.model.addListener('mouseup',objRef.doAction,objRef);
}
}
this.model.addListener("loadModel",this.setMouseListener,this);
}
====== getFeatures implementation ====
function getFeatures(coords) {
rect = [coords[0], coords[1],
coords[2], coords[1],
coords[2], coords[3],
coords[0], coords[3]
]
map = '/home/anakreon/site/web/gis_files/maps/ekby.map';
params = 'MODE=NQUERY&map=' + map
+ "&layer=sites"
+ "&MAPSHAPE=" + rect.join('+');
url = 'http://mathind.csd.auth.gr:7777/cgi-bin/mapserv';
client = new XMLHttpRequest();
client.onreadystatechange = handler;
client.open("GET", url + '?' + params);
client.send();
}
I am looking forward for the next stable release of MapBuilder.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users