[mapguide-commits] r8050 - in trunk/Tools/Maestro: Maestro.Editors Maestro.Editors/FeatureSource/Providers/Wms OSGeo.MapGuide.MaestroAPI/SchemaOverrides

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Apr 16 07:33:46 PDT 2014


Author: jng
Date: 2014-04-16 07:33:46 -0700 (Wed, 16 Apr 2014)
New Revision: 8050

Modified:
   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/FeatureSource/Providers/Wms/WmsProviderCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.resx
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs
Log:
Move some WMS configuration document convenience methods into the main Maestro API

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs	2014-04-16 14:33:46 UTC (rev 8050)
@@ -259,52 +259,8 @@
             try
             {
                 _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 spatial 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);
+                string defaultScName = _config.GetDefaultSpatialContext(_fs);
+                _config.EnsureRasterProperties(defaultScName);
                 _config.EnsureConsistency();
             }
             catch
@@ -313,58 +269,6 @@
             }
         }
 
-        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)

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx	2014-04-16 14:33:46 UTC (rev 8050)
@@ -175,10 +175,10 @@
     <value>Top, Bottom, Left, Right</value>
   </data>
   <data name="grpRaster.Location" type="System.Drawing.Point, System.Drawing">
-    <value>294, 224</value>
+    <value>294, 256</value>
   </data>
   <data name="grpRaster.Size" type="System.Drawing.Size, System.Drawing">
-    <value>357, 262</value>
+    <value>357, 279</value>
   </data>
   <data name="grpRaster.TabIndex" type="System.Int32, mscorlib">
     <value>2</value>
@@ -202,7 +202,7 @@
     <value>Bottom, Right</value>
   </data>
   <data name="btnSave.Location" type="System.Drawing.Point, System.Drawing">
-    <value>495, 492</value>
+    <value>495, 541</value>
   </data>
   <data name="btnSave.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -229,7 +229,7 @@
     <value>Bottom, Right</value>
   </data>
   <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
-    <value>576, 492</value>
+    <value>576, 541</value>
   </data>
   <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
@@ -252,60 +252,9 @@
   <data name=">>btnCancel.ZOrder" xml:space="preserve">
     <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>
@@ -313,7 +262,7 @@
     <value>3, 16</value>
   </data>
   <data name="lstFeatureClasses.Size" type="System.Drawing.Size, System.Drawing">
-    <value>270, 333</value>
+    <value>270, 350</value>
   </data>
   <data name="lstFeatureClasses.TabIndex" type="System.Int32, mscorlib">
     <value>1</value>
@@ -333,6 +282,27 @@
   <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="btnAdd.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnAdd.Size" type="System.Drawing.Size, System.Drawing">
+    <value>49, 22</value>
+  </data>
+  <data name="btnAdd.Text" xml:space="preserve">
+    <value>Add</value>
+  </data>
+  <data name="btnRemove.Enabled" type="System.Boolean, mscorlib">
+    <value>False</value>
+  </data>
+  <data name="btnRemove.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
+    <value>70, 22</value>
+  </data>
+  <data name="btnRemove.Text" xml:space="preserve">
+    <value>Remove</value>
+  </data>
   <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
     <value>3, 16</value>
   </data>
@@ -360,32 +330,35 @@
   <data name=">>toolStrip1.ZOrder" xml:space="preserve">
     <value>1</value>
   </data>
-  <data name="btnAdd.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
-    <value>Magenta</value>
+  <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
+    <value>12, 166</value>
   </data>
-  <data name="btnAdd.Size" type="System.Drawing.Size, System.Drawing">
-    <value>49, 22</value>
+  <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>276, 369</value>
   </data>
-  <data name="btnAdd.Text" xml:space="preserve">
-    <value>Add</value>
+  <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
+    <value>5</value>
   </data>
-  <data name="btnRemove.Enabled" type="System.Boolean, mscorlib">
-    <value>False</value>
+  <data name="groupBox2.Text" xml:space="preserve">
+    <value>Feature Classes</value>
   </data>
-  <data name="btnRemove.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
-    <value>Magenta</value>
+  <data name=">>groupBox2.Name" xml:space="preserve">
+    <value>groupBox2</value>
   </data>
-  <data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
-    <value>70, 22</value>
+  <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="btnRemove.Text" xml:space="preserve">
-    <value>Remove</value>
+  <data name=">>groupBox2.Parent" xml:space="preserve">
+    <value>$this</value>
   </data>
+  <data name=">>groupBox2.ZOrder" xml:space="preserve">
+    <value>4</value>
+  </data>
   <data name="btnReset.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Bottom, Left</value>
   </data>
   <data name="btnReset.Location" type="System.Drawing.Point, System.Drawing">
-    <value>12, 492</value>
+    <value>12, 541</value>
   </data>
   <data name="btnReset.Size" type="System.Drawing.Size, System.Drawing">
     <value>107, 23</value>
@@ -411,48 +384,18 @@
   <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>
@@ -460,7 +403,7 @@
     <value>3, 16</value>
   </data>
   <data name="grdSpatialContexts.Size" type="System.Drawing.Size, System.Drawing">
-    <value>633, 70</value>
+    <value>633, 102</value>
   </data>
   <data name="grdSpatialContexts.TabIndex" type="System.Int32, mscorlib">
     <value>0</value>
@@ -477,108 +420,33 @@
   <data name=">>grdSpatialContexts.ZOrder" xml:space="preserve">
     <value>0</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 name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
+    <value>12, 39</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 name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
+    <value>639, 121</value>
   </data>
-  <data name="grpLogicalClass.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
-    <value>Top, Left, Right</value>
+  <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
+    <value>7</value>
   </data>
-  <data name=">>lnkSwap.Name" xml:space="preserve">
-    <value>lnkSwap</value>
+  <data name="groupBox1.Text" xml:space="preserve">
+    <value>Spatial Contexts (click cell to edit coordinate system)</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 name=">>groupBox1.Name" xml:space="preserve">
+    <value>groupBox1</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.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">
+  <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=">>grpLogicalClass.Parent" xml:space="preserve">
+  <data name=">>groupBox1.Parent" xml:space="preserve">
     <value>$this</value>
   </data>
-  <data name=">>grpLogicalClass.ZOrder" xml:space="preserve">
-    <value>1</value>
+  <data name=">>groupBox1.ZOrder" xml:space="preserve">
+    <value>2</value>
   </data>
+  <data name="grpLogicalClass.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Left, Right</value>
+  </data>
   <data name="lnkSwap.AutoSize" type="System.Boolean, mscorlib">
     <value>True</value>
   </data>
@@ -711,11 +579,38 @@
   <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>297, 166</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=">>grpLogicalClass.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>grpLogicalClass.ZOrder" xml:space="preserve">
+    <value>1</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>
+    <value>125, 541</value>
   </data>
   <data name="btnSwapAll.Size" type="System.Drawing.Size, System.Drawing">
     <value>160, 23</value>
@@ -742,7 +637,7 @@
     <value>True</value>
   </metadata>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>663, 527</value>
+    <value>663, 576</value>
   </data>
   <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
     <value>CenterParent</value>

Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs	2014-04-16 14:33:46 UTC (rev 8050)
@@ -29,6 +29,7 @@
 using OSGeo.MapGuide.MaestroAPI.Resource;
 using OSGeo.MapGuide.ObjectModels.FeatureSource;
 using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI.SchemaOverrides;
 
 namespace Maestro.Editors.FeatureSource.Providers.Wms
 {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2014-04-16 14:33:46 UTC (rev 8050)
@@ -97,6 +97,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Building configuration document for WMS Feature Source.
+        /// </summary>
+        internal static string AutoConfiguringFeatureSource {
+            get {
+                return ResourceManager.GetString("AutoConfiguringFeatureSource", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Base Layer Group.
         /// </summary>
         internal static string BaseLayerGroup {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2014-04-16 14:33:46 UTC (rev 8050)
@@ -1578,4 +1578,7 @@
   <data name="ThemingNotAVectorLayer" xml:space="preserve">
     <value>The layer being themed is not a vector layer</value>
   </data>
+  <data name="AutoConfiguringFeatureSource" xml:space="preserve">
+    <value>Building configuration document for WMS Feature Source</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs	2014-04-16 13:58:39 UTC (rev 8049)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsConfigurationDocument.cs	2014-04-16 14:33:46 UTC (rev 8050)
@@ -18,6 +18,8 @@
 // 
 #endregion
 using OSGeo.MapGuide.MaestroAPI.Schema;
+using OSGeo.MapGuide.ObjectModels.Common;
+using OSGeo.MapGuide.ObjectModels.FeatureSource;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -151,7 +153,7 @@
                             //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.Type == OSGeo.MapGuide.MaestroAPI.Schema.PropertyDefinitionType.Raster)
                                 {
                                     if (prop.Name != mapping.RasterPropertyName)
                                         mapping.RasterPropertyName = prop.Name;
@@ -174,5 +176,117 @@
                 schema.RemoveClass(cls);
             }
         }
+
+        /// <summary>
+        /// Gets the default spatial context from this configuration document. If none is found, the first spatial
+        /// context from the given Feature Source is used
+        /// </summary>
+        /// <param name="fs"></param>
+        /// <returns></returns>
+        public string GetDefaultSpatialContext(IFeatureSource fs)
+        {
+            //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 (this.SpatialContexts.Length > 0)
+            {
+                defaultScName = this.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 spatial 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,
+                    };
+                    this.AddSpatialContext(sc);
+                    defaultScName = sc.Name;
+                }
+            }
+            return defaultScName;
+        }
+
+        /// <summary>
+        /// Ensures that classes in this document have an identity property and a raster property. Any classes which
+        /// have neither, will have properties created for them
+        /// </summary>
+        /// <param name="defaultScName">The name of the default spatial context</param>
+        public void EnsureRasterProperties(string defaultScName)
+        {
+            foreach (var schema in this.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
+                            });
+                        }
+                    }
+                }
+            }
+        }
     }
 }



More information about the mapguide-commits mailing list