[mapguide-commits] r5156 - in trunk/Tools/Maestro: Maestro
Maestro/MaestroEditorInterface
Maestro/ResourceEditors/LoadProcedureEditors MaestroAPI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Sep 20 02:46:40 EDT 2010
Author: jng
Date: 2010-09-20 06:46:40 +0000 (Mon, 20 Sep 2010)
New Revision: 5156
Modified:
trunk/Tools/Maestro/Maestro/EditorInterface.cs
trunk/Tools/Maestro/Maestro/MaestroEditorInterface/EditorInterface.cs
trunk/Tools/Maestro/Maestro/ResourceEditors/LoadProcedureEditors/LoadProcedureCtrl.cs
trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs
trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
trunk/Tools/Maestro/MaestroAPI/XmlFeatureSetReader.cs
Log:
This submission fixes tickets #1433, #1434 and #1442 all relating to load procedures
- Add msgbox notification on completion of load procedure.
- Embed geometrytype metadata to geometry FeatureSetColumns.
- Use this embedded metadata to determine which unnecessary layer styles can be removed.
- Use the decoded class name for the feature class name when creating the layer definitions.
Modified: trunk/Tools/Maestro/Maestro/EditorInterface.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/EditorInterface.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/Maestro/EditorInterface.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -412,6 +412,11 @@
Program.OpenUrl(url);
}
+ public void RefreshTree()
+ {
+ m_editor.RebuildDocumentTree();
+ }
+
public bool UseFusionPreview { get { return Program.ApplicationSettings.UseFusionPreview; } }
public void SetLastException(Exception ex) { m_editor.LastException = ex; }
Modified: trunk/Tools/Maestro/Maestro/MaestroEditorInterface/EditorInterface.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/MaestroEditorInterface/EditorInterface.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/Maestro/MaestroEditorInterface/EditorInterface.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -61,6 +61,11 @@
/// </summary>
void UpdateResourceStates();
+ /// <summary>
+ /// Forces a refresh of the Site Explorer
+ /// </summary>
+ void RefreshTree();
+
/// <summary>
/// Request a browse dialog for the specified resource type
/// </summary>
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LoadProcedureEditors/LoadProcedureCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LoadProcedureEditors/LoadProcedureCtrl.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LoadProcedureEditors/LoadProcedureCtrl.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -200,6 +200,8 @@
try
{
dlg.RunOperationAsync(ownerForm, worker, _ed.CurrentConnection, _resourceID);
+ MessageBox.Show("Load Procedure completed");
+ _ed.RefreshTree();
}
catch (CancelException)
{
Modified: trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/MaestroAPI/FeatureSetReader.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -271,12 +271,26 @@
public abstract class FeatureSetColumn
{
+ protected System.Collections.Hashtable m_metadata = new System.Collections.Hashtable();
+
protected string m_name;
protected Type m_type;
protected bool m_allowNull;
public string Name { get { return m_name; } }
public Type Type { get { return m_type; } }
+
+ public System.Collections.ICollection MetadataKeys { get { return m_metadata.Keys; } }
+
+ public object GetMetadata(string key)
+ {
+ return m_metadata[key];
+ }
+
+ public void SetMetadata(string key, object value)
+ {
+ m_metadata[key] = value;
+ }
}
public abstract class FeatureSetRow : IDataRecord
Modified: trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -2434,15 +2434,53 @@
ld.ResourceId = lyrId;
VectorLayerDefinitionType vld = ld.Item as VectorLayerDefinitionType;
vld.ResourceId = fsId;
- vld.FeatureName = clsDef.Fullname;
+ vld.FeatureName = clsDef.FullnameDecoded;
vld.Geometry = geom.Name;
+ //Step 4: Infer geometry storage support and remove unsupported styles
+ object obj = geom.GetMetadata(GeometryMetadata.GEOM_TYPES);
+ if (obj != null)
+ {
+ List<string> geomTypes = new List<string>();
+ geomTypes.AddRange(obj.ToString().Trim().Split(' '));
+
+ var scale = vld.VectorScaleRange[0];
+
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_POINT))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(PointTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_CURVE))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(LineTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_SURFACE))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(AreaTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ }
+
this.SaveResource(ld);
resCreatedOrUpdated.Add(lyrId);
cb(this, new LengthyOperationProgressArgs("Created: " + lyrId, current));
-
- //Step 4: Infer geometry storage support and remove unsupported styles
- //TODO: There doesn't seem to be a MaestroAPI way to figure out geometry storage types atm
}
}
}
@@ -2640,12 +2678,50 @@
vld.FeatureName = clsDef.Fullname;
vld.Geometry = geom.Name;
+ //Step 4: Infer geometry storage support and remove unsupported styles
+ object obj = geom.GetMetadata(GeometryMetadata.GEOM_TYPES);
+ if (obj != null)
+ {
+ List<string> geomTypes = new List<string>();
+ geomTypes.AddRange(obj.ToString().Trim().Split(' '));
+
+ var scale = vld.VectorScaleRange[0];
+
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_POINT))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(PointTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_CURVE))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(LineTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_SURFACE))
+ {
+ for (int i = scale.Items.Count - 1; i >= 0; i--)
+ {
+ if (typeof(AreaTypeStyleType).IsAssignableFrom(scale.Items[i].GetType()))
+ {
+ scale.Items.RemoveAt(i);
+ }
+ }
+ }
+ }
+
this.SaveResource(ld);
resCreatedOrUpdated.Add(lyrId);
cb(this, new LengthyOperationProgressArgs("Created: " + lyrId, current));
-
- //Step 4: Infer geometry storage support and remove unsupported styles
- //TODO: There doesn't seem to be a MaestroAPI way to figure out geometry storage types atm
}
}
}
Modified: trunk/Tools/Maestro/MaestroAPI/XmlFeatureSetReader.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/XmlFeatureSetReader.cs 2010-09-20 06:03:53 UTC (rev 5155)
+++ trunk/Tools/Maestro/MaestroAPI/XmlFeatureSetReader.cs 2010-09-20 06:46:40 UTC (rev 5156)
@@ -229,6 +229,16 @@
}
}
+ public class GeometryMetadata
+ {
+ public const string GEOM_TYPES = "GEOM_TYPES";
+
+ public const string GEOM_TYPE_POINT = "point";
+ public const string GEOM_TYPE_CURVE = "curve";
+ public const string GEOM_TYPE_SURFACE = "surface";
+ public const string GEOM_TYPE_SOLID = "solid";
+ }
+
public class XmlFeatureSetColumn : FeatureSetColumn
{
internal XmlFeatureSetColumn(XmlNode node) : base()
@@ -290,10 +300,16 @@
m_name = node.Attributes["name"].Value;
m_allowNull = node.Attributes["minOccurs"] != null && node.Attributes["minOccurs"].Value == "0";
if (node.Attributes["type"] != null && node.Attributes["type"].Value == "gml:AbstractGeometryType")
+ {
m_type = Utility.GeometryType;
+ this.SetMetadata(GeometryMetadata.GEOM_TYPES, node.Attributes["fdo:geometricTypes"].Value);
+ }
else if (node["xs:simpleType"] == null)
+ {
m_type = Utility.RasterType;
+ }
else
+ {
switch (node["xs:simpleType"]["xs:restriction"].Attributes["base"].Value.ToLower())
{
case "xs:string":
@@ -331,6 +347,7 @@
m_type = Utility.UnmappedType;
break;
}
+ }
}
}
}
More information about the mapguide-commits
mailing list