[Cartoweb-users] query by point

Pierre GIRAUD pierre.giraud at camptocamp.com
Mon Jan 30 09:56:07 EST 2006


Valerio Noti a écrit :

> Hello,
> is it possible to use a query by point tool instead of query by 
> rectangle available in demo projects?
> I'd like to not allow user to draw a rectangle query but just a query 
> click.
>
> Thanks in advance
>
> Valerio
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users

If your current dhtmlInit.js looks like :

[...]
Map.prototype.query = function(aDisplay) {
  this.zoomin(aDisplay);
  this.getDisplay(aDisplay).docObj.style.cursor = "help";
};
[...]

the quickest way to change the query tool behavior is to copy 
dhtmlInit.js in your project/htdocs/js folder and to modify it to :

[...]
Map.prototype.query = function(aDisplay) {
  this.zoomout(aDisplay);
  this.getDisplay(aDisplay).docObj.style.cursor = "help";
};
[...]

This will give the query tool the same behavior as the zoomout one.


But it should be better (cleaner) to have another tool in the query 
plugin (queryByPoint for example), that could be loaded in the toolbar 
(plugin extension ?). For that, a new tooldescription has to be added to 
the handleMainmapTool() function in the query coreplugin.
In the dhtmlInit.js code, you also need to have a new prototype for 
queryByPoint looking like :

[...]
Map.prototype.querybyPoint = function(aDisplay) {
  this.zoomout(aDisplay);
  this.getDisplay(aDisplay).docObj.style.cursor = "help";
};
[...]

Hope this is clear.


Pierre GIRAUD


-- 
_________________________________________________________
Pierre GIRAUD
Géomaticien, Analyste

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex 

Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com  




More information about the Cartoweb-users mailing list