[mapguide-commits] r7843 - in branches/maestro-5.0.x: Maestro.Base Maestro.Base/Commands/SiteExplorer Maestro.Base/Editor Maestro.Editors/Generic Maestro.Editors/LayerDefinition/Vector/Scales Maestro.Editors/MapDefinition OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Sep 6 02:19:01 PDT 2013


Author: jng
Date: 2013-09-06 02:19:01 -0700 (Fri, 06 Sep 2013)
New Revision: 7843

Modified:
   branches/maestro-5.0.x/Maestro.Base/Commands/SiteExplorer/CompileFullDependencyListCommand.cs
   branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.Designer.cs
   branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.cs
   branches/maestro-5.0.x/Maestro.Base/Strings.Designer.cs
   branches/maestro-5.0.x/Maestro.Base/Strings.resx
   branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs
   branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.cs
   branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.resx
   branches/maestro-5.0.x/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs
   branches/maestro-5.0.x/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs
   branches/maestro-5.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
   branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
   branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
Log:
#2350, #2349, #2300, #2354, #2352: Backport to 5.0.x

Modified: branches/maestro-5.0.x/Maestro.Base/Commands/SiteExplorer/CompileFullDependencyListCommand.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Base/Commands/SiteExplorer/CompileFullDependencyListCommand.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Base/Commands/SiteExplorer/CompileFullDependencyListCommand.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -59,8 +59,8 @@
                 doc.Load(s);
 
                 var matches = Utility.GetResourceIdPointers(doc);
-                //Need to weed out any empty results.
-                return matches.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x));
+                //Need to weed out any empty results and self-references
+                return matches.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x) && x != resId);
             }
         }
 

Modified: branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.Designer.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.Designer.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.Designer.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -43,10 +43,12 @@
             this.editor.BackgroundColor = System.Drawing.SystemColors.Window;
             resources.ApplyResources(this.editor, "editor");
             this.editor.Name = "editor";
+            this.editor.SupportsReReadFromSource = true;
             this.editor.TextColor = System.Drawing.SystemColors.WindowText;
             this.editor.TextFont = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.editor.Validator = null;
             this.editor.XmlContent = "";
+            this.editor.RequestReloadFromSource += new System.EventHandler(this.editor_RequestReloadFromSource);
             // 
             // XmlEditor
             // 

Modified: branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Base/Editor/XmlEditor.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -196,5 +196,22 @@
                 return Properties.Resources.icon_xmleditor;
             }
         }
+
+        private void editor_RequestReloadFromSource(object sender, EventArgs e)
+        {
+            if (MessageService.AskQuestion(Strings.ConfirmReloadXmlFromSource))
+            {
+                var resId = this.EditorService.ResourceID;
+                using (var stream = this.EditorService.ResourceService.GetResourceXmlData(resId))
+                {
+                    using (var sr = new StreamReader(stream))
+                    {
+                        var xml = sr.ReadToEnd();
+                        editor.XmlContent = xml;
+                        MessageService.ShowMessage(Strings.XmlReloadedFromSource);
+                    }
+                }
+            }
+        }
     }
 }

Modified: branches/maestro-5.0.x/Maestro.Base/Strings.Designer.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Base/Strings.Designer.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Base/Strings.Designer.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.18047
+//     Runtime Version:4.0.30319.18052
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -370,6 +370,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Are you sure you want to reload the XML from source? This will discard any un-saved changes you have made..
+        /// </summary>
+        internal static string ConfirmReloadXmlFromSource {
+            get {
+                return ResourceManager.GetString("ConfirmReloadXmlFromSource", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to You are about to reset all preferences to default values. Are you sure you want to do this?.
         /// </summary>
         internal static string ConfirmResetPrefs {
@@ -2537,6 +2546,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to XML content reloaded from source.
+        /// </summary>
+        internal static string XmlReloadedFromSource {
+            get {
+                return ResourceManager.GetString("XmlReloadedFromSource", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Load this resource into the Site Repository.
         /// </summary>
         internal static string XmlResHandlerAction {

Modified: branches/maestro-5.0.x/Maestro.Base/Strings.resx
===================================================================
--- branches/maestro-5.0.x/Maestro.Base/Strings.resx	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Base/Strings.resx	2013-09-06 09:19:01 UTC (rev 7843)
@@ -965,4 +965,10 @@
   <data name="Label_ResourceID" xml:space="preserve">
     <value>Resource ID:</value>
   </data>
+  <data name="ConfirmReloadXmlFromSource" xml:space="preserve">
+    <value>Are you sure you want to reload the XML from source? This will discard any un-saved changes you have made.</value>
+  </data>
+  <data name="XmlReloadedFromSource" xml:space="preserve">
+    <value>XML content reloaded from source</value>
+  </data>
 </root>
\ No newline at end of file

Modified: branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -43,6 +43,7 @@
             this.lblCursorPos = new System.Windows.Forms.ToolStripLabel();
             this.btnFind = new System.Windows.Forms.ToolStripButton();
             this.btnFindAndReplace = new System.Windows.Forms.ToolStripButton();
+            this.btnReRead = new System.Windows.Forms.ToolStripButton();
             this.resDataCtrl = new Maestro.Editors.Generic.ResourceDataPanel();
             this.nodeNumericUpDown1 = new Aga.Controls.Tree.NodeControls.NodeNumericUpDown();
             this.txtXmlContent = new Maestro.Editors.Generic.XmlTextEditorControl();
@@ -71,7 +72,8 @@
             this.toolStripSeparator3,
             this.lblCursorPos,
             this.btnFind,
-            this.btnFindAndReplace});
+            this.btnFindAndReplace,
+            this.btnReRead});
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
             // 
@@ -158,6 +160,13 @@
             this.btnFindAndReplace.Name = "btnFindAndReplace";
             this.btnFindAndReplace.Click += new System.EventHandler(this.btnFindAndReplace_Click);
             // 
+            // btnReRead
+            // 
+            this.btnReRead.Image = global::Maestro.Editors.Properties.Resources.arrow_circle_135;
+            resources.ApplyResources(this.btnReRead, "btnReRead");
+            this.btnReRead.Name = "btnReRead";
+            this.btnReRead.Click += new System.EventHandler(this.btnReRead_Click);
+            // 
             // resDataCtrl
             // 
             this.resDataCtrl.ContentBackgroundColor = System.Drawing.SystemColors.Control;
@@ -284,5 +293,6 @@
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
         private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem findReplaceToolStripMenuItem;
+        private System.Windows.Forms.ToolStripButton btnReRead;
     }
 }

Modified: branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -404,6 +404,32 @@
         {
             DoFindReplace();
         }
+
+        /// <summary>
+        /// Gets or sets whether this editor can support reloading XML content
+        /// from a source resource. If true, subscribe to the 
+        /// <see cref="E:Maestro.Editors.Generic.XmlEditorCtrl.RequestReloadFromSource"/> 
+        /// event to handle this particular action
+        /// </summary>
+        public bool SupportsReReadFromSource
+        {
+            get { return btnReRead.Enabled; }
+            set { btnReRead.Enabled = value; }
+        }
+
+        /// <summary>
+        /// Raised if the user wishes to reload the XML content from source. To handle this
+        /// action, read the XML content from the requested source resource and load it into
+        /// this editor
+        /// </summary>
+        public event EventHandler RequestReloadFromSource;
+
+        private void btnReRead_Click(object sender, EventArgs e)
+        {
+            var h = this.RequestReloadFromSource;
+            if (h != null)
+                h(this, EventArgs.Empty);
+        }
     }
     
     /// <summary>

Modified: branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.resx
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.resx	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/Generic/XmlEditorCtrl.resx	2013-09-06 09:19:01 UTC (rev 7843)
@@ -205,6 +205,18 @@
   <data name="btnFindAndReplace.Text" xml:space="preserve">
     <value>Find/Replace</value>
   </data>
+  <data name="btnReRead.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnReRead.Size" type="System.Drawing.Size, System.Drawing">
+    <value>133, 22</value>
+  </data>
+  <data name="btnReRead.Text" xml:space="preserve">
+    <value>Reload From Source</value>
+  </data>
+  <data name="btnReRead.ToolTipText" xml:space="preserve">
+    <value>Re-loads the XML content from the source resource ID</value>
+  </data>
   <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
     <value>0, 0</value>
   </data>
@@ -405,6 +417,12 @@
   <data name=">>btnFindAndReplace.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name=">>btnReRead.Name" xml:space="preserve">
+    <value>btnReRead</value>
+  </data>
+  <data name=">>btnReRead.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name=">>nodeNumericUpDown1.Name" xml:space="preserve">
     <value>nodeNumericUpDown1</value>
   </data>

Modified: branches/maestro-5.0.x/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/LayerDefinition/Vector/Scales/Condition.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -167,12 +167,16 @@
         private void DeleteButton_Click(object sender, EventArgs e)
         {
             if (ItemDeleted != null)
+            {
                 if (m_prt != null)
                     ItemDeleted(m_prt, null);
                 else if (m_lrt != null)
                     ItemDeleted(m_lrt, null);
                 else if (m_art != null)
                     ItemDeleted(m_art, null);
+                else if (m_comp != null)
+                    ItemDeleted(m_comp, null);
+            }
         }
 
         private void RuleCondition_TextChanged(object sender, EventArgs e)
@@ -186,6 +190,8 @@
                 m_lrt.Filter = RuleCondition.Text;
             else if (m_art != null)
                 m_art.Filter = RuleCondition.Text;
+            else if (m_comp != null)
+                m_comp.Filter = RuleCondition.Text;
 
             SignalChanged();
         }

Modified: branches/maestro-5.0.x/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -88,22 +88,21 @@
         private void ClearScales()
         {
             _map.InitBaseMap();
-            _map.BaseMap.RemoveAllScales();
+            _map.RemoveAllFiniteDisplayScales(true);
             _edSvc.MarkDirty();
         }
 
         private void RemoveScaleFromMap(double scale)
         {
             _scales.Remove(scale);
-            _map.InitBaseMap();
-            _map.BaseMap.RemoveFiniteDisplayScale(scale);
+            _map.RemoveFiniteDisplayScale(scale, true);
             _edSvc.MarkDirty();
         }
 
         private void AddScaleToMap(double scale)
         {
             _map.InitBaseMap();
-            _map.BaseMap.AddFiniteDisplayScale(scale);
+            _map.AddFiniteDisplayScale(scale);
             _edSvc.MarkDirty();
         }
 

Modified: branches/maestro-5.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- branches/maestro-5.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -413,7 +413,7 @@
                     layerCount++;
                 }
                 //Detach the base layer group
-                _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+                _map.RemoveBaseLayerGroup(group.Tag, true);
                 MessageBox.Show(string.Format(Strings.BaseLayerGroupConvertedToLayerGroup, group.Tag.Name, groupName));
                 this.RefreshModels();
                 tabControl1.SelectedIndex = 0; //Switch to Layer Groups
@@ -705,7 +705,7 @@
 
         private void RemoveSelectedTiledLayerItem(BaseLayerGroupItem group)
         {
-            _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+            _map.RemoveBaseLayerGroup(group.Tag, true);
             propertiesPanel.Controls.Clear();
             _tiledLayerModel.Invalidate();
         }

Modified: branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
===================================================================
--- branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -463,6 +463,92 @@
     public static class MapDefinitionExtensions
     {
         /// <summary>
+        /// Adds the specified finite display scale to the Map Definition
+        /// </summary>
+        /// <param name="map"></param>
+        /// <param name="scale"></param>
+        public static void AddFiniteDisplayScale(this IMapDefinition map, double scale)
+        {
+            Check.NotNull(map, "map"); //NOXLATE
+
+            if (map.BaseMap != null)
+                map.InitBaseMap();
+
+            map.BaseMap.AddFiniteDisplayScale(scale);
+        }
+
+        /// <summary>
+        /// Removes the specified finite display scale from the Map Definition
+        /// </summary>
+        /// <param name="map"></param>
+        /// <param name="scale"></param>
+        /// <param name="bDetachIfEmpty"></param>
+        public static void RemoveFiniteDisplayScale(this IMapDefinition map, double scale, bool bDetachIfEmpty)
+        {
+            Check.NotNull(map, "map"); //NOXLATE
+
+            if (map.BaseMap == null)
+                return;
+
+            map.BaseMap.RemoveFiniteDisplayScale(scale);
+            if (map.BaseMap.GroupCount == 0 && map.BaseMap.ScaleCount == 0 && bDetachIfEmpty)
+                map.RemoveBaseMap();
+        }
+
+        /// <summary>
+        /// Removes all finite display scales from the Map Definition
+        /// </summary>
+        /// <param name="map"></param>
+        /// <param name="bDetachIfEmpty"></param>
+        public static void RemoveAllFiniteDisplayScales(this IMapDefinition map, bool bDetachIfEmpty)
+        {
+            Check.NotNull(map, "map"); //NOXLATE
+
+            if (map.BaseMap == null)
+                return;
+
+            map.BaseMap.RemoveAllScales();
+            if (map.BaseMap.GroupCount == 0 && map.BaseMap.ScaleCount == 0 && bDetachIfEmpty)
+                map.RemoveBaseMap();
+        }
+
+        /// <summary>
+        /// Adds the specified base layer group to the map definition
+        /// </summary>
+        /// <param name="map"></param>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public static IBaseMapGroup AddBaseLayerGroup(this IMapDefinition map, string name)
+        {
+            Check.NotNull(map, "map"); //NOXLATE
+            Check.NotEmpty(name, "name"); //NOXLATE
+
+            if (map.BaseMap == null)
+                map.InitBaseMap();
+
+            return map.BaseMap.AddBaseLayerGroup(name);
+        }
+
+        /// <summary>
+        /// Removes the given base layer group from the Map Definition
+        /// </summary>
+        /// <param name="map"></param>
+        /// <param name="group"></param>
+        public static void RemoveBaseLayerGroup(this IMapDefinition map, IBaseMapGroup group, bool bDetachIfEmpty)
+        {
+            Check.NotNull(map, "map"); //NOXLATE
+            if (null == group)
+                return;
+
+            if (map.BaseMap == null)
+                return;
+
+            map.BaseMap.RemoveBaseLayerGroup(group);
+            if (map.BaseMap.GroupCount == 0 && map.BaseMap.GroupCount == 0 && bDetachIfEmpty)
+                map.RemoveBaseMap();
+        }
+
+        /// <summary>
         /// Updates the group name references of all layers belonging to a particular group
         /// </summary>
         /// <param name="map">The map.</param>

Modified: branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
===================================================================
--- branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs	2013-09-06 09:11:46 UTC (rev 7842)
+++ branches/maestro-5.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs	2013-09-06 09:19:01 UTC (rev 7843)
@@ -694,6 +694,15 @@
         {
             _vschema = null;
             versionField = null;
+            foreach (var sm in this.SimpleSymbol)
+            {
+                var ssym = sm.Item as ISimpleSymbolDefinition;
+                var csym = sm.Item as ICompoundSymbolDefinition;
+                if (ssym != null)
+                    ssym.RemoveSchemaAttributes();
+                else if (csym != null)
+                    csym.RemoveSchemaAttributes();
+            }
         }
 
         public static CompoundSymbolDefinition CreateDefault()



More information about the mapguide-commits mailing list