Opened 19 years ago
Closed 19 years ago
#1055 closed defect (fixed)
LayerObj data
Reported by: | Owned by: | hobu | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Input - Native SDE Support | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | banders@… |
Description
Hi!, I try to load data from a SDE connection by perl mapscript. I try to get data from different SDE layer using only one layerObj and changing only data attribute: [...CUT...] $layer->close(); $layer->{data}="ctr.regione,SHAPE"; $layer->open(); [...CUT...] Unfortunately it does not work, it returns the same data as the old connection, like if the layerObj->data were the old one. I try with Oracle Spatial and it works. Could you confirm this bug? thanks a lot, Ivano Picco
Change History (7)
comment:2 by , 19 years ago
Cc: | added |
---|
comment:3 by , 19 years ago
Sean here. I've made change to msCopyLayer so that no layerinfo is copied. Cloned layers have no layerinfo and begin in a closed state.
comment:4 by , 19 years ago
Hi, I don't understand, I have changed only the data value.Do you mean that when I close connection the function free all layer info? Then when I open a new connection, Does the open() load again all info? Thanks, Ivano Picco
comment:5 by , 19 years ago
Ivano, That is essentially correct. However, the "connection" part has been separated from the "layerinfo" part in SDE. Both are cached. They are cached in slightly different ways. There are two use cases going on here. One is to take an existing layer and just change the data member. Under SDE, this will not work as intended because the layerinfo cache already has information regarding the old DATA stuff, and it is not sensitive to changes from MapScript. The second use case is to take the layerObj and execute its clone() method. This will copy all of the pertinent elements of the layerObj into a new instance. When it does this, it *does not* copy over the opened layerinfo stuff. When you then set the DATA member, not having the layerinfo stuff forces the cache to look up its information (which it won't find because this DATA member is now new) and draw the appropriate layer. This is the bug that Sean was refering to in his reply. So, for clarification, here's how you should get what you want: $mynewlayer = $layer->clone(); $mynewlayer->{data}="ctr.regione,SHAPE"; $mynewlayer->open(); Howard
comment:6 by , 19 years ago
oops. I forgot to add that the clone() method was just fixed in CVS to adhere to this behavior. The code I outlined above will work in beta3, but not in beta2.
comment:7 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The clone() method was fixed just before 4.4 was released to deal with this situation.
Note:
See TracTickets
for help on using tickets.