Hi Steff: The problem is (I think) that transparency is applied at the layer
level, not at the
feature level. The feature level 'draw' methods then bypass the transparency
code altogether.
So what/how you are trying to do is not possible. I'm not sure what's up with
the label backgroundcolor
but I'm pretty sure on the first problem. I'm hopeful that 5.0 will be able to
auto detect situations
where alpha blending should be applied and this limitation will go away.
The workaround is to add features to layers first and then use the layer or map
level draw methods.
I can't quite tell how big a problem that will be for you by looking at the
code. I think if you convert
each class in the mobileLayer to a layer itself (each with one class) that it
might be possible.
Steve
>>> Stéphane RIFF <[EMAIL PROTECTED]> 1/29/2007 9:36 AM >>>
Haven't found a workaround yet.
Really anyone can help me ???
Thanks again,
Steff
Stéphane RIFF wrote:
> Hi everybody,
>
> I have a little problem on the draw function with the pointObj class.
> I want to add point dynamically from a postgis database with
> PHPMapscript.
> So I get the coordinates from postgis and draw the point with
> pointObj->draw(...) function.
> The problem is that my pixmap symbols doesn't have the transparency
> activated and my label doesn't have background color.
>
> I use the code below :
>
> $mobileLayer = ms_newLayerObj($map);
> $mobileLayer->set("name","Mobiles");
> $mobileLayer->set("type",MS_LAYER_POINT);
> $mobileLayer->set("status",MS_ON);
> $mobileLayer->set("transparency",MS_GD_ALPHA);
> $mobileLayer->set("labelcache",MS_OFF);
> $mobileLayer->setProjection("init=epsg:4326",MS_TRUE);
> $a_class = array();
> for($row=0;$row<pg_num_rows($result);$row++)
> {
> $lon = pg_fetch_result($result,$row,0);
> $lat = pg_fetch_result($result,$row,1);
> $ico = pg_fetch_result($result,$row,2);
> $sid = pg_fetch_result($result,$row,3);
> if(!in_array($ico,$a_class))
> {
> array_push($a_class,$ico);
> $mobileClass = ms_newClassObj($mobileLayer);
> $mobileClass->set("name",$ico);
> $mobileStyle = ms_newStyleObj($mobileClass);
> $mobileStyle->set("symbolname",$cfg_root."images/symbols/".$ico);
> $mobileLabel = $mobileClass->label;
> $mobileLabel->set("font","Arialbd");
> $mobileLabel->set("size",12);
> $mobileLabel->set("type",MS_TRUETYPE);
> $mobileLabel->set("offsety",-22);
> $mobileLabel->color->setRGB(255,0,0);
> $mobileLabel->backgroundcolor->setRGB(255,0,0);
> }
> $class_index = 0;
> for($cl=0;$cl<$mobileLayer->numclasses;$cl++) {
> $class = $mobileLayer->getClass($cl);
> if($class->name == $ico) {
> $class_index = $cl;
> }
> }
> $point = ms_newPointObj();
> $point->setXY($lon,$lat);
> if($point->draw($map, $mobileLayer, $imgObj, $class_index, $sid) ==
> MS_FAILURE)
> print("error drawing point");
> }
>
> The result image is like that the one attached :
>
>
> ------------------------------------------------------------------------
>