[mapguide-commits] r7110 - branches/2.4/MgDev/Desktop/MapViewer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Oct 11 20:02:26 PDT 2012


Author: jng
Date: 2012-10-11 20:02:26 -0700 (Thu, 11 Oct 2012)
New Revision: 7110

Modified:
   branches/2.4/MgDev/Desktop/MapViewer/IPropertyPane.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs
Log:
mg-desktop: Fix a nasty error when selecting a layer without property mappings and initializing a MgSelectionSet without a MgMapViewerProvider

Modified: branches/2.4/MgDev/Desktop/MapViewer/IPropertyPane.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/IPropertyPane.cs	2012-10-11 03:17:47 UTC (rev 7109)
+++ branches/2.4/MgDev/Desktop/MapViewer/IPropertyPane.cs	2012-10-12 03:02:26 UTC (rev 7110)
@@ -160,7 +160,7 @@
                         continue;
                     }
 
-                    NameValueCollection mappings = provider.GetPropertyMappings(layer);
+                    NameValueCollection mappings = (provider != null) ? provider.GetPropertyMappings(layer) : null;
                     _features[layer.Name] = new List<MgFeature>();
                     
                     var reader = selection.GetSelectedFeatures(layer, layer.GetFeatureClassName(), false);

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs	2012-10-11 03:17:47 UTC (rev 7109)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs	2012-10-12 03:02:26 UTC (rev 7110)
@@ -118,9 +118,11 @@
         internal NameValueCollection GetPropertyMappings(MgLayerBase layer)
         {
             MgResourceIdentifier resId = layer.GetLayerDefinition();
-            MgByteReader content = _resSvc.GetResourceContent(resId);
             string resIdStr = resId.ToString();
+            if (_propertyMappings.ContainsKey(resIdStr))
+                return _propertyMappings[resIdStr];
 
+            MgByteReader content = _resSvc.GetResourceContent(resId);
             XmlDocument doc = new XmlDocument();
             string xml = content.ToString();
             doc.LoadXml(xml);
@@ -135,6 +137,11 @@
                 }
                 _propertyMappings[resIdStr] = propertyMappings;
             }
+            else
+            {
+                //NULL is a legit dictionary value
+                _propertyMappings[resIdStr] = null;
+            }
             return _propertyMappings[resIdStr];
         }
 



More information about the mapguide-commits mailing list