Opened 16 years ago
Closed 15 years ago
#2887 closed defect (fixed)
embedded scalebar not updated when redrawing map with different extent
| Reported by: | szigeti | Owned by: | sdlime |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.4 release |
| Component: | MapServer C Library | Version: | svn-trunk (development) |
| Severity: | normal | Keywords: | scalebar resize redraw |
| Cc: | tbonfort |
Description
When redrawing a map with modified extent, the embedded scalebar is not updated (neither colors, nor intervals, etc.)
Workaround: removing the existing scalebar symbol manually resolves the problem. Probably the
s = msGetSymbolIndex(&(map->symbolset), "scalebar", MS_FALSE);
if(s == -1) {
if (msGrowSymbolSet(&map->symbolset) == NULL)
return -1;
s = map->symbolset.numsymbols;
map->symbolset.numsymbols++;
initSymbol(map->symbolset.symbol[s]);
} else {
if(map->symbolset.symbol[s]->img)
gdImageDestroy(map->symbolset.symbol[s]->img);
}
code in mapscale.c isn't sufficient.
Attachments (1)
Change History (9)
follow-up: 3 comment:1 by , 15 years ago
| Status: | new → assigned |
|---|
comment:2 by , 15 years ago
| Milestone: | → 5.4 release |
|---|
comment:3 by , 15 years ago
Replying to sdlime:
What environment are we talking? Must be something long-running...
I've found this in mapscript/java. The code skeleton was sg. like this:
map=new mapObj(...);
while (...){
[...] some layer & extent modification
map.setSize(...);
map.setExtent(...);
imageObj img=map.draw();
[...] setting output
out.write(img.getBytes());
}
comment:4 by , 15 years ago
I've recreated in perl. As near as I can tell the embedding code is correct. A second map draw results in the update of the existing symbol. Changing the scalebar size before a second draw confirms that. It's the computation of the second scalebar that seems to be off but I'm not sure why yet.
Steve
comment:5 by , 15 years ago
| Cc: | added |
|---|
This is specific to AGG. It's doing so image caching to avoid having to convert between GD and AGG pixel buffers I believe. So even though the right scalebar image is in the symbol it's the old on that's being accessed via the cache. CC'ing Thomas for ideas.
Steve
comment:6 by , 15 years ago
Ok, it was just as easy to remove the scalebar symbol the main symbol set (fixed legends too) and re-add it. That does seem to fix things. Will that cause any problems with the image caching in AGG? Would like confirmation from Thomas this is an ok fix before I commit.
Steve
comment:7 by , 15 years ago
Steve, can you show the code for that?
I was going to propose to add an ifdef'd agg cache removal next to
gdImageDestroy(map->symbolset.symbol[s]->img);
by , 15 years ago
| Attachment: | 2887.patch added |
|---|
Patch to remove embedded scalebar/legend symbols and recreate
comment:8 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

What environment are we talking? Must be something long-running...
Steve