[Mapserver-users] can I use different symbols in thesamedynamiclayer?

Vinko Vrsalovic vinko at cprsig.cl
Tue Sep 30 11:54:04 EDT 2003


On Tue, Sep 30, 2003 at 01:43:15PM +0200, Frieso ter Haseborg wrote:
> Hi Vinko,
> 
> >>Sounds good to me, but why can I change the symbol on using only ONE
> >>class?
> >I don't know. I've never done it that way, maybe it's a useful bug :-)
> 
> Okay but only useful when there's no need to colorize the different
> symbols. ;-)
> Let's leave it at that.
 
Well, as Daniel said, the labelcache must be the responsible of your
problem with doing it in one class. If you don't have labelcache set on your
layer then something smells rotten in Germany ;-)
 
> >>// transfer label-information THIS FAILES!
> >>$newclass->label=$originalclass->label;     
> >I'd do this $newclass->label->set("font",$originalclass->label->font),
> >etc.
> 
> YES! Success at last. *bg* Thank you very much! 
> 
> Even if this gets slowly off topic - if you will excuse me - what's
> wrong with $newclass->label=$originalclass->label;
> 
> I must have a wrong understanding of the class-handling in
> PHP/MapScript. I thought I could transfer the whole sub-class (member)
> e.g. the label with all it's attributes set to another class. At least
> when I use a class in a class with pure PHP such operations are no
> problems, the sub-class with all it's attributes is given to the new
> class.
> 

Yes, but in PHP you don't need a special set() method
$object->set(string $attribute, mixed $value) to set the value of
attributes. I'm not sure, but that is probably is due to the way the 
MapServer C library wrapper is done, I recall reading something about 
this in the list some months ago.

> >> Yes a example would be a great help!
> >$add = $this->figures->getByType('polygon');
> >for ($i=0;$i<count($poly);$i++) {
> >	$line = ms_newLineObj();
> >	while ($pt = $poly[$i]->getPoint()) {
> >		$line->addXY($pt['x'],$pt['y'],0);
> >	}
> >	$shp = ms_newShapeObj(MS_SHAPE_POLYGON);
> >	$shp->add($line);
> >	$shp->set('text',$poly[$i]->getId());
> >	$shp->set("classindex",0);
> >	$lyr->layer->addFeature($shp);
> >}
> 
> But this way doesn't spare handling with one individual class per
> symbol, does it? I think I missed the advantage.

That you can add polygons and lines too... 

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



More information about the mapserver-users mailing list