[mapguide-commits] r6938 - in branches/2.4/MgDev/Desktop: MapViewer MapViewer.Desktop

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Aug 16 05:51:25 PDT 2012


Author: jng
Date: 2012-08-16 05:51:25 -0700 (Thu, 16 Aug 2012)
New Revision: 6938

Modified:
   branches/2.4/MgDev/Desktop/MapViewer.Desktop/MgDesktopMapViewerProvider.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs
Log:
Clean out un-used code as a result of the previous submission. The following public methods have been removed
 - MgMapViewerProvider
    - GetGeometryProperty
    - GetTooltipExpression
    - HasTooltips
    - CheckAndCacheGeometryProperty
    - CacheGeometryProperties

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-16 09:07:48 UTC (rev 6937)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-16 12:51:25 UTC (rev 6938)
@@ -2142,6 +2142,10 @@
             Clipboard.SetImage(this.GetCurrentImage());
         }
 
+        /// <summary>
+        /// Selects features from all selectable layers that intersects the given geometry
+        /// </summary>
+        /// <param name="geom"></param>
         public void SelectByGeometry(MgGeometry geom)
         {
             SelectByGeometry(geom, -1);
@@ -2170,6 +2174,7 @@
                 MgSelectionBase newSel = sel.Selection;
                 string newXml = newSel.ToXml();
                 _selection.FromXml(newXml);
+                newSel.Dispose();
             }
             else
             {

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs	2012-08-16 09:07:48 UTC (rev 6937)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewerProvider.cs	2012-08-16 12:51:25 UTC (rev 6938)
@@ -77,7 +77,6 @@
             DisposeExistingMap();
             _map = map;
             RebuildLayerInfoCache();
-            CacheGeometryProperties(_map.GetLayers());
             OnNewMapLoaded(map);
             var h = this.MapLoaded;
             if (h != null)
@@ -111,63 +110,16 @@
             return CoordSysFactory.Create(_map.GetMapSRS());
         }
 
-        private Dictionary<string, string> _layerGeomProps = new Dictionary<string, string>();
-
-        public void CacheGeometryProperties(MgLayerCollection layers)
-        {
-            //Cache geometry properties
-            for (int i = 0; i < layers.GetCount(); i++)
-            {
-                var layer = layers.GetItem(i);
-                //if (!layer.Selectable || !layer.IsVisible())
-                //    continue;
-
-                var objId = layer.GetObjectId();
-                if (_layerGeomProps.ContainsKey(objId))
-                    continue;
-
-                string fsId = layer.FeatureSourceId;
-                if (fsId.EndsWith(MgResourceType.DrawingSource))
-                    continue;
-
-                CheckAndCacheGeometryProperty(layer);
-            }
-        }
-
-        public void CheckAndCacheGeometryProperty(MgLayerBase layer)
-        {
-            var objId = layer.GetObjectId();
-            if (!_layerGeomProps.ContainsKey(objId))
-            {
-                try
-                {
-                    var cls = layer.GetClassDefinition();
-                    var geomName = cls.DefaultGeometryPropertyName;
-                    if (!string.IsNullOrEmpty(geomName))
-                    {
-                        _layerGeomProps[objId] = geomName;
-                    }
-                }
-                catch (MgException ex)
-                {
-                    Trace.TraceWarning("Failed to get geometry property for layer: " + layer.Name + Environment.NewLine + ex.ToString());
-                    ex.Dispose();
-                }
-            }
-        }
-
         private Dictionary<string, MgCoordinateSystemTransform> _mapToLayerTransforms = new Dictionary<string, MgCoordinateSystemTransform>();
         private Dictionary<string, NameValueCollection> _propertyMappings = new Dictionary<string, NameValueCollection>();
 
         internal Dictionary<string, NameValueCollection> AllPropertyMappings { get { return _propertyMappings; } }
 
         private Dictionary<string, XmlDocument> _cachedLayerDefinitions = new Dictionary<string, XmlDocument>();
-        private Dictionary<string, string> _tooltipExpressions = new Dictionary<string, string>();
 
         protected void RebuildLayerInfoCache()
         {
             _cachedLayerDefinitions.Clear();
-            _tooltipExpressions.Clear();
             _propertyMappings.Clear();
 
             foreach (var trans in _mapToLayerTransforms.Values)
@@ -222,9 +174,6 @@
                 doc.LoadXml(contents.GetItem(i));
 
                 _cachedLayerDefinitions[resIds.GetItem(i)] = doc;
-                XmlNodeList nodes = doc.GetElementsByTagName("ToolTip");
-                if (nodes.Count == 1)
-                    _tooltipExpressions[resIds.GetItem(i)] = nodes[0].InnerText;
 
                 XmlNodeList propMaps = doc.GetElementsByTagName("PropertyMapping");
                 if (propMaps.Count > 0)
@@ -311,21 +260,6 @@
             return CreateTransientState(_map);
         }
 
-        public string GetGeometryProperty(string objId)
-        {
-            return _layerGeomProps[objId];
-        }
-
-        public string GetTooltipExpression(MgResourceIdentifier ldfId)
-        {
-            return _tooltipExpressions[ldfId.ToString()];
-        }
-
-        public bool HasTooltips(MgResourceIdentifier ldfId)
-        {
-            return _tooltipExpressions.ContainsKey(ldfId.ToString());
-        }
-
         internal MgCoordinateSystemTransform GetLayerTransform(string objId, out bool bAlreadyChecked)
         {
             bAlreadyChecked = false;

Modified: branches/2.4/MgDev/Desktop/MapViewer.Desktop/MgDesktopMapViewerProvider.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer.Desktop/MgDesktopMapViewerProvider.cs	2012-08-16 09:07:48 UTC (rev 6937)
+++ branches/2.4/MgDev/Desktop/MapViewer.Desktop/MgDesktopMapViewerProvider.cs	2012-08-16 12:51:25 UTC (rev 6938)
@@ -163,10 +163,17 @@
         public override MgQueryMapFeaturesResult QueryMapFeatures(MgQueryRequestType queryType, MgStringCollection layerNames, MgGeometry filterGeom, int selectionVariant, string featureFilter, int maxFeatures, int layerAttributeFilter)
         {
             var fi = _renderSvc.QueryFeatures(_implMap, layerNames, filterGeom, selectionVariant, featureFilter, maxFeatures, layerAttributeFilter);
-            if (queryType == MgQueryRequestType.Tooltip)
-                return MakeTooltip(fi.GetTooltip());
-            else
-                return MakeSelectionResult(fi.GetSelection());
+            try
+            {
+                if (queryType == MgQueryRequestType.Tooltip)
+                    return MakeTooltip(fi.GetTooltip());
+                else
+                    return MakeSelectionResult(fi.GetSelection());
+            }
+            finally
+            {
+                fi.Dispose();
+            }
         }
     }
 }



More information about the mapguide-commits mailing list