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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Sep 17 07:29:22 PDT 2012


Author: jng
Date: 2012-09-17 07:29:22 -0700 (Mon, 17 Sep 2012)
New Revision: 7021

Modified:
   branches/2.4/MgDev/Desktop/MapViewer.Desktop/MapViewer.Desktop.Net40.csproj
   branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs
   branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj
   branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs
   branches/2.4/MgDev/Desktop/MapViewer/Util.cs
Log:
#2118: Update VS2010 projects and unify/fix the WKT utility methods.

Modified: branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -3,6 +3,7 @@
 using System.Text;
 using System.ComponentModel;
 using System.Windows.Forms;
+using System.Globalization;
 
 namespace OSGeo.MapGuide.Viewer
 {
@@ -329,10 +330,7 @@
             }
         }
 
-        static string MakeWktCircle(double x, double y, double r)
-        {
-            return "CURVEPOLYGON ((" + (x - r) + " " + y + " (CIRCULARARCSEGMENT (" + x + " " + (y - r) + ", " + (x + r) + " " + y + "), CIRCULARARCSEGMENT (" + x + " " + (y + r) + ", " + (x - r) + " " + y + "))))"; //NOXLATE
-        }
+        
 
         public override void Invoke()
         {
@@ -342,7 +340,7 @@
                 if (_wktRw == null)
                     _wktRw = new MgWktReaderWriter();
 
-                MgGeometry geom = _wktRw.Read(MakeWktCircle(x, y, r));
+                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r));
                 viewer.SelectByGeometry(geom);
             });
         }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/MapViewer.Net40.csproj	2012-09-17 14:29:22 UTC (rev 7021)
@@ -219,6 +219,7 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>Resources.resx</DependentUpon>
     </Compile>
+    <Compile Include="Strings.Designer.cs" />
     <Compile Include="Tasks\MgTaskPaneStub.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -270,6 +271,7 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EmbeddedResource Include="Strings.resx" />
     <EmbeddedResource Include="Tasks\MgTaskPaneStub.resx">
       <DependentUpon>MgTaskPaneStub.cs</DependentUpon>
     </EmbeddedResource>

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -258,7 +258,7 @@
 
             _viewer.DigitizeCircle((x, y, r) =>
             {
-                MgGeometry geom = _wktRw.Read(MakeWktCircle(x, y, r));
+                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r));
                 _viewer.SelectByGeometry(geom);
             });
         }
@@ -362,16 +362,6 @@
                 UpdateButtonCheckedState();
             }
         }
-
-        static string MakeWktPolygon(double x1, double y1, double x2, double y2)
-        {
-            return "POLYGON((" + x1 + " " + y1 + ", " + x2 + " " + y1 + ", " + x2 + " " + y2 + ", " + x1 + " " + y2 + ", " + x1 + " " + y1 + "))"; //NOXLATE
-        }
-
-        static string MakeWktCircle(double x, double y, double r)
-        {
-            return "CURVEPOLYGON ((" + (x - r) + " " + y + " (CIRCULARARCSEGMENT (" + x + " " + (y - r) + ", " + (x + r) + " " + y + "), CIRCULARARCSEGMENT (" + x + " " + (y + r) + ", " + (x - r) + " " + y + "))))"; //NOXLATE
-        }
     }
 
     /// <summary>

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -11,6 +11,7 @@
     using System.Xml;
     using System.IO;
     using System.Diagnostics;
+    using System.Globalization;
 
     interface ILegendView
     {
@@ -992,10 +993,10 @@
 
                 if (bHasMin)
                 {
-                    double minVal = double.Parse(cat.MinScale);
+                    double minVal = double.Parse(cat.MinScale, CultureInfo.InvariantCulture);
                     if (bHasMax) //bHasMin = true, bHasMax = true
                     {
-                        double maxVal = double.Parse(cat.MaxScale);
+                        double maxVal = double.Parse(cat.MaxScale, CultureInfo.InvariantCulture);
                         if (scale >= minVal && scale < maxVal)
                             bApplicable = true;
                     }
@@ -1009,7 +1010,7 @@
                 {
                     if (bHasMax) //bHasMin = false, bHasMax = true
                     {
-                        double maxVal = double.Parse(cat.MaxScale);
+                        double maxVal = double.Parse(cat.MaxScale, CultureInfo.InvariantCulture);
                         if (scale < maxVal)
                             bApplicable = true;
                     }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -12,6 +12,7 @@
 using System.Xml;
 using System.Collections.Specialized;
 using System.Collections.ObjectModel;
+using System.Globalization;
 
 namespace OSGeo.MapGuide.Viewer
 {
@@ -144,7 +145,7 @@
             if (_debugCenter == null)
                 _debugCenter = new MgPropertyCollection();
 
-            var center = _wktRW.Read("POINT (" + _map.ViewCenter.Coordinate.X + " " + _map.ViewCenter.Coordinate.Y + ")"); //NOXLATE
+            var center = _wktRW.Read("POINT (" + _map.ViewCenter.Coordinate.X.ToString(CultureInfo.InvariantCulture) + " " + _map.ViewCenter.Coordinate.Y.ToString(CultureInfo.InvariantCulture) + ")"); //NOXLATE
             var agf = _agfRW.Write(center);
             if (!_debugCenter.Contains("Geometry")) //NOXLATE
             {
@@ -2084,13 +2085,6 @@
             }
         }
 
-        private static string MakeWktPolygon(double x1, double y1, double x2, double y2)
-        {
-            return "POLYGON((" + x1 + " " + y1 + ", " + x2 + " " + y1 + ", " + x2 + " " + y2 + ", " + x1 + " " + y2 + ", " + x1 + " " + y1 + "))"; //NOXLATE
-        }
-
-        
-
         private int? _lastTooltipX;
         private int? _lastTooltipY;
 
@@ -2535,7 +2529,7 @@
 
                     var dist = _mapMeasure.GetDistance(coord1, coord2);
 
-                    MgGeometry geom = _wktRW.Read(MakeWktPolygon(mapPt1.X, mapPt1.Y, mapPt2.X, mapPt2.Y));
+                    MgGeometry geom = _wktRW.Read(Util.MakeWktPolygon(mapPt1.X, mapPt1.Y, mapPt2.X, mapPt2.Y));
 
                     SelectByGeometry(geom, 1);
                 }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -73,11 +73,6 @@
             }
         }
 
-        static string MakeWktPolygon(double x1, double y1, double x2, double y2)
-        {
-            return "POLYGON((" + x1 + " " + y1 + ", " + x2 + " " + y1 + ", " + x2 + " " + y2 + ", " + x1 + " " + y2 + ", " + x1 + " " + y1 + "))"; //NOXLATE
-        }
-
         private MgGeometry _filterGeometry;
 
         private void btnRectangle_Click(object sender, EventArgs e)
@@ -85,7 +80,7 @@
             _viewer.DigitizeRectangle((llx, lly, urx, ury) =>
             {
                 ClearFilterGeometry();
-                _filterGeometry = _wktRw.Read(MakeWktPolygon(llx, lly, urx, ury));
+                _filterGeometry = _wktRw.Read(Util.MakeWktPolygon(llx, lly, urx, ury));
                 lblSpatialFilterGeomSet.Visible = true;
             });
         }

Modified: branches/2.4/MgDev/Desktop/MapViewer/Util.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Util.cs	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer/Util.cs	2012-09-17 14:29:22 UTC (rev 7021)
@@ -8,6 +8,20 @@
 {
     internal static class Util
     {
+        public static string MakeWktCircle(double x, double y, double r)
+        {
+            return "CURVEPOLYGON ((" + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + " (CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y - r).ToString(CultureInfo.InvariantCulture) + ", " + (x + r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "), CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y + r).ToString(CultureInfo.InvariantCulture) + ", " + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "))))"; //NOXLATE
+        }
+
+        public static string MakeWktPolygon(double x1, double y1, double x2, double y2)
+        {
+            string x1str = x1.ToString(CultureInfo.InvariantCulture);
+            string y1str = y1.ToString(CultureInfo.InvariantCulture);
+            string x2str = x2.ToString(CultureInfo.InvariantCulture);
+            string y2str = y2.ToString(CultureInfo.InvariantCulture);
+            return "POLYGON((" + x1str + " " + y1str + ", " + x2str + " " + y1str + ", " + x2str + " " + y2str + ", " + x1str + " " + y2str + ", " + x1str + " " + y1str + "))"; //NOXLATE
+        }
+
         public static string ToHtmlColor(Color color)
         {
             return String.Format("{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B); //NOXLATE

Modified: branches/2.4/MgDev/Desktop/MapViewer.Desktop/MapViewer.Desktop.Net40.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer.Desktop/MapViewer.Desktop.Net40.csproj	2012-09-17 13:56:57 UTC (rev 7020)
+++ branches/2.4/MgDev/Desktop/MapViewer.Desktop/MapViewer.Desktop.Net40.csproj	2012-09-17 14:29:22 UTC (rev 7021)
@@ -80,6 +80,7 @@
     <Compile Include="MgDesktopMapViewerProvider.cs" />
     <Compile Include="MgdTransientMapState.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Strings.Designer.cs" />
   </ItemGroup>
   <ItemGroup>
     <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
@@ -104,6 +105,9 @@
       <Name>MapViewer.Net40</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Strings.resx" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.



More information about the mapguide-commits mailing list