Opened 18 years ago

Last modified 14 years ago

#1794 closed defect

mapObj.nextLabel() can be used only once — at Initial Version

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

Description

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;
}

Change History (1)

by eugoss@…, 18 years ago

Attachment: map.i.diff added

mapscript/swiginc/map.i

Note: See TracTickets for help on using tickets.