Opened 19 years ago
Closed 19 years ago
#1472 closed defect (fixed)
API regression handling dymanic pixmap symbol path changes
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Documentation - MapServer | Version: | 4.6 |
Severity: | major | Keywords: | |
Cc: | woodbri@… |
Description
On MS 4.01, we were able to create a layer in the mapfile for a user marker and then in perl/mapscript you could set the position, text and the imagepath and draw the symbol on the image. This could be repeated for any number of locations and each location could have a unique imagepath set for it. It seems this behavior changed, maybe on 4.4.0, where the symbol image seems to be cached. You can change the imagepath, but the image that gets added to the map image is always the default one that is contained in the mapfile. Talking with Sean Gillies, it seems that we need to add a new method call that will allow you to change the imagepath on a symbol that will also replace the cached image. Just adding new symbols dynamically will cause you to hit the MAXSYMBOL limit in map.h so that is not a work-a-round.
Change History (12)
comment:2 by , 19 years ago
Cc: | added |
---|
I don't think I'll be able to get to this any time soon. As I said at the conference this summer, I am pretty much finished with my work on mapscript and moving on to being a user and developer of the C part of mapserver only. Since the actual bug part of this is in the C lib (symbol caching), I'm cc'ing Steve Lime. Please consider creating a new bug in that component to track the symbol caching issue.
comment:3 by , 19 years ago
Status: | new → assigned |
---|
There are a couple of types of image caching going on in MapServer. The symbol drawing code has a built in cache for use when tiles, markers or brushes are generated dynamically. For PIXMAP symbols that is not the case. They are never cached like that- there's no need. So, I assume we're talking about the image that is part of a symbol object. That's not a cache per se... Steve: can you provide a test script that shows the problem? How exactly are you swapping the symbol? Originally you could do something like: $class->{symbol} = 'myfavorite.gif'; ...draw... $class->{symbol} = 'myotherfavorite.gif'; Is that what you're trying? I'm not sure why imagepath is being refered to here it was never intended to be used for anything more than bookeeping. In fact I didn't think symbolObj's were exposed via MapScript until just recently. Regardless seems like a method like setImagepath would do the trick. It would clear any previous image (set symbol->type to PIXMAP?), free the previous imagepath, set a new imagepath and load the new image. Correct? Steve
comment:5 by , 19 years ago
Status: | new → assigned |
---|
Steve: I did commit a new method to the shapeObj API list night. It's called setImagepath and it takes a filename as a parameter. It's basically a wrapper for msGetImageSymbol. I modified that function to clean up any previously allocated img and imagepath values so it should not leak memory. Please give that a try. Sean, assuming this works we should mark imagepath as immutable in mapsymbol.h correct? Steve
comment:6 by , 19 years ago
Cc: | added |
---|
Ok, I've got confirmation from Steve that the fix indeed works. I can back port to 4.6 if necessary. I'll also mark imagepath as immutable in mapsymbol.h. I've included the DM guys so they can add the same method to PHP mapscript... The new method is very simple, it extends the symbolObj and looks like: int setImagepath(constant char *filename) { return msLoadImageSymbol(self, filename); } Steve
comment:8 by , 19 years ago
Component: | MapScript-SWIG → MapServer Documentation |
---|---|
Owner: | changed from | to
Status: | assigned → new |
Changing to a documentation bug at this point. Implemented successfully in both SWIG and PHP MapScript. Steve
comment:10 by , 19 years ago
Owner: | changed from | to
---|
Re-assigning to Perry, he will be taking on my old responsibilities.
comment:12 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sorry I didn't catch this earlier. MapScript API Reference has been updated.
Note:
See TracTickets
for help on using tickets.