[fusion-commits] r1934 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Oct 7 11:29:36 EDT 2009


Author: pdeschamps
Date: 2009-10-07 11:29:35 -0400 (Wed, 07 Oct 2009)
New Revision: 1934

Modified:
   trunk/widgets/Legend.js
Log:
Adding logic to allow the legend widget to display raster icons


Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2009-10-07 15:28:51 UTC (rev 1933)
+++ trunk/widgets/Legend.js	2009-10-07 15:29:35 UTC (rev 1934)
@@ -146,7 +146,7 @@
      */
     renderLegend: function() {},
     
-    /**
+    /**defaultDisabledLayerIcon
      * Method: mapLoading
      * Abstract method that handle the event: Fusion.Event.MAP_LOADING. This method
      * is optional.
@@ -668,21 +668,26 @@
             opt.label = style.legendLabel == '' ? ' ' : style.legendLabel;
             opt.draw = this.renderItem;
         }
-        if (layer.layerTypes[0] == 4) {
-            if (style && style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
-                opt.image = this.imgLayerDWFIcon;
-            } else {
-                opt.image = this.imgLayerRasterIcon;
-            }
-        } else if (!style) {
+        if (!style) {
             opt.image = this.imgDisabledLayerIcon;
             opt.enabled = false;
         } else {
-            opt.image = layer.oMap.getLegendImageURL(scale, layer, style);
+           var defaultIcon = this.imgDisabledLayerIcon;
+           if (layer.layerTypes[0] == 4) {
+               if (style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
+                 defaultIcon = this.imgLayerDWFIcon;
+              } else {
+                defaultIcon = this.imgLayerRasterIcon;
+              }
+            }
+            opt.image = layer.oMap.getLegendImageURL(scale, layer, style, defaultIcon);
         }
-        opt.contextMenu = this.getContextMenu(); 
+        opt.contextMenu = this.getContextMenu();
 
         var item = new Jx.TreeItem(opt);
+
+
+        
         if (bCheckBox) {
             //item.domObj.insertBefore(layer.legend.checkBox, item.domObj.childNodes[1]);
             /* only need to add layer info if it has a check box too */



More information about the fusion-commits mailing list