Opened 18 years ago

Closed 14 years ago

Last modified 14 years ago

#1794 closed defect (fixed)

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)

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 (1)

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

Download all attachments as: .zip

Change History (13)

by eugoss@…, 18 years ago

Attachment: map.i.diff added

mapscript/swiginc/map.i

comment:1 by sdlime, 18 years ago

Status: newassigned

comment:2 by sdlime, 18 years ago

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

Steve

comment:3 by eugoss@…, 18 years ago

Thank you very much.

comment:4 by sdlime, 18 years ago

Component: MapScript-SWIGMapScript-PHP
Owner: changed from sdlime to mapserverbugs
Status: assignednew
This has been committed to CVS head so SWIG/MapScript is ok now. Re-assigning to
PHP/MapScript component.

Steve

comment:5 by dmorissette, 17 years ago

Description: modified (diff)
Milestone: 5.0 release
Owner: changed from mapserverbugs to dmorissette

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

comment:6 by dmorissette, 17 years ago

Milestone: 5.0 release5.2 release

comment:7 by dmorissette, 16 years ago

Milestone: 5.2 release5.4 release

comment:8 by dmorissette, 15 years ago

Milestone: 5.4 release6.0 release

comment:9 by dmorissette, 14 years ago

Cc: dmorissette added
Owner: changed from dmorissette to aboudreault

comment:10 by aboudreault, 14 years ago

Resolution: fixed
Status: newclosed

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

comment:11 by aboudreault, 14 years ago

Cc: jmckenna added
Component: MapScript-PHPMapServer Documentation

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

comment:12 by jmckenna, 14 years ago

ok will review updated docs

Note: See TracTickets for help on using tickets.