[fusion-trac] #283: Make Use of MapServer CLASS TITLE in Legend

Fusion trac_fusion at osgeo.org
Wed Sep 9 11:07:16 EDT 2009


#283: Make Use of MapServer CLASS TITLE in Legend
---------------------------+------------------------------------------------
   Reporter:  tnolte       |       Owner:  madair                        
       Type:  enhancement  |      Status:  new                           
   Priority:  P2           |   Milestone:  2.0                           
  Component:  MapServer    |     Version:  2.0 - beta                    
   Severity:  Minor        |    Keywords:  mapserver, layer, class, title
External_id:               |       State:  New                           
    Browser:  All          |          Os:  All                           
---------------------------+------------------------------------------------
 Currently Fusion only uses the CLASS->NAME when setting the legend label
 for classes. It is desirable to have the same level of control that is
 available via METADATA layer naming in the legend. The most appropriate,
 and seemingly standard way to do this is to check for a CLASS->TITLE and
 use that in the legend and default back to the CLASS->NAME if not defined.
 The following small change to the MapServer LoadMap.php, starting around
 line 360, would be needed:

 {{{
 //create classes and slot them into the scale breaks
 for ($j=0; $j<$layer->numclasses; $j++) {
     $oClass = $layer->getClass($j);
     $classObj = NULL;
     // Use formatted legend label as defined by CLASS->TITLE, fallback on
 CLASS->NAME
     $classObj->legendLabel = $oClass->title != '' ? $oClass->title :
 $oClass->name;
     $classObj->filter = $oClass->getExpression();
     $classMin = $oClass->minscale == -1 ? $layerMin :
 max($oClass->minscale, $layerMin);
     $classMax = $oClass->maxscale == -1 ? $layerMax :
 min($oClass->maxscale, $layerMax);
     $classObj->minScale = $classMin;
     $classObj->maxScale = $classMax;
     $classObj->index = $j;
     for ($k=0; $k<count($aScaleRanges); $k++) {
         if ($classMin < $aScaleRanges[$k]->maxScale && $classMax >
 $aScaleRanges[$k]->minScale) {
             array_push($aScaleRanges[$k]->styles, $classObj);
         }
     }
 }
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/fusion/ticket/283>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.


More information about the fusion-trac mailing list