Ticket #1794 (closed defect: fixed)

Opened 7 years ago

Last modified 3 years ago

mapObj.nextLabel() can be used only once

Reported by: eugoss@… Owned by: aboudreault
Priority: high Milestone: 6.0 release
Component: Documentation - MapServer Version: 4.8
Severity: normal Keywords:
Cc: dmorissette, jmckenna

Description (last modified by dmorissette) (diff)

As mapObj.nextLabel() contains a static variable in its body (see below), it cannot be invoked several times to retrieve labelCacheMemberObj objects of a map. And due to the same reason, it cannot be used in multithreaded environment.

Is it possible to implement something like labelCacheObj.getLabel(index) to access labelCacheMemberObj objects through mapObj.labelcache or modify nextLabel() to allow at least to reset an index in it?

By the way, there is already labelCacheObj.labels holding all labelCacheMemberObj objects. It could be nice to have a couple of set/get for it.

// nextLabel() in question
static labelCacheMemberObj *nextLabel(mapObj *self) {
    static int i = 0;
    if (i < self->labelcache.numlabels)
        return &(self->labelcache.labels[i++]);
    else
        return NULL;
}

Attachments

map.i.diff Download (398 bytes) - added by eugoss@… 7 years ago.
mapscript/swiginc/map.i

Change History

Changed 7 years ago by eugoss@…

mapscript/swiginc/map.i

Changed 7 years ago by sdlime

  • status changed from new to assigned

Changed 7 years ago by sdlime

  • cc assefa@… added
This is a reasonable solution. I'll patch Swig/MapScript and have CC'd Assefa 
for PHP...

Steve

Changed 7 years ago by eugoss@…

Thank you very much.

Changed 7 years ago by sdlime

  • owner changed from sdlime to mapserverbugs
  • status changed from assigned to new
  • component changed from MapScript-SWIG to MapScript-PHP
This has been committed to CVS head so SWIG/MapScript is ok now. Re-assigning to
PHP/MapScript component.

Steve

Changed 6 years ago by dmorissette

  • owner changed from mapserverbugs to dmorissette
  • description modified (diff)
  • milestone set to 5.0 release

I'll take this bug. The issue of nextLabel() vs getlabel(i) has come up again while working on the label priority (RFC-27).

Changed 6 years ago by dmorissette

  • milestone changed from 5.0 release to 5.2 release

Changed 5 years ago by dmorissette

  • milestone changed from 5.2 release to 5.4 release

Changed 4 years ago by dmorissette

  • milestone changed from 5.4 release to 6.0 release

Changed 3 years ago by dmorissette

  • cc dmorissette added
  • owner changed from dmorissette to aboudreault

Changed 3 years ago by aboudreault

  • status changed from new to closed
  • resolution set to fixed

The method map::getLabel has been added in PHP mascript in r9744. The documentation has been updated in r9746.

Changed 3 years ago by aboudreault

  • cc jmckenna added
  • component changed from MapScript-PHP to MapServer Documentation

jmckenna, may you review my documentation update to check if it's ok ? (r9746 and r9747)

Changed 3 years ago by jmckenna

ok will review updated docs

Note: See TracTickets for help on using tickets.