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 :


------------------------------------------------------------------------

Reply via email to