Ticket #283 (closed enhancement: fixed)
Make Use of MapServer CLASS TITLE in Legend
| Reported by: | tnolte | Owned by: | tnolte |
|---|---|---|---|
| Priority: | P2 | Milestone: | 2.0 |
| Component: | MapServer | Version: | 2.0 - beta |
| Severity: | Minor | Keywords: | mapserver, layer, class, title |
| Cc: | External ID: | ||
| state: | Committed | Browser: | All |
| Operating System: | All |
Description
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);
}
}
}
Change History
Note: See
TracTickets for help on using
tickets.
