[mapguide-commits] r6750 - in trunk/Tools/Maestro: Maestro.Editors/FeatureSource/Providers/Odbc Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor OSGeo.MapGuide.MaestroAPI/Schema OSGeo.MapGuide.MaestroAPI/SchemaOverrides

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 11 07:29:04 PDT 2012


Author: jng
Date: 2012-06-11 07:29:04 -0700 (Mon, 11 Jun 2012)
New Revision: 6750

Modified:
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OdbcProviderCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.cs
   trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.resx
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/ConfigurationDocument.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcConfigurationDocument.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs
Log:
#1980: Fix broken ODBC configuration. The problem was that our OdbcTableItem was writing XML like this:

<complexType name="Foo">
   <Table name="Foo">
      <element name="Bar">
          <Column name="Bar" />
      </element>
   </Table>
</complexType>

Instead of this:

<complexType name="Foo">
   <Table name="Foo" />
   <element name="Bar">
       <Column name="Bar" />
   </element>
</complexType>

Which basically made all our ODBC configuration documents thus far invalid and useless.

Other changes include:
 - Add ability to set the coordinate system for the ODBC configuration document
 - Add a new RemoveProperty() API to ClassDefinition that takes a property name 

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OdbcProviderCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OdbcProviderCtrl.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OdbcProviderCtrl.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -276,7 +276,7 @@
                     }
                 }
 
-                var diag = new TableConfigurationDialog(_doc, _defaultSchemaName);
+                var diag = new TableConfigurationDialog(_service, _doc, _defaultSchemaName);
                 if (diag.ShowDialog() == DialogResult.OK)
                 {
                     _doc.ClearMappings();
@@ -285,6 +285,10 @@
                         _doc.AddOverride(table);
                     }
                     string updatedContent = _doc.ToXml();
+                    foreach (var sc in _doc.SpatialContexts)
+                    {
+                        sc.CoordinateSystemWkt = diag.CoordinateSystemWkt;
+                    }
                     _fs.SetConfigurationContent(updatedContent);
                     OnResourceChanged();
                 }
@@ -323,6 +327,7 @@
                 {
                     classNames = names.Select(x => x.Contains(":") ? x.Split(':')[1] : x).ToArray();
                     var schema = _fs.CurrentConnection.FeatureService.DescribeFeatureSourcePartial(_fs.ResourceID, schemaName, classNames);
+                    
                     _doc.AddSchema(schema); //Only one schema is supported by ODBC so this is ok
                     var scList = _fs.GetSpatialInfo(false);
                     foreach (var sc in scList.SpatialContext)

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.Designer.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.Designer.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -34,17 +34,25 @@
             this.label1 = new System.Windows.Forms.Label();
             this.splitContainer1 = new System.Windows.Forms.SplitContainer();
             this.grdTables = new System.Windows.Forms.DataGridView();
-            this.tableConfigCtrl = new Maestro.Editors.FeatureSource.Providers.Odbc.OverrideEditor.TableConfigCtrl();
             this.COL_OVERRIDE = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.COL_NAME = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.COL_KEY = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.COL_X = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.COL_Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.COL_Z = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.tableConfigCtrl = new Maestro.Editors.FeatureSource.Providers.Odbc.OverrideEditor.TableConfigCtrl();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.txtCoordinateSystem = new System.Windows.Forms.TextBox();
+            this.btnPickCs = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
             this.splitContainer1.Panel1.SuspendLayout();
             this.splitContainer1.Panel2.SuspendLayout();
             this.splitContainer1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.grdTables)).BeginInit();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
             this.SuspendLayout();
             // 
             // btnSave
@@ -96,14 +104,9 @@
             this.grdTables.Name = "grdTables";
             this.grdTables.RowHeadersVisible = false;
             this.grdTables.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdTables_CellContentClick);
+            this.grdTables.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdTables_CellContentClick);
             this.grdTables.CurrentCellDirtyStateChanged += new System.EventHandler(this.grdTables_CurrentCellDirtyStateChanged);
-            this.grdTables.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdTables_CellContentClick);
             // 
-            // tableConfigCtrl
-            // 
-            resources.ApplyResources(this.tableConfigCtrl, "tableConfigCtrl");
-            this.tableConfigCtrl.Name = "tableConfigCtrl";
-            // 
             // COL_OVERRIDE
             // 
             this.COL_OVERRIDE.DataPropertyName = "Override";
@@ -146,22 +149,66 @@
             this.COL_Z.Name = "COL_Z";
             this.COL_Z.ReadOnly = true;
             // 
+            // tableConfigCtrl
+            // 
+            resources.ApplyResources(this.tableConfigCtrl, "tableConfigCtrl");
+            this.tableConfigCtrl.Name = "tableConfigCtrl";
+            // 
+            // groupBox1
+            // 
+            resources.ApplyResources(this.groupBox1, "groupBox1");
+            this.groupBox1.Controls.Add(this.label1);
+            this.groupBox1.Controls.Add(this.splitContainer1);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.TabStop = false;
+            // 
+            // groupBox2
+            // 
+            resources.ApplyResources(this.groupBox2, "groupBox2");
+            this.groupBox2.Controls.Add(this.btnPickCs);
+            this.groupBox2.Controls.Add(this.txtCoordinateSystem);
+            this.groupBox2.Controls.Add(this.label2);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.TabStop = false;
+            // 
+            // label2
+            // 
+            resources.ApplyResources(this.label2, "label2");
+            this.label2.Name = "label2";
+            // 
+            // txtCoordinateSystem
+            // 
+            resources.ApplyResources(this.txtCoordinateSystem, "txtCoordinateSystem");
+            this.txtCoordinateSystem.Name = "txtCoordinateSystem";
+            this.txtCoordinateSystem.ReadOnly = true;
+            // 
+            // btnPickCs
+            // 
+            resources.ApplyResources(this.btnPickCs, "btnPickCs");
+            this.btnPickCs.Name = "btnPickCs";
+            this.btnPickCs.UseVisualStyleBackColor = true;
+            this.btnPickCs.Click += new System.EventHandler(this.btnPickCs_Click);
+            // 
             // TableConfigurationDialog
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             resources.ApplyResources(this, "$this");
-            this.Controls.Add(this.splitContainer1);
-            this.Controls.Add(this.label1);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.btnCancel);
             this.Controls.Add(this.btnSave);
             this.Name = "TableConfigurationDialog";
             this.ShowIcon = false;
             this.splitContainer1.Panel1.ResumeLayout(false);
             this.splitContainer1.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
             this.splitContainer1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.grdTables)).EndInit();
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
             this.ResumeLayout(false);
-            this.PerformLayout();
 
         }
 
@@ -179,5 +226,10 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn COL_X;
         private System.Windows.Forms.DataGridViewTextBoxColumn COL_Y;
         private System.Windows.Forms.DataGridViewTextBoxColumn COL_Z;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.Button btnPickCs;
+        private System.Windows.Forms.TextBox txtCoordinateSystem;
+        private System.Windows.Forms.Label label2;
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -22,10 +22,16 @@
             grdTables.DataSource = _tables;
         }
 
-        public TableConfigurationDialog(OdbcConfigurationDocument doc, string schemaName)
+        private IEditorService _edSvc;
+
+        public TableConfigurationDialog(IEditorService edSvc, OdbcConfigurationDocument doc, string schemaName)
             : this()
         {
-            tableConfigCtrl.SetSpatialContexts(doc.GetSpatialContextNames());
+            _edSvc = edSvc;
+            var scNames = doc.GetSpatialContextNames();
+            tableConfigCtrl.SetSpatialContexts(scNames);
+            var sc = doc.GetSpatialContext(scNames[0]);
+            txtCoordinateSystem.Text = sc.CoordinateSystemWkt;
 
             var schema = doc.GetSchema(schemaName);
             Dictionary<string, TableOverrideItem> tables = new Dictionary<string, TableOverrideItem>();
@@ -72,6 +78,8 @@
             }
         }
 
+        public string CoordinateSystemWkt { get { return txtCoordinateSystem.Text; } }
+
         public OdbcTableItem[] ConfiguredTables
         {
             get
@@ -138,5 +146,12 @@
                 }
             }
         }
+
+        private void btnPickCs_Click(object sender, EventArgs e)
+        {
+            var cs = _edSvc.GetCoordinateSystem();
+            if (!string.IsNullOrEmpty(cs))
+                txtCoordinateSystem.Text = cs;
+        }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.resx	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Odbc/OverrideEditor/TableConfigurationDialog.resx	2012-06-11 14:29:04 UTC (rev 6750)
@@ -112,26 +112,26 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="btnSave.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Bottom, Right</value>
   </data>
   <data name="btnSave.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
     <value>NoControl</value>
   </data>
-  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="btnSave.Location" type="System.Drawing.Point, System.Drawing">
-    <value>512, 306</value>
+    <value>512, 445</value>
   </data>
   <data name="btnSave.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
   </data>
-  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="btnSave.TabIndex" type="System.Int32, mscorlib">
     <value>1</value>
   </data>
@@ -142,7 +142,7 @@
     <value>btnSave</value>
   </data>
   <data name=">>btnSave.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnSave.Parent" xml:space="preserve">
     <value>$this</value>
@@ -157,7 +157,7 @@
     <value>NoControl</value>
   </data>
   <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
-    <value>593, 306</value>
+    <value>593, 445</value>
   </data>
   <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -172,7 +172,7 @@
     <value>btnCancel</value>
   </data>
   <data name=">>btnCancel.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnCancel.Parent" xml:space="preserve">
     <value>$this</value>
@@ -187,7 +187,7 @@
     <value>NoControl</value>
   </data>
   <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>13, 13</value>
+    <value>15, 26</value>
   </data>
   <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
     <value>467, 13</value>
@@ -202,68 +202,38 @@
     <value>label1</value>
   </data>
   <data name=">>label1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>label1.Parent" xml:space="preserve">
-    <value>$this</value>
+    <value>groupBox1</value>
   </data>
   <data name=">>label1.ZOrder" xml:space="preserve">
-    <value>1</value>
+    <value>0</value>
   </data>
   <data name="splitContainer1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Bottom, Left, Right</value>
   </data>
   <data name="splitContainer1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>16, 39</value>
+    <value>18, 47</value>
   </data>
-  <metadata name="COL_OVERRIDE.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="COL_OVERRIDE.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="COL_OVERRIDE.HeaderText" xml:space="preserve">
-    <value>Override</value>
-  </data>
-  <data name="COL_OVERRIDE.Width" type="System.Int32, mscorlib">
-    <value>60</value>
-  </data>
-  <metadata name="COL_NAME.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <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_KEY.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="COL_KEY.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="COL_KEY.HeaderText" xml:space="preserve">
-    <value>Key</value>
-  </data>
-  <data name="COL_KEY.Width" type="System.Int32, mscorlib">
-    <value>50</value>
-  </data>
-  <metadata name="COL_X.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="COL_X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="COL_X.HeaderText" xml:space="preserve">
-    <value>X Column</value>
-  </data>
-  <data name="COL_X.Width" type="System.Int32, mscorlib">
-    <value>50</value>
-  </data>
-  <metadata name="COL_Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="COL_Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="COL_Y.HeaderText" xml:space="preserve">
-    <value>Y Column</value>
-  </data>
-  <data name="COL_Y.Width" type="System.Int32, mscorlib">
-    <value>50</value>
-  </data>
-  <metadata name="COL_Z.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="COL_Z.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="COL_Z.HeaderText" xml:space="preserve">
-    <value>Z Column</value>
-  </data>
   <data name="grdTables.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
     <value>Fill</value>
   </data>
@@ -271,7 +241,7 @@
     <value>0, 0</value>
   </data>
   <data name="grdTables.Size" type="System.Drawing.Size, System.Drawing">
-    <value>454, 250</value>
+    <value>422, 298</value>
   </data>
   <data name="grdTables.TabIndex" type="System.Int32, mscorlib">
     <value>0</value>
@@ -280,7 +250,7 @@
     <value>grdTables</value>
   </data>
   <data name=">>grdTables.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>grdTables.Parent" xml:space="preserve">
     <value>splitContainer1.Panel1</value>
@@ -292,7 +262,7 @@
     <value>splitContainer1.Panel1</value>
   </data>
   <data name=">>splitContainer1.Panel1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>splitContainer1.Panel1.Parent" xml:space="preserve">
     <value>splitContainer1</value>
@@ -307,7 +277,7 @@
     <value>0, 0</value>
   </data>
   <data name="tableConfigCtrl.Size" type="System.Drawing.Size, System.Drawing">
-    <value>194, 250</value>
+    <value>194, 298</value>
   </data>
   <data name="tableConfigCtrl.TabIndex" type="System.Int32, mscorlib">
     <value>0</value>
@@ -316,7 +286,7 @@
     <value>tableConfigCtrl</value>
   </data>
   <data name=">>tableConfigCtrl.Type" xml:space="preserve">
-    <value>Maestro.Editors.FeatureSource.Providers.Odbc.OverrideEditor.TableConfigCtrl, Maestro.Editors, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=null</value>
+    <value>Maestro.Editors.FeatureSource.Providers.Odbc.OverrideEditor.TableConfigCtrl, Maestro.Editors, Version=5.0.0.6640, Culture=neutral, PublicKeyToken=f526c48929fda856</value>
   </data>
   <data name=">>tableConfigCtrl.Parent" xml:space="preserve">
     <value>splitContainer1.Panel2</value>
@@ -328,7 +298,7 @@
     <value>splitContainer1.Panel2</value>
   </data>
   <data name=">>splitContainer1.Panel2.Type" xml:space="preserve">
-    <value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>splitContainer1.Panel2.Parent" xml:space="preserve">
     <value>splitContainer1</value>
@@ -337,10 +307,10 @@
     <value>1</value>
   </data>
   <data name="splitContainer1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>652, 250</value>
+    <value>620, 298</value>
   </data>
   <data name="splitContainer1.SplitterDistance" type="System.Int32, mscorlib">
-    <value>454</value>
+    <value>422</value>
   </data>
   <data name="splitContainer1.TabIndex" type="System.Int32, mscorlib">
     <value>4</value>
@@ -349,19 +319,193 @@
     <value>splitContainer1</value>
   </data>
   <data name=">>splitContainer1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>splitContainer1.Parent" xml:space="preserve">
+    <value>groupBox1</value>
+  </data>
+  <data name=">>splitContainer1.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <metadata name="COL_OVERRIDE.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="COL_OVERRIDE.HeaderText" xml:space="preserve">
+    <value>Override</value>
+  </data>
+  <data name="COL_OVERRIDE.Width" type="System.Int32, mscorlib">
+    <value>60</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_KEY.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="COL_KEY.HeaderText" xml:space="preserve">
+    <value>Key</value>
+  </data>
+  <data name="COL_KEY.Width" type="System.Int32, mscorlib">
+    <value>50</value>
+  </data>
+  <metadata name="COL_X.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="COL_X.HeaderText" xml:space="preserve">
+    <value>X Column</value>
+  </data>
+  <data name="COL_X.Width" type="System.Int32, mscorlib">
+    <value>50</value>
+  </data>
+  <metadata name="COL_Y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="COL_Y.HeaderText" xml:space="preserve">
+    <value>Y Column</value>
+  </data>
+  <data name="COL_Y.Width" type="System.Int32, mscorlib">
+    <value>50</value>
+  </data>
+  <metadata name="COL_Z.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="COL_Z.HeaderText" xml:space="preserve">
+    <value>Z Column</value>
+  </data>
+  <data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Bottom, Left, Right</value>
+  </data>
+  <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
+    <value>12, 75</value>
+  </data>
+  <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
+    <value>656, 364</value>
+  </data>
+  <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
+    <value>5</value>
+  </data>
+  <data name="groupBox1.Text" xml:space="preserve">
+    <value>Overrides</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=">>splitContainer1.ZOrder" xml:space="preserve">
+  <data name=">>groupBox1.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="groupBox2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Left, Right</value>
+  </data>
+  <data name="btnPickCs.Location" type="System.Drawing.Point, System.Drawing">
+    <value>606, 21</value>
+  </data>
+  <data name="btnPickCs.Size" type="System.Drawing.Size, System.Drawing">
+    <value>32, 23</value>
+  </data>
+  <data name="btnPickCs.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="btnPickCs.Text" xml:space="preserve">
+    <value>...</value>
+  </data>
+  <data name=">>btnPickCs.Name" xml:space="preserve">
+    <value>btnPickCs</value>
+  </data>
+  <data name=">>btnPickCs.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=">>btnPickCs.Parent" xml:space="preserve">
+    <value>groupBox2</value>
+  </data>
+  <data name=">>btnPickCs.ZOrder" xml:space="preserve">
     <value>0</value>
   </data>
-  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <data name="txtCoordinateSystem.Location" type="System.Drawing.Point, System.Drawing">
+    <value>168, 23</value>
+  </data>
+  <data name="txtCoordinateSystem.Size" type="System.Drawing.Size, System.Drawing">
+    <value>432, 20</value>
+  </data>
+  <data name="txtCoordinateSystem.TabIndex" type="System.Int32, mscorlib">
+    <value>1</value>
+  </data>
+  <data name=">>txtCoordinateSystem.Name" xml:space="preserve">
+    <value>txtCoordinateSystem</value>
+  </data>
+  <data name=">>txtCoordinateSystem.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=">>txtCoordinateSystem.Parent" xml:space="preserve">
+    <value>groupBox2</value>
+  </data>
+  <data name=">>txtCoordinateSystem.ZOrder" xml:space="preserve">
+    <value>1</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>14, 26</value>
+  </data>
+  <data name="label2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>136, 13</value>
+  </data>
+  <data name="label2.TabIndex" type="System.Int32, mscorlib">
+    <value>0</value>
+  </data>
+  <data name="label2.Text" xml:space="preserve">
+    <value>Use this Coordinate System</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>groupBox2</value>
+  </data>
+  <data name=">>label2.ZOrder" xml:space="preserve">
+    <value>2</value>
+  </data>
+  <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
+    <value>13, 13</value>
+  </data>
+  <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>655, 56</value>
+  </data>
+  <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
+    <value>6</value>
+  </data>
+  <data name="groupBox2.Text" xml:space="preserve">
+    <value>Coordinate System</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>0</value>
+  </data>
+  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
   </metadata>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>680, 341</value>
+    <value>680, 480</value>
   </data>
   <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
     <value>WindowsDefaultBounds</value>
@@ -373,42 +517,42 @@
     <value>COL_OVERRIDE</value>
   </data>
   <data name=">>COL_OVERRIDE.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewCheckBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>COL_NAME.Name" xml:space="preserve">
     <value>COL_NAME</value>
   </data>
   <data name=">>COL_NAME.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>COL_KEY.Name" xml:space="preserve">
     <value>COL_KEY</value>
   </data>
   <data name=">>COL_KEY.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>COL_X.Name" xml:space="preserve">
     <value>COL_X</value>
   </data>
   <data name=">>COL_X.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>COL_Y.Name" xml:space="preserve">
     <value>COL_Y</value>
   </data>
   <data name=">>COL_Y.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>COL_Z.Name" xml:space="preserve">
     <value>COL_Z</value>
   </data>
   <data name=">>COL_Z.Type" xml:space="preserve">
-    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>$this.Name" xml:space="preserve">
     <value>TableConfigurationDialog</value>
   </data>
   <data name=">>$this.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Schema/ClassDefinition.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -167,8 +167,28 @@
         {
             return _properties.IndexOf(prop);
         }
-        
+
         /// <summary>
+        /// Removes the property definition of the specified name. If it is a data property
+        /// it is also removed from the identity properties (if it is specified as one)
+        /// </summary>
+        /// <param name="propertyName"></param>
+        public void RemoveProperty(string propertyName)
+        {
+            int idx = -1;
+            for (int i = 0; i < _properties.Count; i++)
+            {
+                if (_properties[i].Name == propertyName)
+                {
+                    idx = i;
+                    break;
+                }
+            }
+            if (idx >= 0)
+                RemovePropertyAt(idx);
+        }
+
+        /// <summary>
         /// Removes the property definition at the specified index. If it is a data property
         /// is is also removed from the identity properties (if it is specified as one)
         /// </summary>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/ConfigurationDocument.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/ConfigurationDocument.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/ConfigurationDocument.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -147,7 +147,7 @@
         /// </summary>
         /// <param name="doc"></param>
         /// <param name="currentNode"></param>
-        public void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode)
+        public virtual void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode)
         {
             var dstore = doc.CreateElement("fdo", "DataStore", XmlNamespaces.FDO);
             dstore.SetAttribute("xmlns:xs", XmlNamespaces.XS);

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcConfigurationDocument.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcConfigurationDocument.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcConfigurationDocument.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -69,6 +69,35 @@
             return items;
         }
 
+        /*
+        public override void WriteXml(XmlDocument doc, XmlNode currentNode)
+        {
+            //
+            foreach (var schema in this.Schemas)
+            {
+                foreach (var cls in schema.Classes)
+                {
+                    var ov = this.GetOverride(schema.Name, cls.Name);
+                    if (ov != null)
+                    {
+                        if (!string.IsNullOrEmpty(ov.XColumn))
+                        {
+                            cls.RemoveProperty(ov.XColumn);
+                        }
+                        if (!string.IsNullOrEmpty(ov.YColumn))
+                        {
+                            cls.RemoveProperty(ov.YColumn);
+                        }
+                        if (!string.IsNullOrEmpty(ov.ZColumn))
+                        {
+                            cls.RemoveProperty(ov.ZColumn);
+                        }
+                    }
+                }
+            }
+            base.WriteXml(doc, currentNode);
+        }*/
+
         /// <summary>
         /// Write this document's schema mappings to the given XML document
         /// </summary>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs	2012-06-11 13:33:49 UTC (rev 6749)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/OdbcTableItem.cs	2012-06-11 14:29:04 UTC (rev 6750)
@@ -76,44 +76,49 @@
                 {
                     var table = doc.CreateElement("Table");
                     table.SetAttribute("name", this.ClassName);
+                    ctype.AppendChild(table);
+
+                    PropertyDefinition geomProp = null;
+                    foreach (var prop in cls.Properties)
                     {
-                        PropertyDefinition geomProp = null;
-                        foreach (var prop in cls.Properties)
+                        //If this is geometry, we'll handle it later
+                        if (prop.Name == cls.DefaultGeometryPropertyName)
                         {
-                            //If this is geometry, we'll handle it later
-                            if (prop.Name == cls.DefaultGeometryPropertyName)
-                            {
-                                geomProp = prop;
-                                continue;
-                            }
+                            geomProp = prop;
+                            continue;
+                        }
 
-                            var el = doc.CreateElement("element");
-                            el.SetAttribute("name", Utility.EncodeFDOName(prop.Name));
+                        //If this is a geometry mapped X/Y/Z property, skip it
+                        if (prop.Name == this.XColumn ||
+                            prop.Name == this.YColumn ||
+                            prop.Name == this.ZColumn)
+                            continue;
 
-                            var col = doc.CreateElement("Column");
-                            col.SetAttribute("name", prop.Name);
+                        var el = doc.CreateElement("element");
+                        el.SetAttribute("name", Utility.EncodeFDOName(prop.Name));
 
-                            el.AppendChild(col);
-                            table.AppendChild(el);
-                        }
+                        var col = doc.CreateElement("Column");
+                        col.SetAttribute("name", prop.Name);
 
-                        //Append geometry mapping
-                        if (geomProp != null)
-                        {
-                            var el = doc.CreateElement("element");
-                            el.SetAttribute("name", geomProp.Name);
+                        el.AppendChild(col);
+                        ctype.AppendChild(el);
+                    }
 
-                            if (!string.IsNullOrEmpty(this.XColumn))
-                                el.SetAttribute("xColumnName", this.XColumn);
-                            if (!string.IsNullOrEmpty(this.YColumn))
-                                el.SetAttribute("yColumnName", this.YColumn);
-                            if (!string.IsNullOrEmpty(this.ZColumn))
-                                el.SetAttribute("zColumnName", this.ZColumn);
+                    //Append geometry mapping
+                    if (geomProp != null)
+                    {
+                        var el = doc.CreateElement("element");
+                        el.SetAttribute("name", geomProp.Name);
 
-                            table.AppendChild(el);
-                        }
+                        if (!string.IsNullOrEmpty(this.XColumn))
+                            el.SetAttribute("xColumnName", this.XColumn);
+                        if (!string.IsNullOrEmpty(this.YColumn))
+                            el.SetAttribute("yColumnName", this.YColumn);
+                        if (!string.IsNullOrEmpty(this.ZColumn))
+                            el.SetAttribute("zColumnName", this.ZColumn);
+
+                        ctype.AppendChild(el);
                     }
-                    ctype.AppendChild(table);
                 }
                 currentNode.AppendChild(ctype);
             }
@@ -143,8 +148,9 @@
             }
 
             var table = node["Table"];
-
-            foreach (System.Xml.XmlNode el in table.ChildNodes)
+            var el = table.NextSibling;
+            //foreach (System.Xml.XmlNode el in table.ChildNodes)
+            while(el != null)
             {
                 var colName = el.Attributes["name"];
 
@@ -161,6 +167,7 @@
                     if (z != null)
                         this.ZColumn = z.Value;
                 }
+                el = el.NextSibling;
             }
         }
     }



More information about the mapguide-commits mailing list