Bug 1835, proposed changes

Tamas Szekeres szekerest at GMAIL.COM
Fri Aug 25 18:04:22 EDT 2006


Developers,

According to the IRC meeting we were agreed in that
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1835
should be handled as a bug. When setting the styleObj.symbolname
styleObj.symbol should also be set by calling msGetSymbolIndex
properly.

I have proposed to impement this by redefining the setter of
styleObj.symbolname, because the interface would remain the same at
the user's perspective. After digging into the code it seems almost
impossible to implement the proposed solution since styleObj does not
contain a reference to the map object so as to call msGetSymbolIndex
properly.

Therefore i will create a new member function for styleObj similarly
to the PHP implementation as:

symbol.i

%extend styleObj {
int setSymbolByName(mapObj *map, char* symbolname)
    {
        self->symbol = msGetSymbolIndex(&map->symbolset, symbolname, MS_TRUE);
        self->symbolname = symbolname;
        return self->symbol;
	}
}


FYI, if the symbolObj would contain a reference to the map the first
one should be implemented as:

 map.h

#ifdef SWIG
%typemap(memberin) char* symbolname {
  $self->symbol = msGetSymbolIndex(&$self->map->symbolset, $input, MS_TRUE);
  $1 = $input;
}
#endif
typedef struct {
...
} styleObj;

#ifdef SWIG
%typemap(memberin) char* symbolname;
#endif

I seems a bit strange to place a typemap to map.h but in this
situation it is inevitable so as to restrict the typemap to the scope
of the styleObj.

Tamas



More information about the mapserver-dev mailing list