[fusion-commits] r2060 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Feb 8 21:13:44 EST 2010


Author: liuar
Date: 2010-02-08 21:13:42 -0500 (Mon, 08 Feb 2010)
New Revision: 2060

Modified:
   trunk/widgets/Legend.js
Log:
Fixed ticket #306 Legend panel is empty with Raster/WMS data source

Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2010-02-08 17:00:47 UTC (rev 2059)
+++ trunk/widgets/Legend.js	2010-02-09 02:13:42 UTC (rev 2060)
@@ -717,23 +717,25 @@
             opt.label = style.legendLabel == '' ? ' ' : style.legendLabel;
             opt.draw = this.renderItem;
         }
+        
         if (!style) {
             opt.image = this.imgDisabledLayerIcon;
             opt.enabled = false;
         } else {
-           var defaultIcon = this.imgDisabledLayerIcon;
-           if (layer.layerTypes[0] == 4) {
-               if (style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
-                 defaultIcon = this.imgLayerDWFIcon;
-              } else {
-                defaultIcon = this.imgLayerRasterIcon;
-              }
+            if(style.iconOpt && style.iconOpt.url){
+                opt.image = style.iconOpt.url;
+            }else{
+                opt.image = layer.oMap.getLegendImageURL(scale, layer, style);
             }
-            if (style.iconOpt && style.iconOpt.url) {
-                opt.image = style.iconOpt.url;
+        }
+        // MapGuide DWF and Raster layer
+        if (layer.layerTypes[0] == 4) {
+            if (style && style.staticIcon == Fusion.Constant.LAYER_DWF_TYPE) {
+                opt.image = this.imgLayerDWFIcon;
             } else {
-                opt.image = layer.oMap.getLegendImageURL(scale, layer, style, defaultIcon);
+                opt.image = this.imgLayerRasterIcon;
             }
+            opt.enabled = true;
         }
         opt.contextMenu = this.getContextMenu();
 



More information about the fusion-commits mailing list