[mapguide-commits] r6277 - trunk/MgDev/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Dec 2 07:53:58 EST 2011


Author: jng
Date: 2011-12-02 04:53:58 -0800 (Fri, 02 Dec 2011)
New Revision: 6277

Modified:
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
   trunk/MgDev/Web/src/viewerfiles/legendctrl.templ
   trunk/MgDev/Web/src/viewerfiles/legendui.templ
Log:
#1710: Apply bruno's patch

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-12-02 12:08:12 UTC (rev 6276)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-12-02 12:53:58 UTC (rev 6277)
@@ -653,7 +653,10 @@
 {
     if(!hasTiles)
         return;
-    visGroups = GetLegendCtrl().GetBaseGroups(true);
+    for(var gr in visBaseGroups.items){
+      visBaseGroups.removeItem(gr);
+    }
+    visGroups = GetLegendCtrl().GetBaseGroups(true,curScale);
     for(var i=0; i < visGroups.length; i++)
         visBaseGroups.setItem(visGroups[i], i);
 }

Modified: trunk/MgDev/Web/src/viewerfiles/legendctrl.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/legendctrl.templ	2011-12-02 12:08:12 UTC (rev 6276)
+++ trunk/MgDev/Web/src/viewerfiles/legendctrl.templ	2011-12-02 12:53:58 UTC (rev 6277)
@@ -37,9 +37,9 @@
     return thisFrame.legendUiFrame.GetLayers(onlyVisible, onlySelectable);
 }
 
-function GetBaseGroups(onlyVisible)
+function GetBaseGroups(onlyVisible,scale)
 {
-    return thisFrame.legendUiFrame.GetBaseGroups(onlyVisible);
+    return thisFrame.legendUiFrame.GetBaseGroups(onlyVisible,scale);
 }
 
 // private functions -----------------------------------------------

Modified: trunk/MgDev/Web/src/viewerfiles/legendui.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/legendui.templ	2011-12-02 12:08:12 UTC (rev 6276)
+++ trunk/MgDev/Web/src/viewerfiles/legendui.templ	2011-12-02 12:53:58 UTC (rev 6277)
@@ -1087,8 +1087,25 @@
     }
 }
 
-function GetBaseGroups(visOnly)
+function IsBaseGroupLayersVisible(baseGroup,scale)
 {
+  for(var i=0; i < baseGroup.children.length; i++)
+  {
+    var layerTree = baseGroup.children[i];
+    for( var j=0; j < layerTree.children.length;j++ )
+    {
+      var style = layerTree.children[j];
+      if(scale >= style.min && scale <= style.max)
+      {
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
+function GetBaseGroups(visOnly,scale)
+{
     if(tree == null)
         return null;
     groups = new Array();
@@ -1100,6 +1117,8 @@
             {
                 if(visOnly && !tree[i].visible)
                     continue;
+                if(scale && visOnly && !IsBaseGroupLayersVisible(tree[i],scale))
+                    continue;
                 groups.push(tree[i].name);
             }
         }



More information about the mapguide-commits mailing list