[Mapserver-users] legendObj outlinecolor property does not exist?
Gerald Buckmaster
gbuckmaster at cox.net
Mon May 26 19:40:16 PDT 2003
All,
Disregard the irrelevant ramblings about truetype with this exception:
The legendObj rendered text (type unknown, though I asked for truetype) with
the size property set; the scalebarObj did not - it errored. As soon as I
remarked out the "$my_lg_label->set(size, 10);" on the labelObjects of both
major objects, it worked.
I still have no outline around the legend. Probably something simple.
Gerald
On Monday 26 May 2003 07:21 pm, Gerald Buckmaster wrote:
> Daniel,
>
> Thanks, but apparently it still does not display an outline around the
> legend, but something did mess with my truetype on a different class
> object. My truetype support died on the labelObj of scalebarObj...still
> works fine on the labelObj of the legendObj (already tried a few
> minsize-maxsize scalings). I get an error in the Apache error_log: PHP
> Fatal error: MapServer Error in msGetBitmapFont(): Invalid bitmap font.
> Must be one of tiny, small, medium, large or giant.
>
> The scalebarObj label is exactly the same (even copy-pasted) as the
> legendObj label but gives me this error. This file is the only code I've
> messed with (font scaling worked fine before on both major objects), so I
> think it may be tied somehow to modifications to the ColorObj's. I don't
> know...just wild stabs in the dark.
>
> This script works great, but doesn't render an outline around the legend.
>
> /* BUILD LEGEND */
> $my_legend = $map->legend;
> $my_legend->set(height, 80);
> $my_legend->set(width, 160);
> $my_legend->imagecolor->setRGB(240,220,200); # tan
> $my_legend->outlinecolor->setRGB(1,1,1); # black
> $my_legend->set(status, MS_EMBED);
> $my_legend->set(position, MS_UL);
> /* SET LEGEND LABEL PROPERTIES */
> $my_lg_label = $my_legend->label;
> $my_lg_label->set(font, "arial");
> $my_lg_label->set(type, MS_TRUETYPE);
> $my_lg_label->set(size, 10);
> $my_lg_label->set(minsize, 6);
> $my_lg_label->set(maxsize, 12);
> $my_lg_label->color->setRGB(100,100,100);
> $my_legend->set(postlabelcache, MS_TRUE);
> /* DRAW LEGEND */
> $map->drawLegend();
>
> This script generates the BITMAP error indicated above.
>
> /* BUILD SCALEBAR */
> $my_scalebar = $map->scalebar;
> $my_scalebar->set(height, 6);
> $my_scalebar->set(width, 300);
> $my_scalebar->set(intervals, 10);
> $my_scalebar->set(units, MS_KILOMETERS);
> $my_scalebar->set(status, MS_EMBED);
> $my_scalebar->set(position, MS_LC); # lower center
> $my_scalebar->color->setRGB(200,10,10); # maroon
> $my_scalebar->backgroundcolor->setRGB(10,100,10); # evergreen
> $my_scalebar->outlinecolor->setRGB(255,255,255); # white
> $my_scalebar->imagecolor->setRGB(20,255,90); # bright green
> /* SET SCALEBAR LABEL PROPERTIES */
> $my_sb_label = $my_scalebar->label;
> $my_sb_label->set(font, "arial");
> $my_sb_label->set(type, MS_TRUETYPE);
> $my_sb_label->set(size, 10);
> $my_sb_label->set(minsize, 6);
> $my_sb_label->set(maxsize, 12);
> $my_sb_label->color->setRGB(100,100,100);
> $my_scalebar->set(postlabelcache, MS_TRUE);
> /* DRAW SCALEBAR */
> $map->drawScalebar(); # <--- ERROR ON THIS LINE
>
> So, in summary, It looks like labelObj's attached to ScalebarObj do not
> like MS_TRUETYPE as a type, or the integer style property is mandatory,
> regardless of type, or I'm in over my head.
>
> Thanks...this is getting interesting.
>
> Gerald
>
> On Monday 26 May 2003 04:43 pm, Daniel Morissette wrote:
> > Ooopps, you're talking about the legendObj, not the classObj... I should
> > have read your message more closely before responding... duh!
> >
> > This change should also be described in the migration guide, but it's a
> > different story: the legend->outlinecolor is now of type ColorObj like
> > all other color variables in mapscript, so you access it this way:
> >
> > $my_legend->outlinecolor->setRGB(255,0,0);
> >
> > Daniel
> >
> > Daniel Morissette wrote:
> > > The class outlinecolor has been moved to a new style object in version
> > > 4.0dev. You can get the latest PHP MapScript 4.0 (a.k.a. 3.7) docs at:
> > > http://www2.dmsolutions.ca/mapserver/dl/mapserver-3.7-dev-PHP-MAPSCRIPT
> > >-R EADME.txt
> > >
> > > See also the migration guide in the wiki for a more complete list of
> > > changes between 3.6 and 4.0:
> > > http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?MigrationGuide
> > >
> > > Daniel
More information about the MapServer-users
mailing list