[fusion-commits] r2227 - sandbox/jxlib-3.0/layers/MapServer/php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Sep 13 07:57:00 EDT 2010


Author: pagameba
Date: 2010-09-13 11:57:00 +0000 (Mon, 13 Sep 2010)
New Revision: 2227

Modified:
   sandbox/jxlib-3.0/layers/MapServer/php/LoadMap.php
   sandbox/jxlib-3.0/layers/MapServer/php/LoadScaleRanges.php
Log:
use class-level metadata for displayInLegend and legendLabel.

Modified: sandbox/jxlib-3.0/layers/MapServer/php/LoadMap.php
===================================================================
--- sandbox/jxlib-3.0/layers/MapServer/php/LoadMap.php	2010-09-10 18:35:41 UTC (rev 2226)
+++ sandbox/jxlib-3.0/layers/MapServer/php/LoadMap.php	2010-09-13 11:57:00 UTC (rev 2227)
@@ -329,20 +329,24 @@
          //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
-             $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);
-                 }
+             $displayInLegend = strtolower($oClass->getMetaData('displayInLegend')) == 'false' ? false : true;
+             if ($displayInLegend) {
+               $title = $oClass->getMetaData('legendlabel');
+               $classObj = NULL;
+               // Use formatted legend label as defined by CLASS->TITLE
+               $classObj->legendLabel = $title != '' ? $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);
+                   }
+               }
              }
          }
          //$layerObj->scaleRanges = $aScaleRanges;

Modified: sandbox/jxlib-3.0/layers/MapServer/php/LoadScaleRanges.php
===================================================================
--- sandbox/jxlib-3.0/layers/MapServer/php/LoadScaleRanges.php	2010-09-10 18:35:41 UTC (rev 2226)
+++ sandbox/jxlib-3.0/layers/MapServer/php/LoadScaleRanges.php	2010-09-13 11:57:00 UTC (rev 2227)
@@ -136,22 +136,26 @@
 		//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
-			$classObj->legendLabel = $oClass->title != '' ? $oClass->title : $oClass->name;
-			//$classObj->legendLabel = $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);
-				}
-			}
+			$displayInLegend = strtolower($oClass->getMetaData('displayInLegend')) == 'false' ? false : true;
+      if ($displayInLegend) {
+        $title = $oClass->getMetaData('legendlabel');
+        $classObj = NULL;
+  			// Use formatted legend label as defined by CLASS->TITLE
+  			$classObj->legendLabel = $title != '' ? $title : $oClass->name;
+  			//$classObj->legendLabel = $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);
+  				}
+  			}
+      }
 		}
 		//$layerObj->scaleRanges = $aScaleRanges;
 		$_SESSION['scale_ranges'][$mapName][$layer->name] = $aScaleRanges;



More information about the fusion-commits mailing list