[mapguide-commits] r6936 - trunk/Tools/Maestro/Maestro.MapViewer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Aug 16 00:28:54 PDT 2012


Author: jng
Date: 2012-08-16 00:28:53 -0700 (Thu, 16 Aug 2012)
New Revision: 6936

Modified:
   trunk/Tools/Maestro/Maestro.MapViewer/DefaultToolbar.cs
   trunk/Tools/Maestro/Maestro.MapViewer/Interfaces.cs
   trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs
Log:
Fix RuntimeMap viewer behaviour wrt selection. Point-based selections should call QueryMapFeatures with maxFeatures = 1 and every other selection should call it with maxFeatures = -1. This way, point-based selections do not "fall-through" to each selectable layer by default.

Modified: trunk/Tools/Maestro/Maestro.MapViewer/DefaultToolbar.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/DefaultToolbar.cs	2012-08-06 14:18:43 UTC (rev 6935)
+++ trunk/Tools/Maestro/Maestro.MapViewer/DefaultToolbar.cs	2012-08-16 07:28:53 UTC (rev 6936)
@@ -245,7 +245,7 @@
 
             _viewer.DigitizeCircle((x, y, r) =>
             {
-                _viewer.SelectByWkt(MakeWktCircle(x, y, r));
+                _viewer.SelectByWkt(MakeWktCircle(x, y, r), -1);
             });
         }
 
@@ -266,7 +266,7 @@
                     wkt.Append(coordinates[i, 0] + " " + coordinates[i, 1]);
                 }
                 wkt.Append("))");
-                _viewer.SelectByWkt(wkt.ToString());
+                _viewer.SelectByWkt(wkt.ToString(), -1);
             });
         }
 

Modified: trunk/Tools/Maestro/Maestro.MapViewer/Interfaces.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/Interfaces.cs	2012-08-06 14:18:43 UTC (rev 6935)
+++ trunk/Tools/Maestro/Maestro.MapViewer/Interfaces.cs	2012-08-16 07:28:53 UTC (rev 6936)
@@ -251,7 +251,9 @@
         /// <summary>
         /// Selects features from all selectable layers that intersects the given geometry in WKT format
         /// </summary>
-        void SelectByWkt(string wkt);
+        /// <param name="wkt">The geometry wkt</param>
+        /// <param name="maxFeatures">The maximum number of features to select. Specify -1 to select all features</param>
+        void SelectByWkt(string wkt, int maxFeatures);
 
         /// <summary>
         /// Zooms to the initial map view

Modified: trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs	2012-08-06 14:18:43 UTC (rev 6935)
+++ trunk/Tools/Maestro/Maestro.MapViewer/MapViewer.cs	2012-08-16 07:28:53 UTC (rev 6936)
@@ -2024,8 +2024,9 @@
         /// <summary>
         /// Selects features from all selectable layers that intersects the given geometry
         /// </summary>
-        /// <param name="geom"></param>
-        public void SelectByWkt(string wkt)
+        /// <param name="wkt">The geometry wkt</param>
+        /// <param name="maxFeatures">The maximum number of features to select. Specify -1 to select all features.</param>
+        public void SelectByWkt(string wkt, int maxFeatures)
         {
             //Don't select if dragging. This is the cause of the failure to render
             //multiple selections, which required a manual refresh afterwards
@@ -2036,7 +2037,7 @@
             var sw = new Stopwatch();
             sw.Start();
 #endif
-            _map.QueryMapFeatures(wkt, -1, true, "INTERSECTS", CreateQueryOptionsForSelection());
+            _map.QueryMapFeatures(wkt, maxFeatures, true, "INTERSECTS", CreateQueryOptionsForSelection());
 #if TRACE
             sw.Stop();
             Trace.TraceInformation("Selection processing completed in {0}ms", sw.ElapsedMilliseconds);
@@ -2354,7 +2355,7 @@
                         Math.Max(mapPt1.X, mapPt2.X),
                         Math.Max(mapPt1.Y, mapPt2.Y));
 
-                    SelectByWkt(MakeWktPolygon(env.MinX, env.MinY, env.MaxX, env.MaxY));
+                    SelectByWkt(MakeWktPolygon(env.MinX, env.MinY, env.MaxX, env.MaxY), 1);
                 }
                 else if (this.ActiveTool == MapActiveTool.ZoomIn)
                 {
@@ -2536,7 +2537,7 @@
                         Math.Min(mapPt.Y, mapDragPt.Y),
                         Math.Max(mapPt.X, mapDragPt.X),
                         Math.Max(mapPt.Y, mapDragPt.Y));
-                    SelectByWkt(MakeWktPolygon(env.MinX, env.MinY, env.MaxX, env.MaxY));
+                    SelectByWkt(MakeWktPolygon(env.MinX, env.MinY, env.MaxX, env.MaxY), -1);
                 }
                 else if (this.ActiveTool == MapActiveTool.ZoomIn)
                 {



More information about the mapguide-commits mailing list