Opened 20 years ago
Closed 20 years ago
#898 closed defect (wontfix)
check for layer queryability inside query functions
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapScript-SWIG | Version: | 4.3 |
Severity: | normal | Keywords: | |
Cc: |
Description
New users often get tripped up by the way that mapserver uses layer.template to control the queryability of a layer. When a user calls queryByPoint() for example, they expect to get results, and we could save new users a lot of trouble by setting the template value for them inside the function if NULL, and then setting it back to NULL. The queryByPoint method, for example, would become: int queryByPoint(mapObj *map, pointObj *point, int mode, double buffer) { int retval; if (self->template == NULL) { // make queryable self->template = strdup("query"); retval = msQueryByPoint(map, self->index, mode, *point, buffer); free(self->template); self->template = NULL; } else if (strlen(self->template) < 1) { // string like "" free(self->template); self->template = strdup("query"); retval = msQueryByPoint(map, self->index, mode, *point, buffer); free(self->template); self->template = strdup(""); } else { retval = msQueryByPoint(map, self->index, mode, *point, buffer); } return retval; } maybe some macros would be helpful to do this for all the query methods.
Change History (2)
Note:
See TracTickets
for help on using tickets.