[Mapserver-users] help with adding labels/annotation, please
Haiyan Liu
hliu at jdbarnes.com
Wed Apr 14 08:58:14 PDT 2004
Oh yeah, call that drawLabelCache(0 fixed my problem. Let you know.
-Haiyan
On Tue, 2004-04-13 at 13:22, Haiyan Liu wrote:
> Hi all,
>
> I had some problem with adding annotation to my map. I wrapped some
> codes(see Dylan Keon's posting) posted in this list into my function(see
> below). I created the map file. But what I got is just a blank image.
> Can anyone tell me what is going wrong in my situation? Thanks.
>
> // draw annotation on passed in image
> // @param: float $x, $y
> // @param: string $layer_name -- annotation layer name
> // @param: string $text -- for label
> // $param: reference of imageObj $image
>
> function addLabel($x, $y, $layer_name, $text, &$image){
> $pt = ms_newLineObj();
> $pt->addXY($x, $y);
>
> $shape = ms_newShapeObj(MS_SHAPE_LINE);
> $shape->set('classindex', 0);
> $shape->set('text', $text); // assign the label
> $shape->add($pt);
> // note: $map is a member var in my map class
> $layer = $this->map->getLayerByName($layer_name);
> $layer->set("status", 1);
>
> $layer->addFeature($shape);
> $layer->draw($image);
>
> //$shape->draw($this->map, $layer, $image);
>
> $pt->free();
> $shape->free();
> }
>
>
> #=============================================
>
> LAYER
> NAME pin_text
> STATUS ON
> TYPE ANNOTATION
> FEATURE
> END
> CLASS
> LABEL
> TYPE TRUETYPE
> FONT arial
> SIZE 10
> COLOR 250 0 0
> POSITION UC
> FORCE TRUE
> END
> END
> END
>
> #=============================================
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list