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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon May 27 05:26:36 PDT 2013


Author: jng
Date: 2013-05-27 05:26:35 -0700 (Mon, 27 May 2013)
New Revision: 7528

Modified:
   trunk/Tools/Maestro/MgCooker/Program.cs
   trunk/Tools/Maestro/MgCooker/Progress.cs
   trunk/Tools/Maestro/MgCooker/SetupRun.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/RenderThread.cs
Log:
Rename some MgCooker classes and related properties to be more intuitive
 - BatchSettings -> TilingRunCollection
 - BatchMap -> MapTilingConfiguration
 - BatchMap.Map -> MapTilingConfiguration.MapDefinition
 - TileSettings -> TileRunParameters
We can do this because these are APIs *new* to 5.0, so we might as well get these name changes out of the way before we API freeze for RC1.

Modified: trunk/Tools/Maestro/MgCooker/Program.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/Program.cs	2013-05-27 12:22:10 UTC (rev 7527)
+++ trunk/Tools/Maestro/MgCooker/Program.cs	2013-05-27 12:26:35 UTC (rev 7528)
@@ -224,7 +224,7 @@
             }
             
 
-            BatchSettings bx = new BatchSettings(connection);
+            TilingRunCollection bx = new TilingRunCollection(connection);
             
             int x;
 
@@ -284,7 +284,7 @@
             }
 
             if (overrideExtents != null)
-                foreach (BatchMap bm in bx.Maps)
+                foreach (MapTilingConfiguration bm in bx.Maps)
                     bm.MaxExtent = overrideExtents;
 
             if (largs.IndexOf("/commandline") < 0 && largs.IndexOf("commandline") < 0)
@@ -312,20 +312,20 @@
             }
         }
 
-        static void bx_FailedRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref Exception exception)
+        static void bx_FailedRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref Exception exception)
         {
             exceptionList.Add(exception);
             exception = null;
         }
 
-        static void DisplayProgress(BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void DisplayProgress(MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             if (hasConsole)
                 Console.Clear();
             Console.WriteLine(string.Format(Strings.ConsoleUpdateTime.Replace("\\t", "\t"), DateTime.Now));
             Console.WriteLine(string.Format(Strings.ConsoleCurrentMap.Replace("\\t", "\t"), map.ResourceId, mapCount, map.Parent.Maps.Count));
-            Console.WriteLine(string.Format(Strings.ConsoleCurrentGroup.Replace("\\t", "\t"), group, groupCount, map.Map.BaseMap.GroupCount));
-            Console.WriteLine(string.Format(Strings.ConsoleCurrentScale.Replace("\\t", "\t"), map.Map.BaseMap.GetScaleAt(Array.IndexOf<int>(map.ScaleIndexMap, scaleindex)), Array.IndexOf<int>(map.ScaleIndexMap, scaleindex) + 1, map.Map.BaseMap.ScaleCount));
+            Console.WriteLine(string.Format(Strings.ConsoleCurrentGroup.Replace("\\t", "\t"), group, groupCount, map.MapDefinition.BaseMap.GroupCount));
+            Console.WriteLine(string.Format(Strings.ConsoleCurrentScale.Replace("\\t", "\t"), map.MapDefinition.BaseMap.GetScaleAt(Array.IndexOf<int>(map.ScaleIndexMap, scaleindex)), Array.IndexOf<int>(map.ScaleIndexMap, scaleindex) + 1, map.MapDefinition.BaseMap.ScaleCount));
             Console.WriteLine(string.Format(Strings.ConsoleCurrentTile.Replace("\\t", "\t"), tileCount, totalTiles));
             Console.WriteLine();
             Console.WriteLine(string.Format(Strings.ConsoleGroupDuration.Replace("\\t", "\t"), DateTime.Now - beginGroup));
@@ -339,14 +339,14 @@
         }
 
 
-        static void bx_FinishRenderingGroup(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_FinishRenderingGroup(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             TimeSpan duration = DateTime.Now - beginGroup;
             if (m_logableProgress)
                 Console.WriteLine(string.Format(Strings.ConsoleOperationFinishGroup, DateTime.Now, group, duration));
         }
 
-        static void bx_BeginRenderingGroup(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_BeginRenderingGroup(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             groupCount++;
             beginGroup = DateTime.Now;
@@ -359,7 +359,7 @@
             totalTiles = map.TotalTiles;
         }
 
-        static void bx_FinishRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_FinishRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             tileRuns.Add(DateTime.Now - beginTile);
             tileCount++;
@@ -391,26 +391,26 @@
             }
         }
 
-        static void bx_BeginRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_BeginRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             beginTile = DateTime.Now;
         }
 
-        static void bx_FinishRenderingScale(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_FinishRenderingScale(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             TimeSpan duration = DateTime.Now - beginScale;
             if (m_logableProgress)
-                Console.WriteLine(string.Format(Strings.ConsoleOperationFinishScale, DateTime.Now, map.Map.BaseMap.GetScaleAt(scaleindex), duration));
+                Console.WriteLine(string.Format(Strings.ConsoleOperationFinishScale, DateTime.Now, map.MapDefinition.BaseMap.GetScaleAt(scaleindex), duration));
         }
 
-        static void bx_BeginRenderingScale(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_BeginRenderingScale(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             beginScale = DateTime.Now;
             if (m_logableProgress)
-                Console.WriteLine(string.Format(Strings.ConsoleOperationBeginScale, beginMap, map.Map.BaseMap.GetScaleAt(scaleindex), scaleindex, map.Resolutions));
+                Console.WriteLine(string.Format(Strings.ConsoleOperationBeginScale, beginMap, map.MapDefinition.BaseMap.GetScaleAt(scaleindex), scaleindex, map.Resolutions));
         }
 
-        static void bx_FinishRenderingMap(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_FinishRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             groupCount = 0;
             TimeSpan duration = DateTime.Now - beginMap;
@@ -418,7 +418,7 @@
                 Console.WriteLine(string.Format(Strings.ConsoleOperationFinishMap, DateTime.Now, map.ResourceId, duration));
         }
 
-        static void bx_BeginRenderingMap(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        static void bx_BeginRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             mapCount++;
             beginMap = DateTime.Now;

Modified: trunk/Tools/Maestro/MgCooker/Progress.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/Progress.cs	2013-05-27 12:22:10 UTC (rev 7527)
+++ trunk/Tools/Maestro/MgCooker/Progress.cs	2013-05-27 12:26:35 UTC (rev 7528)
@@ -30,7 +30,7 @@
 {
     public partial class Progress : Form
     {
-        private BatchSettings m_bx;
+        private TilingRunCollection m_bx;
         private List<TimeSpan> m_tileRuns;
         private long m_tileCount;
         private DateTime m_lastUpdate;
@@ -50,7 +50,7 @@
             InitializeComponent();
         }
 
-        public Progress(BatchSettings bx)
+        public Progress(TilingRunCollection bx)
             : this()
         {
             m_bx = bx;
@@ -65,13 +65,13 @@
             m_tileRuns = new List<TimeSpan>();
 
             m_grandTotalTiles = 0;
-            foreach (BatchMap bm in m_bx.Maps)
+            foreach (MapTilingConfiguration bm in m_bx.Maps)
                 m_grandTotalTiles += bm.TotalTiles;
 
             m_grandBegin = DateTime.Now;
         }
 
-        void bx_FailedRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref Exception exception)
+        void bx_FailedRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref Exception exception)
         {
             m_failCount++;
             exception = null; //Eat it
@@ -93,7 +93,7 @@
             this.Close();
         }
 
-        void bx_FinishRenderingMaps(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_FinishRenderingMaps(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             if (this.InvokeRequired)
                 this.Invoke(new System.Threading.ThreadStart(DoClose));
@@ -101,7 +101,7 @@
                 DoClose();
         }
 
-        void bx_FinishRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_FinishRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             m_tileRuns.Add(DateTime.Now - m_beginTile);
             m_tileCount++;
@@ -130,9 +130,9 @@
             }
         }
 
-        private delegate void DisplayProgressDelegate(BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel);
+        private delegate void DisplayProgressDelegate(MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel);
 
-        private void DisplayProgress(BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        private void DisplayProgress(MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             if (m_cancel)
                 cancel = true;
@@ -163,22 +163,22 @@
         }
 
 
-        void bx_BeginRenderingTile(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_BeginRenderingTile(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             m_beginTile = DateTime.Now;
         }
 
-        void bx_BeginRenderingScale(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_BeginRenderingScale(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
         }
 
-        void bx_BeginRenderingGroup(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_BeginRenderingGroup(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             m_totalTiles = map.TotalTiles;
             m_tileCount = 0;
         }
 
-        void bx_BeginRenderingMap(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel)
+        void bx_BeginRenderingMap(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel)
         {
             m_tileCount = 0;
         }

Modified: trunk/Tools/Maestro/MgCooker/SetupRun.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/SetupRun.cs	2013-05-27 12:22:10 UTC (rev 7527)
+++ trunk/Tools/Maestro/MgCooker/SetupRun.cs	2013-05-27 12:26:35 UTC (rev 7528)
@@ -233,7 +233,7 @@
             }
             try
             {
-                BatchSettings bx = new BatchSettings(con);
+                TilingRunCollection bx = new TilingRunCollection(con);
 
                 if (LimitTileset.Checked)
                 {
@@ -254,7 +254,7 @@
 
                 foreach (Config c in ReadTree())
                 {
-                    BatchMap bm = new BatchMap(bx, c.MapDefinition);
+                    MapTilingConfiguration bm = new MapTilingConfiguration(bx, c.MapDefinition);
                     bm.SetGroups(new string[] { c.Group });
                     bm.SetScales(c.ScaleIndexes);
                     if (c.ExtentOverride != null)

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs	2013-05-27 12:22:10 UTC (rev 7527)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/BatchSettings.cs	2013-05-27 12:26:35 UTC (rev 7528)
@@ -36,7 +36,7 @@
     /// <param name="column">The column being processed</param>
     /// <param name="cancel">A control flag to stop the tile rendering</param>
     /// <param name="state">The state that invoked the callback</param>
-    public delegate void ProgressCallback(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref bool cancel);
+    public delegate void ProgressCallback(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref bool cancel);
 
     /// <summary>
     /// This delegate is used to monitor progress on tile rendering
@@ -48,7 +48,7 @@
     /// <param name="column">The column being processed</param>
     /// <param name="state">The state that invoked the callback</param>
     /// <param name="exception">The exception from the last attempt, set this to null to ignore the exception</param>
-    public delegate void ErrorCallback(CallbackStates state, BatchMap map, string group, int scaleindex, int row, int column, ref Exception exception);
+    public delegate void ErrorCallback(CallbackStates state, MapTilingConfiguration map, string group, int scaleindex, int row, int column, ref Exception exception);
 
     /// <summary>
     /// These are the avalible states for callbacks
@@ -104,7 +104,7 @@
     /// <summary>
     /// Class to hold settings for a batch run of tile building
     /// </summary>
-    public class BatchSettings
+    public class TilingRunCollection
     {
         /// <summary>
         /// A reference to the connection
@@ -113,11 +113,11 @@
         /// <summary>
         /// The list of maps
         /// </summary>
-        private List<BatchMap> m_maps;
+        private List<MapTilingConfiguration> m_maps;
         /// <summary>
         /// A default set of tile settings
         /// </summary>
-        private TileSettings m_tileSettings = new TileSettings();
+        private TileRunParameters m_tileSettings = new TileRunParameters();
 
         /// <summary>
         /// A flag that indicates the rendering should stop
@@ -175,59 +175,59 @@
         /// </summary>
         public event ErrorCallback FailedRenderingTile;
 
-        internal void InvokeBeginRendering(BatchMap batchMap)
+        internal void InvokeBeginRendering(MapTilingConfiguration batchMap)
         {
             if (this.BeginRenderingMap != null)
                 this.BeginRenderingMap(CallbackStates.StartRenderMap, batchMap, null, -1, -1, -1, ref m_cancel);
             PauseEvent.WaitOne();
         }
 
-        internal void InvokeFinishRendering(BatchMap batchMap)
+        internal void InvokeFinishRendering(MapTilingConfiguration batchMap)
         {
             if (this.FinishRenderingMap != null)
                 this.FinishRenderingMap(CallbackStates.FinishRenderMap, batchMap, null, -1, -1, -1, ref m_cancel);
         }
 
-        internal void InvokeBeginRendering(BatchMap batchMap, string group)
+        internal void InvokeBeginRendering(MapTilingConfiguration batchMap, string group)
         {
             if (this.BeginRenderingGroup != null)
                 this.BeginRenderingGroup(CallbackStates.StartRenderGroup, batchMap, group, -1, -1, -1, ref m_cancel);
             PauseEvent.WaitOne();
         }
 
-        internal void InvokeFinishRendering(BatchMap batchMap, string group)
+        internal void InvokeFinishRendering(MapTilingConfiguration batchMap, string group)
         {
             if (this.FinishRenderingGroup != null)
                 this.FinishRenderingGroup(CallbackStates.FinishRenderGroup, batchMap, group, -1, -1, -1, ref m_cancel);
         }
 
-        internal void InvokeBeginRendering(BatchMap batchMap, string group, int scaleindex)
+        internal void InvokeBeginRendering(MapTilingConfiguration batchMap, string group, int scaleindex)
         {
             if (this.BeginRenderingScale != null)
                 this.BeginRenderingScale(CallbackStates.StartRenderScale, batchMap, group, scaleindex, -1, -1, ref m_cancel);
             PauseEvent.WaitOne();
         }
 
-        internal void InvokeFinishRendering(BatchMap batchMap, string group, int scaleindex)
+        internal void InvokeFinishRendering(MapTilingConfiguration batchMap, string group, int scaleindex)
         {
             if (this.FinishRenderingScale != null)
                 this.FinishRenderingScale(CallbackStates.FinishRenderScale, batchMap, group, scaleindex, -1, -1, ref m_cancel);
         }
 
-        internal void InvokeBeginRendering(BatchMap batchMap, string group, int scaleindex, int row, int col)
+        internal void InvokeBeginRendering(MapTilingConfiguration batchMap, string group, int scaleindex, int row, int col)
         {
             if (this.BeginRenderingTile != null)
                 this.BeginRenderingTile(CallbackStates.StartRenderTile, batchMap, group, scaleindex, row, col, ref m_cancel);
             PauseEvent.WaitOne();
         }
 
-        internal void InvokeFinishRendering(BatchMap batchMap, string group, int scaleindex, int row, int col)
+        internal void InvokeFinishRendering(MapTilingConfiguration batchMap, string group, int scaleindex, int row, int col)
         {
             if (this.FinishRenderingTile != null)
                 this.FinishRenderingTile(CallbackStates.FinishRenderTile, batchMap, group, scaleindex, row, col, ref m_cancel);
         }
 
-        internal Exception InvokeError(BatchMap batchMap, string group, int scaleindex, int row, int col, ref Exception exception)
+        internal Exception InvokeError(MapTilingConfiguration batchMap, string group, int scaleindex, int row, int col, ref Exception exception)
         {
             if (this.FailedRenderingTile != null)
                 this.FailedRenderingTile(CallbackStates.FailedRenderingTile, batchMap, group, scaleindex, row, col, ref exception);
@@ -244,7 +244,7 @@
         /// <param name="username">The username to connect with</param>
         /// <param name="password">The password to connect with</param>
         /// <param name="maps">A list of maps to process, leave empty to process all layers</param>
-        public BatchSettings(string mapagent, string username, string password, params string[] maps)
+        public TilingRunCollection(string mapagent, string username, string password, params string[] maps)
             : this(ConnectionProviderRegistry.CreateConnection("Maestro.Http", "Url", mapagent, "Username", username, "Password", password, "AllowUntestedVersions", "true"), maps) //NOXLATE
         {
         }
@@ -253,10 +253,10 @@
         /// Constructs a new batch setup
         /// </summary>
         /// <param name="connection"></param>
-        public BatchSettings(IServerConnection connection)
+        public TilingRunCollection(IServerConnection connection)
         {
             m_connection = connection;
-            m_maps = new List<BatchMap>();
+            m_maps = new List<MapTilingConfiguration>();
         }
 
         /// <summary>
@@ -264,10 +264,10 @@
         /// </summary>
         /// <param name="connection"></param>
         /// <param name="maps"></param>
-        public BatchSettings(IServerConnection connection, params string[] maps)
+        public TilingRunCollection(IServerConnection connection, params string[] maps)
         {
             m_connection = connection;
-            m_maps = new List<BatchMap>();
+            m_maps = new List<MapTilingConfiguration>();
 
             AddMapDefinitions(maps);
         }
@@ -288,7 +288,7 @@
 
             foreach (string s in maps)
             {
-                BatchMap bm = new BatchMap(this, s);
+                MapTilingConfiguration bm = new MapTilingConfiguration(this, s);
                 if (bm.Resolutions > 0)
                     m_maps.Add(bm);
             }
@@ -300,7 +300,7 @@
         /// <param name="scaleindexes"></param>
         public void SetScales(int[] scaleindexes)
         {
-            foreach (BatchMap bm in m_maps)
+            foreach (MapTilingConfiguration bm in m_maps)
                 bm.SetScales(scaleindexes);
         }
 
@@ -310,7 +310,7 @@
         /// <param name="groups"></param>
         public void SetGroups(string[] groups)
         {
-            foreach (BatchMap bm in m_maps)
+            foreach (MapTilingConfiguration bm in m_maps)
                 bm.SetGroups(groups);
         }
 
@@ -320,7 +320,7 @@
         /// <param name="limit"></param>
         public void LimitRows(long limit)
         {
-            foreach (BatchMap bm in m_maps)
+            foreach (MapTilingConfiguration bm in m_maps)
                 bm.LimitRows(limit);
         }
 
@@ -330,7 +330,7 @@
         /// <param name="limit"></param>
         public void LimitCols(long limit)
         {
-            foreach (BatchMap bm in m_maps)
+            foreach (MapTilingConfiguration bm in m_maps)
                 bm.LimitCols(limit);
         }
 
@@ -344,7 +344,7 @@
             if (this.BeginRenderingMaps != null)
                 this.BeginRenderingMaps(CallbackStates.StartRenderAllMaps, null, null, -1, -1, -1, ref m_cancel);
 
-            foreach (BatchMap bm in this.Maps)
+            foreach (MapTilingConfiguration bm in this.Maps)
                 if (m_cancel)
                     break;
                 else
@@ -359,14 +359,14 @@
         /// </summary>
         public IServerConnection Connection { get { return m_connection; } }
         /// <summary>
-        /// The list of maps to proccess
+        /// The list of map configurations to proccess
         /// </summary>
-        public List<BatchMap> Maps { get { return m_maps; } }
+        public List<MapTilingConfiguration> Maps { get { return m_maps; } }
 
         /// <summary>
         /// The tile settings
         /// </summary>
-        public TileSettings Config { get { return m_tileSettings; } }
+        public TileRunParameters Config { get { return m_tileSettings; } }
 
         /// <summary>
         /// Gets a flag indicating if the rendering process is cancelled
@@ -377,12 +377,12 @@
     /// <summary>
     /// Class that represents a single map to build tiles for
     /// </summary>
-    public class BatchMap
+    public class MapTilingConfiguration
     {
         /// <summary>
         /// A reference to the parent, and thus the connection
         /// </summary>
-        private BatchSettings m_parent;
+        private TilingRunCollection m_parent;
         /// <summary>
         /// The map read from MapGuide
         /// </summary>
@@ -453,7 +453,7 @@
         /// </summary>
         /// <param name="parent">The parent entry</param>
         /// <param name="map">The resource id for the mapdefinition</param>
-        public BatchMap(BatchSettings parent, string map)
+        public MapTilingConfiguration(TilingRunCollection parent, string map)
         {
             m_parent = parent;
             m_mapdefinition = (IMapDefinition)parent.Connection.ResourceService.GetResource(map);
@@ -473,7 +473,7 @@
 
         internal void CalculateDimensions()
         {
-            int[] tmp = new int[this.Map.BaseMap.ScaleCount];
+            int[] tmp = new int[this.MapDefinition.BaseMap.ScaleCount];
             for (int i = 0; i < tmp.Length; i++)
                 tmp[i] = i;
 
@@ -508,6 +508,20 @@
                 {
                     //This is the algorithm proposed by the MapGuide team:
                     //http://www.nabble.com/Pre-Genererate--tiles-for-the-entire-map-at-all-pre-defined-zoom-scales-to6074037.html#a6078663
+                    //
+                    //Method description inline (in case nabble link disappears):
+                    //
+                    // The upper left corner of the extents of the map corresponds to tile (0,0). Then tile (1,0) is to the right of that and tile (0,1) is under tile (0,0).
+                    // So assuming you know the extents of your map, you can calculate how many tiles it spans at the given scale, using the following
+                    //
+                    // number of tiles x = map width in meters  / ( 0.079375 * map_scale)
+                    // number of tiles y = map height in meters / ( 0.079375 * map_scale)
+                    //
+                    // where 0.079375 = [inch to meter] / image DPI * tile size = 0.0254 / 96 * 300.
+                    //
+                    // This assumes you know the scale factor that converts your map width and height to meters. You can get this from the coordinate system of the map if you don't know it, but it's much easier to just plug in the number into this equation.
+                    // 
+                    // Also have in mind that you can also request tiles beyond the map extent (for example tile (-1, -1), however, there is probably no point to cache them unless you have valid data outside your initial map extents.
                     
                     //The tile extent in meters
                     double tileWidth  =((INCH_TO_METER / m_parent.Config.DPI * m_parent.Config.TileWidth) * (scale));
@@ -727,18 +741,18 @@
         /// <summary>
         /// Gets the MapDefintion
         /// </summary>
-        public IMapDefinition Map { get { return m_mapdefinition; } }
+        public IMapDefinition MapDefinition { get { return m_mapdefinition; } }
 
         /// <summary>
-        /// Gets a reference to the parent
+        /// Gets a reference to the parent tiling run collection
         /// </summary>
-        public BatchSettings Parent { get { return m_parent; } }
+        public TilingRunCollection Parent { get { return m_parent; } }
     }
 
     /// <summary>
-    /// Parameters for a tiling run
+    /// Defines global parameters for a tiling run
     /// </summary>
-    public class TileSettings
+    public class TileRunParameters
     {
         /// <summary>
         /// The meters per unit

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/RenderThread.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/RenderThread.cs	2013-05-27 12:22:10 UTC (rev 7527)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Tile/RenderThread.cs	2013-05-27 12:26:35 UTC (rev 7528)
@@ -59,11 +59,11 @@
         private object SyncLock;
         private AutoResetEvent Event;
         private int CompleteFlag;
-        private BatchSettings Parent;
+        private TilingRunCollection Parent;
         private int Scale;
         private string Group;
         private string MapDefinition;
-        private BatchMap Invoker;
+        private MapTilingConfiguration Invoker;
 
         private bool Randomize;
         private int Rows;
@@ -73,7 +73,7 @@
 
         private bool FillerComplete = false;
 
-        public RenderThreads(BatchMap invoker, BatchSettings parent, int scale, string group, string mapdef, int rows, int cols, int rowOffset, int colOffset, bool randomize)
+        public RenderThreads(MapTilingConfiguration invoker, TilingRunCollection parent, int scale, string group, string mapdef, int rows, int cols, int rowOffset, int colOffset, bool randomize)
         {
             TileSet = new Queue<KeyValuePair<int, int>>();
             SyncLock = new object();



More information about the mapguide-commits mailing list