Opened 15 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)

2887.patch (3.4 KB ) - added by sdlime 15 years ago.
Patch to remove embedded scalebar/legend symbols and recreate

Download all attachments as: .zip

Change History (9)

comment:1 by sdlime, 15 years ago

Status: newassigned

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

Steve

comment:2 by sdlime, 15 years ago

Milestone: 5.4 release

in reply to:  1 comment:3 by szigeti, 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 sdlime, 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 sdlime, 15 years ago

Cc: tbonfort 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 sdlime, 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 tbonfort, 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 sdlime, 15 years ago

Attachment: 2887.patch added

Patch to remove embedded scalebar/legend symbols and recreate

comment:8 by sdlime, 15 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.