[mapguide-commits] r5558 - in sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI: Mapping ObjectModels Resource/Validation

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Feb 18 05:45:07 EST 2011


Author: jng
Date: 2011-02-18 02:45:07 -0800 (Fri, 18 Feb 2011)
New Revision: 5558

Modified:
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs
Log:
#1591: Re-jig the IRasterLayerDefinition interface and its implementation

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs	2011-02-18 07:01:42 UTC (rev 5557)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs	2011-02-18 10:45:07 UTC (rev 5558)
@@ -136,9 +136,9 @@
                         this.GeometryPropertyName = rdf.Geometry;
                         this.QualifiedClassName = rdf.FeatureName;
 
-                        if (rdf.GridScaleRange.Count > 0)
+                        if (rdf.GridScaleRangeCount > 0)
                         {
-                            _scaleRanges = new double[rdf.GridScaleRange.Count * 2];
+                            _scaleRanges = new double[rdf.GridScaleRangeCount * 2];
                             int i = 0;
                             foreach (var gsr in rdf.GridScaleRange)
                             {

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs	2011-02-18 07:01:42 UTC (rev 5557)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs	2011-02-18 10:45:07 UTC (rev 5558)
@@ -78,10 +78,47 @@
         }
 
         [XmlIgnore]
-        ICollection<IGridScaleRange> IRasterLayerDefinition.GridScaleRange
+        IEnumerable<IGridScaleRange> IRasterLayerDefinition.GridScaleRange
         {
-            get { return (ICollection<IGridScaleRange>)this.GridScaleRange; }
+            get 
+            {
+                foreach (var gsr in this.GridScaleRange)
+                {
+                    yield return gsr;
+                }
+            }
         }
+
+        public void AddGridScaleRange(IGridScaleRange range)
+        {
+            var gsr = range as GridScaleRangeType;
+            if (gsr != null)
+            {
+                this.GridScaleRange.Add(gsr);
+            }
+        }
+
+        public void RemoveGridScaleRange(IGridScaleRange range)
+        {
+            var gsr = range as GridScaleRangeType;
+            if (gsr != null)
+            {
+                this.GridScaleRange.Remove(gsr);
+            }
+        }
+
+        public int IndexOfScaleRange(IGridScaleRange range)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IGridScaleRange GetScaleRangeAt(int index)
+        {
+            throw new NotImplementedException();
+        }
+
+        [XmlIgnore]
+        public int GridScaleRangeCount { get { return this.GridScaleRange.Count; } }
     }
 
     partial class ChannelBandType : IChannelBand

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-02-18 07:01:42 UTC (rev 5557)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-02-18 10:45:07 UTC (rev 5558)
@@ -481,7 +481,25 @@
         /// Gets the grid scale ranges.
         /// </summary>
         /// <value>The grid scale ranges.</value>
-        ICollection<IGridScaleRange> GridScaleRange { get; }
+        IEnumerable<IGridScaleRange> GridScaleRange { get; }
+
+        /// <summary>
+        /// Adds the specified grid scale range
+        /// </summary>
+        /// <param name="range"></param>
+        void AddGridScaleRange(IGridScaleRange range);
+
+        /// <summary>
+        /// Removes the specified grid scale range
+        /// </summary>
+        /// <param name="range"></param>
+        void RemoveGridScaleRange(IGridScaleRange range);
+
+        int IndexOfScaleRange(IGridScaleRange range);
+
+        IGridScaleRange GetScaleRangeAt(int index);
+
+        int GridScaleRangeCount { get; }
     }
 
     //If only all layers were as simple as this one...

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs	2011-02-18 07:01:42 UTC (rev 5557)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs	2011-02-18 10:45:07 UTC (rev 5558)
@@ -116,9 +116,9 @@
             }
             else if (gldef != null)
             {
-                if (gldef.GridScaleRange == null || gldef.GridScaleRange.Count == 0)
+                if (gldef.GridScaleRange == null || gldef.GridScaleRangeCount == 0)
                     issues.Add(new ValidationIssue(resource, ValidationStatus.Error, Properties.Resources.LDF_MissingScaleRangesError));
-                else if (gldef.GridScaleRange.Count != 1)
+                else if (gldef.GridScaleRangeCount != 1)
                     issues.Add(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LDF_MultipleScaleRangesWarning));
             }
             else if (dldef != null)



More information about the mapguide-commits mailing list