[mapguide-commits] r5684 - in trunk/Tools/Maestro: Maestro.Editors/LayerDefinition/Vector Maestro.Editors/LayerDefinition/Vector/Scales OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Apr 6 10:05:46 EDT 2011


Author: jng
Date: 2011-04-06 07:05:46 -0700 (Wed, 06 Apr 2011)
New Revision: 5684

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ScaleRangeConditions.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerStyleSectionCtrl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
Log:
#1651: Fix some defects in the Layer Definition editor
 * Deleting a vector scale range does not update the underlying XML content
 * Adding a new vector scale range (control) does not create a default (line/point/area) rule controls
 * When a particular point style is enabled (The Show XXX style checkbox is ticked), only create a new default rule if the current style has no rules in it 

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ScaleRangeConditions.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ScaleRangeConditions.cs	2011-04-05 15:29:24 UTC (rev 5683)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ScaleRangeConditions.cs	2011-04-06 14:05:46 UTC (rev 5684)
@@ -137,9 +137,11 @@
                     m_vsc.PointStyle = pst;
                     pointConditionList.SetItem(m_vsc, pst);
                 }
-
-                pointConditionList.AddRule();
-
+                else
+                {
+                    if (m_vsc.PointStyle.RuleCount == 0)
+                        pointConditionList.AddRule();
+                }
             }
             else
             {
@@ -171,8 +173,11 @@
                     m_vsc.LineStyle = ls;
                     lineConditionList.SetItem(m_vsc, ls);
                 }
-
-                lineConditionList.AddRule();
+                else
+                {
+                    if (m_vsc.LineStyle.RuleCount == 0)
+                        lineConditionList.AddRule();
+                }
             }
             else
             {
@@ -204,8 +209,11 @@
                     m_vsc.AreaStyle = ast;
                     areaConditionList.SetItem(m_vsc, ast);
                 }
-
-                areaConditionList.AddRule();
+                else
+                {
+                    if (m_vsc.AreaStyle.RuleCount == 0)
+                        areaConditionList.AddRule();
+                }
             }
             else
             {

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerStyleSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerStyleSectionCtrl.cs	2011-04-05 15:29:24 UTC (rev 5683)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerStyleSectionCtrl.cs	2011-04-06 14:05:46 UTC (rev 5684)
@@ -74,8 +74,8 @@
             if (scaleRangeList.SelectedItem == null)
                 return;
             IVectorScaleRange vsc = scaleRangeList.SelectedItem;
-            scaleRangeList.RemoveScaleRange(scaleRangeList.SelectedItem);
-            _vl.RemoveVectorScaleRange(scaleRangeList.SelectedItem);
+            scaleRangeList.RemoveScaleRange(vsc);
+            _vl.RemoveVectorScaleRange(vsc);
 
             _edsvc.HasChanged();
         }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs	2011-04-05 15:29:24 UTC (rev 5683)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerFactory.cs	2011-04-06 14:05:46 UTC (rev 5684)
@@ -92,9 +92,6 @@
                 LineStyle = CreateDefaultLineStyle(),
                 PointStyle = CreateDefaultPointStyle()
             };
-            defaultRange.AreaStyle.AddRule(CreateDefaultAreaRule());
-            defaultRange.LineStyle.AddRule(CreateDefaultLineRule());
-            defaultRange.PointStyle.AddRule(CreateDefaultPointRule());
             vl.VectorScaleRange.Add(defaultRange);
 
             this.Item = vl;
@@ -177,26 +174,32 @@
 
         public IPointVectorStyle CreateDefaultPointStyle()
         {
-            return new PointTypeStyleType()
+            IPointVectorStyle pts = new PointTypeStyleType()
             {
                 PointRule = new System.ComponentModel.BindingList<PointRuleType>()
             };
+            pts.AddRule(CreateDefaultPointRule());
+            return pts;
         }
 
         public ILineVectorStyle CreateDefaultLineStyle()
         {
-            return new LineTypeStyleType()
+            ILineVectorStyle lts = new LineTypeStyleType()
             {
                 LineRule = new System.ComponentModel.BindingList<LineRuleType>()
             };
+            lts.AddRule(CreateDefaultLineRule());
+            return lts;
         }
 
         public IAreaVectorStyle CreateDefaultAreaStyle()
         {
-            return new AreaTypeStyleType()
+            IAreaVectorStyle ats = new AreaTypeStyleType()
             {
                 AreaRule = new System.ComponentModel.BindingList<AreaRuleType>()
             };
+            ats.AddRule(CreateDefaultAreaRule());
+            return ats;
         }
 
         public IVectorScaleRange CreateVectorScaleRange()

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-04-05 15:29:24 UTC (rev 5683)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-04-06 14:05:46 UTC (rev 5684)
@@ -596,6 +596,8 @@
         /// Gets the type of this style specification
         /// </summary>
         StyleType StyleType { get; }
+
+        int RuleCount { get; }
     }
 
     /// <summary>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs	2011-04-05 15:29:24 UTC (rev 5683)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs	2011-04-06 14:05:46 UTC (rev 5684)
@@ -278,6 +278,17 @@
             }
         }
 
+        [XmlIgnore]
+        int IVectorStyle.RuleCount 
+        { 
+            get 
+            {
+                if (this.AreaRule != null)
+                    return this.AreaRule.Count;
+                return 0;
+            } 
+        }
+
         void IAreaVectorStyle.RemoveAllRules()
         {
             this.AreaRule.Clear();
@@ -347,6 +358,17 @@
             }
         }
 
+        [XmlIgnore]
+        int IVectorStyle.RuleCount
+        {
+            get
+            {
+                if (this.PointRule != null)
+                    return this.PointRule.Count;
+                return 0;
+            }
+        }
+
         public void RemoveAllRules()
         {
             this.PointRule.Clear();
@@ -426,6 +448,17 @@
             }
         }
 
+        [XmlIgnore]
+        int IVectorStyle.RuleCount
+        {
+            get
+            {
+                if (this.LineRule != null)
+                    return this.LineRule.Count;
+                return 0;
+            }
+        }
+
         public void RemoveAllRules()
         {
             this.LineRule.Clear();



More information about the mapguide-commits mailing list