Opened 20 years ago
Closed 19 years ago
#535 closed defect (fixed)
[PHP MapScript] Support for queryMapObj via PHP
Reported by: | dmorissette | Owned by: | mapserverbugs |
---|---|---|---|
Priority: | high | Milestone: | FUTURE |
Component: | MapScript-PHP | Version: | 4.1 |
Severity: | normal | Keywords: | |
Cc: | m.cave-ayland@…, mapserver@… |
Description
We need to eventually add a queryMapObj class in PHP MapScript -------- Original Message -------- Subject: [Mapserver-users] PHP MapScript DLL QueryMap class? Date: Mon, 8 Dec 2003 14:26:29 -0500 From: Mike Leahy <mgleahy@fes.uwaterloo.ca> To: <mapserver-users@lists.gis.umn.edu>, <maplab-users@lists.maptools.org> Hello all, I'm just curious if there's any way to set parameters for the QUERYMAP in a map object using the PHP MapScript DLL (I'm using the 4.1 version right now). Basically that's the only component I can't figure out how to set when I dynamically create a map object without a mapfile. My workaround is to create a temporary mapfile that has nothing but an empty MAP and the QUERYMAP properties, then create a map object in PHP from that file. After that, everything else works great. I see there are PHP MapScript constants defined for the QueryMap object (i.e. the Querymap styles), but there is no way to change anything in the querymap. This is not a particularly huge deal, as I already have a workaround in my case, but it might be a little more efficient if a class was defined that provided access to those parameters from a PHP script. Is this something we might see in later builds...or is there an undocumented class or function that can be used? Thanks, Mike
Attachments (1)
Change History (10)
comment:1 by , 20 years ago
Cc: | added |
---|
comment:3 by , 19 years ago
As part of my ongoing work with Mapserver, I have written some code to implement queryMapObj with PHP Mapscript. It is likely that this patch will need some review since it is my first foray into creating a new Mapscript object and so might not quite work as expected.... The patch implements the following: 1) Expose a queryMapObj as mapObj->querymap 2) Implement the following querymap properties: querymap->width - width of the query map querymap->height - height of query map querymap->color - a colorObj representing the color of the query map 3) Implement the following querymap methods: querymap->setsize(width, height) - set the width and height of the query map. Looking at the code, I agree with Steve's comments in bug 774 that ideally a query map should be able to pick up existing STYLES to display the query results. Perhaps a new queryClass() member of layerObj could be invented which is just a classObj used to style the results of any of the query functions? This would help my current hack for applying custom styles in a query map - currently I draw the map once with the styles I want, remove all the classes from my layer, add styles for the query results and then finally redraw the queryMap with style MS_SELECTED. I appreciate that since this is quite a major change so late in beta, and as noted below, the complimentary methods in SWIG Mapscript don't exist yet so I don't expect it to make the final 4.6 release. However it would be great if this could make its way into a 4.6.x series release after review. Many thanks, Mark.
by , 19 years ago
Attachment: | ms-querymapobj.patch added |
---|
first cut of querymapobj implementation for PHP Mapscript
comment:4 by , 19 years ago
Cc: | added |
---|
Mark, can you please remind us about this in the weeks after the 4.6 release? Thanks.
comment:5 by , 19 years ago
Hi Daniel, no problem - I appreciate that most of the core developers will be busy with OSG 05 matters for the next couple of weeks. Mark.
comment:6 by , 19 years ago
Hi everyone, Just a reminder about this patch as requested. Since it didn't make 4.6.0, I'd be much more inclined to rewrite the queryMap code. I think it would be good to create a new query class for each layer (a query classObj within each layerObj); any shapes that match the query will then get styled according to this new class. While that's good in theory, it's going to be difficult for me to find the extra development time on this one, so it may have to go in as it is :( What do people think? Mark.
comment:8 by , 19 years ago
Mark, I think we will go only with the querymap->set() method and get rid of the querymap->setSize(w,h) method since there seems to be no equivalent in SWIG MapScript (trying to keep both as close as possible). Is that ok. Was there a specific reason why the setSize() method was added?
comment:9 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed. PHP MapScript queryMapObj implemented in CVS HEAD, using Mark's patch minus the setSize() method: QuerymapObj Class: ------------------ Constructor: Instances of querymapObj are always are always embedded inside the mapObj. Members: int width int height int style (MS_NORMAL, MS_HILITE, MS_SELECTED) colorObj color Methods: int set(string property_name, new_value) Set object property to a new value. Returns -1 on error.
Note:
See TracTickets
for help on using tickets.