[mapguide-commits] r6973 - in branches/maestro-4.0.x: Maestro Maestro.Editors/Common OSGeo.MapGuide.MaestroAPI/Expression OSGeo.MapGuide.MaestroAPI/Feature OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.MaestroAPI.Native

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Sep 3 05:48:48 PDT 2012


Author: jng
Date: 2012-09-03 05:48:48 -0700 (Mon, 03 Sep 2012)
New Revision: 6973

Modified:
   branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.cs
   branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.designer.cs
   branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.resx
   branches/maestro-4.0.x/Maestro/changelog.txt
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Http/XmlReaderBase.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Expression/ExpressionFeatureReader.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/FeatureBase.cs
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/ReaderBase.cs
Log:
#2100: Backport to 4.0.x. We had to fix some reader methods due to some methods not being present in the 4.0.x iteration of the MaestroAPI

Modified: branches/maestro-4.0.x/Maestro/changelog.txt
===================================================================
--- branches/maestro-4.0.x/Maestro/changelog.txt	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/Maestro/changelog.txt	2012-09-03 12:48:48 UTC (rev 6973)
@@ -1,5 +1,9 @@
-4.0.2
+4.0.3
 -----
+ - Use UNIQUE() for fetching distinct values in Expression Editor
+
+4.0.2
+-----
  - mg-desktop binary update (20 July 2012 release)
  - Added validation rules for Feature Sources regarding secured credentials
  - Added support for creating Feature Sources with secured credentials

Modified: branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -750,16 +750,58 @@
 
         private void LookupValues_Click(object sender, EventArgs e)
         {
+            //Use UNIQUE() method first. This should work in most cases
             using (new WaitCursor(this))
             {
+                string filter = null;
+                var expr = "UNIQUE(" + ColumnName.Text + ")";
+                bool bFallback = false;
+                ColumnValue.Items.Clear();
+                ColumnValue.Tag = null;
                 try
                 {
+                    using (var rdr = _featSvc.AggregateQueryFeatureSource(m_featureSource, _cls.QualifiedName, filter, new System.Collections.Specialized.NameValueCollection() { 
+                            { "UNIQ_VALS", expr }
+                        }))
+                    {
+                        for (int i = 0; i < rdr.FieldCount; i++)
+                        {
+                            if (rdr.GetName(i) == "UNIQ_VALS")
+                            {
+                                ColumnName.Tag = rdr.GetFieldType(i);
+                            }
+                        }
+                        while (rdr.ReadNext())
+                        {
+                            if (!rdr.IsNull("UNIQ_VALS"))
+                            {
+                                object value = rdr["UNIQ_VALS"];
+                                ColumnValue.Items.Add(value);
+                            }
+                        }
+                        rdr.Close();
+                    }
+                }
+                catch
+                {
+                    ColumnValue.Items.Clear();
+                    bFallback = true;
+                }
+                if (!bFallback)
+                {
+                    ColumnValue.Enabled = true;
+                    ColumnValue.SelectedIndex = -1;
+                    ColumnValue.DroppedDown = true;
+                    return;
+                }
+
+                try
+                {
                     SortedList<string, PropertyDefinition> cols = (SortedList<string, PropertyDefinition>)ColumnName.Tag;
                     PropertyDefinition col = cols[ColumnName.Text];
 
                     bool retry = true;
                     Exception rawEx = null;
-                    string filter = null;
 
                     SortedList<string, string> values = new SortedList<string, string>();
                     bool hasNull = false;
@@ -825,12 +867,27 @@
 
         private void ColumnValue_SelectedIndexChanged(object sender, EventArgs e)
         {
-            if (ColumnValue.SelectedIndex >= 0 && ColumnValue.Tag as Type != null)
+            if (ColumnValue.SelectedIndex >= 0)
             {
-                if (ColumnValue.Tag == typeof(string) && (ColumnValue.SelectedIndex != 0 || ColumnValue.Text != "NULL"))
-                    ExpressionText.SelectedText = " '" + ColumnValue.Text + "' ";
-                else
-                    ExpressionText.SelectedText = " " + ColumnValue.Text + " ";
+                var tag = ColumnValue.Tag;
+                if (tag != null)
+                {
+                    if (ColumnValue.Tag == typeof(string) && (ColumnValue.SelectedIndex != 0 || ColumnValue.Text != "NULL"))
+                    {
+                        InsertText("'" + ColumnValue.Text + "'");
+                    }
+                    else
+                    {
+                        if (tag is PropertyValueType && (PropertyValueType)tag == PropertyValueType.String)
+                            InsertText("'" + ColumnValue.Text + "'");
+                        else
+                            InsertText(ColumnValue.Text);
+                    }
+                }
+                else 
+                {
+                    InsertText(ColumnValue.Text);
+                }
             }
         }
     }

Modified: branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.designer.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.designer.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.designer.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -35,6 +35,8 @@
             this.panel1 = new System.Windows.Forms.Panel();
             this.lblHint = new System.Windows.Forms.Label();
             this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+            this.btnProperties = new System.Windows.Forms.ToolStripDropDownButton();
+            this.btnFunctions = new System.Windows.Forms.ToolStripDropDownButton();
             this.btnFilter = new System.Windows.Forms.ToolStripDropDownButton();
             this.btnCondition = new System.Windows.Forms.ToolStripMenuItem();
             this.btnSpatial = new System.Windows.Forms.ToolStripMenuItem();
@@ -45,8 +47,6 @@
             this.ColumnName = new System.Windows.Forms.ToolStripComboBox();
             this.ExpressionText = new System.Windows.Forms.TextBox();
             this._autoCompleteTooltip = new System.Windows.Forms.ToolTip(this.components);
-            this.btnFunctions = new System.Windows.Forms.ToolStripDropDownButton();
-            this.btnProperties = new System.Windows.Forms.ToolStripDropDownButton();
             this.panel1.SuspendLayout();
             this.toolStrip1.SuspendLayout();
             this.SuspendLayout();
@@ -92,6 +92,18 @@
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
             // 
+            // btnProperties
+            // 
+            this.btnProperties.Image = global::Maestro.Editors.Properties.Resources.property;
+            resources.ApplyResources(this.btnProperties, "btnProperties");
+            this.btnProperties.Name = "btnProperties";
+            // 
+            // btnFunctions
+            // 
+            this.btnFunctions.Image = global::Maestro.Editors.Properties.Resources.function;
+            resources.ApplyResources(this.btnFunctions, "btnFunctions");
+            this.btnFunctions.Name = "btnFunctions";
+            // 
             // btnFilter
             // 
             this.btnFilter.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -160,22 +172,10 @@
             this.ExpressionText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyDown);
             this.ExpressionText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ExpressionText_KeyUp);
             // 
-            // btnFunctions
-            // 
-            this.btnFunctions.Image = global::Maestro.Editors.Properties.Resources.function;
-            resources.ApplyResources(this.btnFunctions, "btnFunctions");
-            this.btnFunctions.Name = "btnFunctions";
-            // 
-            // btnProperties
-            // 
-            this.btnProperties.Image = global::Maestro.Editors.Properties.Resources.property;
-            resources.ApplyResources(this.btnProperties, "btnProperties");
-            this.btnProperties.Name = "btnProperties";
-            // 
             // ExpressionEditor
             // 
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             resources.ApplyResources(this, "$this");
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             this.ControlBox = false;
             this.Controls.Add(this.ExpressionText);
             this.Controls.Add(this.toolStrip1);

Modified: branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.resx
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.resx	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/Maestro.Editors/Common/ExpressionEditor.resx	2012-09-03 12:48:48 UTC (rev 6973)
@@ -112,23 +112,23 @@
     <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="OKBtn.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Bottom, Right</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="OKBtn.Location" type="System.Drawing.Point, System.Drawing">
     <value>342, 6</value>
   </data>
   <data name="OKBtn.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="OKBtn.TabIndex" type="System.Int32, mscorlib">
     <value>2</value>
   </data>
@@ -139,7 +139,7 @@
     <value>OKBtn</value>
   </data>
   <data name=">>OKBtn.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=">>OKBtn.Parent" xml:space="preserve">
     <value>panel1</value>
@@ -166,7 +166,7 @@
     <value>CancelBtn</value>
   </data>
   <data name=">>CancelBtn.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=">>CancelBtn.Parent" xml:space="preserve">
     <value>panel1</value>
@@ -174,11 +174,26 @@
   <data name=">>CancelBtn.ZOrder" xml:space="preserve">
     <value>1</value>
   </data>
+  <data name="lblHint.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="lblHint.Location" type="System.Drawing.Point, System.Drawing">
+    <value>12, 11</value>
+  </data>
+  <data name="lblHint.Size" type="System.Drawing.Size, System.Drawing">
+    <value>202, 13</value>
+  </data>
+  <data name="lblHint.TabIndex" type="System.Int32, mscorlib">
+    <value>4</value>
+  </data>
+  <data name="lblHint.Text" xml:space="preserve">
+    <value>Press Alt + Right to invoke auto-complete</value>
+  </data>
   <data name=">>lblHint.Name" xml:space="preserve">
     <value>lblHint</value>
   </data>
   <data name=">>lblHint.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=">>lblHint.Parent" xml:space="preserve">
     <value>panel1</value>
@@ -202,7 +217,7 @@
     <value>panel1</value>
   </data>
   <data name=">>panel1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>panel1.Parent" xml:space="preserve">
     <value>$this</value>
@@ -210,41 +225,14 @@
   <data name=">>panel1.ZOrder" xml:space="preserve">
     <value>2</value>
   </data>
-  <data name="lblHint.AutoSize" type="System.Boolean, mscorlib">
-    <value>True</value>
-  </data>
-  <data name="lblHint.Location" type="System.Drawing.Point, System.Drawing">
-    <value>12, 11</value>
-  </data>
-  <data name="lblHint.Size" type="System.Drawing.Size, System.Drawing">
-    <value>202, 13</value>
-  </data>
-  <data name="lblHint.TabIndex" type="System.Int32, mscorlib">
-    <value>4</value>
-  </data>
-  <data name="lblHint.Text" xml:space="preserve">
-    <value>Press Alt + Right to invoke auto-complete</value>
-  </data>
-  <data name=">>lblHint.Name" xml:space="preserve">
-    <value>lblHint</value>
-  </data>
-  <data name=">>lblHint.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>lblHint.Parent" xml:space="preserve">
-    <value>panel1</value>
-  </data>
-  <data name=">>lblHint.ZOrder" xml:space="preserve">
-    <value>0</value>
-  </data>
-  <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <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="btnProperties.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
   </data>
   <data name="btnProperties.Size" type="System.Drawing.Size, System.Drawing">
-    <value>85, 22</value>
+    <value>89, 22</value>
   </data>
   <data name="btnProperties.Text" xml:space="preserve">
     <value>Properties</value>
@@ -253,16 +241,34 @@
     <value>Magenta</value>
   </data>
   <data name="btnFunctions.Size" type="System.Drawing.Size, System.Drawing">
-    <value>82, 22</value>
+    <value>88, 22</value>
   </data>
   <data name="btnFunctions.Text" xml:space="preserve">
     <value>Functions</value>
   </data>
+  <data name="btnCondition.Size" type="System.Drawing.Size, System.Drawing">
+    <value>127, 22</value>
+  </data>
+  <data name="btnCondition.Text" xml:space="preserve">
+    <value>Condition</value>
+  </data>
+  <data name="btnSpatial.Size" type="System.Drawing.Size, System.Drawing">
+    <value>127, 22</value>
+  </data>
+  <data name="btnSpatial.Text" xml:space="preserve">
+    <value>Spatial</value>
+  </data>
+  <data name="btnDistance.Size" type="System.Drawing.Size, System.Drawing">
+    <value>127, 22</value>
+  </data>
+  <data name="btnDistance.Text" xml:space="preserve">
+    <value>Distance</value>
+  </data>
   <data name="btnFilter.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
   </data>
   <data name="btnFilter.Size" type="System.Drawing.Size, System.Drawing">
-    <value>60, 22</value>
+    <value>62, 22</value>
   </data>
   <data name="btnFilter.Text" xml:space="preserve">
     <value>Filter</value>
@@ -310,7 +316,7 @@
     <value>toolStrip1</value>
   </data>
   <data name=">>toolStrip1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <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>$this</value>
@@ -318,24 +324,6 @@
   <data name=">>toolStrip1.ZOrder" xml:space="preserve">
     <value>1</value>
   </data>
-  <data name="btnCondition.Size" type="System.Drawing.Size, System.Drawing">
-    <value>152, 22</value>
-  </data>
-  <data name="btnCondition.Text" xml:space="preserve">
-    <value>Condition</value>
-  </data>
-  <data name="btnSpatial.Size" type="System.Drawing.Size, System.Drawing">
-    <value>152, 22</value>
-  </data>
-  <data name="btnSpatial.Text" xml:space="preserve">
-    <value>Spatial</value>
-  </data>
-  <data name="btnDistance.Size" type="System.Drawing.Size, System.Drawing">
-    <value>152, 22</value>
-  </data>
-  <data name="btnDistance.Text" xml:space="preserve">
-    <value>Distance</value>
-  </data>
   <data name="ExpressionText.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
     <value>Fill</value>
   </data>
@@ -358,7 +346,7 @@
     <value>ExpressionText</value>
   </data>
   <data name=">>ExpressionText.Type" xml:space="preserve">
-    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>ExpressionText.Parent" xml:space="preserve">
     <value>$this</value>
@@ -366,15 +354,12 @@
   <data name=">>ExpressionText.ZOrder" xml:space="preserve">
     <value>0</value>
   </data>
-  <metadata name="_autoCompleteTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="_autoCompleteTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>116, 17</value>
   </metadata>
-  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
-    <value>6, 13</value>
-  </data>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
     <value>510, 289</value>
   </data>
@@ -387,76 +372,76 @@
   <data name="$this.Text" xml:space="preserve">
     <value>Expression Editor</value>
   </data>
+  <data name=">>btnProperties.Name" xml:space="preserve">
+    <value>btnProperties</value>
+  </data>
+  <data name=">>btnProperties.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnFunctions.Name" xml:space="preserve">
+    <value>btnFunctions</value>
+  </data>
+  <data name=">>btnFunctions.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name=">>btnFilter.Name" xml:space="preserve">
     <value>btnFilter</value>
   </data>
   <data name=">>btnFilter.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnCondition.Name" xml:space="preserve">
     <value>btnCondition</value>
   </data>
   <data name=">>btnCondition.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnSpatial.Name" xml:space="preserve">
     <value>btnSpatial</value>
   </data>
   <data name=">>btnSpatial.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnDistance.Name" xml:space="preserve">
     <value>btnDistance</value>
   </data>
   <data name=">>btnDistance.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>toolStripSeparator1.Name" xml:space="preserve">
     <value>toolStripSeparator1</value>
   </data>
   <data name=">>toolStripSeparator1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>ColumnValue.Name" xml:space="preserve">
     <value>ColumnValue</value>
   </data>
   <data name=">>ColumnValue.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>LookupValues.Name" xml:space="preserve">
     <value>LookupValues</value>
   </data>
   <data name=">>LookupValues.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>ColumnName.Name" xml:space="preserve">
     <value>ColumnName</value>
   </data>
   <data name=">>ColumnName.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>_autoCompleteTooltip.Name" xml:space="preserve">
     <value>_autoCompleteTooltip</value>
   </data>
   <data name=">>_autoCompleteTooltip.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
-  <data name=">>btnFunctions.Name" xml:space="preserve">
-    <value>btnFunctions</value>
-  </data>
-  <data name=">>btnFunctions.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>btnProperties.Name" xml:space="preserve">
-    <value>btnProperties</value>
-  </data>
-  <data name=">>btnProperties.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
   <data name=">>$this.Name" xml:space="preserve">
     <value>ExpressionEditor</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: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Expression/ExpressionFeatureReader.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Expression/ExpressionFeatureReader.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Expression/ExpressionFeatureReader.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -98,6 +98,16 @@
             return _reader.GetName(index);
         }
 
+        public override Schema.PropertyValueType GetPropertyType(int index)
+        {
+            return _reader.GetPropertyType(index);
+        }
+
+        public override Schema.PropertyValueType GetPropertyType(string name)
+        {
+            return _reader.GetPropertyType(name);
+        }
+
         public override ReaderType ReaderType
         {
             get { return _reader.ReaderType; }

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/FeatureBase.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/FeatureBase.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/FeatureBase.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -134,6 +134,36 @@
             _pos = -1;
         }
 
+        public override PropertyValueType GetPropertyType(int index)
+        {
+            var prop = this.ClassDefinition.Properties[index];
+            if (prop.Type == PropertyDefinitionType.Data)
+                return (PropertyValueType)((DataPropertyDefinition)prop).DataType;
+            else if (prop.Type == PropertyDefinitionType.Geometry)
+                return PropertyValueType.Geometry;
+            else if (prop.Type == PropertyDefinitionType.Raster)
+                return PropertyValueType.Raster;
+            else
+                throw new ArgumentException();
+        }
+
+        public override PropertyValueType GetPropertyType(string name)
+        {
+            var prop = this.ClassDefinition.FindProperty(name);
+            if (prop != null)
+            {
+                if (prop.Type == PropertyDefinitionType.Data)
+                    return (PropertyValueType)((DataPropertyDefinition)prop).DataType;
+                else if (prop.Type == PropertyDefinitionType.Geometry)
+                    return PropertyValueType.Geometry;
+                else if (prop.Type == PropertyDefinitionType.Raster)
+                    return PropertyValueType.Raster;
+                else
+                    throw new ArgumentException();
+            }
+            throw new ArgumentException();
+        }
+
         /// <summary>
         /// Reads the next feature.
         /// </summary>

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/ReaderBase.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/ReaderBase.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/Feature/ReaderBase.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -368,5 +368,19 @@
         {
             get { return this.Current[name]; }
         }
+
+        /// <summary>
+        /// Gets the type of the property.
+        /// </summary>
+        /// <param name="name">The name.</param>
+        /// <returns></returns>
+        public abstract OSGeo.MapGuide.MaestroAPI.Schema.PropertyValueType GetPropertyType(string name);
+
+        /// <summary>
+        /// Gets the type of the property at the specified index.
+        /// </summary>
+        /// <param name="index">The index.</param>
+        /// <returns></returns>
+        public abstract OSGeo.MapGuide.MaestroAPI.Schema.PropertyValueType GetPropertyType(int index);
     }
 }

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Http/XmlReaderBase.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Http/XmlReaderBase.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Http/XmlReaderBase.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -140,6 +140,16 @@
             }
         }
 
+        public override PropertyValueType GetPropertyType(string name)
+        {
+            return _propertyMap[name].Type;
+        }
+
+        public override PropertyValueType GetPropertyType(int index)
+        {
+            return _properties[index].Type;
+        }
+
         public override Type GetFieldType(int i)
         {
             return ClrFdoTypeMap.GetClrType(_properties[i].Type);

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -80,6 +80,17 @@
             get { return ReaderType.Data; }
         }
 
+        public override PropertyValueType GetPropertyType(int index)
+        {
+            var name = _reader.GetPropertyName(index);
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
+        public override PropertyValueType GetPropertyType(string name)
+        {
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
         public override string GetName(int index)
         {
             return _reader.GetPropertyName(index);

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -23,6 +23,7 @@
 using OSGeo.MapGuide.MaestroAPI.Exceptions;
 using OSGeo.MapGuide.MaestroAPI.Feature;
 using GisSharpBlog.NetTopologySuite.IO;
+using OSGeo.MapGuide.MaestroAPI.Schema;
 
 namespace OSGeo.MapGuide.MaestroAPI.Native
 {
@@ -51,6 +52,17 @@
             return null;
         }
 
+        public override PropertyValueType GetPropertyType(int index)
+        {
+            var name = _reader.GetPropertyName(index);
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
+        public override PropertyValueType GetPropertyType(string name)
+        {
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
         public override void Dispose()
         {
             Close();

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs	2012-09-03 12:32:42 UTC (rev 6972)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs	2012-09-03 12:48:48 UTC (rev 6973)
@@ -70,6 +70,17 @@
             return null;
         }
 
+        public override PropertyValueType GetPropertyType(int index)
+        {
+            var name = _reader.GetPropertyName(index);
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
+        public override PropertyValueType GetPropertyType(string name)
+        {
+            return (PropertyValueType)_reader.GetPropertyType(name); //We can do this because the enum values map directly to MgPropertyType
+        }
+
         public override void Close()
         {
             _reader.Close();



More information about the mapguide-commits mailing list