[mapserver-users] can't set class obj's color in php
Pushkar Pradhan
pushkar at ERC.MsState.Edu
Mon Jun 10 21:02:47 PDT 2002
Thanks Daniel,
That was careless of me. Anyway got that part working but another problem
by this code is also very difficult to find:
$cl = array();
for($c = 0; $c < count($tmp->numclasses); $c++) { // 2 classes in .map
$cl[$c]= $tmp->getClass($c);
echo "class index $c";
$status = $cl[$c]->set("color", $map->addColor(255, 0, 0));
}
This code executes only once, browser displays echo statem. only once,
the second layer must also be red but it doesn't change, I don't know if
this is a php problem or mapscript is causing it to jump out of for loop.
Bye,
> Pushkar Pradhan wrote:
> >
> > I am stuck, not able to set a class obj's color in mapscript,
> > code:
> > for($c = 0; $c < count($tmp->numclasses); $c++) {
> > echo "class index $c";
> > $cl1 = $tmp->getClass($c);
> > $cl1->set("color", "255 0 0");
> > }
> >
>
> The 'color' class member in MapScript is a color index... so try this:
>
> $cl1->set("color", $map->addColor(255, 0, 0));
>
> --
> ------------------------------------------------------------
> Daniel Morissette morissette at dmsolutions.ca
> DM Solutions Group http://www.dmsolutions.ca/
> ------------------------------------------------------------
> Don't put for tomorrow what you can do today, because if
> you enjoy it today you can do it again tomorrow.
>
-Pushkar S. Pradhan
More information about the MapServer-users
mailing list