Opened 20 years ago
Closed 15 years ago
#762 closed defect (fixed)
[PHP MapScript] Add mapObj::insertLayer and mapObj::removeLayer
Reported by: | dmorissette | Owned by: | aboudreault |
---|---|---|---|
Priority: | high | Milestone: | 5.4 release |
Component: | MapScript-PHP | Version: | 4.3 |
Severity: | normal | Keywords: | |
Cc: | jmckenna, dmorissette |
Description (last modified by )
Attachments (4)
Change History (14)
comment:1 by , 20 years ago
Milestone: | → 4.4 release |
---|
comment:2 by , 20 years ago
Cc: | removed |
---|
comment:4 by , 16 years ago
Description: | modified (diff) |
---|
A question about the missing removeLayer() came up on the -users list today. Here is an exceprt from my reply explaining why we never addressed this ticket:
"... then I started to wonder why we never implemented removeLayer(), and it came back to me that removeLayer() returns a standalone layerObj that's decoupled from the mapObj and can even be reinserted into the map at another location later on with insertLayer(). Without looking into this in any detail, it sounds like adding this may be more involved than just adding a new method since PHP MapScript doesn't allow decoupling objects like this at the moment. That and the fact that there are simpler alternatives to do the same thing (i.e. setting status MS_DELETE) probably explains why we never did it."
comment:5 by , 16 years ago
Description: | modified (diff) |
---|
comment:6 by , 16 years ago
Cc: | added |
---|
add insertLayer r7574. README and online php mapscript doc updated.
comment:7 by , 16 years ago
I do not really understand why it's not possible to also add a 'removeLayer' method. Setting the layer status to MS_DELETE is in most cases not working as workaround. The layers still appear in the layers list and have an index, they still appear in WMS capabilities responses.
Defining the removeLayer method was quite straightforward. If you want to include it in a new Mapscript version I can send you the patch.
I have not understood the problem of 'decoupled layers'. If I remove a layer I get a valid layer object back, I can modify its properties and reinsert it into the map object, I have not experienced any problems for this. Anyway, the purpose of removing a layer is normally not to continue to use this layer but to have it completely removed from the map object. In my opinion it's also a cleaner approach than trying to work with statuses.
comment:8 by , 16 years ago
Cc: | added |
---|---|
Milestone: | FUTURE → 5.4 release |
Owner: | changed from | to
Armin, please attach your patch and we'll have a look.
by , 16 years ago
Attachment: | php_mapscript.c.diff added |
---|
by , 16 years ago
Attachment: | php_mapscript.h.diff added |
---|
by , 16 years ago
Attachment: | mapscript_i.c.diff added |
---|
comment:9 by , 16 years ago
The patch looks good and it works. I simply added a condition in the removeLayer fonction to ensure that the layer index passed in argument is a long. (otherwise... a null or a string parameter could be converted in a long and the wrong layer will be removed). I'll join the official patch for trunk.
Thanks armin!
by , 15 years ago
Attachment: | bug762.patch added |
---|