[mapguide-commits] r6951 - in branches/2.4/MgDev/Desktop: MapViewer MgDesktop SampleExtension

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Aug 23 08:58:33 PDT 2012


Author: jng
Date: 2012-08-23 08:58:33 -0700 (Thu, 23 Aug 2012)
New Revision: 6951

Modified:
   branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
   branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj
   branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj.filters
   branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.Net40.csproj
Log:
mg-desktop changes:
 - Update VS2010 projects
 - Fix incorrect layer attribute filter being passed for tooltip queries
 - Implement delayed tooltip queries. This way a tooltip query is only sent *after* the moving mouse pointer becomes stationary for the period defined in the TooltipDelayInterval property, instead of on every mouse move event. This is similar to how the AJAX and Fusion viewers do it.

Modified: branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj	2012-08-23 12:08:14 UTC (rev 6950)
+++ branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj	2012-08-23 15:58:33 UTC (rev 6951)
@@ -130,6 +130,7 @@
     <Compile Include="MgLayerSelectionHandler.cs">
       <SubType>Component</SubType>
     </Compile>
+    <Compile Include="MgLegendControlPresenter.cs" />
     <Compile Include="MgLineMeasureControlImpl.cs">
       <SubType>UserControl</SubType>
     </Compile>

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-23 12:08:14 UTC (rev 6950)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-23 15:58:33 UTC (rev 6951)
@@ -200,6 +200,7 @@
             this.TooltipFillColor = Color.LightYellow;
             this.TooltipFillTransparency = 200;
             this.MouseWheelDelayRenderInterval = 800;
+            this.TooltipDelayInterval = 1000;
 
             this.ActiveTool = MapActiveTool.None;
             this.DoubleBuffered = true;
@@ -234,6 +235,7 @@
             base.MouseHover += OnMapMouseHover;
             base.MouseEnter += OnMouseEnter;
             base.MouseWheel += OnMapMouseWheel;
+            base.MouseLeave += OnMapMouseLeave;
         }
 
         /// <summary>
@@ -303,6 +305,7 @@
                 base.MouseDoubleClick -= OnMapMouseDoubleClick;
                 base.MouseHover -= OnMapMouseHover;
                 base.MouseEnter -= OnMouseEnter;
+                base.MouseLeave -= OnMapMouseLeave;
 
                 if (renderWorker != null)
                 {
@@ -382,6 +385,13 @@
         [Description("The amount of time (in ms) to wait to re-render after a mouse wheel scroll")]
         public int MouseWheelDelayRenderInterval { get; set; }
 
+        /// <summary>
+        /// The amount of time (in ms) to wait to re-render after a mouse wheel scroll
+        /// </summary>
+        [Category("MapGuide Viewer")]
+        [Description("The amount of time (in ms) to wait to fire off a tooltip request after the mouse pointer becomes stationary")]
+        public int TooltipDelayInterval { get; set; }
+
         private Color _selColor;
 
         /// <summary>
@@ -2115,7 +2125,7 @@
             ringCoords.Add(_geomFact.CreateCoordinateXY(mapPt2.X, mapPt2.Y)); //Close it
             var poly = _geomFact.CreatePolygon(_geomFact.CreateLinearRing(ringCoords), new MgLinearRingCollection());
 
-            MgTooltipQueryResult tr = _provider.QueryMapFeatures(MgQueryRequestType.Tooltip, null, poly, MgFeatureSpatialOperations.Intersects, "", 1, 4 /* has tooltips */) as MgTooltipQueryResult;
+            MgTooltipQueryResult tr = _provider.QueryMapFeatures(MgQueryRequestType.Tooltip, null, poly, MgFeatureSpatialOperations.Intersects, "", 1, 5 /* has tooltips */) as MgTooltipQueryResult;
             if (tr != null)
             {
                 _activeTooltipText = tr.Tooltip;
@@ -2220,6 +2230,13 @@
 
         #region Mouse handlers
 
+        private void OnMapMouseLeave(object sender, EventArgs e)
+        {
+            //Need to do this otherwise a tooltip query is made at the viewer boundary
+            if (delayTooltipTimer != null && delayTooltipTimer.Enabled)
+                delayTooltipTimer.Stop();
+        }
+
         private void OnMapMouseDown(object sender, MouseEventArgs e)
         {
             if (IsBusy) return;
@@ -2660,15 +2677,6 @@
                     }
                 }
 
-                // FIXME: 
-                //
-                // We really need a JS setTimeout() equivalent for C# because that's what we want
-                // to do here, set a delayed call to QueryFirstVisibleTooltip() that is aborted if
-                // the mouse pointer has moved significantly since the last time.
-                //
-                // A timer based approach could probably work, but I haven't figured out the best 
-                // way yet.
-
                 this.TooltipsEnabled = !isDragging && this.FeatureTooltipsEnabled;
 
                 //Only query for tooltips if not digitizing
@@ -2676,15 +2684,22 @@
                    (this.ActiveTool == MapActiveTool.Select || this.ActiveTool == MapActiveTool.Pan) &&
                     this.TooltipsEnabled)
                 {
-#if TRACE
-                    var sw = new Stopwatch();
-                    sw.Start();
-#endif
-                    _activeTooltipText = QueryFirstVisibleTooltip(e.X, e.Y);
-#if TRACE
-                    sw.Stop();
-                    //Trace.TraceInformation("QueryFirstVisibleTooltip() executed in {0}ms", sw.ElapsedMilliseconds);
-#endif
+                    if (delayTooltipTimer == null)
+                    {
+                        delayTooltipTimer = new System.Timers.Timer();
+                        delayTooltipTimer.Enabled = false;
+                        delayTooltipTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnDelayTooltipTimerElapsed);
+                        delayTooltipTimer.Interval = this.TooltipDelayInterval;
+                    }
+
+                    _delayTooltipQueryPoint = new Point(e.X, e.Y);
+                    delayTooltipTimer.Start();
+
+                    if (Math.Abs(e.X - _lastTooltipQueryX) > 2 || Math.Abs(e.Y - _lastTooltipQueryY) > 2)
+                    {
+                        _activeTooltipText = null;
+                        Invalidate();
+                    }
                 }
                 else
                 {
@@ -2707,6 +2722,24 @@
             }
         }
 
+        void OnDelayTooltipTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
+        {
+            delayTooltipTimer.Stop();
+            if (_delayTooltipQueryPoint.HasValue)
+            {
+                _activeTooltipText = QueryFirstVisibleTooltip(_delayTooltipQueryPoint.Value.X, _delayTooltipQueryPoint.Value.Y);
+                _lastTooltipQueryX = _delayTooltipQueryPoint.Value.X;
+                _lastTooltipQueryY = _delayTooltipQueryPoint.Value.Y;
+                _delayTooltipQueryPoint = null;
+                Invalidate();
+            }
+        }
+
+        private int _lastTooltipQueryX;
+        private int _lastTooltipQueryY;
+        private Point? _delayTooltipQueryPoint = null;
+        private System.Timers.Timer delayTooltipTimer = null;
+
         private void HandleMouseUp(MouseEventArgs e)
         {
             if (isDragging)

Modified: branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj	2012-08-23 12:08:14 UTC (rev 6950)
+++ branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj	2012-08-23 15:58:33 UTC (rev 6951)
@@ -467,6 +467,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="Services\Resource\ResourceContentCache.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="System\ConfigProperties.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -1031,6 +1037,7 @@
     <ClInclude Include="Services\Rendering\FeatureInformation.h" />
     <ClInclude Include="Services\Resource\ByteSourceDwfInputStreamImpl.h" />
     <ClInclude Include="Services\ByteSourceRasterStreamImpl.h" />
+    <ClInclude Include="Services\Resource\ResourceContentCache.h" />
     <ClInclude Include="System\ClassId.h" />
     <ClInclude Include="System\ConfigProperties.h" />
     <ClInclude Include="Exception\ConnectionFailedException.h" />

Modified: branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj.filters
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj.filters	2012-08-23 12:08:14 UTC (rev 6950)
+++ branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.vcxproj.filters	2012-08-23 15:58:33 UTC (rev 6951)
@@ -393,6 +393,9 @@
     <ClCompile Include="Services\Feature\FeatureSetReader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="Services\Resource\ResourceContentCache.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Exception\AliasNotFoundException.h">
@@ -845,6 +848,9 @@
     <ClInclude Include="Services\CryptoDefs.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="Services\Resource\ResourceRontentCache.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\braindump.txt" />

Modified: branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.Net40.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.Net40.csproj	2012-08-23 12:08:14 UTC (rev 6950)
+++ branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.Net40.csproj	2012-08-23 15:58:33 UTC (rev 6951)
@@ -147,6 +147,10 @@
     <Compile Include="ParcelQueryResultWindow.Designer.cs">
       <DependentUpon>ParcelQueryResultWindow.cs</DependentUpon>
     </Compile>
+    <Compile Include="PrePostRendering.cs" />
+    <Compile Include="PrePostRendering.Designer.cs">
+      <DependentUpon>PrePostRendering.cs</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ResourceIdDialog.cs">
       <SubType>Form</SubType>
@@ -222,6 +226,9 @@
     <EmbeddedResource Include="ParcelQueryResultWindow.resx">
       <DependentUpon>ParcelQueryResultWindow.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="PrePostRendering.resx">
+      <DependentUpon>PrePostRendering.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="ResourceIdDialog.resx">
       <DependentUpon>ResourceIdDialog.cs</DependentUpon>
     </EmbeddedResource>



More information about the mapguide-commits mailing list