[mapguide-commits] r4429 - in trunk/Tools/Maestro/Maestro: .
ResourceEditors/LayerEditorControls
ResourceEditors/LayerEditorControls/ScaleControls
ResourceEditors/LayerEditorControls/Strings
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Dec 12 18:29:29 EST 2009
Author: ksgeograf
Date: 2009-12-12 18:29:28 -0500 (Sat, 12 Dec 2009)
New Revision: 4429
Modified:
trunk/Tools/Maestro/Maestro/FormMain.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRange.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeConditions.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeList.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.Designer.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.resx
trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/VectorLayer.cs
Log:
Fixed issue #1170.
Also fixed a bug with loading resources from xml files.
Modified: trunk/Tools/Maestro/Maestro/FormMain.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/FormMain.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/FormMain.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -2022,24 +2022,17 @@
return;
}
- object item = null;
- using(System.IO.FileStream fs = System.IO.File.Open(OpenXmlFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
- item = m_connection.DeserializeObject(m_editors.GetResourceInstanceTypeFromResourceID(document.ResourceId), fs);
- EditorInterface edir = new EditorInterface(this, new TabPage(m_editors.GetResourceNameFromResourceID(document.ResourceId)), document.ResourceId, true);
- OSGeo.MapGuide.Maestro.ResourceEditors.XmlEditorControl c = new OSGeo.MapGuide.Maestro.ResourceEditors.XmlEditorControl(edir);
- c.Resource = item;
- c.ResourceId = document.ResourceId;
- edir.Page.Controls.Add(c);
- c.Dock = DockStyle.Fill;
- tabItems.TabPages.Add(edir.Page);
- tabItems.SelectedTab = edir.Page;
- edir.HasChanged();
- m_userControls.Add(document.ResourceId, edir);
- tabItems_SelectedIndexChanged(sender, e);
+ string tmpid = "Session:" + m_connection.SessionID + "//" + Guid.NewGuid().ToString() + "." + new MaestroAPI.ResourceIdentifier(document.ResourceId).Extension;
+
+ using (System.IO.FileStream fs = System.IO.File.Open(OpenXmlFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
+ m_connection.SetResourceXmlData(tmpid, fs);
+
+ OpenResource(tmpid, typeof(ResourceEditors.XmlEditorControl));
}
}
catch (Exception ex)
{
+ LastException = ex;
MessageBox.Show(this, string.Format(Strings.FormMain.XmlEditorError, ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRange.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRange.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRange.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -37,6 +37,8 @@
private VectorLayer m_owner;
+ public bool HasUnsupportedItems { get { return scaleRangeConditions.HasUnsupportedItems; } }
+
public VectorLayer Owner
{
get { return m_owner; }
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeConditions.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeConditions.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeConditions.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -34,7 +34,9 @@
private VectorScaleRangeType m_vsc;
private bool m_isUpdating = false;
+ private bool m_hasUnsupportedItems = false;
+ public bool HasUnsupportedItems { get { return m_hasUnsupportedItems; } }
private VectorLayer m_owner;
@@ -65,6 +67,7 @@
bool hasPoints = false;
bool hasLines = false;
bool hasAreas = false;
+ m_hasUnsupportedItems = false;
if (m_vsc.Items != null)
foreach (object o in m_vsc.Items)
{
@@ -83,6 +86,8 @@
hasAreas = true;
areaConditionList.SetItem(m_vsc, o as AreaTypeStyleType);
}
+ else
+ m_hasUnsupportedItems = true;
}
DisplayPoints.Checked = hasPoints;
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeList.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeList.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/ScaleControls/ScaleRangeList.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -36,6 +36,18 @@
private VectorScaleRangeType m_selectedItem;
private VectorLayer m_owner;
+ public bool HasUnsupportedItems
+ {
+ get
+ {
+ foreach (ScaleRange sr in this.ControlList.Controls)
+ if (sr.HasUnsupportedItems)
+ return true;
+
+ return false;
+ }
+ }
+
public VectorLayer Owner
{
get { return m_owner; }
@@ -43,7 +55,7 @@
{
m_owner = value;
foreach (ScaleRange sr in this.ControlList.Controls)
- sr.Owner = m_owner; ;
+ sr.Owner = m_owner;
}
}
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.Designer.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.Designer.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -77,5 +77,16 @@
return ResourceManager.GetString("SchemaMissingError", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to This layer contains items that are not supported by the editor.
+ ///If you save this layer they may be removed.
+ ///It is recommended that you open this layer with the xml editor instead..
+ /// </summary>
+ internal static string UnsupportedItemsDetectedWarning {
+ get {
+ return ResourceManager.GetString("UnsupportedItemsDetectedWarning", resourceCulture);
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.resx
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.resx 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/Strings/VectorLayer.resx 2009-12-12 23:29:28 UTC (rev 4429)
@@ -125,4 +125,10 @@
<value>Cannot display editor, because no schema was selected</value>
<comment>An error message that is displayed when the user attempts to perform an action that requires a schema present, but none is selected</comment>
</data>
+ <data name="UnsupportedItemsDetectedWarning" xml:space="preserve">
+ <value>This layer contains items that are not supported by the editor.
+If you save this layer they may be removed.
+It is recommended that you open this layer with the xml editor instead.</value>
+ <comment>A warning message that is displayed if the layer has unsupported items</comment>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/VectorLayer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/VectorLayer.cs 2009-12-12 23:01:21 UTC (rev 4428)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditorControls/VectorLayer.cs 2009-12-12 23:29:28 UTC (rev 4429)
@@ -92,6 +92,7 @@
private ToolStripButton SortScalesByDisplayRangeButton;
private FeatureSourceDescription.FeatureSourceSchema m_selectedSchema;
+ private bool m_hasReportedUnsupportedItems = false;
public VectorLayer()
{
@@ -614,6 +615,12 @@
scaleRangeList.SetItem(vl);
scaleRangeList.ResizeAuto();
+
+ if (!m_hasReportedUnsupportedItems && scaleRangeList.HasUnsupportedItems)
+ {
+ m_hasReportedUnsupportedItems = true;
+ MessageBox.Show(this, Strings.VectorLayer.UnsupportedItemsDetectedWarning, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
}
}
finally
More information about the mapguide-commits
mailing list