[mapguide-commits] r7128 - in trunk/Tools/Maestro: Maestro.Editors Maestro.Editors/FeatureSource/Providers/Wms MaestroAPITests OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Schema OSGeo.MapGuide.MaestroAPI/SchemaOverrides
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Oct 18 12:21:48 PDT 2012
Author: jng
Date: 2012-10-18 12:21:47 -0700 (Thu, 18 Oct 2012)
New Revision: 7128
Modified:
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx
trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.resx
trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/DataPropertyDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/FeatureSchema.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/GeometricPropertyDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/PropertyDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/RasterPropertyDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
Log:
#2117: Make the WMS Feature Source editor more robust
- Use the recently exposed GetSchemaMapping API to provide the "base" WMS configuration document for us to build on, falling back to the original method if the first method fails.
- Fix schema element description properties not been serialized/deserialized from XML. This is important as for some WMS services the WMS layer is put into the description component of a FDO logical class definition with the name being a long ugly guid.
- Update a configuration unit test to verify description serialization
- Update the WMS Advanced Configuration dialog:
- Support editing the logical class name/description and to swap them
- Add a button to batch swap the name/description of all logical classes
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.Designer.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.Designer.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -44,10 +44,18 @@
this.grdSpatialContexts = new System.Windows.Forms.DataGridView();
this.COL_NAME = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.COL_CS = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.grpLogicalClass = new System.Windows.Forms.GroupBox();
+ this.lnkSwap = new System.Windows.Forms.LinkLabel();
+ this.txtClassDescription = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.txtClassName = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnSwapAll = new System.Windows.Forms.Button();
this.groupBox2.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grdSpatialContexts)).BeginInit();
+ this.grpLogicalClass.SuspendLayout();
this.SuspendLayout();
//
// label1
@@ -162,12 +170,61 @@
this.COL_CS.Name = "COL_CS";
this.COL_CS.ReadOnly = true;
//
+ // grpLogicalClass
+ //
+ resources.ApplyResources(this.grpLogicalClass, "grpLogicalClass");
+ this.grpLogicalClass.Controls.Add(this.lnkSwap);
+ this.grpLogicalClass.Controls.Add(this.txtClassDescription);
+ this.grpLogicalClass.Controls.Add(this.label3);
+ this.grpLogicalClass.Controls.Add(this.txtClassName);
+ this.grpLogicalClass.Controls.Add(this.label2);
+ this.grpLogicalClass.Name = "grpLogicalClass";
+ this.grpLogicalClass.TabStop = false;
+ //
+ // lnkSwap
+ //
+ resources.ApplyResources(this.lnkSwap, "lnkSwap");
+ this.lnkSwap.Name = "lnkSwap";
+ this.lnkSwap.TabStop = true;
+ this.lnkSwap.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkSwap_LinkClicked);
+ //
+ // txtClassDescription
+ //
+ resources.ApplyResources(this.txtClassDescription, "txtClassDescription");
+ this.txtClassDescription.Name = "txtClassDescription";
+ this.txtClassDescription.TextChanged += new System.EventHandler(this.txtClassDescription_TextChanged);
+ //
+ // label3
+ //
+ resources.ApplyResources(this.label3, "label3");
+ this.label3.Name = "label3";
+ //
+ // txtClassName
+ //
+ resources.ApplyResources(this.txtClassName, "txtClassName");
+ this.txtClassName.Name = "txtClassName";
+ this.txtClassName.TextChanged += new System.EventHandler(this.txtClassName_TextChanged);
+ //
+ // label2
+ //
+ resources.ApplyResources(this.label2, "label2");
+ this.label2.Name = "label2";
+ //
+ // btnSwapAll
+ //
+ resources.ApplyResources(this.btnSwapAll, "btnSwapAll");
+ this.btnSwapAll.Name = "btnSwapAll";
+ this.btnSwapAll.UseVisualStyleBackColor = true;
+ this.btnSwapAll.Click += new System.EventHandler(this.btnSwapAll_Click);
+ //
// WmsAdvancedConfigurationDialog
//
this.AcceptButton = this.btnSave;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
resources.ApplyResources(this, "$this");
this.ControlBox = false;
+ this.Controls.Add(this.btnSwapAll);
+ this.Controls.Add(this.grpLogicalClass);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.groupBox2);
@@ -183,6 +240,8 @@
this.toolStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.grdSpatialContexts)).EndInit();
+ this.grpLogicalClass.ResumeLayout(false);
+ this.grpLogicalClass.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -205,5 +264,12 @@
private System.Windows.Forms.DataGridView grdSpatialContexts;
private System.Windows.Forms.DataGridViewTextBoxColumn COL_NAME;
private System.Windows.Forms.DataGridViewTextBoxColumn COL_CS;
+ private System.Windows.Forms.GroupBox grpLogicalClass;
+ private System.Windows.Forms.TextBox txtClassDescription;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox txtClassName;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.LinkLabel lnkSwap;
+ private System.Windows.Forms.Button btnSwapAll;
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -29,6 +29,7 @@
using OSGeo.MapGuide.MaestroAPI.Schema;
using Maestro.Editors.Common;
using OSGeo.MapGuide.ObjectModels.Common;
+using Maestro.Shared.UI;
namespace Maestro.Editors.FeatureSource.Providers.Wms
{
@@ -39,13 +40,11 @@
private IFeatureSource _fs;
public WmsConfigurationDocument Document { get { return _config; } }
- private BindingList<RasterWmsItem> _items;
public WmsAdvancedConfigurationDialog(IEditorService service)
{
InitializeComponent();
grdSpatialContexts.AutoGenerateColumns = false;
- _items = new BindingList<RasterWmsItem>();
_service = service;
_fs = (IFeatureSource)_service.GetEditedResource();
txtFeatureServer.Text = _fs.GetConnectionProperty("FeatureServer"); //NOXLATE
@@ -59,16 +58,15 @@
catch (Exception ex)
{
MessageBox.Show(string.Format(Strings.ErrorLoadingWmsConfig, ex.Message), Strings.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
- _config = BuildDefaultWmsDocument();
+ MakeDefaultDocument();
}
}
else
{
- _config = BuildDefaultWmsDocument();
+ MakeDefaultDocument();
}
- _items = new BindingList<RasterWmsItem>(new List<RasterWmsItem>(_config.RasterOverrides));
- lstFeatureClasses.DataSource = _items;
+ lstFeatureClasses.DataSource = _config.RasterOverrides;
grdSpatialContexts.DataSource = _config.SpatialContexts;
}
@@ -116,7 +114,7 @@
private static RasterWmsItem CreateDefaultItem(string schemaName, string clsName, string rasName, IFdoSpatialContext defaultSc)
{
- var item = new RasterWmsItem(clsName, rasName);
+ var item = new RasterWmsItem(schemaName, clsName, rasName);
item.ImageFormat = "PNG"; //NOXLATE
item.IsTransparent = true;
item.BackgroundColor = Color.White;
@@ -147,16 +145,61 @@
this.DialogResult = DialogResult.Cancel;
}
+ private ClassDefinition _logicalClass;
+ private bool _updatingLogicalClassUI = false;
+
private void lstFeatureClasses_SelectedIndexChanged(object sender, EventArgs e)
{
var item = (RasterWmsItem)lstFeatureClasses.SelectedItem;
grpRaster.Controls.Clear();
+ _updatingLogicalClassUI = true;
+ try
+ {
+ if (item != null)
+ {
+ var ctrl = new RasterDefinitionCtrl(_config, item, _service);
+ ctrl.Dock = DockStyle.Fill;
+ grpRaster.Controls.Add(ctrl);
- var ctrl = new RasterDefinitionCtrl(_config, item, _service);
- ctrl.Dock = DockStyle.Fill;
- grpRaster.Controls.Add(ctrl);
+ btnRemove.Enabled = true;
- btnRemove.Enabled = true;
+ //Get logical class
+ string schemaName = item.SchemaName;
+ string className = item.FeatureClass;
+
+ if (!string.IsNullOrEmpty(schemaName) && !string.IsNullOrEmpty(className))
+ {
+ _logicalClass = _config.GetClass(schemaName, className);
+ if (_logicalClass != null)
+ {
+ txtClassName.Text = _logicalClass.Name;
+ txtClassDescription.Text = _logicalClass.Description;
+ }
+ else
+ {
+ txtClassName.Text = string.Empty;
+ txtClassDescription.Text = string.Empty;
+ }
+ }
+ else
+ {
+ _logicalClass = null;
+ txtClassName.Text = string.Empty;
+ txtClassDescription.Text = string.Empty;
+ }
+ }
+ else
+ {
+ _logicalClass = null;
+ txtClassName.Text = string.Empty;
+ txtClassDescription.Text = string.Empty;
+ }
+ }
+ finally
+ {
+ _updatingLogicalClassUI = false;
+ }
+ grpLogicalClass.Enabled = (_logicalClass != null);
}
private void btnRemove_Click(object sender, EventArgs e)
@@ -206,15 +249,122 @@
private void btnReset_Click(object sender, EventArgs e)
{
- _config = BuildDefaultWmsDocument();
- _items.Clear();
- foreach (var ov in _config.RasterOverrides)
+ MakeDefaultDocument();
+ lstFeatureClasses.DataSource = _config.RasterOverrides;
+ grdSpatialContexts.DataSource = _config.SpatialContexts;
+ }
+
+ private void MakeDefaultDocument()
+ {
+ try
{
- _items.Add(ov);
+ _config = (WmsConfigurationDocument)_service.FeatureService.GetSchemaMapping("OSGeo.WMS", _fs.ConnectionString); //NOXLATE
+ //BOGUS: This was not as sufficient as I originally thought, nevertheless this contains
+ //information that would not exist if we constructed the document the old fashioned way.
+ string defaultScName = string.Empty;
+ if (_config.SpatialContexts.Length > 0)
+ {
+ defaultScName = _config.SpatialContexts[0].Name;
+ }
+ else
+ {
+ var list = _fs.GetSpatialInfo(false);
+ if (list.SpatialContext.Count > 0)
+ {
+ defaultScName = list.SpatialContext[0].Name;
+ }
+ else //Really? What kind of WMS service are you????
+ {
+ var sc = new FdoSpatialContextListSpatialContext()
+ {
+ Name = "EPSG:4326", //NOXLATE
+ Description = "Maestro-generated spatialc context", //NOXLATE
+ CoordinateSystemName = "EPSG:4326", //NOXLATE
+ CoordinateSystemWkt = "GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]", //NOXLATE
+ Extent = new FdoSpatialContextListSpatialContextExtent()
+ {
+ LowerLeftCoordinate = new FdoSpatialContextListSpatialContextExtentLowerLeftCoordinate()
+ {
+ X = "-180.0", //NOXLATE
+ Y = "-90.0" //NOXLATE
+ },
+ UpperRightCoordinate = new FdoSpatialContextListSpatialContextExtentUpperRightCoordinate()
+ {
+ X = "180.0", //NOXLATE
+ Y = "90.0" //NOXLATE
+ }
+ },
+ ExtentType = FdoSpatialContextListSpatialContextExtentType.Static,
+ IsActive = true,
+ XYTolerance = 0.0001,
+ ZTolerance = 0.0001,
+ };
+ _config.AddSpatialContext(sc);
+ defaultScName = sc.Name;
+ }
+ }
+
+ EnsureRasterProperties(defaultScName);
+ _config.EnsureConsistency();
}
- grdSpatialContexts.DataSource = _config.SpatialContexts;
+ catch
+ {
+ _config = BuildDefaultWmsDocument();
+ }
}
+ private void EnsureRasterProperties(string defaultScName)
+ {
+ foreach (var schema in _config.Schemas)
+ {
+ foreach (var cls in schema.Classes)
+ {
+ //Add identity property if none found
+ if (cls.IdentityProperties.Count == 0)
+ {
+ cls.AddProperty(new DataPropertyDefinition("Id", string.Empty) //NOXLATE
+ {
+ DataType = DataPropertyType.String,
+ Length = 256,
+ IsNullable = false
+ }, true);
+ }
+ //Add raster property if there's only one property (the identity property we either just added or found)
+ if (cls.Properties.Count == 1)
+ {
+ cls.AddProperty(new RasterPropertyDefinition("Image", string.Empty) //NOXLATE
+ {
+ DefaultImageXSize = 1024,
+ DefaultImageYSize = 1024,
+ SpatialContextAssociation = defaultScName
+ });
+ }
+ else
+ {
+ bool bFoundRaster = false;
+ //Try to find this raster property
+ foreach (var prop in cls.Properties)
+ {
+ if (prop.Type == OSGeo.MapGuide.MaestroAPI.Schema.PropertyDefinitionType.Raster)
+ {
+ bFoundRaster = true;
+ break;
+ }
+ }
+ if (!bFoundRaster)
+ {
+ cls.AddProperty(new RasterPropertyDefinition("Image", string.Empty) //NOXLATE
+ {
+ DefaultImageXSize = 1024,
+ DefaultImageYSize = 1024,
+ SpatialContextAssociation = defaultScName
+ });
+ }
+ }
+ }
+ }
+ }
+
private void grdSpatialContexts_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1)
@@ -226,5 +376,78 @@
}
}
}
+
+ private void txtClassName_TextChanged(object sender, EventArgs e)
+ {
+ if (_updatingLogicalClassUI) return;
+ if (_logicalClass == null) return;
+ var item = lstFeatureClasses.SelectedItem as RasterWmsItem;
+ if (item == null) return;
+
+ _logicalClass.Name = txtClassName.Text;
+ item.FeatureClass = _logicalClass.Name;
+ lstFeatureClasses.DataSource = _config.RasterOverrides; //rebind
+ }
+
+ private void txtClassDescription_TextChanged(object sender, EventArgs e)
+ {
+ if (_updatingLogicalClassUI) return;
+ if (_logicalClass == null) return;
+ var item = lstFeatureClasses.SelectedItem as RasterWmsItem;
+ if (item == null) return;
+
+ _logicalClass.Description = txtClassDescription.Text;
+ item.FeatureClass = _logicalClass.Name;
+ lstFeatureClasses.DataSource = _config.RasterOverrides; //rebind
+ }
+
+ private void lnkSwap_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ if (_logicalClass == null) return;
+ var item = lstFeatureClasses.SelectedItem as RasterWmsItem;
+ if (item == null) return;
+
+ try
+ {
+ _updatingLogicalClassUI = true;
+ var tmp = txtClassName.Text;
+ txtClassName.Text = txtClassDescription.Text;
+ txtClassDescription.Text = tmp;
+
+ _logicalClass.Name = txtClassName.Text;
+ _logicalClass.Description = txtClassDescription.Text;
+ item.FeatureClass = _logicalClass.Name;
+ lstFeatureClasses.DataSource = _config.RasterOverrides; //rebind
+ }
+ finally
+ {
+ _updatingLogicalClassUI = false;
+ }
+ }
+
+ private void btnSwapAll_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show(Strings.ConfirmWmsLogicalClassSwap, string.Empty, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
+ {
+ using (new WaitCursor(this))
+ {
+ _logicalClass = null;
+ lstFeatureClasses.SelectedItem = null;
+ foreach (var item in _config.RasterOverrides)
+ {
+ var cls = _config.GetClass(item.SchemaName, item.FeatureClass);
+ if (cls == null)
+ continue;
+
+ var tmp = cls.Name;
+ cls.Name = cls.Description;
+ cls.Description = tmp;
+
+ item.FeatureClass = cls.Name;
+ }
+ lstFeatureClasses.DataSource = _config.RasterOverrides; //rebind
+ }
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx 2012-10-18 19:21:47 UTC (rev 7128)
@@ -144,7 +144,7 @@
<value>$this</value>
</data>
<data name=">>label1.ZOrder" xml:space="preserve">
- <value>7</value>
+ <value>9</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtFeatureServer.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
@@ -169,16 +169,16 @@
<value>$this</value>
</data>
<data name=">>txtFeatureServer.ZOrder" xml:space="preserve">
- <value>6</value>
+ <value>8</value>
</data>
<data name="grpRaster.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="grpRaster.Location" type="System.Drawing.Point, System.Drawing">
- <value>294, 134</value>
+ <value>294, 224</value>
</data>
<data name="grpRaster.Size" type="System.Drawing.Size, System.Drawing">
- <value>357, 352</value>
+ <value>357, 262</value>
</data>
<data name="grpRaster.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -196,7 +196,7 @@
<value>$this</value>
</data>
<data name=">>grpRaster.ZOrder" xml:space="preserve">
- <value>5</value>
+ <value>7</value>
</data>
<data name="btnSave.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value>
</data>
<data name=">>btnSave.ZOrder" xml:space="preserve">
- <value>4</value>
+ <value>6</value>
</data>
<data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
@@ -250,11 +250,62 @@
<value>$this</value>
</data>
<data name=">>btnCancel.ZOrder" xml:space="preserve">
- <value>3</value>
+ <value>5</value>
</data>
+ <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
<data name="groupBox2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left</value>
</data>
+ <data name=">>lstFeatureClasses.Name" xml:space="preserve">
+ <value>lstFeatureClasses</value>
+ </data>
+ <data name=">>lstFeatureClasses.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lstFeatureClasses.Parent" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>lstFeatureClasses.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name=">>toolStrip1.Name" xml:space="preserve">
+ <value>toolStrip1</value>
+ </data>
+ <data name=">>toolStrip1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>toolStrip1.Parent" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>toolStrip1.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 134</value>
+ </data>
+ <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
+ <value>276, 352</value>
+ </data>
+ <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
+ <value>5</value>
+ </data>
+ <data name="groupBox2.Text" xml:space="preserve">
+ <value>Feature Classes</value>
+ </data>
+ <data name=">>groupBox2.Name" xml:space="preserve">
+ <value>groupBox2</value>
+ </data>
+ <data name=">>groupBox2.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>groupBox2.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>groupBox2.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
<data name="lstFeatureClasses.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@@ -309,30 +360,6 @@
<data name=">>toolStrip1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
- <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
- <value>12, 134</value>
- </data>
- <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
- <value>276, 352</value>
- </data>
- <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
- <value>5</value>
- </data>
- <data name="groupBox2.Text" xml:space="preserve">
- <value>Feature Classes</value>
- </data>
- <data name=">>groupBox2.Name" xml:space="preserve">
- <value>groupBox2</value>
- </data>
- <data name=">>groupBox2.Type" xml:space="preserve">
- <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </data>
- <data name=">>groupBox2.Parent" xml:space="preserve">
- <value>$this</value>
- </data>
- <data name=">>groupBox2.ZOrder" xml:space="preserve">
- <value>2</value>
- </data>
<data name="btnAdd.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
@@ -379,23 +406,53 @@
<value>$this</value>
</data>
<data name=">>btnReset.ZOrder" xml:space="preserve">
- <value>1</value>
+ <value>3</value>
</data>
<data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
+ <data name=">>grdSpatialContexts.Name" xml:space="preserve">
+ <value>grdSpatialContexts</value>
+ </data>
+ <data name=">>grdSpatialContexts.Type" xml:space="preserve">
+ <value>System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>grdSpatialContexts.Parent" xml:space="preserve">
+ <value>groupBox1</value>
+ </data>
+ <data name=">>grdSpatialContexts.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 39</value>
+ </data>
+ <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>639, 89</value>
+ </data>
+ <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
+ <value>7</value>
+ </data>
+ <data name="groupBox1.Text" xml:space="preserve">
+ <value>Spatial Contexts (click cell to edit coordinate system)</value>
+ </data>
+ <data name=">>groupBox1.Name" xml:space="preserve">
+ <value>groupBox1</value>
+ </data>
+ <data name=">>groupBox1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>groupBox1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>groupBox1.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
<metadata name="COL_NAME.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <data name="COL_NAME.HeaderText" xml:space="preserve">
- <value>Name</value>
- </data>
<metadata name="COL_CS.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <data name="COL_CS.HeaderText" xml:space="preserve">
- <value>Coordinate System</value>
- </data>
<data name="grdSpatialContexts.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@@ -420,30 +477,267 @@
<data name=">>grdSpatialContexts.ZOrder" xml:space="preserve">
<value>0</value>
</data>
- <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
- <value>12, 39</value>
+ <metadata name="COL_NAME.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="COL_NAME.HeaderText" xml:space="preserve">
+ <value>Name</value>
</data>
- <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
- <value>639, 89</value>
+ <metadata name="COL_CS.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="COL_CS.HeaderText" xml:space="preserve">
+ <value>Coordinate System</value>
</data>
- <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
- <value>7</value>
+ <data name="grpLogicalClass.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
</data>
- <data name="groupBox1.Text" xml:space="preserve">
- <value>Spatial Contexts (click cell to edit coordinate system)</value>
+ <data name=">>lnkSwap.Name" xml:space="preserve">
+ <value>lnkSwap</value>
</data>
- <data name=">>groupBox1.Name" xml:space="preserve">
- <value>groupBox1</value>
+ <data name=">>lnkSwap.Type" xml:space="preserve">
+ <value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
- <data name=">>groupBox1.Type" xml:space="preserve">
+ <data name=">>lnkSwap.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>lnkSwap.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name=">>txtClassDescription.Name" xml:space="preserve">
+ <value>txtClassDescription</value>
+ </data>
+ <data name=">>txtClassDescription.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtClassDescription.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>txtClassDescription.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name=">>label3.Name" xml:space="preserve">
+ <value>label3</value>
+ </data>
+ <data name=">>label3.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label3.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>label3.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name=">>txtClassName.Name" xml:space="preserve">
+ <value>txtClassName</value>
+ </data>
+ <data name=">>txtClassName.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtClassName.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>txtClassName.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name=">>label2.Name" xml:space="preserve">
+ <value>label2</value>
+ </data>
+ <data name=">>label2.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label2.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>label2.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
+ <data name="grpLogicalClass.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="grpLogicalClass.Location" type="System.Drawing.Point, System.Drawing">
+ <value>294, 134</value>
+ </data>
+ <data name="grpLogicalClass.Size" type="System.Drawing.Size, System.Drawing">
+ <value>354, 84</value>
+ </data>
+ <data name="grpLogicalClass.TabIndex" type="System.Int32, mscorlib">
+ <value>8</value>
+ </data>
+ <data name="grpLogicalClass.Text" xml:space="preserve">
+ <value>Logical Class</value>
+ </data>
+ <data name=">>grpLogicalClass.Name" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>grpLogicalClass.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
- <data name=">>groupBox1.Parent" xml:space="preserve">
+ <data name=">>grpLogicalClass.Parent" xml:space="preserve">
<value>$this</value>
</data>
- <data name=">>groupBox1.ZOrder" xml:space="preserve">
+ <data name=">>grpLogicalClass.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="lnkSwap.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="lnkSwap.Location" type="System.Drawing.Point, System.Drawing">
+ <value>88, 0</value>
+ </data>
+ <data name="lnkSwap.Size" type="System.Drawing.Size, System.Drawing">
+ <value>40, 13</value>
+ </data>
+ <data name="lnkSwap.TabIndex" type="System.Int32, mscorlib">
+ <value>4</value>
+ </data>
+ <data name="lnkSwap.Text" xml:space="preserve">
+ <value>(Swap)</value>
+ </data>
+ <data name=">>lnkSwap.Name" xml:space="preserve">
+ <value>lnkSwap</value>
+ </data>
+ <data name=">>lnkSwap.Type" xml:space="preserve">
+ <value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lnkSwap.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>lnkSwap.ZOrder" xml:space="preserve">
<value>0</value>
</data>
+ <data name="txtClassDescription.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
+ </data>
+ <data name="txtClassDescription.Location" type="System.Drawing.Point, System.Drawing">
+ <value>91, 49</value>
+ </data>
+ <data name="txtClassDescription.Size" type="System.Drawing.Size, System.Drawing">
+ <value>234, 20</value>
+ </data>
+ <data name="txtClassDescription.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name=">>txtClassDescription.Name" xml:space="preserve">
+ <value>txtClassDescription</value>
+ </data>
+ <data name=">>txtClassDescription.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtClassDescription.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>txtClassDescription.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="label3.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="label3.Location" type="System.Drawing.Point, System.Drawing">
+ <value>16, 52</value>
+ </data>
+ <data name="label3.Size" type="System.Drawing.Size, System.Drawing">
+ <value>60, 13</value>
+ </data>
+ <data name="label3.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="label3.Text" xml:space="preserve">
+ <value>Description</value>
+ </data>
+ <data name=">>label3.Name" xml:space="preserve">
+ <value>label3</value>
+ </data>
+ <data name=">>label3.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label3.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>label3.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="txtClassName.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
+ </data>
+ <data name="txtClassName.Location" type="System.Drawing.Point, System.Drawing">
+ <value>91, 23</value>
+ </data>
+ <data name="txtClassName.Size" type="System.Drawing.Size, System.Drawing">
+ <value>234, 20</value>
+ </data>
+ <data name="txtClassName.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name=">>txtClassName.Name" xml:space="preserve">
+ <value>txtClassName</value>
+ </data>
+ <data name=">>txtClassName.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtClassName.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>txtClassName.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name="label2.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="label2.Location" type="System.Drawing.Point, System.Drawing">
+ <value>16, 26</value>
+ </data>
+ <data name="label2.Size" type="System.Drawing.Size, System.Drawing">
+ <value>35, 13</value>
+ </data>
+ <data name="label2.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name="label2.Text" xml:space="preserve">
+ <value>Name</value>
+ </data>
+ <data name=">>label2.Name" xml:space="preserve">
+ <value>label2</value>
+ </data>
+ <data name=">>label2.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label2.Parent" xml:space="preserve">
+ <value>grpLogicalClass</value>
+ </data>
+ <data name=">>label2.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
+ <data name="btnSwapAll.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Left</value>
+ </data>
+ <data name="btnSwapAll.Location" type="System.Drawing.Point, System.Drawing">
+ <value>125, 492</value>
+ </data>
+ <data name="btnSwapAll.Size" type="System.Drawing.Size, System.Drawing">
+ <value>160, 23</value>
+ </data>
+ <data name="btnSwapAll.TabIndex" type="System.Int32, mscorlib">
+ <value>9</value>
+ </data>
+ <data name="btnSwapAll.Text" xml:space="preserve">
+ <value>Swap Class Name/Description</value>
+ </data>
+ <data name=">>btnSwapAll.Name" xml:space="preserve">
+ <value>btnSwapAll</value>
+ </data>
+ <data name=">>btnSwapAll.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnSwapAll.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnSwapAll.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -367,6 +367,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to In some cases, the actual WMS layer name would be generated in the FDO class description. Swap FDO logical class names with their descriptions?.
+ /// </summary>
+ internal static string ConfirmWmsLogicalClassSwap {
+ get {
+ return ResourceManager.GetString("ConfirmWmsLogicalClassSwap", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The content file does not exist.
/// </summary>
internal static string ContentFileMissing {
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2012-10-18 19:21:47 UTC (rev 7128)
@@ -1452,4 +1452,7 @@
<data name="InvalidLayerNameFormat" xml:space="preserve">
<value>Invalid Layer Name Format. Name must have both {0} and {1} format markers</value>
</data>
+ <data name="ConfirmWmsLogicalClassSwap" xml:space="preserve">
+ <value>In some cases, the actual WMS layer name would be generated in the FDO class description. Swap FDO logical class names with their descriptions?</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -165,15 +165,15 @@
{
var conf = new WmsConfigurationDocument();
- var schema = new FeatureSchema("WMS", "");
- var cls = new ClassDefinition("NASAWMSGlobalPan", "");
- cls.AddProperty(new DataPropertyDefinition("Id", "")
+ var schema = new FeatureSchema("WMS", "WMS Test Schema");
+ var cls = new ClassDefinition("NASAWMSGlobalPan", "WMS Test Class");
+ cls.AddProperty(new DataPropertyDefinition("Id", "ID Property")
{
DataType = DataPropertyType.String,
Length = 256,
IsNullable = false
}, true);
- cls.AddProperty(new RasterPropertyDefinition("Image", "")
+ cls.AddProperty(new RasterPropertyDefinition("Image", "Raster Property")
{
DefaultImageXSize = 800,
DefaultImageYSize = 800
@@ -182,7 +182,7 @@
schema.AddClass(cls);
conf.AddSchema(schema);
- var item = new RasterWmsItem(cls.Name, "Image");
+ var item = new RasterWmsItem(schema.Name, cls.Name, "Image");
item.ImageFormat = RasterWmsItem.WmsImageFormat.PNG;
item.IsTransparent = true;
item.BackgroundColor = ColorTranslator.FromHtml("#FFFFFF");
@@ -208,7 +208,23 @@
Assert.AreEqual(1, conf.RasterOverrides.Length);
var ritem = conf.RasterOverrides[0];
+ cls = conf.GetClass("WMS", "NASAWMSGlobalPan");
+ Assert.NotNull(cls);
+ Assert.NotNull(cls.Parent);
+ Assert.AreEqual("WMS", cls.Parent.Name);
+ Assert.AreEqual("WMS Test Schema", cls.Parent.Description);
+ Assert.AreEqual("NASAWMSGlobalPan", cls.Name);
+ Assert.AreEqual("WMS Test Class", cls.Description);
+ var prop = cls.FindProperty("Id");
+ Assert.NotNull(prop);
+ Assert.AreEqual("Id", prop.Name);
+ Assert.AreEqual("ID Property", prop.Description);
+ prop = cls.FindProperty("Image");
+ Assert.NotNull(prop);
+ Assert.AreEqual("Image", prop.Name);
+ Assert.AreEqual("Raster Property", prop.Description);
+
Assert.AreEqual(item.ImageFormat, ritem.ImageFormat);
Assert.AreEqual(item.IsTransparent, ritem.IsTransparent);
Assert.AreEqual(item.BackgroundColor, ritem.BackgroundColor);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -307,6 +307,13 @@
ctype.SetAttribute("hasGeometry", XmlNamespaces.FDO, "false"); //NOXLATE
}
+ //Write description node
+ var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE
+ var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE
+ docN.InnerText = this.Description;
+ ctype.AppendChild(anno);
+ anno.AppendChild(docN);
+
var cnt = doc.CreateElement("xs", "complexContent", XmlNamespaces.XS); //NOXLATE
ctype.AppendChild(cnt);
@@ -343,6 +350,11 @@
if (abn != null)
this.IsAbstract = Convert.ToBoolean(abn.Value);
+ //Description
+ var docNode = node.SelectSingleNode("xs:annotation/xs:documentation", mgr); //NOXLATE
+ if (docNode != null)
+ this.Description = docNode.InnerText;
+
//Process properties
XmlNodeList propNodes = node.SelectNodes("xs:complexContent/xs:extension/xs:sequence/xs:element", mgr); //NOXLATE
if (propNodes.Count == 0)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/DataPropertyDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/DataPropertyDefinition.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/DataPropertyDefinition.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -202,6 +202,13 @@
if (this.IsAutoGenerated)
prop.SetAttribute("autogenerated", XmlNamespaces.FDO, this.IsAutoGenerated.ToString().ToLower()); //NOXLATE
+ //Write description node
+ var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE
+ var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE
+ docN.InnerText = this.Description;
+ prop.AppendChild(anno);
+ anno.AppendChild(docN);
+
var simp = doc.CreateElement("xs", "simpleType", XmlNamespaces.XS); //NOXLATE
prop.AppendChild(simp);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/FeatureSchema.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/FeatureSchema.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/FeatureSchema.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -134,6 +134,13 @@
schema.SetAttribute("elementFormDefault", "qualified"); //NOXLATE
schema.SetAttribute("attributeFormDefault", "unqualified"); //NOXLATE
+ //Write description node
+ var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE
+ var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE
+ docN.InnerText = this.Description;
+ schema.AppendChild(anno);
+ anno.AppendChild(docN);
+
foreach (var cls in this.Classes)
{
cls.WriteXml(doc, schema);
@@ -152,6 +159,11 @@
if (!node.Name.Equals("xs:schema")) //NOXLATE
throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "xs:schema"));
+ //Description
+ var docNode = node.SelectSingleNode("xs:annotation/xs:documentation", mgr); //NOXLATE
+ if (docNode != null)
+ this.Description = docNode.InnerText;
+
var tns = node.Attributes["targetNamespace"];
if (tns == null)
throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedAttribute, "targetNamespace"));
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/GeometricPropertyDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/GeometricPropertyDefinition.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/GeometricPropertyDefinition.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -272,7 +272,7 @@
var en = Utility.EncodeFDOName(this.Name);
var geom = doc.CreateElement("xs", "element", XmlNamespaces.XS); //NOXLATE
- //TODO: This may have been decoded. Should it be re-encoded?
+
geom.SetAttribute("name", en); //NOXLATE
geom.SetAttribute("type", "gml:AbstractGeometryType"); //NOXLATE
geom.SetAttribute("hasMeasure", XmlNamespaces.FDO, this.HasMeasure.ToString().ToLower()); //NOXLATE
@@ -282,6 +282,13 @@
geom.SetAttribute("geometryTypes", XmlNamespaces.FDO, GeometryTypesToString()); //NOXLATE
geom.SetAttribute("geometryReadOnly", XmlNamespaces.FDO, this.IsReadOnly.ToString().ToLower()); //NOXLATE
+ //Write description node
+ var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE
+ var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE
+ docN.InnerText = this.Description;
+ geom.AppendChild(anno);
+ anno.AppendChild(docN);
+
currentNode.AppendChild(geom);
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/PropertyDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/PropertyDefinition.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/PropertyDefinition.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -214,6 +214,11 @@
string name = Utility.DecodeFDOName(nn.Value);
string desc = string.Empty;
+ //Description
+ var docNode = node.SelectSingleNode("xs:annotation/xs:documentation", mgr); //NOXLATE
+ if (docNode != null)
+ desc = docNode.InnerText;
+
if (node.Attributes["type"] != null && node.Attributes["type"].Value == "gml:AbstractGeometryType") //NOXLATE
{
prop = new GeometricPropertyDefinition(name, desc);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/RasterPropertyDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/RasterPropertyDefinition.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/RasterPropertyDefinition.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -83,13 +83,20 @@
var en = Utility.EncodeFDOName(this.Name);
var geom = doc.CreateElement("xs", "element", XmlNamespaces.XS); //NOXLATE
- //TODO: This may have been decoded. Should it be re-encoded?
+
geom.SetAttribute("name", en); //NOXLATE
geom.SetAttribute("type", "fdo:RasterPropertyType"); //NOXLATE
geom.SetAttribute("defaultImageXSize", XmlNamespaces.FDO, this.DefaultImageXSize.ToString()); //NOXLATE
geom.SetAttribute("defaultImageYSize", XmlNamespaces.FDO, this.DefaultImageYSize.ToString()); //NOXLATE
geom.SetAttribute("srsName", XmlNamespaces.FDO, this.SpatialContextAssociation); //NOXLATE
+ //Write description node
+ var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE
+ var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE
+ docN.InnerText = this.Description;
+ geom.AppendChild(anno);
+ anno.AppendChild(docN);
+
currentNode.AppendChild(geom);
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -61,15 +61,22 @@
/// <summary>
/// Initializes a new instance of the <see cref="RasterWmsItem"/> class.
/// </summary>
+ /// <param name="schemaName">Name of the schema</param>
/// <param name="className">Name of the class.</param>
/// <param name="rasterPropertyName">Name of the raster property.</param>
- public RasterWmsItem(string className, string rasterPropertyName)
+ public RasterWmsItem(string schemaName, string className, string rasterPropertyName)
{
+ this.SchemaName = schemaName;
this.FeatureClass = className;
this.RasterPropertyName = rasterPropertyName;
}
/// <summary>
+ /// Gets the name of the FDO logical schema this particular override applies to
+ /// </summary>
+ public string SchemaName { get; internal set; }
+
+ /// <summary>
/// Gets or sets the feature class.
/// </summary>
/// <value>
@@ -242,7 +249,7 @@
throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));
var fc = node.ParentNode.Attributes["name"].Value; //NOXLATE
- this.FeatureClass = fc.Substring(0, fc.Length - "Type".Length); //NOXLATE
+ this.FeatureClass = Utility.DecodeFDOName(fc.Substring(0, fc.Length - "Type".Length)); //NOXLATE
this.RasterPropertyName = node.Attributes["name"].Value; //NOXLATE
var format = node["Format"]; //NOXLATE
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -17,6 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
+using OSGeo.MapGuide.MaestroAPI.Schema;
using System;
using System.Collections.Generic;
using System.Text;
@@ -58,13 +59,17 @@
var map = doc.CreateElement("SchemaMapping"); //NOXLATE
map.SetAttribute("provider", "OSGeo.WMS.3.2"); //NOXLATE
map.SetAttribute("xmlns", "http://fdowms.osgeo.org/schemas"); //NOXLATE
+ //TODO: Is WMS multi-schema? We should factor this in
map.SetAttribute("name", base._schemas[0].Name); //NOXLATE
{
foreach(var ritem in _rasterItems)
{
+ if (ritem.SchemaName != base._schemas[0].Name)
+ continue;
+
var ctype = doc.CreateElement("complexType"); //NOXLATE
var ctypeName = doc.CreateAttribute("name"); //NOXLATE
- ctypeName.Value = ritem.FeatureClass + "Type"; //NOXLATE
+ ctypeName.Value = Utility.EncodeFDOName(ritem.FeatureClass) + "Type"; //NOXLATE
ctype.Attributes.Append(ctypeName);
{
ritem.WriteXml(doc, ctype);
@@ -109,11 +114,65 @@
throw new Exception(string.Format(Strings.ErrorBadDocumentExpectedElement, "RasterDefinition"));
RasterWmsItem item = new RasterWmsItem();
+ item.SchemaName = sn.Value;
item.ReadXml(rdf, mgr);
this.AddRasterItem(item);
}
}
}
+
+ /// <summary>
+ /// Removes any logical classes without physical mappings and vice versa, also ensures that the physical mapping refers
+ /// to the correct logical raster property
+ /// </summary>
+ public void EnsureConsistency()
+ {
+ var removeClasses = new List<ClassDefinition>();
+ var removeMappings = new List<RasterWmsItem>();
+ foreach (var mapping in this.RasterOverrides)
+ {
+ var cls = this.GetClass(mapping.SchemaName, mapping.FeatureClass);
+ if (cls == null)
+ removeMappings.Add(mapping);
+ }
+ //Triple nested loop? You know what they say about Big-O. If n is usually small
+ //don't bother trying to optimize.
+ foreach (var schema in this.Schemas)
+ {
+ foreach (var cls in schema.Classes)
+ {
+ bool bFound = false;
+ foreach (var mapping in this.RasterOverrides)
+ {
+ if (mapping.SchemaName == schema.Name && mapping.FeatureClass == cls.Name)
+ {
+ bFound = true;
+ //Since we're here. Fix up the raster logical property if there's a mismatch
+ foreach (var prop in cls.Properties)
+ {
+ if (prop.Type == PropertyDefinitionType.Raster)
+ {
+ if (prop.Name != mapping.RasterPropertyName)
+ mapping.RasterPropertyName = prop.Name;
+ }
+ }
+ break;
+ }
+ }
+ if (!bFound)
+ removeClasses.Add(cls);
+ }
+ }
+ foreach (var mapping in removeMappings)
+ {
+ this.RemoveRasterItem(mapping);
+ }
+ foreach (var cls in removeClasses)
+ {
+ var schema = cls.Parent;
+ schema.RemoveClass(cls);
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2012-10-17 15:08:43 UTC (rev 7127)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2012-10-18 19:21:47 UTC (rev 7128)
@@ -615,6 +615,14 @@
/// FDO encodes a string
/// </summary>
/// <param name="name"></param>
+ /// <remarks>
+ /// <para>
+ /// FDO names must always be encoded when writing back to attributes in XML configuration documents as it may contain reserved characters that would render the final XML attribute content invalid.
+ /// </para>
+ /// <para>
+ /// Consequently, such names must always be decoded when reading from XML configuration documents otherwise these escape characters may still be present after reading
+ /// </para>
+ /// </remarks>
/// <returns></returns>
public static string EncodeFDOName(string name)
{
@@ -734,6 +742,14 @@
/// Converts FDO encoded characters into their original character.
/// </summary>
/// <param name="name">The FDO encoded string</param>
+ /// <remarks>
+ /// <para>
+ /// FDO names must always be encoded when writing back to attributes in XML configuration documents as it may contain reserved characters that would render the final XML attribute content invalid.
+ /// </para>
+ /// <para>
+ /// Consequently, such names must always be decoded when reading from XML configuration documents otherwise these escape characters may still be present after reading
+ /// </para>
+ /// </remarks>
/// <returns>The unencoded version of the string</returns>
public static string DecodeFDOName(string name)
{
More information about the mapguide-commits
mailing list