[Mapserver-users] legendObj outlinecolor property does not exist?

Paul Spencer spencer@dmsolutions.ca
Mon, 26 May 2003 22:34:52 -0400


Gerald, I believe that you are right in thinking that you cannot use 
truetype fonts for scalebar objects :)

Cheers,

Paul

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
>>>
>>>Gerald Buckmaster wrote:
>>>
>>>>Greetings,
>>>>
>>>>In the process of learning how to code PHP/Mapscript applications, I
>>>>ran across a possible removal of a property from the legendObj class. 
>>>>My Linux system consists of 2.4.21-0.13mdk, PHP Version 4.3.2RC3, and
>>>>MapServer version 4.0 (development) OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
>>>>SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER INPUT=TIFF
>>>>INPUT=EPPL7 INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL
>>>>INPUT=SHAPEFILE.
>>>>
>>>>When the code (offending portion remarked out) below is executed,
>>>>nothing is displayed and I get the following error in my Apache
>>>>error_log: PHP Fatal error:  Property 'outlinecolor' does not exist in
>>>>legend object.
>>>>
>>>>        $my_legend = $map->legend;
>>>>        $my_legend->set(height, 80);
>>>>        $my_legend->set(width, 160);
>>>>        #$my_legend->set(outlinecolor, 1);
>>>>        $my_legend->set(status, MS_EMBED);
>>>>        $my_legend->set(position, MS_UL);
>>>>        $my_legend->set(postlabelcache, MS_TRUE);
>>>>        $map->drawLegend();
>>>>
>>>>BTW, when the offending line (concerning outlinecolor) is remarked out,
>>>>the applications works perfectly.
>>>>
>>>>According to DM Solutions documentation on Mapscript 3.6, located at:
>>>>http://www2.dmsolutions.ca/webtools/php_mapscript/php_mapscript_docs36.
>>>>html
>>>>
>>>>The property does exist as shown below:
>>>>
>>>>legendObj Class
>>>> -----------
>>>>
>>>> Constructor:
>>>>
>>>>   Instances of legendObj are always are always embedded inside the
>>>>mapObj.
>>>>
>>>> Members:
>>>>
>>>>   int height;
>>>>   int width;
>>>>   int keysizex;
>>>>   int keysizey;
>>>>   int keyspacingx;
>>>>   int keyspacingy;
>>>>   int outlinecolor; //Color of outline of box, -1 for no outline
>>>>   int status; //MS_ON, MS_OFF, MS_EMBED
>>>>   int position; //for embeded legends, MS_UL, MS_UC, ...
>>>>   int transparent;
>>>>   int interlace;
>>>>   int postlabelcache; //MS_TRUE, MS_FALSE
>>>>   labelObj label;
>>>>   colorObj imagecolor;
>>>>   string   template
>>>>
>>>>Did this property get dropped in the recent development, or did I miss
>>>>something in the build of of Mapserver 4.0 dev?  More importantly, can
>>>>I duplicate the functionality of the outlinecolor property of legendObj
>>>>with other code?
>>>>
>>>>Thanks,
>>>>
>>>>Gerald
> 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users@lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 

-- 
Paul Spencer
Applications and Software Development
DM Solutions Group Inc.
http://www.dmsolutions.ca


_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users