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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed May 18 12:05:53 EDT 2011


Author: jng
Date: 2011-05-18 09:05:53 -0700 (Wed, 18 May 2011)
New Revision: 5818

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
Log:
#1690: The line of code in the editor to set the line size context was commented out. Why was it commented out? Because the SizeContext property was introduced in the 1.1.0 layer schema and the IStroke interface was made against the 1.0.0 schema, so it never knew about size contexts. This submission introduces a new IStroke2 interface which has the SizeContext property and is implemented by xml classes of Layer Definition 1.1.0 and higher


Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs	2011-05-18 15:43:03 UTC (rev 5817)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/StyleEditors/LineFeatureStyleEditor.cs	2011-05-18 16:05:53 UTC (rev 5818)
@@ -126,6 +126,15 @@
 				if (lineStyles.Items.Count > 0)
 					lineStyles.SelectedIndex = 0;
 
+                if (!compositeLines.Checked)
+                {
+                    var st2 = m_item[0] as IStroke2;
+                    if (st2 != null)
+                        sizeContextCombo.SelectedValue = st2.SizeContext;
+                    else
+                        sizeContextCombo.Enabled = false; //Must be a 1.0.0 schema line rule
+                }
+
 				UpdateDisplayForSelected();
 
 			}
@@ -479,11 +488,16 @@
 		{
 			if (m_inUpdate)
 				return;
-            //this.CurrentStrokeType.SizeContext = (SizeContextType)Enum.Parse(typeof(SizeContextType), (string)sizeContextCombo.SelectedValue);
-            previewPicture.Refresh();
-            lineStyles.Refresh();
-            if (Changed != null)
-				Changed(this, new EventArgs());
+
+            var st2 = this.CurrentStrokeType as IStroke2;
+            if (st2 != null)
+            {
+                st2.SizeContext = (SizeContextType)Enum.Parse(typeof(SizeContextType), (string)sizeContextCombo.SelectedValue);
+                previewPicture.Refresh();
+                lineStyles.Refresh();
+                if (Changed != null)
+                    Changed(this, new EventArgs());
+            }
 		}
 
 		private void sizeUnitsCombo_SelectedIndexChanged(object sender, System.EventArgs e)

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-05-18 15:43:03 UTC (rev 5817)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaces.cs	2011-05-18 16:05:53 UTC (rev 5818)
@@ -835,6 +835,18 @@
     }
 
     /// <summary>
+    /// Encapsulates the stylization of a line. Supported in Layer Definition schema
+    /// 1.1.0 and newer
+    /// </summary>
+    public interface IStroke2 : IStroke, ICloneableLayerElement<IStroke2>
+    {
+        /// <summary>
+        /// Gets or sets the size context of the thickness units
+        /// </summary>
+        SizeContextType SizeContext { get; set; }
+    }
+
+    /// <summary>
     /// Symbolization characteristics for areas.
     /// </summary>
     public interface IAreaSymbolizationFill : ICloneableLayerElement<IAreaSymbolizationFill>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs	2011-05-18 15:43:03 UTC (rev 5817)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs	2011-05-18 16:05:53 UTC (rev 5818)
@@ -310,7 +310,11 @@
 #endif
     }
 
+#if LDF_100
     partial class StrokeType : IStroke
+#else
+    partial class StrokeType : IStroke, IStroke2
+#endif
     {
         internal StrokeType() { }
 
@@ -318,6 +322,14 @@
         {
             return StrokeType.Deserialize(this.Serialize());
         }
+
+#if LDF_100
+#else
+        IStroke2 ICloneableLayerElement<IStroke2>.Clone()
+        {
+            return StrokeType.Deserialize(this.Serialize());
+        }
+#endif
     }
 
     partial class FillType : IFill



More information about the mapguide-commits mailing list