[mapguide-commits] r6818 - in trunk/Tools/Maestro: Maestro.MapViewer OSGeo.MapGuide.MaestroAPI/Mapping OSGeo.MapGuide.MaestroAPI.Local

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jun 26 07:37:26 PDT 2012


Author: jng
Date: 2012-06-26 07:37:25 -0700 (Tue, 26 Jun 2012)
New Revision: 6818

Modified:
   trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
Log:
#2020: Make RuntimeMap.ViewCenter readonly. Add a new SetViewCenter API to allow changing the map's view center. The LocalRuntimeMap overrides this to delegate straight to the underlying MgdMap.

Modified: trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs	2012-06-26 14:24:03 UTC (rev 6817)
+++ trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs	2012-06-26 14:37:25 UTC (rev 6818)
@@ -1522,8 +1522,7 @@
                 OnPropertyChanged("ViewHistoryIndex");
             }
 
-            _map.ViewCenter.X = x;
-            _map.ViewCenter.Y = y;
+            _map.SetViewCenter(x, y);
 #if VIEWER_DEBUG
             UpdateCenterDebugPoint();
             //var mapExt = _map.MapExtent;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2012-06-26 14:24:03 UTC (rev 6817)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2012-06-26 14:37:25 UTC (rev 6818)
@@ -318,7 +318,8 @@
             this.DisplayDpi = 96;
             this.DisplayWidth = 0;
             this.DisplayHeight = 0;
-            this.ViewCenter = this.DataExtent.Center();
+            var pt = this.DataExtent.Center();
+            this.SetViewCenter(pt.X, pt.Y);
 
             _disableChangeTracking = false;
         }
@@ -475,10 +476,19 @@
             {
                 return _viewCenter;
             }
-            set
+        }
+
+        public virtual void SetViewCenter(double x, double y)
+        {
+            if (_viewCenter == null)
             {
-                _viewCenter = value;
+                _viewCenter = ObjectFactory.CreatePoint2D(x, y);
             }
+            else
+            {
+                _viewCenter.X = x;
+                _viewCenter.Y = y;
+            }
         }
 
         /// <summary>
@@ -804,7 +814,7 @@
             }
             else
             {
-                this.ViewCenter = ObjectFactory.CreatePoint2D(cc[0], cc[1]);
+                this.SetViewCenter(cc[0], cc[1]);
             }
             this.ViewScale = d.ReadDouble();
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs	2012-06-26 14:24:03 UTC (rev 6817)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs	2012-06-26 14:37:25 UTC (rev 6818)
@@ -27,6 +27,12 @@
 
 namespace OSGeo.MapGuide.MaestroAPI.Local
 {
+    // A general note about this implementation
+    //
+    // The only thing this shares with RuntimeMap is the ancestry (which is needed if we want to use rendering APIs) because
+    // other than that, these implementations are complete wrappers around their respective MgdMap, MgLayerGroup and MgLayerBase
+    // classes, barely touching anything from their respective superclasses (and almost overriding everything from their parents)
+
     internal class LocalRuntimeMap : RuntimeMap
     {
         private MgdMap _impl;
@@ -194,13 +200,11 @@
                 var coord = pt.Coordinate;
                 return ObjectFactory.CreatePoint2D(coord.X, coord.Y);
             }
-            set
-            {
-                if (value == null)
-                    throw new ArgumentNullException();
+        }
 
-                _impl.SetViewCenterXY(value.X, value.Y);
-            }
+        public override void SetViewCenter(double x, double y)
+        {
+            _impl.SetViewCenterXY(x, y);
         }
 
         public override double ViewScale



More information about the mapguide-commits mailing list