[mapguide-commits] r8114 - in trunk/Tools/Maestro: MgCooker OSGeo.MapGuide.MaestroAPI/Tile

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 6 23:53:26 PDT 2014


Author: jng
Date: 2014-05-06 23:53:26 -0700 (Tue, 06 May 2014)
New Revision: 8114

Modified:
   trunk/Tools/Maestro/MgCooker/Program.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs
Log:
constant-ify MgCooker command-line parameters


Modified: trunk/Tools/Maestro/MgCooker/Program.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/Program.cs	2014-05-07 05:49:54 UTC (rev 8113)
+++ trunk/Tools/Maestro/MgCooker/Program.cs	2014-05-07 06:53:26 UTC (rev 8114)
@@ -90,36 +90,36 @@
             
             List<string> largs = new List<string>(args);
             Dictionary<string, string> opts = CommandLineParser.ExtractOptions(largs);
-            if (opts.ContainsKey("mapagent"))
-                mapagent = opts["mapagent"];
-            if (opts.ContainsKey("username"))
-                username = opts["username"];
-            if (opts.ContainsKey("password"))
-                password = opts["password"];
-            if (opts.ContainsKey("mapdefinitions"))
-                mapdefinitions = opts["mapdefinitions"];
-            if (opts.ContainsKey("scaleindex"))
-                scaleindex = opts["scaleindex"];
-            if (opts.ContainsKey("basegroups"))
-                basegroups = opts["basegroups"];
+            if (opts.ContainsKey(TileRunParameters.MAPAGENT))
+                mapagent = opts[TileRunParameters.MAPAGENT];
+            if (opts.ContainsKey(TileRunParameters.USERNAME))
+                username = opts[TileRunParameters.USERNAME];
+            if (opts.ContainsKey(TileRunParameters.PASSWORD))
+                password = opts[TileRunParameters.PASSWORD];
+            if (opts.ContainsKey(TileRunParameters.MAPDEFINITIONS))
+                mapdefinitions = opts[TileRunParameters.MAPDEFINITIONS];
+            if (opts.ContainsKey(TileRunParameters.SCALEINDEX))
+                scaleindex = opts[TileRunParameters.SCALEINDEX];
+            if (opts.ContainsKey(TileRunParameters.BASEGROUPS))
+                basegroups = opts[TileRunParameters.BASEGROUPS];
 
-            if (opts.ContainsKey("limitrows"))
-                limitRows = opts["limitrows"];
-            if (opts.ContainsKey("limitcols"))
-                limitCols = opts["limitcols"];
+            if (opts.ContainsKey(TileRunParameters.LIMITROWS))
+                limitRows = opts[TileRunParameters.LIMITROWS];
+            if (opts.ContainsKey(TileRunParameters.LIMITCOLS))
+                limitCols = opts[TileRunParameters.LIMITCOLS];
 
-            if (opts.ContainsKey("tilewidth"))
-                tileWidth = opts["tilewidth"];
-            if (opts.ContainsKey("tileheight"))
-                tileHeight = opts["tileheight"];
+            if (opts.ContainsKey(TileRunParameters.TILEWIDTH))
+                tileWidth = opts[TileRunParameters.TILEWIDTH];
+            if (opts.ContainsKey(TileRunParameters.TILEHEIGHT))
+                tileHeight = opts[TileRunParameters.TILEHEIGHT];
 
-            if (opts.ContainsKey("DPI"))
-                DPI = opts["DPI"];
-            if (opts.ContainsKey("metersperunit"))
-                metersPerUnit = opts["metersperunit"];
-            if (opts.ContainsKey("extentoverride"))
+            if (opts.ContainsKey(TileRunParameters.DOTSPERINCH))
+                DPI = opts[TileRunParameters.DOTSPERINCH];
+            if (opts.ContainsKey(TileRunParameters.METERSPERUNIT))
+                metersPerUnit = opts[TileRunParameters.METERSPERUNIT];
+            if (opts.ContainsKey(TileRunParameters.EXTENTOVERRIDE))
             {
-                string[] parts = opts["extentoverride"].Split(',');
+                string[] parts = opts[TileRunParameters.EXTENTOVERRIDE].Split(',');
                 if (parts.Length == 4)
                 {
                     double minx;
@@ -161,14 +161,14 @@
             string[] maps = mapdefinitions.Split(',');
 
             SetupRun sr = null;
-            if (!opts.ContainsKey("username") || (!opts.ContainsKey("mapagent")))
+            if (!opts.ContainsKey(TileRunParameters.USERNAME) || (!opts.ContainsKey(TileRunParameters.MAPAGENT)))
             {
                 if (!batchMode)
                 {
-                    if (opts.ContainsKey("provider") && opts.ContainsKey("connection-params"))
+                    if (opts.ContainsKey(TileRunParameters.PROVIDER) && opts.ContainsKey(TileRunParameters.CONNECTIONPARAMS))
                     {
-                        var initP = ConnectionProviderRegistry.ParseConnectionString(opts["connection-params"]);
-                        connection = ConnectionProviderRegistry.CreateConnection(opts["provider"], initP);
+                        var initP = ConnectionProviderRegistry.ParseConnectionString(opts[TileRunParameters.CONNECTIONPARAMS]);
+                        connection = ConnectionProviderRegistry.CreateConnection(opts[TileRunParameters.PROVIDER], initP);
                         sr = new SetupRun(connection, maps, opts);
                     }
                     else
@@ -192,7 +192,7 @@
             if (connection == null)
             {
                 var initP = new NameValueCollection();
-                if (!opts.ContainsKey("native-connection"))
+                if (!opts.ContainsKey(TileRunParameters.NATIVECONNECTION))
                 {
                     initP["Url"] = mapagent;
                     initP["Username"] = username;
@@ -202,11 +202,11 @@
 
                     connection = ConnectionProviderRegistry.CreateConnection("Maestro.Http", initP);
                 }
-                else if (opts.ContainsKey("provider") && opts.ContainsKey("connection-params"))
+                else if (opts.ContainsKey(TileRunParameters.PROVIDER) && opts.ContainsKey(TileRunParameters.CONNECTIONPARAMS))
                 {
-                    initP = ConnectionProviderRegistry.ParseConnectionString(opts["connection-params"]);
+                    initP = ConnectionProviderRegistry.ParseConnectionString(opts[TileRunParameters.CONNECTIONPARAMS]);
 
-                    connection = ConnectionProviderRegistry.CreateConnection(opts["provider"], initP);
+                    connection = ConnectionProviderRegistry.CreateConnection(opts[TileRunParameters.PROVIDER], initP);
                 }
                 else
                 {
@@ -257,10 +257,10 @@
                 bx.Config.UseOfficialMethod = true;
             }
 
-            if (opts.ContainsKey("random-tile-order"))
+            if (opts.ContainsKey(TileRunParameters.RANDOMTILEORDER))
                 bx.Config.RandomizeTileSequence = true;
 
-            if (opts.ContainsKey("threadcount") && int.TryParse(opts["threadcount"], out x) && x > 0)
+            if (opts.ContainsKey(TileRunParameters.THREADCOUNT) && int.TryParse(opts[TileRunParameters.THREADCOUNT], out x) && x > 0)
                 bx.Config.ThreadCount = x;
 
             //Now that all global parameters are set, we can now add the map definitions

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs	2014-05-07 05:49:54 UTC (rev 8113)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs	2014-05-07 06:53:26 UTC (rev 8114)
@@ -761,6 +761,26 @@
     /// </summary>
     public class TileRunParameters
     {
+        public const string MAPAGENT = "mapagent"; //NOXLATE
+        public const string USERNAME = "username"; //NOXLATE
+        public const string PASSWORD = "password"; //NOXLATE
+        public const string NATIVECONNECTION = "native-connection"; //NOXLATE
+
+        public const string MAPDEFINITIONS = "mapdefinitions"; //NOXLATE
+        public const string LIMITROWS = "limitrows"; //NOXLATE
+        public const string LIMITCOLS = "limitcols"; //NOXLATE
+        public const string EXTENTOVERRIDE = "extentoverride"; //NOXLATE
+        public const string METERSPERUNIT = "metersperunit"; //NOXLATE
+        public const string BASEGROUPS = "basegroups"; //NOXLATE
+        public const string SCALEINDEX = "scaleindex"; //NOXLATE
+        public const string PROVIDER = "provider"; //NOXLATE
+        public const string CONNECTIONPARAMS = "connection-params"; //NOXLATE
+        public const string TILEWIDTH = "tilewidth"; //NOXLATE
+        public const string TILEHEIGHT = "tileheight"; //NOXLATE
+        public const string DOTSPERINCH = "DPI"; //NOXLATE
+        public const string RANDOMTILEORDER = "random-tile-order"; //NOXLATE
+        public const string THREADCOUNT = "threadcount"; //NOXLATE
+
         /// <summary>
         /// The meters per unit
         /// </summary>



More information about the mapguide-commits mailing list