Opened 13 years ago

Last modified 12 years ago

#4067 new defect

set a Style property for a Line type layer using php mapscript

Reported by: juanpablomx Owned by: aboudreault
Priority: highest Milestone: 6.0.1 release
Component: MapScript-PHP Version: 6.0
Severity: critical Keywords: set styleobj mapscript php
Cc:

Description

I'm using mapscript to add layers to my map file. The problem is that when i want to add a style to the class that a use in that layer it does work.

The layer is a Line type, and i want to set the color and the width for this layer.

$objLayer[$key] = ms_newLayerObj($map); $objLayer[$key]->set( "name", $valuecarto_nom); $objLayer[$key]->set( "type", $valuems_type); $objLayer[$key]->set( "status", MS_ON); $objLayer[$key]->set( "data", $map_path.$valuearchivo); $objLayer[$key]->setProjection($proy[$valueid_carto_ms]);

foreach($clase[$valueid_carto_ms] as $keyC => $vClase) {

$objClase[$valueid_carto_ms][$keyC]=ms_newClassObj($objLayer[$key]); $objClase[$valueid_carto_ms][$keyC]->set('name',$vClasenombre); foreach($estilo[$valueid_carto_ms][$keyC] as $keyE => $vEstilo) { $objEstilo[$valueid_carto_ms][$keyC][$keyE]=new StyleObj($objClase[$valueid_carto_ms][$keyC]); if($vEstiloid_simbolo!=0)

{ $objEstilo[$valueid_carto_ms][$keyC][$keyE]->set('symbol', $vEstiloid_simbolo); } if($vEstilocolor!=) { $color=explode(' ', $vEstilocolor); $objEstilo[$valueid_carto_ms][$keyC][$keyE]->color->setRGB(0,0,255); } if($vEstilocolor_linea!=) { $color_linea=explode(' ', $vEstilocolor_linea); $objEstilo[$valueid_carto_ms][$keyC][$keyE]->outlinecolor->setRGB($color_linea[0],$color_linea[1],$color_linea[2]); } if($vEstilocolor_fondo!=) { $color_fondo=explode(' ', $vEstilocolor_fondo); $objEstilo[$valueid_carto_ms][$keyC][$keyE]->backgroundcolor->setRGB($color_fondo[0],$color_fondo[1],$color_fondo[2]); } if($vEstilotamanio>0) { $objEstilo[$valueid_carto_ms][$keyC][$keyE]->set('size', $vstilotamanio); } if($vEstiloancho>0) { $objEstilo[$valueid_carto_ms][$keyC][$keyE]->set('width', $vEstiloancho); }

} } $image=$map->draw(); $image_url=$image->saveWebImage();

Change History (1)

comment:1 by iap, 12 years ago

Can you paste the code into a pastebin ? Also try to use a minimal example so the issue can be easily reproduced.

Note: See TracTickets for help on using tickets.