[Mapserver-users] How to set class' color by code.

Vinko Vrsalovic vinko at cprsig.cl
Sat Sep 6 23:11:32 EDT 2003


On Sat, Sep 06, 2003 at 01:29:17PM +0700, Krung Saengpole wrote:
> Hi all,
> 
> I want to set the class' color by code using PHPMapscript/PHP4.3.2 on Windows XP but have no luck.  I didn't find any members or methods of ClassObj to set its color. Can I do this? (Not set color of LABEL in CLASS) e.g.
> 
> $class=ms_newClassObj($layer);
> $class->....# how to set class color

I guess you're using MapServer 4.0.

There's a new StyleObj that manages the colors and symbols of a class.

So, now you have the ClassObj that has an instance of a LabelObj and an
instance of a StyleObj (or more than one).

$class = ms_newClassObj($layer);
$style = ms_newStyleObj($class);
$style->color->setRGB(0,0,0); // New method for adding colors

BTW, what's the use of having more than one style per class?

-- 
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl



More information about the mapserver-users mailing list