[fusion-commits] r1641 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Nov 6 12:54:37 EST 2008


Author: pagameba
Date: 2008-11-06 12:54:37 -0500 (Thu, 06 Nov 2008)
New Revision: 1641

Modified:
   trunk/widgets/Legend.js
Log:
Fixes #147.  Use the layerTypes array to determine if the layer is a raster layer or not.  Just using the style no longer works because there are no styles for raster layers.

Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2008-11-05 19:02:44 UTC (rev 1640)
+++ trunk/widgets/Legend.js	2008-11-06 17:54:37 UTC (rev 1641)
@@ -560,7 +560,7 @@
                 }               
             }
             layer.legend.treeItem.checkBox.checked = layer.visible?true:false;
-            if (range.styles.length > 0) {
+            if (layer.layerTypes[0] == 4 || range.styles.length > 0) {
               layer.legend.treeItem.checkBox.disabled = false;
             } else {
               layer.legend.treeItem.checkBox.disabled = true;
@@ -623,19 +623,15 @@
             opt.label = style.legendLabel == '' ? ' ' : style.legendLabel;
             opt.draw = this.renderItem;
         }
-        if (!style) {
-            opt.image = this.imgDisabledLayerIcon;
-            opt.enabled = false;
-        } else {
-          if (style.staticIcon) {
-            if (style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
-              opt.image = this.imgLayerDWFIcon;
+        if (layer.layerTypes[0] == 4) {
+            if (style && style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
+                opt.image = this.imgLayerDWFIcon;
             } else {
-              opt.image = this.imgLayerRasterIcon;
+                opt.image = this.imgLayerRasterIcon;
             }
-          } else {
-            opt.image = style.getLegendImageURL(scale, layer);
-          }
+        } else if (!style) {
+            opt.image = this.imgDisabledLayerIcon;
+            opt.enabled = false;
         }
        
         var item = new Jx.TreeItem(opt);



More information about the fusion-commits mailing list