[mapguide-commits] r5640 - in trunk/Tools/Maestro:
Maestro.Base/Commands Maestro.Base/Commands/SiteExplorer
Maestro.Base/Properties Maestro.Base/Services Maestro.Base/UI
Maestro.Editors/FeatureSource/Providers/Wms
OSGeo.MapGuide.MaestroAPI/ObjectModels
OSGeo.MapGuide.MaestroAPI/SchemaOverrides
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Mar 19 11:35:38 EDT 2011
Author: jng
Date: 2011-03-19 08:35:38 -0700 (Sat, 19 Mar 2011)
New Revision: 5640
Modified:
trunk/Tools/Maestro/Maestro.Base/Commands/PasteCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
trunk/Tools/Maestro/Maestro.Base/UI/RenameItemDialog.cs
trunk/Tools/Maestro/Maestro.Base/UI/SiteExplorer.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/RasterDefinitionCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSourceInterfaces.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/IFdoSpatialContext.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsLayerDefinition.cs
Log:
This submission contains the following changes:
- #738: More work on WMS feature source editor
- #1636: Protect open resources from being overwritten by copy/paste/rename/saveas commands
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/PasteCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/PasteCommand.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/PasteCommand.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -62,7 +62,8 @@
LoggingService.InfoFormatted(Properties.Resources.ClipboardAction, item.ClipboardState, item.ResourceId, folder.ResourceId);
//Keep testing until we find a target resource identifier that
- //doesn't already exists
+ //doesn't already exists. Note this would automatically guard against any resources in this folder
+ //that may already be open in an editor
var rid = new ResourceIdentifier(item.ResourceId);
var name = rid.IsFolder ? (rid.Name + "/") : (rid.Name + "." + rid.ResourceType.ToString());
var resId = folder.ResourceId + name;
@@ -87,9 +88,13 @@
if (item.ClipboardState == RepositoryItem.ClipboardAction.Copy)
{
if (item.IsFolder)
+ {
conn.ResourceService.CopyFolderWithReferences(item.ResourceId, resId, null, null);
+ }
else
+ {
conn.ResourceService.CopyResource(item.ResourceId, resId, false);
+ }
}
else if (item.ClipboardState == RepositoryItem.ClipboardAction.Cut)
{
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -36,6 +36,7 @@
var wb = Workbench.Instance;
var exp = wb.ActiveSiteExplorer;
var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+ var omgr = ServiceRegistry.GetService<OpenResourceManager>();
var conn = connMgr.GetConnection(exp.ConnectionName);
var ed = wb.ActiveDocumentView as IEditorViewContent;
@@ -48,6 +49,12 @@
if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
+ if (omgr.IsOpen(picker.ResourceID))
+ {
+ MessageService.ShowMessage(string.Format(Properties.Resources.CannotSaveToResourceAlreadyOpened, picker.ResourceID));
+ return;
+ }
+
using (new WaitCursor(wb))
{
ed.EditorService.SaveAs(picker.ResourceID);
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -34,6 +34,7 @@
{
var wb = Workbench.Instance;
var exp = wb.ActiveSiteExplorer;
+ var omgr = ServiceRegistry.GetService<OpenResourceManager>();
var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
var conn = connMgr.GetConnection(exp.ConnectionName);
if (exp.SelectedItems.Length == 1)
@@ -49,6 +50,12 @@
}
}
+ if (!current.IsFolder && omgr.IsOpen(current.ResourceId))
+ {
+ MessageService.ShowMessage(Properties.Resources.CannotRenameAlreadyOpenedResource);
+ return;
+ }
+
var dlg = new RenameItemDialog(current.Name, names);
if (dlg.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK)
{
@@ -65,6 +72,12 @@
newid = parent.ResourceId + dlg.NewName + "." + current.ResourceType;
}
+ if (omgr.IsOpen(newid))
+ {
+ MessageService.ShowMessage(string.Format(Properties.Resources.CannotRenameToResourceAlreadyOpened, newid));
+ return;
+ }
+
var prog = new ProgressDialog();
prog.RunOperationAsync(wb, (worker, e, args) =>
{
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -268,6 +268,33 @@
}
}
+ /// <summary>
+ /// Looks up a localized string similar to Cannot rename resource as it is already opened by another editor.
+ /// </summary>
+ internal static string CannotRenameAlreadyOpenedResource {
+ get {
+ return ResourceManager.GetString("CannotRenameAlreadyOpenedResource", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot rename resource to {0} as it is already opened by another editor.
+ /// </summary>
+ internal static string CannotRenameToResourceAlreadyOpened {
+ get {
+ return ResourceManager.GetString("CannotRenameToResourceAlreadyOpened", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot save to {0} as it is already opened by another editor.
+ /// </summary>
+ internal static string CannotSaveToResourceAlreadyOpened {
+ get {
+ return ResourceManager.GetString("CannotSaveToResourceAlreadyOpened", resourceCulture);
+ }
+ }
+
internal static System.Drawing.Bitmap clipboard_paste {
get {
object obj = ResourceManager.GetObject("clipboard_paste", resourceCulture);
@@ -301,6 +328,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Closing open editor of {0}.
+ /// </summary>
+ internal static string ClosingOpenEditor {
+ get {
+ return ResourceManager.GetString("ClosingOpenEditor", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Confirm.
/// </summary>
internal static string Confirm {
@@ -1113,6 +1149,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to The following resources were not copied or moved because they would be overwriting resources currently open: {0}.
+ /// </summary>
+ internal static string NotCopiedOrMovedDueToOpenEditors {
+ get {
+ return ResourceManager.GetString("NotCopiedOrMovedDueToOpenEditors", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Resource ID must not be session based.
/// </summary>
internal static string NotSessionBasedId {
@@ -1965,6 +2010,24 @@
}
/// <summary>
+ /// Looks up a localized string similar to Open editor updated to {0}.
+ /// </summary>
+ internal static string UpdatedOpenEditor {
+ get {
+ return ResourceManager.GetString("UpdatedOpenEditor", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Updating open editors of {0} to {1}.
+ /// </summary>
+ internal static string UpdatingOpenReferences {
+ get {
+ return ResourceManager.GetString("UpdatingOpenReferences", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Building resource list....
/// </summary>
internal static string ValidationBuildingList {
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-19 15:35:38 UTC (rev 5640)
@@ -850,4 +850,25 @@
<data name="FolderNameExists" xml:space="preserve">
<value>Folder name already exists</value>
</data>
+ <data name="UpdatingOpenReferences" xml:space="preserve">
+ <value>Updating open editors of {0} to {1}</value>
+ </data>
+ <data name="ClosingOpenEditor" xml:space="preserve">
+ <value>Closing open editor of {0}</value>
+ </data>
+ <data name="UpdatedOpenEditor" xml:space="preserve">
+ <value>Open editor updated to {0}</value>
+ </data>
+ <data name="CannotRenameAlreadyOpenedResource" xml:space="preserve">
+ <value>Cannot rename resource as it is already opened by another editor</value>
+ </data>
+ <data name="CannotRenameToResourceAlreadyOpened" xml:space="preserve">
+ <value>Cannot rename resource to {0} as it is already opened by another editor</value>
+ </data>
+ <data name="CannotSaveToResourceAlreadyOpened" xml:space="preserve">
+ <value>Cannot save to {0} as it is already opened by another editor</value>
+ </data>
+ <data name="NotCopiedOrMovedDueToOpenEditors" xml:space="preserve">
+ <value>The following resources were not copied or moved because they would be overwriting resources currently open: {0}</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -207,4 +207,4 @@
return _openItems[resourceId];
}
}
-}
+}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Base/UI/RenameItemDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/RenameItemDialog.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/UI/RenameItemDialog.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -24,6 +24,7 @@
using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using Maestro.Base.Services;
namespace Maestro.Base.UI
{
Modified: trunk/Tools/Maestro/Maestro.Base/UI/SiteExplorer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/SiteExplorer.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Base/UI/SiteExplorer.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -419,6 +419,8 @@
private string [] MoveResources(ICollection<string> resIds, string folderId)
{
var wb = Workbench.Instance;
+ var notMoved = new List<string>();
+ var omgr = ServiceRegistry.GetService<OpenResourceManager>();
var dlg = new ProgressDialog();
var worker = new ProgressDialog.DoBackgroundWork((w, e, args) =>
{
@@ -439,12 +441,18 @@
//moved instead of the folder itself!
var rid = new ResourceIdentifier(r);
var target = folderId + rid.Name + "/";
- //_conn.ResourceService.MoveFolderWithReferences(r, target, null, cb);
_conn.ResourceService.MoveResourceWithReferences(r, target, null, cb);
}
else
- _conn.ResourceService.MoveResourceWithReferences(r, folderId, null, cb);
- //string msg = string.Format("Moving {0} to {1}", r, folderId);
+ {
+ var rid = new ResourceIdentifier(r);
+ var target = folderId + rid.Name + "." + rid.Extension;
+
+ if (!omgr.IsOpen(target))
+ _conn.ResourceService.MoveResourceWithReferences(r, target, null, cb);
+ else
+ notMoved.Add(r);
+ }
}
//Collect affected folders and refresh them
@@ -462,6 +470,10 @@
});
var affectedFolders = (IEnumerable<string>)dlg.RunOperationAsync(wb, worker, folderId, resIds);
+
+ if (notMoved.Count > 0)
+ MessageService.ShowMessage(string.Format(Properties.Resources.NotCopiedOrMovedDueToOpenEditors, Environment.NewLine + string.Join(Environment.NewLine, notMoved.ToArray())));
+
return new List<string>(affectedFolders).ToArray();
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/RasterDefinitionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/RasterDefinitionCtrl.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/RasterDefinitionCtrl.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -29,6 +29,7 @@
namespace Maestro.Editors.FeatureSource.Providers.Wms
{
+ [ToolboxItem(false)]
public partial class RasterDefinitionCtrl : UserControl
{
private RasterWmsItem _item;
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -28,6 +28,7 @@
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.MaestroAPI.Schema;
using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.Common;
namespace Maestro.Editors.FeatureSource.Providers.Wms
{
@@ -72,29 +73,48 @@
private WmsConfigurationDocument BuildDefaultWmsDocument()
{
var doc = new WmsConfigurationDocument();
+ var contexts = _fs.GetSpatialInfo(false);
var schemaName = _fs.GetSchemaNames()[0];
- doc.AddSchema(new FeatureSchema(schemaName, ""));
- /*
- foreach (var cls in desc.AllClasses)
+ var clsNames = _fs.GetClassNames(schemaName);
+ var schema = new FeatureSchema(schemaName, "");
+ doc.AddSchema(schema);
+
+ var defaultSc = contexts.SpatialContext[0];
+
+ foreach (var clsName in clsNames)
{
- var raster = GetRasterProperty(cls);
- if (raster != null)
+ var cls = new ClassDefinition(clsName, "");
+ cls.AddProperty(new DataPropertyDefinition("Id", "")
{
- var item = CreateDefaultItem(cls, raster);
+ DataType = DataPropertyType.String,
+ Length = 256,
+ IsNullable = false
+ }, true);
+ cls.AddProperty(new RasterPropertyDefinition("Image", "")
+ {
+ DefaultImageXSize = 1024,
+ DefaultImageYSize = 1024,
+ SpatialContextAssociation = defaultSc.Name
+ });
- doc.AddRasterItem(item);
- }
- }*/
+ schema.AddClass(cls);
+
+ var item = CreateDefaultItem(schema.Name, cls.Name, "Image", defaultSc);
+ doc.AddRasterItem(item);
+ }
+
return doc;
}
- private static RasterWmsItem CreateDefaultItem(ClassDefinition cls, RasterPropertyDefinition raster)
+ private static RasterWmsItem CreateDefaultItem(string schemaName, string clsName, string rasName, IFdoSpatialContext defaultSc)
{
- var item = new RasterWmsItem(cls.Name, raster.Name);
+ var item = new RasterWmsItem(clsName, rasName);
item.ImageFormat = "PNG";
item.IsTransparent = true;
item.BackgroundColor = Color.White;
- item.SpatialContextName = "EPSG:4326";
+ item.SpatialContextName = defaultSc.Name;
+ item.UseTileCache = false;
+ item.AddLayer(new WmsLayerDefinition(schemaName + ":" + clsName) { Style = "default" });
return item;
}
@@ -102,7 +122,7 @@
{
foreach (var prop in cls.Properties)
{
- if (prop.Type == PropertyDefinitionType.Raster)
+ if (prop.Type == OSGeo.MapGuide.MaestroAPI.Schema.PropertyDefinitionType.Raster)
return (RasterPropertyDefinition)prop;
}
return null;
@@ -133,6 +153,7 @@
private void btnRemove_Click(object sender, EventArgs e)
{
+ /*
var item = (RasterWmsItem)lstFeatureClasses.SelectedItem;
_items.Remove(item);
@@ -142,10 +163,12 @@
//Remove mapped class from logical schema
var schema = _config.Schemas[0];
schema.RemoveClass(item.FeatureClass);
+ */
}
private void btnAdd_Click(object sender, EventArgs e)
{
+ /*
var name = GenericInputDialog.GetValue(Properties.Resources.TitleNewFeatureClass, Properties.Resources.PromptName, null);
var schema = _config.Schemas[0];
@@ -170,6 +193,7 @@
_config.AddRasterItem(item);
_items.Add(item);
+ */
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsAdvancedConfigurationDialog.resx 2011-03-19 15:35:38 UTC (rev 5640)
@@ -253,10 +253,10 @@
<value>Fill</value>
</data>
<data name="lstFeatureClasses.Location" type="System.Drawing.Point, System.Drawing">
- <value>3, 41</value>
+ <value>3, 16</value>
</data>
<data name="lstFeatureClasses.Size" type="System.Drawing.Size, System.Drawing">
- <value>270, 225</value>
+ <value>270, 251</value>
</data>
<data name="lstFeatureClasses.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -276,27 +276,6 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.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>
@@ -309,6 +288,9 @@
<data name="toolStrip1.Text" xml:space="preserve">
<value>toolStrip1</value>
</data>
+ <data name="toolStrip1.Visible" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
<data name=">>toolStrip1.Name" xml:space="preserve">
<value>toolStrip1</value>
</data>
@@ -345,6 +327,27 @@
<data name=">>groupBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
+ <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>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Providers/Wms/WmsProviderCtrl.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -30,6 +30,7 @@
namespace Maestro.Editors.FeatureSource.Providers.Wms
{
+ [ToolboxItem(false)]
public partial class WmsProviderCtrl : EditorBindableCollapsiblePanel
{
public WmsProviderCtrl()
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSourceInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSourceInterfaces.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSourceInterfaces.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -380,6 +380,20 @@
}
/// <summary>
+ /// Gets the names of all the feature classes in the specified schema of this feature source
+ /// </summary>
+ /// <param name="fs"></param>
+ /// <param name="schemaName"></param>
+ /// <returns></returns>
+ public static string[] GetClassNames(this IFeatureSource fs, string schemaName)
+ {
+ Check.NotNull(fs, "fs");
+ Check.NotEmpty(schemaName, "schemaName");
+
+ return fs.CurrentConnection.FeatureService.GetClassNames(fs.ResourceID, schemaName);
+ }
+
+ /// <summary>
/// Sets the connection properties of the feature source
/// </summary>
/// <param name="fs"></param>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/IFdoSpatialContext.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/IFdoSpatialContext.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/IFdoSpatialContext.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -217,7 +217,7 @@
var baseCrs = node["gml:baseCRS"];
this.Name = srsName.InnerText;
- this.Description = remarks.InnerText;
+ this.Description = (remarks != null) ? remarks.InnerText : string.Empty;
var bbox = ext["gml:boundingBox"];
if (bbox != null)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/RasterWmsItem.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -62,6 +62,8 @@
public void RemoveLayer(WmsLayerDefinition layer) { _layers.Remove(layer); }
+ public bool UseTileCache { get; set; }
+
public string Time { get; set; }
public string SpatialContextName { get; set; }
@@ -86,6 +88,9 @@
var bgcolor = doc.CreateElement("BackgroundColor");
bgcolor.InnerText = "0x" + Utility.SerializeHTMLColor(this.BackgroundColor, false);
+ var useTileCache = doc.CreateElement("UseTileCache");
+ useTileCache.InnerText = this.UseTileCache ? "true" : "false";
+
var time = doc.CreateElement("Time");
time.InnerText = this.Time;
@@ -97,6 +102,7 @@
rasterDef.AppendChild(format);
rasterDef.AppendChild(transparent);
+ rasterDef.AppendChild(useTileCache);
rasterDef.AppendChild(bgcolor);
rasterDef.AppendChild(time);
rasterDef.AppendChild(elevation);
@@ -122,6 +128,7 @@
var format = node["Format"];
var transparent = node["Transparent"];
+ var useTileCache = node["UseTileCache"];
var bgcolor = node["BackgroundColor"];
var time = node["Time"];
var elevation = node["Elevation"];
@@ -133,12 +140,22 @@
if (transparent != null)
this.IsTransparent = (transparent.InnerText.ToLower() == "true");
+ if (useTileCache != null)
+ this.UseTileCache = (useTileCache.InnerText.ToLower() == "true");
+
if (bgcolor != null)
{
- if (bgcolor.InnerText.StartsWith("0x"))
- this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText.Substring(2));
- else
- this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText);
+ if (!string.IsNullOrEmpty(bgcolor.InnerText))
+ {
+ if (bgcolor.InnerText.StartsWith("0x"))
+ this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText.Substring(2));
+ else
+ this.BackgroundColor = ColorTranslator.FromHtml("#" + bgcolor.InnerText);
+ }
+ else
+ {
+ this.BackgroundColor = default(Color);
+ }
}
if (time != null)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsLayerDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsLayerDefinition.cs 2011-03-18 23:52:52 UTC (rev 5639)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SchemaOverrides/WmsLayerDefinition.cs 2011-03-19 15:35:38 UTC (rev 5640)
@@ -32,13 +32,21 @@
public string Name { get; set; }
+ public string Style { get; set; }
+
public void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode)
{
var layer = doc.CreateElement("Layer");
var n = doc.CreateAttribute("name");
n.Value = this.Name;
layer.Attributes.Append(n);
- layer.AppendChild(doc.CreateElement("Style"));
+ {
+ var style = doc.CreateElement("Style");
+ var s = doc.CreateAttribute("name");
+ s.Value = this.Style;
+ style.Attributes.Append(s);
+ layer.AppendChild(style);
+ }
currentNode.AppendChild(layer);
}
@@ -51,6 +59,16 @@
if (n == null)
throw new Exception("Bad document. Expected attribute: name");
+ var style = node.FirstChild;
+ if (style != null)
+ {
+ var s = style.Attributes["name"];
+ if (s != null)
+ {
+ this.Style = s.Value;
+ }
+ }
+
this.Name = n.Value;
}
}
More information about the mapguide-commits
mailing list