[mapguide-commits] r6235 - trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Nov 18 06:42:18 EST 2011


Author: jng
Date: 2011-11-18 03:42:18 -0800 (Fri, 18 Nov 2011)
New Revision: 6235

Modified:
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
Log:
Add extra sanity checks to ensure there is not any reversed min/max scale pairs

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs	2011-11-17 12:16:54 UTC (rev 6234)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs	2011-11-18 11:42:18 UTC (rev 6235)
@@ -26,6 +26,7 @@
 using OSGeo.MapGuide.MaestroAPI.Resource;
 using OSGeo.MapGuide.ObjectModels.FeatureSource;
 using OSGeo.MapGuide.MaestroAPI.Feature;
+using System.Diagnostics;
 
 namespace OSGeo.MapGuide.MaestroAPI.Mapping
 {
@@ -193,10 +194,27 @@
                     }
                     break;
             }
-
+            EnsureOrderedMinMaxScales();
             _disableChangeTracking = false;
         }
 
+        private void EnsureOrderedMinMaxScales()
+        {
+            Debug.Assert(_scaleRanges.Length % 2 == 0);
+            int scaleCount = _scaleRanges.Length / 2;
+            for (int i = 0; i < scaleCount; i++)
+            {
+                int minPos = i * 2;
+                int maxPos = i * 2 + 1;
+                if (_scaleRanges[minPos] > _scaleRanges[maxPos])
+                {
+                    double temp = _scaleRanges[minPos];
+                    _scaleRanges[minPos] = _scaleRanges[maxPos];
+                    _scaleRanges[maxPos] = temp;
+                }
+            }
+        }
+
         private void InitIdentityProperties(IVectorLayerDefinition vl)
         {
             var fs = (IFeatureSource)this.Parent.ResourceService.GetResource(vl.ResourceId);
@@ -693,6 +711,8 @@
 
                 this.IdentityProperties = ids.ToArray();
             }
+
+            EnsureOrderedMinMaxScales();
         }
 
         //from MgPropertyType



More information about the mapguide-commits mailing list