[mapguide-commits] r6066 - in trunk/Tools/Maestro: Maestro Maestro.Base Maestro.Base/Commands/SiteExplorer Maestro.Base/Properties OSGeo.MapGuide.MaestroAPI/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Aug 14 12:56:39 EDT 2011


Author: jng
Date: 2011-08-14 09:56:39 -0700 (Sun, 14 Aug 2011)
New Revision: 6066

Added:
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/CopyResourceIdCommand.cs
Modified:
   trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
   trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
   trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
   trunk/Tools/Maestro/Maestro/changelog.txt
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ISimpleTransform.cs
Log:
#1771: Add copy resource ids to clipboard command.

Also add support for transforming coordinates to WGS84.PseudoMercator using Proj.Net (approximation only, but sufficient for purposes of transforming map definition extents)


Modified: trunk/Tools/Maestro/Maestro/changelog.txt
===================================================================
--- trunk/Tools/Maestro/Maestro/changelog.txt	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/Maestro/changelog.txt	2011-08-14 16:56:39 UTC (rev 6066)
@@ -1,4 +1,12 @@
-3.5 beta 2
+3.5
+---
+
+ - New Copy Resource IDs to clipboard command
+ - Map Extent calculation now is done through an informative progress dialog
+ - New symbol definition validation rules
+ - Added Proj.Net shortcut to support the WGS84.PseudoMercator coordinate system (note that results are not exactly the same as MgCoordinateSystem/CS-Map, but produces approximate results for purposes of setting Map Definition extents)
+
+3.5 beta 2
 ----------
 
  - Improved AIMS 2012 support

Added: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/CopyResourceIdCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/CopyResourceIdCommand.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/CopyResourceIdCommand.cs	2011-08-14 16:56:39 UTC (rev 6066)
@@ -0,0 +1,49 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ICSharpCode.Core;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+    internal class CopyResourceIdCommand : AbstractMenuCommand
+    {
+        public override void Run()
+        {
+            var wb = Workbench.Instance;
+            var exp = wb.ActiveSiteExplorer;
+
+            List<string> buffer = new List<string>();
+            foreach (var item in exp.SelectedItems)
+            {
+                buffer.Add(item.ResourceId);
+            }
+
+            try
+            {
+                System.Windows.Forms.Clipboard.SetText(string.Join(Environment.NewLine, buffer.ToArray()));
+            }
+            catch
+            {
+            }
+        }
+    }
+}

Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin	2011-08-14 16:56:39 UTC (rev 6066)
@@ -122,6 +122,9 @@
                   label="${res:Menu_Edit}">
             <Condition action="Disable" name="IsNotRoot">
                 <Condition action="Disable" name="CanCutOrCopy">
+                    <MenuItem id="CopyResourceIds"
+                              label="${res:SiteExplorer_CopyResourceIds}"
+                              class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                     <MenuItem id="CopyItem"
                               icon="document_copy"
                               label="${res:Menu_Edit_Copy}"
@@ -425,6 +428,9 @@
             <MenuItem type="Separator" />
             <Condition action="Disable" name="IsNotRoot">
                 <Condition action="Disable" name="CanCutOrCopy">
+                    <MenuItem id="CopyResourceIds"
+                              label="${res:SiteExplorer_CopyResourceIds}"
+                              class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                     <MenuItem id="Copy"
                               icon="document_copy"
                               label="${res:SiteExplorer_SelectedItem_Copy}"
@@ -466,6 +472,9 @@
     <Path name="/Maestro/Shell/SiteExplorer/SelectedFolders">
         <Condition action="Disable" name="MultipleSelected">
             <Condition action="Disable" name="CanCutOrCopy">
+                <MenuItem id="CopyResourceIds"
+                          label="${res:SiteExplorer_CopyResourceIds}"
+                          class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                 <MenuItem id="Copy"
                           icon="document_copy"
                           label="${res:SiteExplorer_SelectedItem_Copy}"
@@ -528,6 +537,9 @@
             </Condition>
             <MenuItem type="Separator" />
             <Condition action="Disable" name="CanCutOrCopy">
+                <MenuItem id="CopyResourceIds"
+                          label="${res:SiteExplorer_CopyResourceIds}"
+                          class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                 <MenuItem id="Copy"
                           icon="document_copy"
                           label="${res:SiteExplorer_SelectedItem_Copy}"
@@ -587,6 +599,9 @@
                       class="Maestro.Base.Commands.SiteExplorer.FindReplaceXmlContentCommand" />
             <MenuItem type="Separator" />
             <Condition action="Disable" name="CanCutOrCopy">
+                <MenuItem id="CopyResourceIds"
+                          label="${res:SiteExplorer_CopyResourceIds}"
+                          class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                 <MenuItem id="Copy"
                           icon="document_copy"
                           label="${res:SiteExplorer_SelectedItem_Copy}"
@@ -623,6 +638,9 @@
                       class="Maestro.Base.Commands.SiteExplorer.DeleteSelectedItemsCommand" />
             <MenuItem type="Separator" />
             <Condition action="Disable" name="CanCutOrCopy">
+                <MenuItem id="CopyResourceIds"
+                          label="${res:SiteExplorer_CopyResourceIds}"
+                          class="Maestro.Base.Commands.SiteExplorer.CopyResourceIdCommand" />
                 <MenuItem id="Copy"
                           icon="document_copy"
                           label="${res:SiteExplorer_SelectedItem_Copy}"

Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2011-08-14 16:56:39 UTC (rev 6066)
@@ -101,6 +101,7 @@
     <Compile Include="Commands\SaveAllCommand.cs" />
     <Compile Include="Commands\SaveResourceAsCommand.cs" />
     <Compile Include="Commands\SaveResourceCommand.cs" />
+    <Compile Include="Commands\SiteExplorer\CopyResourceIdCommand.cs" />
     <Compile Include="Commands\SiteExplorer\DuplicateResourceCommand.cs" />
     <Compile Include="Commands\SiteExplorer\FindReplaceXmlContentCommand.cs" />
     <Compile Include="Commands\SiteExplorer\PurgeFeatureSourceCacheCommand.cs" />

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs	2011-08-14 16:56:39 UTC (rev 6066)
@@ -490,9 +490,23 @@
         /// <summary>
         ///   Looks up a localized string similar to Programming:
         ///
-        ///	Jackie Ng
-        ///	Kenneth Skovhede
-        ///	Crispin Hoult.
+        ///  Jackie Ng (Maestro 2.0+)
+        ///  Kenneth Skovhede (Maestro 1.0 - 2.0)
+        ///	
+        ///Many thanks to the following people for providing patches and actively testing releases to help make Maestro a better quality applicaton for all:
+        ///
+        ///  Jason Birch
+        ///  Crispin Hoult
+        ///  Zac Spitzer
+        ///  Gunter Becker
+        ///  Andrew DeMerchant
+        ///  Gabriele Monfardini
+        ///  Gordon Luckett
+        ///
+        ///Many thanks to the following people who have translated Maestro into other languages:
+        ///
+        ///  José Manuel Cerrejón González (Spanish)
+        ///  Pierre Cardina [rest of string was truncated]&quot;;.
         /// </summary>
         internal static string Contributors {
             get {
@@ -1921,6 +1935,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Copy Resource IDs to clipboard.
+        /// </summary>
+        internal static string SiteExplorer_CopyResourceIds {
+            get {
+                return ResourceManager.GetString("SiteExplorer_CopyResourceIds", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Create Standard Folder Structure.
         /// </summary>
         internal static string SiteExplorer_CreateFolderStructure {

Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx	2011-08-14 16:56:39 UTC (rev 6066)
@@ -1055,4 +1055,7 @@
   <data name="Contributors" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\Contributors.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
   </data>
+  <data name="SiteExplorer_CopyResourceIds" xml:space="preserve">
+    <value>Copy Resource IDs to clipboard</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ISimpleTransform.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ISimpleTransform.cs	2011-08-14 15:26:59 UTC (rev 6065)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ISimpleTransform.cs	2011-08-14 16:56:39 UTC (rev 6066)
@@ -44,9 +44,6 @@
 
     /// <summary>
     /// A simple transform that wraps the NTS coordinate system transformation APIs
-    /// 
-    /// This does not handle some of the more complex transformations like CS-Map can,
-    /// such as WGS84.PseudoMercator (required for Google/Yahoo/Bing underlays in fusion)
     /// </summary>
     public class DefaultSimpleTransform : ISimpleTransform
     {
@@ -54,6 +51,32 @@
         private ICoordinateSystem _target;
         private ICoordinateTransformation _trans;
 
+        const string CSMAP_WGS84_PSEUDO_MERCATOR = @"PROJCS[""WGS84.PseudoMercator"",GEOGCS[""LL84"",DATUM[""WGS84"",SPHEROID[""WGS84"",6378137.000,298.25722293]],PRIMEM[""Greenwich"",0],UNIT[""Degree"",0.017453292519943295]],PROJECTION[""Popular Visualisation Pseudo Mercator""],PARAMETER[""false_easting"",0.000],PARAMETER[""false_northing"",0.000],PARAMETER[""central_meridian"",0.00000000000000],UNIT[""Meter"",1.00000000000000]]";
+
+        // Proj.Net cannot handle the WGS84.PseudoMercator WKT. Here's an alternative WKT that is Proj.Net compatible and produces
+        // approximately similar results:
+        //
+        // http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
+        //
+        const string POPULAR_VISUALISATION_CRS = 
+@"PROJCS[""Popular Visualisation CRS / Mercator"",
+ GEOGCS[""Popular Visualisation CRS"",
+  DATUM[""WGS84"",
+    SPHEROID[""WGS84"", 6378137.0, 298.257223563, AUTHORITY[""EPSG"",""7059""]],
+  AUTHORITY[""EPSG"",""6055""]],
+ PRIMEM[""Greenwich"", 0, AUTHORITY[""EPSG"", ""8901""]],
+ UNIT[""degree"", 0.0174532925199433, AUTHORITY[""EPSG"", ""9102""]],
+ AXIS[""E"", EAST], AXIS[""N"", NORTH], AUTHORITY[""EPSG"",""4055""]],
+PROJECTION[""Mercator""],
+PARAMETER[""semi_minor"",6378137],
+PARAMETER[""False_Easting"", 0],
+PARAMETER[""False_Northing"", 0],
+PARAMETER[""Central_Meridian"", 0],
+PARAMETER[""Latitude_of_origin"", 0],
+UNIT[""metre"", 1, AUTHORITY[""EPSG"", ""9001""]],
+AXIS[""East"", EAST], AXIS[""North"", NORTH],
+AUTHORITY[""EPSG"",""3785""]]";
+
         /// <summary>
         /// Initializes a new instance of the <see cref="DefaultSimpleTransform"/> class.
         /// </summary>
@@ -61,9 +84,12 @@
         /// <param name="targetCsWkt">The target cs WKT.</param>
         public DefaultSimpleTransform(string sourceCsWkt, string targetCsWkt)
         {
+            //Check for and replace the WGS84.PseudoMercator WKT
+            string srcWkt = sourceCsWkt == CSMAP_WGS84_PSEUDO_MERCATOR ? POPULAR_VISUALISATION_CRS : sourceCsWkt;
+            string dstWkt = targetCsWkt == CSMAP_WGS84_PSEUDO_MERCATOR ? POPULAR_VISUALISATION_CRS : targetCsWkt;
             var fact = new CoordinateSystemFactory();
-            _source = fact.CreateFromWkt(sourceCsWkt);
-            _target = fact.CreateFromWkt(targetCsWkt);
+            _source = fact.CreateFromWkt(srcWkt);
+            _target = fact.CreateFromWkt(dstWkt);
             var tfact = new CoordinateTransformationFactory();
             _trans = tfact.CreateFromCoordinateSystems(_source, _target);
         }



More information about the mapguide-commits mailing list