[mapguide-commits] r5291 - in sandbox/maestro-3.0:
ExtendedModels/LoadProcedure-1.1.0
ExtendedModels/LoadProcedure-2.2.0 Generated Maestro.Base
Maestro.Base/Commands/SiteExplorer Maestro.Base/Properties
Maestro.Base/Templates Maestro.Editors
Maestro.Editors/LoadProcedure Maestro.Editors/Properties
Maestro.ResourceValidation MaestroAPITests
OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Commands
OSGeo.MapGuide.MaestroAPI/ObjectModels
OSGeo.MapGuide.MaestroAPI.Http
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Oct 18 06:21:07 EDT 2010
Author: jng
Date: 2010-10-18 03:21:07 -0700 (Mon, 18 Oct 2010)
New Revision: 5291
Added:
sandbox/maestro-3.0/Maestro.Base/Templates/DwfLoadProcedureItemTemplate.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.resx
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.resx
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcFactory.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedureInterfaces.cs
Modified:
sandbox/maestro-3.0/ExtendedModels/LoadProcedure-1.1.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.csproj
sandbox/maestro-3.0/ExtendedModels/LoadProcedure-2.2.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.csproj
sandbox/maestro-3.0/Generated/LoadProcedure-1.0.0.designer.cs
sandbox/maestro-3.0/Generated/LoadProcedure-1.1.0.designer.cs
sandbox/maestro-3.0/Generated/LoadProcedure-2.2.0.designer.cs
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs
sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx
sandbox/maestro-3.0/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs
sandbox/maestro-3.0/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/InputFilesCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadProcedureEditorCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadTargetCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs
sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
sandbox/maestro-3.0/Maestro.ResourceValidation/LoadProcedureValidator.cs
sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs
sandbox/maestro-3.0/MaestroAPITests/ValidationTests.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSourceInterfaces.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaceExtensions.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
Log:
3.0 sandbox changes:
- Introduce interfaces for the Load Procedure schema. Because we are only targeting a subset of this schema, all versions cleanly implement the same interface, thus execution should be seamless (v2.2 SQLite load procedures have yet to be tested)
- Fix incorrect ValidatingSchema property for LayerDefinitions versions > 1.0.0
- Modify ObjectFactory to allow pluggable Load Procedure factory methods (just like Layer Definition)
- Move ExecuteLoadProcedure back up to the IServerConnection API level. The implementation still resides as a command, but it is no longer list under CommandType as it is now considered a built-in feature that doesn't require capability checking.
- Update Load Procedure Validation to use Load Procedure interfaces
- Add SQLite load procedure support. Support is not fully tested
- Fix some databinding issues in the Load Procedure Editor
- Add DWF load procedure support. This is still somewhat broken as we need to properly set CS and extents by peeking at the DWF internals.
Modified: sandbox/maestro-3.0/ExtendedModels/LoadProcedure-1.1.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.csproj
===================================================================
--- sandbox/maestro-3.0/ExtendedModels/LoadProcedure-1.1.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.csproj 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/ExtendedModels/LoadProcedure-1.1.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-1.1.0.csproj 2010-10-18 10:21:07 UTC (rev 5291)
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;LP110</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -39,8 +39,17 @@
<Compile Include="..\..\Generated\LoadProcedure-1.1.0.designer.cs">
<Link>LoadProcedure-1.1.0.designer.cs</Link>
</Compile>
+ <Compile Include="..\..\OSGeo.MapGuide.MaestroAPI\ObjectModels\LoadProcedure.cs">
+ <Link>LoadProcedure.cs</Link>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
+ <Project>{80FA3158-8B5F-48D1-A393-0378AFE48A7E}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: sandbox/maestro-3.0/ExtendedModels/LoadProcedure-2.2.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.csproj
===================================================================
--- sandbox/maestro-3.0/ExtendedModels/LoadProcedure-2.2.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.csproj 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/ExtendedModels/LoadProcedure-2.2.0/OSGeo.MapGuide.ObjectModels.LoadProcedure-2.2.0.csproj 2010-10-18 10:21:07 UTC (rev 5291)
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;LP220</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -39,8 +39,17 @@
<Compile Include="..\..\Generated\LoadProcedure-2.2.0.designer.cs">
<Link>LoadProcedure-2.2.0.designer.cs</Link>
</Compile>
+ <Compile Include="..\..\OSGeo.MapGuide.MaestroAPI\ObjectModels\LoadProcedure.cs">
+ <Link>LoadProcedure.cs</Link>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
+ <Project>{80FA3158-8B5F-48D1-A393-0378AFE48A7E}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: sandbox/maestro-3.0/Generated/LoadProcedure-1.0.0.designer.cs
===================================================================
--- sandbox/maestro-3.0/Generated/LoadProcedure-1.0.0.designer.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Generated/LoadProcedure-1.0.0.designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -4,7 +4,7 @@
// <NameSpace>OSGeo.MapGuide.ObjectModels.LoadProcedure</NameSpace><Collection>BindingList</Collection><codeType>CSharp</codeType><EnableDataBinding>True</EnableDataBinding><EnableLasyLoading>False</EnableLasyLoading><HidePrivateFieldInIDE>True</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net20</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><AutomaticProperties>False</AutomaticProperties><DisableDebug>False</DisableDebug><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitia
lizeFields>False</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
-namespace OSGeo.MapGuide.ObjectModels.LoadProcedure {
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
@@ -12,8 +12,8 @@
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
+ using OSGeo.MapGuide.ObjectModels.LoadProcedure;
-
/// <summary>
/// Specification of a load procedure
/// </summary>
@@ -2896,18 +2896,4 @@
}
#endregion
}
-
- [System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.3.0.33572")]
- [System.SerializableAttribute()]
- public enum SdfKeyTreatmentType {
-
- /// <remarks/>
- AutogenerateAll,
-
- /// <remarks/>
- DiscardDuplicates,
-
- /// <remarks/>
- MergeDuplicates,
- }
}
Modified: sandbox/maestro-3.0/Generated/LoadProcedure-1.1.0.designer.cs
===================================================================
--- sandbox/maestro-3.0/Generated/LoadProcedure-1.1.0.designer.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Generated/LoadProcedure-1.1.0.designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -4,7 +4,7 @@
// <NameSpace>OSGeo.MapGuide.ObjectModels.LoadProcedure</NameSpace><Collection>BindingList</Collection><codeType>CSharp</codeType><EnableDataBinding>True</EnableDataBinding><EnableLasyLoading>False</EnableLasyLoading><HidePrivateFieldInIDE>True</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net20</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><AutomaticProperties>False</AutomaticProperties><DisableDebug>False</DisableDebug><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitia
lizeFields>False</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
-namespace OSGeo.MapGuide.ObjectModels.LoadProcedure {
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_1_0 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
@@ -12,8 +12,8 @@
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
+ using OSGeo.MapGuide.ObjectModels.LoadProcedure;
-
/// <summary>
/// Specification of a load procedure
/// </summary>
@@ -2770,18 +2770,4 @@
}
#endregion
}
-
- [System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.3.0.33572")]
- [System.SerializableAttribute()]
- public enum SdfKeyTreatmentType {
-
- /// <remarks/>
- AutogenerateAll,
-
- /// <remarks/>
- DiscardDuplicates,
-
- /// <remarks/>
- MergeDuplicates,
- }
}
Modified: sandbox/maestro-3.0/Generated/LoadProcedure-2.2.0.designer.cs
===================================================================
--- sandbox/maestro-3.0/Generated/LoadProcedure-2.2.0.designer.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Generated/LoadProcedure-2.2.0.designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -4,7 +4,7 @@
// <NameSpace>OSGeo.MapGuide.ObjectModels.LoadProcedure</NameSpace><Collection>BindingList</Collection><codeType>CSharp</codeType><EnableDataBinding>True</EnableDataBinding><EnableLasyLoading>False</EnableLasyLoading><HidePrivateFieldInIDE>True</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net20</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><AutomaticProperties>False</AutomaticProperties><DisableDebug>False</DisableDebug><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitia
lizeFields>False</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
-namespace OSGeo.MapGuide.ObjectModels.LoadProcedure {
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_2_2_0 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
@@ -12,8 +12,8 @@
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
+ using OSGeo.MapGuide.ObjectModels.LoadProcedure;
-
/// <summary>
/// Specification of a load procedure
/// </summary>
@@ -2968,18 +2968,4 @@
}
#endregion
}
-
- [System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.3.0.33572")]
- [System.SerializableAttribute()]
- public enum SdfKeyTreatmentType {
-
- /// <remarks/>
- AutogenerateAll,
-
- /// <remarks/>
- DiscardDuplicates,
-
- /// <remarks/>
- MergeDuplicates,
- }
}
Modified: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -24,6 +24,7 @@
using Maestro.Base.Services;
using Maestro.Shared.UI;
using Maestro.Base.UI;
+using OSGeo.MapGuide.MaestroAPI.Resource;
namespace Maestro.Base.Commands.SiteExplorer
{
@@ -45,6 +46,14 @@
{
DoDelete(wb, resSvc, items);
}
+
+ //Refresh the parent. Multi-select is only allowed from same parent
+ //so we should get the same result
+ var parent = ResourceIdentifier.GetParentFolder(items[0].ResourceId);
+ if (parent == null) //root?
+ exp.RefreshModel(null);
+ else
+ exp.RefreshModel(parent);
}
}
}
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin 2010-10-18 10:21:07 UTC (rev 5291)
@@ -52,6 +52,7 @@
<Class id="PrintLayout100" class="Maestro.Base.Templates.PrintLayoutItemTemplate" />
<Class id="SdfLoadProcedure100" class="Maestro.Base.Templates.SdfLoadProcedureItemTemplate" />
<Class id="ShpLoadProcedure100" class="Maestro.Base.Templates.ShpLoadProcedureItemTemplate" />
+ <Class id="DwfLoadProcedure100" class="Maestro.Base.Templates.DwfLoadProcedureItemTemplate" />
<Class id="SimpleSymbol100" class="Maestro.Base.Templates.SimpleSymbolDefinitionItemTemplate" />
<Class id="CompoundSymbol100" class="Maestro.Base.Templates.CompoundSymbolDefinitionItemTemplate" />
<Class id="WebLayout100" class="Maestro.Base.Templates.WebLayoutItemTemplate" />
Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.csproj 2010-10-18 10:21:07 UTC (rev 5291)
@@ -181,6 +181,7 @@
<Compile Include="Templates\ApplicationDefinitionItemTemplate.cs" />
<Compile Include="Templates\DrawingLayerDefinitionItemTemplate.cs" />
<Compile Include="Templates\DrawingSourceItemTemplate.cs" />
+ <Compile Include="Templates\DwfLoadProcedureItemTemplate.cs" />
<Compile Include="Templates\FeatureSourceItemTemplate.cs" />
<Compile Include="Templates\ItemTemplate.cs" />
<Compile Include="Templates\RasterLayerDefinitionItemTemplate.cs" />
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -473,6 +473,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Autodesk DWF (*.dwf)|*.dwf.
+ /// </summary>
+ internal static string Filter_Dwf_Files {
+ get {
+ return ResourceManager.GetString("Filter_Dwf_Files", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to MapGuide Package File (*.mgp)|*.mgp.
/// </summary>
internal static string Filter_Mgp_Files {
@@ -1384,6 +1393,24 @@
}
/// <summary>
+ /// Looks up a localized string similar to Create a DWF Load Procedure.
+ /// </summary>
+ internal static string TPL_LP_DWF_DESC {
+ get {
+ return ResourceManager.GetString("TPL_LP_DWF_DESC", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DWF Load Procedure.
+ /// </summary>
+ internal static string TPL_LP_DWF_NAME {
+ get {
+ return ResourceManager.GetString("TPL_LP_DWF_NAME", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Create a new SDF Load Procedure.
/// </summary>
internal static string TPL_LP_SDF_DESC {
Modified: sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Properties/Resources.resx 2010-10-18 10:21:07 UTC (rev 5291)
@@ -700,4 +700,13 @@
<data name="box__plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\box--plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="Filter_Dwf_Files" xml:space="preserve">
+ <value>Autodesk DWF (*.dwf)|*.dwf</value>
+ </data>
+ <data name="TPL_LP_DWF_DESC" xml:space="preserve">
+ <value>Create a DWF Load Procedure</value>
+ </data>
+ <data name="TPL_LP_DWF_NAME" xml:space="preserve">
+ <value>DWF Load Procedure</value>
+ </data>
</root>
\ No newline at end of file
Added: sandbox/maestro-3.0/Maestro.Base/Templates/DwfLoadProcedureItemTemplate.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Templates/DwfLoadProcedureItemTemplate.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Base/Templates/DwfLoadProcedureItemTemplate.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,58 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using Res = Maestro.Base.Properties.Resources;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.MaestroAPI.ObjectModels;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+
+namespace Maestro.Base.Templates
+{
+ public class DwfLoadProcedureItemTemplate : ItemTemplate
+ {
+ public DwfLoadProcedureItemTemplate()
+ {
+ Category = Res.TPL_CATEGORY_DEFAULT;
+ //Icon = Res.document;
+ Description = Res.TPL_LP_DWF_DESC;
+ Name = Res.TPL_LP_DWF_NAME;
+ ResourceType = ResourceTypes.LoadProcedure.ToString();
+ }
+
+ public override IResource CreateItem(IServerConnection conn)
+ {
+ using (var dlg = DialogFactory.OpenFile())
+ {
+ dlg.Multiselect = true;
+ dlg.Filter = Properties.Resources.Filter_Dwf_Files;
+ if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ return ObjectFactory.CreateLoadProcedure(conn, LoadType.Dwf, dlg.FileNames);
+ }
+ return null;
+ }
+ }
+ }
+}
Modified: sandbox/maestro-3.0/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Templates/SdfLoadProcedureItemTemplate.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -26,6 +26,7 @@
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
using Maestro.Shared.UI;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace Maestro.Base.Templates
{
@@ -48,7 +49,7 @@
dlg.Filter = Properties.Resources.Filter_Sdf_Files;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
- return ObjectFactory.CreateSdfLoadProcedure(conn, dlg.FileNames);
+ return ObjectFactory.CreateLoadProcedure(conn, LoadType.Sdf, dlg.FileNames);
}
return null;
}
Modified: sandbox/maestro-3.0/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Base/Templates/ShpLoadProcedureItemTemplate.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -26,6 +26,7 @@
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
using Maestro.Shared.UI;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace Maestro.Base.Templates
{
@@ -48,7 +49,7 @@
dlg.Filter = Properties.Resources.Filter_Shp_Files;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
- return ObjectFactory.CreateShpLoadProcedure(conn, dlg.FileNames);
+ return ObjectFactory.CreateLoadProcedure(conn, LoadType.Shp, dlg.FileNames);
}
}
return null;
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.Designer.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,93 @@
+namespace Maestro.Editors.LoadProcedure
+{
+ partial class DwfTransformationCtrl
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.btnBrowseCs = new System.Windows.Forms.Button();
+ this.txtCoordinateSystem = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.contentPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // contentPanel
+ //
+ this.contentPanel.Controls.Add(this.btnBrowseCs);
+ this.contentPanel.Controls.Add(this.txtCoordinateSystem);
+ this.contentPanel.Controls.Add(this.label1);
+ this.contentPanel.Size = new System.Drawing.Size(426, 148);
+ //
+ // btnBrowseCs
+ //
+ this.btnBrowseCs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowseCs.Location = new System.Drawing.Point(381, 39);
+ this.btnBrowseCs.Name = "btnBrowseCs";
+ this.btnBrowseCs.Size = new System.Drawing.Size(28, 23);
+ this.btnBrowseCs.TabIndex = 22;
+ this.btnBrowseCs.Text = "...";
+ this.btnBrowseCs.UseVisualStyleBackColor = true;
+ this.btnBrowseCs.Click += new System.EventHandler(this.btnBrowseCs_Click);
+ //
+ // txtCoordinateSystem
+ //
+ this.txtCoordinateSystem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtCoordinateSystem.Location = new System.Drawing.Point(17, 41);
+ this.txtCoordinateSystem.Name = "txtCoordinateSystem";
+ this.txtCoordinateSystem.ReadOnly = true;
+ this.txtCoordinateSystem.Size = new System.Drawing.Size(358, 20);
+ this.txtCoordinateSystem.TabIndex = 21;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(14, 15);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(250, 13);
+ this.label1.TabIndex = 20;
+ this.label1.Text = "Use the following Coordinate System (if none found)";
+ //
+ // DwfTransformationCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.HeaderText = "Transformation";
+ this.Name = "DwfTransformationCtrl";
+ this.Size = new System.Drawing.Size(426, 175);
+ this.contentPanel.ResumeLayout(false);
+ this.contentPanel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnBrowseCs;
+ private System.Windows.Forms.TextBox txtCoordinateSystem;
+ private System.Windows.Forms.Label label1;
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,62 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+using Maestro.Shared.UI;
+
+namespace Maestro.Editors.LoadProcedure
+{
+ public partial class DwfTransformationCtrl : EditorBindableCollapsiblePanel
+ {
+ public DwfTransformationCtrl()
+ {
+ InitializeComponent();
+ }
+
+ private IEditorService _service;
+
+ public override void Bind(IEditorService service)
+ {
+ _service = service;
+ _service.RegisterCustomNotifier(this);
+
+ var lp = _service.GetEditedResource() as ILoadProcedure;
+ var dlp = lp.SubType as IDwfLoadProcedure;
+
+ TextBoxBinder.BindText(txtCoordinateSystem, dlp, "CoordinateSystem");
+ }
+
+ private void btnBrowseCs_Click(object sender, EventArgs e)
+ {
+ string cs = _service.GetCoordinateSystem();
+ if (!string.IsNullOrEmpty(cs) && cs != txtCoordinateSystem.Text)
+ {
+ txtCoordinateSystem.Text = cs;
+ }
+ }
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.resx (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/DwfTransformationCtrl.resx 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <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>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/InputFilesCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/InputFilesCtrl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/InputFilesCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -27,6 +27,7 @@
using Maestro.Shared.UI;
using System.Diagnostics;
using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace Maestro.Editors.LoadProcedure
{
@@ -37,14 +38,14 @@
InitializeComponent();
}
- private OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedureType _lpt;
+ private IBaseLoadProcedure _lpt;
public override void Bind(IEditorService service)
{
- var lp = service.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure;
+ var lp = service.GetEditedResource() as ILoadProcedure;
Debug.Assert(lp != null);
- _lpt = lp.Item;
+ _lpt = (IBaseLoadProcedure)lp.SubType;
service.RegisterCustomNotifier(this);
lstInputFiles.DataSource = _lpt.SourceFile;
@@ -72,10 +73,14 @@
private string GetFilter()
{
string filter = Properties.Resources.FilterAll;
- if (_lpt is OSGeo.MapGuide.ObjectModels.LoadProcedure.SdfLoadProcedureType)
+ if (_lpt.Type == LoadType.Sdf)
filter = Properties.Resources.FilterSdf;
- else if (_lpt is OSGeo.MapGuide.ObjectModels.LoadProcedure.ShpLoadProcedureType)
+ else if (_lpt.Type == LoadType.Shp)
filter = Properties.Resources.FilterShp;
+ else if (_lpt.Type == LoadType.Dwf)
+ filter = Properties.Resources.FilterDwf;
+ else if (_lpt.Type == LoadType.Sqlite)
+ filter = Properties.Resources.FilterSqlite;
return filter;
}
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadProcedureEditorCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadProcedureEditorCtrl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadProcedureEditorCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -37,32 +37,44 @@
InitializeComponent();
}
- private OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure _lp;
+ private OSGeo.MapGuide.ObjectModels.LoadProcedure.ILoadProcedure _lp;
private IEditorService _ed;
public override void Bind(IEditorService service)
{
_ed = service;
- _lp = _ed.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure;
+ _lp = _ed.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.ILoadProcedure;
Debug.Assert(_lp != null);
service.RegisterCustomNotifier(this);
CollapsiblePanel tp = null;
- if (_lp.Item is SdfLoadProcedureType)
+ if (_lp.SubType.Type == LoadType.Sdf)
{
var trans = new SdfTransformationCtrl();
trans.Bind(service);
tp = trans;
}
- else if (_lp.Item is ShpLoadProcedureType)
+ else if (_lp.SubType.Type == LoadType.Shp)
{
var trans = new ShpTransformationCtrl();
trans.Bind(service);
tp = trans;
}
+ else if (_lp.SubType.Type == LoadType.Dwf)
+ {
+ var trans = new DwfTransformationCtrl();
+ trans.Bind(service);
+ tp = trans;
+ }
+ else if (_lp.SubType.Type == LoadType.Sqlite)
+ {
+ var trans = new SqliteTransformationCtrl();
+ trans.Bind(service);
+ tp = trans;
+ }
else
{
throw new NotSupportedException();
@@ -90,26 +102,20 @@
void OnExecute(object sender, EventArgs e)
{
- if (_ed.SupportsCommand(CommandType.ExecuteLoadProcedure))
+ var pdlg = new ProgressDialog();
+ pdlg.CancelAbortsThread = true;
+
+ var worker = new ProgressDialog.DoBackgroundWork(ExecuteLoadProcedure);
+ try
{
- var pdlg = new ProgressDialog();
- pdlg.CancelAbortsThread = true;
-
- var worker = new ProgressDialog.DoBackgroundWork(ExecuteLoadProcedure);
- try
- {
- var result = pdlg.RunOperationAsync(this.ParentForm, worker, _ed, _lp);
- MessageBox.Show(Properties.Resources.OperationCompleted);
- _ed.RequestRefresh(_lp.Item.RootPath);
- }
- catch (CancelException)
- {
- MessageBox.Show(Properties.Resources.OperationCancelled);
- }
+ _ed.SyncSessionCopy();
+ var result = pdlg.RunOperationAsync(this.ParentForm, worker, _ed, _lp);
+ MessageBox.Show(Properties.Resources.OperationCompleted);
+ _ed.RequestRefresh(_lp.SubType.RootPath);
}
- else
+ catch (CancelException)
{
- MessageBox.Show(Properties.Resources.LoadProcedureVersionExecutionNotSupported);
+ MessageBox.Show(Properties.Resources.OperationCancelled);
}
}
@@ -121,11 +127,9 @@
};
IEditorService ed = (IEditorService)args[0];
- var proc = (OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure)args[1];
+ var proc = (ILoadProcedure)args[1];
- var cmd = (IExecuteLoadProcedure)_ed.CreateCommand(CommandType.ExecuteLoadProcedure);
-
- return cmd.Execute(proc, cb);
+ return proc.CurrentConnection.ExecuteLoadProcedure(proc, cb, true);
}
public event EventHandler ResourceChanged;
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadTargetCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadTargetCtrl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/LoadTargetCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -26,6 +26,7 @@
using System.Windows.Forms;
using Maestro.Shared.UI;
using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace Maestro.Editors.LoadProcedure
{
@@ -43,20 +44,27 @@
service.RegisterCustomNotifier(this);
_service = service;
- var lp = _service.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure;
-
- txtTargetRoot.DataBindings.Add("Text", lp.Item, "RootPath");
- chkCreateFeatureSources.DataBindings.Add("Checked", lp.Item, "GenerateSpatialDataSources");
- chkCreateLayers.DataBindings.Add("Checked", lp.Item, "GenerateLayers");
- txtFeatureSourceRoot.DataBindings.Add("Text", lp.Item, "SpatialDataSourcesPath");
- txtFeatureFolderName.DataBindings.Add("Text", lp.Item, "SpatialDataSourcesFolder");
- txtLayerRoot.DataBindings.Add("Text", lp.Item, "LayersPath");
- txtLayerFolderName.DataBindings.Add("Text", lp.Item, "LayersFolder");
+ var lp = _service.GetEditedResource() as ILoadProcedure;
+ var fproc = lp.SubType;
+
+ TextBoxBinder.BindText(txtTargetRoot, fproc, "RootPath");
+ CheckBoxBinder.BindChecked(chkCreateFeatureSources, fproc, "GenerateSpatialDataSources");
+ CheckBoxBinder.BindChecked(chkCreateLayers, fproc, "GenerateLayers");
+ TextBoxBinder.BindText(txtFeatureSourceRoot, fproc, "SpatialDataSourcesPath");
+ TextBoxBinder.BindText(txtFeatureFolderName, fproc, "SpatialDataSourcesFolder");
+ TextBoxBinder.BindText(txtLayerRoot, fproc, "LayersPath");
+ TextBoxBinder.BindText(txtLayerFolderName, fproc, "LayersFolder");
}
private void btnBrowseRoot_Click(object sender, EventArgs e)
{
txtTargetRoot.Text = _service.SelectFolder();
+
+ if (string.IsNullOrEmpty(txtFeatureSourceRoot.Text))
+ txtFeatureSourceRoot.Text = txtTargetRoot.Text;
+
+ if (string.IsNullOrEmpty(txtLayerRoot.Text))
+ txtLayerRoot.Text = txtTargetRoot.Text;
}
private void btnBrowseFeatureRoot_Click(object sender, EventArgs e)
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SdfTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -44,14 +44,14 @@
{
_service = service;
- var lp = service.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure;
+ var lp = service.GetEditedResource() as ILoadProcedure;
Debug.Assert(lp != null);
service.RegisterCustomNotifier(this);
- var sdflp = lp.Item as OSGeo.MapGuide.ObjectModels.LoadProcedure.SdfLoadProcedureType;
+ var sdflp = lp.SubType as ISdfLoadProcedure;
- txtCoordinateSystem.DataBindings.Add("Text", sdflp, "CoordinateSystem");
+ TextBoxBinder.BindText(txtCoordinateSystem, sdflp, "CoordinateSystem");
numGeneralizePercentage.DataBindings.Add("Value", sdflp, "Generalization");
cmbSdfConflictStrategy.DataSource = Enum.GetValues(typeof(SdfKeyTreatmentType));
//cmbSdfConflictStrategy.DataBindings.Add("SelectedItem", sdflp, "SdfKeyTreatement");
Modified: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/ShpTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -27,6 +27,7 @@
using Maestro.Shared.UI;
using System.Diagnostics;
using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace Maestro.Editors.LoadProcedure
{
@@ -43,16 +44,16 @@
{
_service = service;
- var lp = service.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure;
+ var lp = service.GetEditedResource() as ILoadProcedure;
Debug.Assert(lp != null);
service.RegisterCustomNotifier(this);
- var shplp = lp.Item as OSGeo.MapGuide.ObjectModels.LoadProcedure.ShpLoadProcedureType;
+ var shplp = lp.SubType as IShpLoadProcedure;
- txtCoordinateSystem.DataBindings.Add("Text", shplp, "CoordinateSystem");
+ TextBoxBinder.BindText(txtCoordinateSystem, shplp, "CoordinateSystem");
numGeneralizePercentage.DataBindings.Add("Value", shplp, "Generalization");
- chkConvertToSdf.DataBindings.Add("Checked", shplp, "ConvertToSdf");
+ CheckBoxBinder.BindChecked(chkConvertToSdf, shplp, "ConvertToSdf");
}
}
}
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.Designer.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,133 @@
+namespace Maestro.Editors.LoadProcedure
+{
+ partial class SqliteTransformationCtrl
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label4 = new System.Windows.Forms.Label();
+ this.numGeneralizePercentage = new System.Windows.Forms.NumericUpDown();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnBrowseCs = new System.Windows.Forms.Button();
+ this.txtCoordinateSystem = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.contentPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numGeneralizePercentage)).BeginInit();
+ this.SuspendLayout();
+ //
+ // contentPanel
+ //
+ this.contentPanel.Controls.Add(this.btnBrowseCs);
+ this.contentPanel.Controls.Add(this.txtCoordinateSystem);
+ this.contentPanel.Controls.Add(this.label1);
+ this.contentPanel.Controls.Add(this.label4);
+ this.contentPanel.Controls.Add(this.numGeneralizePercentage);
+ this.contentPanel.Controls.Add(this.label2);
+ this.contentPanel.Size = new System.Drawing.Size(475, 145);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label4.Location = new System.Drawing.Point(14, 104);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(311, 13);
+ this.label4.TabIndex = 16;
+ this.label4.Text = "Note: Disabled features are not supported by Maestro";
+ //
+ // numGeneralizePercentage
+ //
+ this.numGeneralizePercentage.Enabled = false;
+ this.numGeneralizePercentage.Location = new System.Drawing.Point(276, 72);
+ this.numGeneralizePercentage.Name = "numGeneralizePercentage";
+ this.numGeneralizePercentage.Size = new System.Drawing.Size(120, 20);
+ this.numGeneralizePercentage.TabIndex = 15;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Enabled = false;
+ this.label2.Location = new System.Drawing.Point(14, 74);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(171, 13);
+ this.label2.TabIndex = 14;
+ this.label2.Text = "Generalize data by this percentage";
+ //
+ // btnBrowseCs
+ //
+ this.btnBrowseCs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowseCs.Location = new System.Drawing.Point(405, 43);
+ this.btnBrowseCs.Name = "btnBrowseCs";
+ this.btnBrowseCs.Size = new System.Drawing.Size(28, 23);
+ this.btnBrowseCs.TabIndex = 19;
+ this.btnBrowseCs.Text = "...";
+ this.btnBrowseCs.UseVisualStyleBackColor = true;
+ this.btnBrowseCs.Click += new System.EventHandler(this.btnBrowseCs_Click);
+ //
+ // txtCoordinateSystem
+ //
+ this.txtCoordinateSystem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtCoordinateSystem.Location = new System.Drawing.Point(17, 45);
+ this.txtCoordinateSystem.Name = "txtCoordinateSystem";
+ this.txtCoordinateSystem.ReadOnly = true;
+ this.txtCoordinateSystem.Size = new System.Drawing.Size(382, 20);
+ this.txtCoordinateSystem.TabIndex = 18;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(14, 17);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(250, 13);
+ this.label1.TabIndex = 17;
+ this.label1.Text = "Use the following Coordinate System (if none found)";
+ //
+ // SqliteTransformationCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.HeaderText = "Transformation";
+ this.Name = "SqliteTransformationCtrl";
+ this.Size = new System.Drawing.Size(475, 172);
+ this.contentPanel.ResumeLayout(false);
+ this.contentPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numGeneralizePercentage)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.NumericUpDown numGeneralizePercentage;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button btnBrowseCs;
+ private System.Windows.Forms.TextBox txtCoordinateSystem;
+ private System.Windows.Forms.Label label1;
+
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,61 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+
+namespace Maestro.Editors.LoadProcedure
+{
+ public partial class SqliteTransformationCtrl : EditorBindableCollapsiblePanel
+ {
+ public SqliteTransformationCtrl()
+ {
+ InitializeComponent();
+ }
+
+ private IEditorService _service;
+
+ public override void Bind(IEditorService service)
+ {
+ _service = service;
+ _service.RegisterCustomNotifier(this);
+ var lp = service.GetEditedResource() as ILoadProcedure;
+ var slp = lp.SubType as ISqliteLoadProcedure;
+
+ txtCoordinateSystem.DataBindings.Add("Text", slp, "CoordinateSystem");
+ numGeneralizePercentage.DataBindings.Add("Value", slp, "Generalization");
+ }
+
+ private void btnBrowseCs_Click(object sender, EventArgs e)
+ {
+ string cs = _service.GetCoordinateSystem();
+ if (!string.IsNullOrEmpty(cs) && cs != txtCoordinateSystem.Text)
+ {
+ txtCoordinateSystem.Text = cs;
+ }
+ }
+ }
+}
Added: sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.resx (rev 0)
+++ sandbox/maestro-3.0/Maestro.Editors/LoadProcedure/SqliteTransformationCtrl.resx 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <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>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/Maestro.Editors.csproj 2010-10-18 10:21:07 UTC (rev 5291)
@@ -379,6 +379,12 @@
<Compile Include="LayerDefinition\Vector\VectorLayerStyleSectionCtrl.Designer.cs">
<DependentUpon>VectorLayerStyleSectionCtrl.cs</DependentUpon>
</Compile>
+ <Compile Include="LoadProcedure\DwfTransformationCtrl.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="LoadProcedure\DwfTransformationCtrl.Designer.cs">
+ <DependentUpon>DwfTransformationCtrl.cs</DependentUpon>
+ </Compile>
<Compile Include="LoadProcedure\ExecuteCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -415,6 +421,12 @@
<Compile Include="LoadProcedure\ShpTransformationCtrl.Designer.cs">
<DependentUpon>ShpTransformationCtrl.cs</DependentUpon>
</Compile>
+ <Compile Include="LoadProcedure\SqliteTransformationCtrl.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="LoadProcedure\SqliteTransformationCtrl.Designer.cs">
+ <DependentUpon>SqliteTransformationCtrl.cs</DependentUpon>
+ </Compile>
<Compile Include="MapDefinition\FiniteScaleListCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -767,6 +779,9 @@
<DependentUpon>VectorLayerStyleSectionCtrl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="LoadProcedure\DwfTransformationCtrl.resx">
+ <DependentUpon>DwfTransformationCtrl.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="LoadProcedure\ExecuteCtrl.resx">
<DependentUpon>ExecuteCtrl.cs</DependentUpon>
</EmbeddedResource>
@@ -790,6 +805,9 @@
<DependentUpon>ShpTransformationCtrl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="LoadProcedure\SqliteTransformationCtrl.resx">
+ <DependentUpon>SqliteTransformationCtrl.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MapDefinition\FiniteScaleListCtrl.resx">
<DependentUpon>FiniteScaleListCtrl.cs</DependentUpon>
</EmbeddedResource>
Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -541,6 +541,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Autodesk DWF (*.dwf)|*.dwf.
+ /// </summary>
+ internal static string FilterDwf {
+ get {
+ return ResourceManager.GetString("FilterDwf", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Autodesk SDF (*.sdf)|*.*.
/// </summary>
internal static string FilterSdf {
@@ -559,6 +568,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to SQLite files|*.sqlite;*.db;*.sdx;*.slt.
+ /// </summary>
+ internal static string FilterSqlite {
+ get {
+ return ResourceManager.GetString("FilterSqlite", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Cannot Find an Empty String.
/// </summary>
internal static string FindEmptyString {
Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx 2010-10-18 10:21:07 UTC (rev 5291)
@@ -946,4 +946,10 @@
<data name="SelectSymbolLibraryFirst" xml:space="preserve">
<value>Please specify the symbol library first</value>
</data>
+ <data name="FilterDwf" xml:space="preserve">
+ <value>Autodesk DWF (*.dwf)|*.dwf</value>
+ </data>
+ <data name="FilterSqlite" xml:space="preserve">
+ <value>SQLite files|*.sqlite;*.db;*.sdx;*.slt</value>
+ </data>
</root>
\ No newline at end of file
Modified: sandbox/maestro-3.0/Maestro.ResourceValidation/LoadProcedureValidator.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.ResourceValidation/LoadProcedureValidator.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/Maestro.ResourceValidation/LoadProcedureValidator.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -42,43 +42,46 @@
var set = new ValidationResultSet();
- var loadProc = (resource as LoadProcedure).Item;
+ var loadProc = (resource as ILoadProcedure).SubType;
- if (typeof(DwgLoadProcedureType).IsAssignableFrom(loadProc.GetType()))
+ if (loadProc.Type == LoadType.Dwg)
{
set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_DWGNotSupported));
return set.GetAllIssues(); //all she wrote
}
- if (typeof(RasterLoadProcedureType).IsAssignableFrom(loadProc.GetType()))
+ if (loadProc.Type == LoadType.Raster)
{
set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_RasterNotSupported));
return set.GetAllIssues(); //all she wrote
}
- if (typeof(DwfLoadProcedureType).IsAssignableFrom(loadProc.GetType()))
+ if (loadProc.Type == LoadType.Sdf)
{
- set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_DWFNotSupported));
- return set.GetAllIssues(); //all she wrote
+ set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_Sdf2OptionsNotSupported));
+ set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_GeneralizationNotSupported));
}
- if (typeof(SdfLoadProcedureType).IsAssignableFrom(loadProc.GetType()))
+ if (loadProc.Type == LoadType.Shp)
{
- set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_Sdf2OptionsNotSupported));
+ set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_ConvertToSdf3NotSupported));
set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_GeneralizationNotSupported));
}
- if (typeof(ShpLoadProcedureType).IsAssignableFrom(loadProc.GetType()))
+ if (loadProc.Type == LoadType.Sqlite)
{
- set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_ConvertToSdf3NotSupported));
set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, Properties.Resources.LPROC_GeneralizationNotSupported));
}
- foreach (var fn in loadProc.SourceFile)
+ var fproc = loadProc as IBaseLoadProcedure;
+ if (fproc != null)
{
- if (!System.IO.File.Exists(fn))
+ foreach (var fn in fproc.SourceFile)
{
- set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, string.Format(Properties.Resources.LPROC_SourceFileNotFound, fn)));
+ if (!System.IO.File.Exists(fn))
+ {
+ set.AddIssue(new ValidationIssue(resource, ValidationStatus.Warning, string.Format(Properties.Resources.LPROC_SourceFileNotFound, fn)));
+ }
}
}
Modified: sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/MaestroAPITests/ResourceTests.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -36,6 +36,7 @@
using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace MaestroAPITests
{
@@ -358,7 +359,7 @@
}
#endregion
- res = ObjectFactory.CreateSdfLoadProcedure(conn, null);
+ res = ObjectFactory.CreateLoadProcedure(conn, LoadType.Sdf, null);
#region Load Procedure
try
{
@@ -391,7 +392,7 @@
}
#endregion
- res = ObjectFactory.CreateShpLoadProcedure(conn, null);
+ res = ObjectFactory.CreateLoadProcedure(conn, LoadType.Shp, null);
#region Load Procedure
try
{
Modified: sandbox/maestro-3.0/MaestroAPITests/ValidationTests.cs
===================================================================
--- sandbox/maestro-3.0/MaestroAPITests/ValidationTests.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/MaestroAPITests/ValidationTests.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -28,6 +28,7 @@
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
using OSGeo.MapGuide.MaestroAPI;
using Maestro.ResourceValidation;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace MaestroAPITests
{
@@ -94,10 +95,14 @@
[Test]
public void TestLoadProcedureValidation()
{
+ //TODO: Update these test to use pre-defined XML fragments
+ //since ObjectFactory should correctly forbid creation of
+ //unsupported types
+
var id = "Library://Test.LoadProcedure";
var mock = new Mockery();
var conn = mock.NewMock<IServerConnection>();
- var lp = ObjectFactory.CreateSdfLoadProcedure(conn, new string[]
+ var lp = ObjectFactory.CreateLoadProcedure(conn, LoadType.Sdf, new string[]
{
"C:\\foo.sdf",
"C:\\bar.sdf"
@@ -110,7 +115,7 @@
//SDF2, generalization and 2 missing files
Assert.AreEqual(4, set.GetAllIssues().Length);
- lp = ObjectFactory.CreateShpLoadProcedure(conn, new string[]
+ lp = ObjectFactory.CreateLoadProcedure(conn, LoadType.Shp, new string[]
{
"C:\\foo.shp",
"C:\\bar.shp"
@@ -123,9 +128,9 @@
//SDF3 conversion, generalization and 2 missing files
Assert.AreEqual(4, set.GetAllIssues().Length);
- lp = new OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure()
+ lp = new OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcedure()
{
- Item = new OSGeo.MapGuide.ObjectModels.LoadProcedure.DwfLoadProcedureType()
+ Item = new OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.DwgLoadProcedureType()
};
lp.ResourceID = id;
set = new ValidationResultSet();
@@ -134,9 +139,9 @@
//Not supported
Assert.AreEqual(1, set.GetAllIssues().Length);
- lp = new OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure()
+ lp = new OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcedure()
{
- Item = new OSGeo.MapGuide.ObjectModels.LoadProcedure.DwgLoadProcedureType()
+ Item = new OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.RasterLoadProcedureType()
};
lp.ResourceID = id;
set = new ValidationResultSet();
@@ -144,17 +149,6 @@
//Not supported
Assert.AreEqual(1, set.GetAllIssues().Length);
-
- lp = new OSGeo.MapGuide.ObjectModels.LoadProcedure.LoadProcedure()
- {
- Item = new OSGeo.MapGuide.ObjectModels.LoadProcedure.RasterLoadProcedureType()
- };
- lp.ResourceID = id;
- set = new ValidationResultSet();
- set.AddIssues(ResourceValidatorSet.Validate(lp, false));
-
- //Not supported
- Assert.AreEqual(1, set.GetAllIssues().Length);
}
}
}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/CommandType.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -26,16 +26,12 @@
public enum CommandType : int
{
/// <summary>
- /// Execute v1.0.0 Load Procedure resources
- /// </summary>
- ExecuteLoadProcedure = 1,
- /// <summary>
/// Get v1.0.0 Capabilites document
/// </summary>
- GetCapabilities = 2,
+ GetCapabilities = 1,
/// <summary>
/// Get v1.1.0 Capabilites document
/// </summary>
- GetCapabilities2 = 3,
+ GetCapabilities2 = 2,
}
}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -21,26 +21,22 @@
using System.Collections.Generic;
using System.Text;
-using LP = OSGeo.MapGuide.ObjectModels.LoadProcedure;
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+using OSGeo.MapGuide.MaestroAPI.Services;
namespace OSGeo.MapGuide.MaestroAPI.Commands
{
- //TODO: We should decouple this from the v1.0.0 LoadProcedure object
- // v1.1.0 only introduced DWG-specific things (which Maestro will never support anyway)
- // v2.2.0 only introduced a new SQLite sub-type (with no-specific unique properties AFAIK)
- // So structurally speaking, nothing has changed in the XML schema between v1.0.0 and v2.2.0
-
/// <summary>
- /// A command to execute v1.0.0 Load Procedures
+ /// A command to execute Load Procedures
/// </summary>
public interface IExecuteLoadProcedure : ICommand
{
- string[] Execute(LP.LoadProcedure loadProc, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback);
+ string[] Execute(ILoadProcedure loadProc, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback);
string[] Execute(string resourceID, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback);
bool IgnoreUnsupportedFeatures { get; set; }
}
@@ -85,7 +81,7 @@
if (ResourceIdentifier.GetResourceType(this.ResourceID) != ResourceTypes.LoadProcedure)
throw new ArgumentException("Not a load procedure resource id: " + this.ResourceID);
- LP.LoadProcedure proc = (LP.LoadProcedure)this.Parent.ResourceService.GetResource(resourceID);
+ ILoadProcedure proc = (ILoadProcedure)this.Parent.ResourceService.GetResource(resourceID);
return Execute(proc, callback);
}
@@ -101,7 +97,7 @@
/// <param name="ignoreUnsupportedFeatures">If false, will throw exceptions when executing a load procedure containing unsupported features.</param>
/// <param name="callback"></param>
/// <returns>A list of resource IDs that were created from the execution of this load procedure</returns>
- public string[] Execute(LP.LoadProcedure proc, LengthyOperationProgressCallBack callback)
+ public string[] Execute(ILoadProcedure proc, LengthyOperationProgressCallBack callback)
{
//TODO: Localize callback messages
//TODO: Localize exception messages
@@ -126,60 +122,66 @@
//TODO: SDF and SHP load procedures share lots of common logic. Merge the two
//once everything's all good.
- LP.SdfLoadProcedureType sdfl = proc.Item as LP.SdfLoadProcedureType;
- LP.ShpLoadProcedureType shpl = proc.Item as LP.ShpLoadProcedureType;
+ var type = proc.SubType.Type;
+ if (type == LoadType.Dwg || type == LoadType.Raster)
+ throw new NotSupportedException("Unsupported load procedure type"); //LOCALIZEME
+ var sproc = (IBaseLoadProcedure)proc.SubType;
+
bool firstExecute = true;
- if (sdfl != null)
+ if (type == LoadType.Shp)
{
+ var shpl = (IShpLoadProcedure)sproc;
if (!this.IgnoreUnsupportedFeatures)
{
//Anything less than 100% implies use of generalization
- if (sdfl.Generalization < 100.0)
- {
- throw new NotSupportedException("Generalization of data is not supported");
- }
- }
-
- resourcesCreatedOrUpdated = ExecuteSdfLoadProcedure(cb, sdfl, ref firstExecute);
- }
- else if (shpl != null)
- {
- if (!this.IgnoreUnsupportedFeatures)
- {
- //Anything less than 100% implies use of generalization
if (shpl.Generalization < 100.0)
{
- throw new NotSupportedException("Generalization of data is not supported");
+ throw new NotSupportedException("Generalization of data is not supported"); //LOCALIZEME
}
//Can't do this because we don't have a portable .net FDO/MG Feature Service
if (shpl.ConvertToSdf)
{
- throw new NotSupportedException("Conversion of SHP files to SDF files is not supported");
+ throw new NotSupportedException("Conversion of SHP files to SDF files is not supported"); //LOCALIZEME
}
}
resourcesCreatedOrUpdated = ExecuteShpLoadProcedure(cb, shpl, ref firstExecute);
}
- else //We don't support anything else (and probably never will)
+ else
{
- throw new NotSupportedException("Unsupported load procedure type");
+ if (!this.IgnoreUnsupportedFeatures)
+ {
+ CheckUnsupportedFeatures(sproc);
+ }
+ resourcesCreatedOrUpdated = ExecuteBaseProcedure(cb, sproc, ref firstExecute);
}
//Update the generated resources list if this is the first execution
if (firstExecute)
{
- proc.Item.ResourceId.Clear();
+ sproc.ResourceId.Clear();
foreach (var it in resourcesCreatedOrUpdated)
{
- proc.Item.ResourceId.Add(it);
+ sproc.ResourceId.Add(it);
}
this.Parent.ResourceService.SaveResourceAs(proc, this.ResourceID);
}
return resourcesCreatedOrUpdated;
}
- private string[] ExecuteShpLoadProcedure(LengthyOperationProgressCallBack cb, LP.ShpLoadProcedureType shpl, ref bool firstExecution)
+ private void CheckUnsupportedFeatures(IBaseLoadProcedure sproc)
{
+ if (sproc.Type == LoadType.Dwf)
+ {
+ if (Array.IndexOf(this.Parent.Capabilities.SupportedServices, (int)ServiceType.Drawing) < 0)
+ {
+ throw new NotSupportedException("This connection does not support required service: " + ServiceType.Drawing.ToString()); //LOCALIZEME
+ }
+ }
+ }
+
+ private string[] ExecuteShpLoadProcedure(LengthyOperationProgressCallBack cb, IShpLoadProcedure shpl, ref bool firstExecution)
+ {
List<string> resCreatedOrUpdated = new List<string>();
var shpFiles = shpl.SourceFile;
@@ -431,20 +433,20 @@
return resCreatedOrUpdated.ToArray();
}
- private string[] ExecuteSdfLoadProcedure(LengthyOperationProgressCallBack cb, LP.SdfLoadProcedureType sdfl, ref bool firstExecution)
+ private string[] ExecuteBaseProcedure(LengthyOperationProgressCallBack cb, IBaseLoadProcedure proc, ref bool firstExecution)
{
List<string> resCreatedOrUpdated = new List<string>();
- var files = sdfl.SourceFile;
+ var files = proc.SourceFile;
int pcPerFile = (int)(100 / files.Count);
int current = 0;
- string root = sdfl.RootPath;
+ string root = proc.RootPath;
if (!root.EndsWith("/"))
root += "/";
- string sdp = sdfl.SpatialDataSourcesPath;
- string lp = sdfl.LayersPath;
+ string sdp = proc.SpatialDataSourcesPath;
+ string lp = proc.LayersPath;
if (!string.IsNullOrEmpty(sdp))
{
@@ -458,8 +460,8 @@
lp += "/";
}
- string fsRoot = (string.IsNullOrEmpty(sdp) ? root : sdp) + sdfl.SpatialDataSourcesFolder;
- string layerRoot = (string.IsNullOrEmpty(lp) ? root : lp) + sdfl.LayersFolder;
+ string fsRoot = (string.IsNullOrEmpty(sdp) ? root : sdp) + proc.SpatialDataSourcesFolder;
+ string layerRoot = (string.IsNullOrEmpty(lp) ? root : lp) + proc.LayersFolder;
if (!fsRoot.EndsWith("/"))
fsRoot += "/";
@@ -467,9 +469,9 @@
layerRoot += "/";
List<string> resToUpdate = new List<string>();
- if (sdfl.ResourceId != null)
+ if (proc.ResourceId != null)
{
- resToUpdate.AddRange(sdfl.ResourceId);
+ resToUpdate.AddRange(proc.ResourceId);
firstExecution = false;
}
else
@@ -487,152 +489,228 @@
string resName = System.IO.Path.GetFileNameWithoutExtension(file);
string dataName = System.IO.Path.GetFileName(file);
+ string dsId = fsRoot + resName + ".DrawingSource";
string fsId = fsRoot + resName + ".FeatureSource";
string lyrId = layerRoot + resName + ".LayerDefinition";
- if (sdfl.GenerateSpatialDataSources)
+ if (proc.GenerateSpatialDataSources)
{
//Skip only if we have an update list and this resource id is not in it
bool skip = (resToUpdate.Count > 0 && !resToUpdate.Contains(fsId));
if (!skip)
{
- //Process is as follows:
- //
- // 1. Create and save feature source document.
- // 2. Upload sdf file as resource data for this document.
- // 3. Test the connection, it should check out.
- // 4. If no spatial contexts are detected, assign a default one from the load procedure and save the modified feature source.
+ if (proc.Type == LoadType.Dwf)
+ {
+ //Process is as follows:
+ //
+ // 1. Create and save drawing source document.
+ // 2. Upload dwf file as resource data for this document.
- //Step 1: Create feature source document
- var fs = ObjectFactory.CreateFeatureSource(this.Parent, "OSGeo.SDF", "File=%MG_DATA_FILE_PATH%" + dataName);
- fs.ResourceID = fsId;
+ //Step 1: Create and save drawing source document.
+ var ds = ObjectFactory.CreateDrawingSource(this.Parent);
+ ds.SourceName = dataName;
+ ds.CoordinateSpace = proc.CoordinateSystem;
+ ds.ResourceID = dsId;
+ this.Parent.ResourceService.SaveResource(ds);
+ resCreatedOrUpdated.Add(dsId);
+ cb(this, new LengthyOperationProgressArgs("Created: " + dsId, current));
- this.Parent.ResourceService.SaveResource(fs);
- resCreatedOrUpdated.Add(fsId);
- cb(this, new LengthyOperationProgressArgs("Created: " + fsId, current));
+ //Step 2: Load resource data for document
+ this.Parent.ResourceService.SetResourceData(dsId, dataName, ResourceDataType.File, System.IO.File.OpenRead(file));
+ cb(this, new LengthyOperationProgressArgs("Loaded: " + file, current));
- //TODO: When the infrastructure is available to us (ie. A portable .net FDO/MG Feature Service API wrapper)
- //Maybe then we can actually implement the generalization and duplicate record handling properties. Until then, we skip
- //these options
+ var dwSvc = (IDrawingService)Parent.GetService((int)ServiceType.Drawing);
+ var list = dwSvc.EnumerateDrawingSections(dsId);
+ if (list.Section.Count > 0)
+ {
+ foreach(var sect in list.Section)
+ {
+ //TODO: Extract CS and extent info of each sheet and reg them into the document content
+ //DWF files are ZIP files, so we have the ability to peek at its internals
+ var sht = ds.CreateSheet(sect.Name, 0, 0, 0, 0);
+ ds.AddSheet(sht);
+ }
+ this.Parent.ResourceService.SaveResource(ds);
+ }
+ }
+ else
+ {
+ //Process is as follows:
+ //
+ // 1. Create and save feature source document.
+ // 2. Upload sdf file as resource data for this document.
+ // 3. Test the connection, it should check out.
+ // 4. If no spatial contexts are detected, assign a default one from the load procedure and save the modified feature source.
- //Step 2: Load resource data for document
- this.Parent.ResourceService.SetResourceData(fsId, dataName, ResourceDataType.File, System.IO.File.OpenRead(file));
+ //Step 1: Create feature source document
+ string prefix = "File=%MG_DATA_FILE_PATH%";
+ string provider = "OSGeo.SDF";
- cb(this, new LengthyOperationProgressArgs("Loaded: " + file, current));
+ switch (proc.Type)
+ {
+ case LoadType.Sqlite:
+ provider = "OSGeo.SQLite";
+ break;
+ }
- //Step 3: Test to make sure we're all good so far
- string result = this.Parent.FeatureService.TestConnection(fsId);
+ var fs = ObjectFactory.CreateFeatureSource(this.Parent, provider, prefix + dataName);
+ fs.ResourceID = fsId;
- //LocalNativeConnection returns this string, so I'm assuming this is the "success" result
- if (result == "No errors")
- {
- //Step 4: Test to see if default cs needs to be specified
- FdoSpatialContextList spatialContexts = this.Parent.FeatureService.GetSpatialContextInfo(fsId, false);
- if (spatialContexts.SpatialContext.Count == 0 && !string.IsNullOrEmpty(sdfl.CoordinateSystem))
+ this.Parent.ResourceService.SaveResource(fs);
+ resCreatedOrUpdated.Add(fsId);
+ cb(this, new LengthyOperationProgressArgs("Created: " + fsId, current));
+
+ //TODO: When the infrastructure is available to us (ie. A portable .net FDO/MG Feature Service API wrapper)
+ //Maybe then we can actually implement the generalization and duplicate record handling properties. Until then, we skip
+ //these options
+
+ //Step 2: Load resource data for document
+ this.Parent.ResourceService.SetResourceData(fsId, dataName, ResourceDataType.File, System.IO.File.OpenRead(file));
+
+ cb(this, new LengthyOperationProgressArgs("Loaded: " + file, current));
+
+ //Step 3: Test to make sure we're all good so far
+ string result = this.Parent.FeatureService.TestConnection(fsId);
+
+ //LocalNativeConnection returns this string, so I'm assuming this is the "success" result
+ if (result == "No errors")
{
- //Register the default CS from the load procedure
- fs.AddSpatialContextOverride(new SpatialContextType()
+ //Step 4: Test to see if default cs needs to be specified
+ FdoSpatialContextList spatialContexts = this.Parent.FeatureService.GetSpatialContextInfo(fsId, false);
+ if (spatialContexts.SpatialContext.Count == 0 && !string.IsNullOrEmpty(proc.CoordinateSystem))
{
- Name = "Default",
- CoordinateSystem = sdfl.CoordinateSystem
- });
+ //Register the default CS from the load procedure
+ fs.AddSpatialContextOverride(new SpatialContextType()
+ {
+ Name = "Default",
+ CoordinateSystem = proc.CoordinateSystem
+ });
- //Update this feature source
- this.Parent.ResourceService.SaveResource(fs);
+ //Update this feature source
+ this.Parent.ResourceService.SaveResource(fs);
- cb(this, new LengthyOperationProgressArgs("Set default spatial context for: " + fsId, current));
+ cb(this, new LengthyOperationProgressArgs("Set default spatial context for: " + fsId, current));
+ }
}
}
}
}
- if (sdfl.GenerateLayers)
+ if (proc.GenerateLayers)
{
//Skip only if we have an update list and this resource id is not in it
bool skip = (resToUpdate.Count > 0 && !resToUpdate.Contains(lyrId));
if (!skip)
{
- //NOTE: Because we are working against 1.0.0 object types this will always create 1.0.0 Layer Definition
- //resources
+ if (proc.Type == LoadType.Dwf)
+ {
+ //Process is as follows
+ //
+ // 1. Enumerate the sheets on the drawing source
+ // 2. Set the referenced sheet to the first known sheet
- //Process is as follows
- //
- // 1. Describe the schema of the feature source
- // 2. If it contains at least one feature class, create a layer definition
- // 3. Set the following layer definition properties:
- // - Feature Source: the feature source id
- // - Feature Class: the first feature class in the schema
- // - Geometry: the first geometry property in the first feature class
- // 4. Infer the supported geometry types for this feature class. Toggle supported styles accordingly.
+ var dwSvc = (IDrawingService)Parent.GetService((int)ServiceType.Drawing);
+ var list = dwSvc.EnumerateDrawingSections(dsId);
+ if (list.Section.Count > 0)
+ {
+ //Create drawing layer
+ var ld = ObjectFactory.CreateDefaultLayer(this.Parent, LayerType.Drawing, new Version(1, 0, 0));
+ var dl = ld.SubLayer as IDrawingLayerDefinition;
+ dl.ResourceId = dsId;
+ //Use the first one
+ dl.Sheet = list.Section[0].Name;
- //Step 1: Describe the schema
- FeatureSourceDescription desc = this.Parent.FeatureService.DescribeFeatureSource(fsId);
+ ld.ResourceID = lyrId;
- if (desc.Classes.Length > 0)
+ this.Parent.ResourceService.SaveResource(ld);
+ resCreatedOrUpdated.Add(lyrId);
+ cb(this, new LengthyOperationProgressArgs("Created: " + lyrId, current));
+ }
+ }
+ else
{
- //Step 2: Find the first feature class with a geometry property
- ClassDefinition clsDef = null;
- FeatureSetColumn geom = null;
+ //NOTE: Because we are working against 1.0.0 object types this will always create 1.0.0 Layer Definition
+ //resources
- bool done = false;
+ //Process is as follows
+ //
+ // 1. Describe the schema of the feature source
+ // 2. If it contains at least one feature class, create a layer definition
+ // 3. Set the following layer definition properties:
+ // - Feature Source: the feature source id
+ // - Feature Class: the first feature class in the schema
+ // - Geometry: the first geometry property in the first feature class
+ // 4. Infer the supported geometry types for this feature class. Toggle supported styles accordingly.
- foreach (ClassDefinition cls in desc.Classes)
+ //Step 1: Describe the schema
+ FeatureSourceDescription desc = this.Parent.FeatureService.DescribeFeatureSource(fsId);
+
+ if (desc.Classes.Length > 0)
{
- if (done) break;
+ //Step 2: Find the first feature class with a geometry property
+ ClassDefinition clsDef = null;
+ FeatureSetColumn geom = null;
- foreach (FeatureSetColumn prop in cls.Columns)
+ bool done = false;
+
+ foreach (ClassDefinition cls in desc.Classes)
{
if (done) break;
- if (typeof(Topology.Geometries.IGeometry).IsAssignableFrom(prop.Type))
+ foreach (FeatureSetColumn prop in cls.Columns)
{
- clsDef = cls;
- geom = prop;
- done = true;
+ if (done) break;
+
+ if (typeof(Topology.Geometries.IGeometry).IsAssignableFrom(prop.Type))
+ {
+ clsDef = cls;
+ geom = prop;
+ done = true;
+ }
}
}
- }
- if (clsDef != null && geom != null)
- {
- var ld = ObjectFactory.CreateDefaultLayer(this.Parent, LayerType.Vector, new Version(1, 0, 0));
+ if (clsDef != null && geom != null)
+ {
+ var ld = ObjectFactory.CreateDefaultLayer(this.Parent, LayerType.Vector, new Version(1, 0, 0));
- //Step 3: Assign default properties
- ld.ResourceID = lyrId;
- var vld = ld.SubLayer as IVectorLayerDefinition;
- vld.ResourceId = fsId;
- vld.FeatureName = clsDef.QualifiedName;
- vld.Geometry = geom.Name;
+ //Step 3: Assign default properties
+ ld.ResourceID = lyrId;
+ var vld = ld.SubLayer as IVectorLayerDefinition;
+ vld.ResourceId = fsId;
+ vld.FeatureName = clsDef.QualifiedName;
+ vld.Geometry = geom.Name;
- //Step 4: Infer geometry storage support and remove unsupported styles
- object obj = geom.GetMetadata(GeometryMetadata.GEOM_TYPES);
- if (obj != null)
- {
- List<string> geomTypes = new List<string>();
- geomTypes.AddRange(obj.ToString().Trim().Split(' '));
+ //Step 4: Infer geometry storage support and remove unsupported styles
+ object obj = geom.GetMetadata(GeometryMetadata.GEOM_TYPES);
+ if (obj != null)
+ {
+ List<string> geomTypes = new List<string>();
+ geomTypes.AddRange(obj.ToString().Trim().Split(' '));
- var scale = vld.GetScaleRangeAt(0);
+ var scale = vld.GetScaleRangeAt(0);
- var remove = new List<string>();
- if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_POINT))
- {
- remove.Add(GeometryMetadata.GEOM_TYPE_POINT);
+ var remove = new List<string>();
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_POINT))
+ {
+ remove.Add(GeometryMetadata.GEOM_TYPE_POINT);
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_CURVE))
+ {
+ remove.Add(GeometryMetadata.GEOM_TYPE_CURVE);
+ }
+ if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_SURFACE))
+ {
+ remove.Add(GeometryMetadata.GEOM_TYPE_SURFACE);
+ }
+
+ scale.RemoveStyles(remove);
}
- if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_CURVE))
- {
- remove.Add(GeometryMetadata.GEOM_TYPE_CURVE);
- }
- if (!geomTypes.Contains(GeometryMetadata.GEOM_TYPE_SURFACE))
- {
- remove.Add(GeometryMetadata.GEOM_TYPE_SURFACE);
- }
- scale.RemoveStyles(remove);
+ this.Parent.ResourceService.SaveResource(ld);
+ resCreatedOrUpdated.Add(lyrId);
+ cb(this, new LengthyOperationProgressArgs("Created: " + lyrId, current));
}
-
- this.Parent.ResourceService.SaveResource(ld);
- resCreatedOrUpdated.Add(lyrId);
- cb(this, new LengthyOperationProgressArgs("Created: " + lyrId, current));
}
}
}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -23,12 +23,31 @@
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.MaestroAPI.Commands;
using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace OSGeo.MapGuide.MaestroAPI
{
public interface IServerConnection
{
/// <summary>
+ /// Executes the specified load procedure
+ /// </summary>
+ /// <param name="loadProc"></param>
+ /// <param name="callback"></param>
+ /// <param name="ignoreUnsupportedFeatures"></param>
+ /// <returns></returns>
+ string[] ExecuteLoadProcedure(ILoadProcedure loadProc, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupportedFeatures);
+
+ /// <summary>
+ /// Executes the load procedure indicated by the specified resource id
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="callback"></param>
+ /// <param name="ignoreUnsupportedFeatures"></param>
+ /// <returns></returns>
+ string[] ExecuteLoadProcedure(string resourceID, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupportedFeatures);
+
+ /// <summary>
/// Gets the feature service
/// </summary>
IFeatureService FeatureService { get; }
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-10-18 10:21:07 UTC (rev 5291)
@@ -197,6 +197,8 @@
<Compile Include="ObjectModels\Envelope.cs" />
<Compile Include="ObjectModels\FeatureSource.cs" />
<Compile Include="ObjectModels\LayerFactory.cs" />
+ <Compile Include="ObjectModels\LoadProcedureInterfaces.cs" />
+ <Compile Include="ObjectModels\LoadProcFactory.cs" />
<Compile Include="ObjectModels\MapDefinitionInterfaces.cs" />
<Compile Include="ObjectModels\PrintLayoutInterfaces.cs" />
<Compile Include="ObjectModels\SymbolInterfaces.cs" />
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -24,6 +24,7 @@
using System.Xml.Serialization;
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide.MaestroAPI.ObjectModels;
+using OSGeo.MapGuide.ObjectModels.Common;
namespace OSGeo.MapGuide.ObjectModels.DrawingSource
{
@@ -115,6 +116,21 @@
}
}
+ IDrawingSourceSheet IDrawingSource.CreateSheet(string name, double minx, double miny, double maxx, double maxy)
+ {
+ return new DrawingSourceSheet()
+ {
+ Extent = new DrawingSourceSheetExtent()
+ {
+ MinX = minx,
+ MinY = miny,
+ MaxX = maxx,
+ MaxY = maxy
+ },
+ Name = name
+ };
+ }
+
void IDrawingSource.AddSheet(IDrawingSourceSheet sheet)
{
var sht = sheet as DrawingSourceSheet;
@@ -130,26 +146,16 @@
}
}
+ partial class DrawingSourceSheetExtent : IEnvelope
+ { }
+
partial class DrawingSourceSheet : IDrawingSourceSheet
{
- OSGeo.MapGuide.ObjectModels.Common.Envelope IDrawingSourceSheet.Extent
+ IEnvelope IDrawingSourceSheet.Extent
{
get
{
- if (this.Extent == null)
- {
- return null;
- }
- else
- {
- return new OSGeo.MapGuide.ObjectModels.Common.Envelope()
- {
- MaxX = this.Extent.MaxX,
- MaxY = this.Extent.MaxY,
- MinX = this.Extent.MinX,
- MinY = this.Extent.MinY
- };
- }
+ return this.Extent;
}
set
{
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSourceInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSourceInterfaces.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSourceInterfaces.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -38,12 +38,14 @@
void AddSheet(IDrawingSourceSheet sheet);
void RemoveSheet(IDrawingSourceSheet sheet);
+
+ IDrawingSourceSheet CreateSheet(string name, double minx, double miny, double maxx, double maxy);
}
public interface IDrawingSourceSheet
{
string Name { get; set; }
- Envelope Extent { get; set; }
+ IEnvelope Extent { get; set; }
}
}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaceExtensions.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaceExtensions.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerInterfaceExtensions.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -157,8 +157,8 @@
var sheet = ((IDrawingLayerDefinition)layer.SubLayer).Sheet;
var dws = (IDrawingSource)conn.ResourceService.GetResource(((IDrawingLayerDefinition)layer.SubLayer).ResourceId);
- var csCat = conn.CoordinateSystemCatalog;
- return csCat.ConvertCoordinateSystemCodeToWkt(dws.CoordinateSpace);
+ //This should already be WKT form
+ return dws.CoordinateSpace;
}
}
break;
@@ -196,12 +196,15 @@
var sheet = ((IDrawingLayerDefinition)layer.SubLayer).Sheet;
var dws = (IDrawingSource)conn.ResourceService.GetResource(((IDrawingLayerDefinition)layer.SubLayer).ResourceId);
- //find matching sheet
- foreach (var sht in dws.Sheet)
+ if (dws.Sheet != null)
{
- if (sheet.Equals(sht.Name))
+ //find matching sheet
+ foreach (var sht in dws.Sheet)
{
- return ObjectFactory.CreateEnvelope(sht.Extent.MinX, sht.Extent.MinY, sht.Extent.MaxX, sht.Extent.MaxY);
+ if (sheet.Equals(sht.Name))
+ {
+ return ObjectFactory.CreateEnvelope(sht.Extent.MinX, sht.Extent.MinY, sht.Extent.MaxX, sht.Extent.MaxY);
+ }
}
}
}
Added: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcFactory.cs (rev 0)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcFactory.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.IO;
+
+#if LP110
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_1_0
+#elif LP220
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_2_2_0
+#else
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0
+#endif
+{
+ public static class LoadProcEntryPoint
+ {
+ const string ARBITRARY_XYM = "LOCAL_CS[\"Non-Earth (Meter)\", LOCAL_DATUM[\"Local Datum\", 0], UNIT[\"Meter\", 1], AXIS[\"X\", EAST], AXIS[\"Y\", NORTH]]";
+
+ private static void ApplyDefaults(LoadProcedureType lt)
+ {
+ lt.RootPath = "Library://";
+ lt.CoordinateSystem = ARBITRARY_XYM;
+ lt.SpatialDataSourcesPath = "";
+ lt.SpatialDataSourcesFolder = "Data";
+ lt.LayersPath = "";
+ lt.LayersFolder = "Layers";
+ lt.GenerateMaps = false;
+ lt.GenerateLayers = true;
+ lt.GenerateSpatialDataSources = true;
+ lt.SourceFile = new System.ComponentModel.BindingList<string>();
+ }
+
+ internal static ILoadProcedure CreateDefaultSdf()
+ {
+ var proc = new LoadProcedure()
+ {
+ Item = new SdfLoadProcedureType() { Generalization = 100.0 }
+ };
+ ApplyDefaults(proc.Item);
+ return proc;
+ }
+
+ internal static ILoadProcedure CreateDefaultShp()
+ {
+ var proc = new LoadProcedure()
+ {
+ Item = new ShpLoadProcedureType() { Generalization = 100.0, ConvertToSdf = false }
+ };
+ ApplyDefaults(proc.Item);
+ return proc;
+ }
+
+ internal static ILoadProcedure CreateDefaultDwf()
+ {
+ var proc = new LoadProcedure()
+ {
+ Item = new DwfLoadProcedureType()
+ };
+ ApplyDefaults(proc.Item);
+ return proc;
+ }
+
+ public static IResource Deserialize(string xml)
+ {
+ return LoadProcedure.Deserialize(xml);
+ }
+
+ public static Stream Serialize(IResource res)
+ {
+ return res.SerializeToStream();
+ }
+
+#if LP220
+
+ internal static ILoadProcedure CreateDefaultSqlite()
+ {
+ var proc = new LoadProcedure()
+ {
+ Item = new SqliteLoadProcedureType() { Generalization = 100.0 }
+ };
+ ApplyDefaults(proc.Item);
+ return proc;
+ }
+
+#endif
+ }
+}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -23,14 +23,25 @@
using OSGeo.MapGuide.MaestroAPI.Resource;
using System.Xml.Serialization;
using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
-namespace OSGeo.MapGuide.ObjectModels.LoadProcedure
+#if LP110
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_1_0
+#elif LP220
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_2_2_0
+#else
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0
+#endif
{
- partial class LoadProcedure : IResource
+ partial class LoadProcedure : ILoadProcedure
{
- internal LoadProcedure() { }
-
+#if LP110
+ private static readonly Version RES_VERSION = new Version(1, 1, 0);
+#elif LP220
+ private static readonly Version RES_VERSION = new Version(2, 2, 0);
+#else
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+#endif
[XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
@@ -88,7 +99,14 @@
[XmlAttribute("noNamespaceSchemaLocation", Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public string ValidatingSchema
{
+
+#if LP110
+ get { return "LoadProcedure-1.1.0.xsd"; }
+#elif LP220
+ get { return "LoadProcedure-2.2.0.xsd"; }
+#else
get { return "LoadProcedure-1.0.0.xsd"; }
+#endif
set { }
}
@@ -97,10 +115,23 @@
{
get { return true; }
}
+
+ IBaseLoadProcedure ILoadProcedure.SubType
+ {
+ get { return (IBaseLoadProcedure)this.Item; }
+ }
}
- partial class LoadProcedureType
+ abstract partial class LoadProcedureType : IBaseLoadProcedure
{
+ public void AddFile(string file)
+ {
+ if (this.sourceFileField.Contains(file))
+ {
+ this.sourceFileField.Add(file);
+ }
+ }
+
public void AddFiles(IEnumerable<string> files)
{
Check.NotNull(files, "files");
@@ -122,5 +153,101 @@
this.sourceFileField.Remove(file);
}
}
+
+ bool? IBaseLoadProcedure.GenerateMaps
+ {
+ get
+ {
+ return this.GenerateMapsSpecified ?
+ new Nullable<bool>(this.GenerateMaps) :
+ null;
+ }
+ set
+ {
+ if (value.HasValue)
+ {
+ this.GenerateMaps = value.Value;
+ this.GenerateMapsSpecified = true;
+ }
+ else
+ {
+ this.GenerateMapsSpecified = false;
+ }
+ }
+ }
+
+ bool? IBaseLoadProcedure.GenerateSymbolLibraries
+ {
+ get
+ {
+ return this.GenerateSymbolLibrariesSpecified ?
+ new Nullable<bool>(this.GenerateSymbolLibraries) :
+ null;
+ }
+ set
+ {
+ if (value.HasValue)
+ {
+ this.GenerateSymbolLibraries = value.Value;
+ this.GenerateSymbolLibrariesSpecified = true;
+ }
+ else
+ {
+ this.GenerateSymbolLibrariesSpecified = false;
+ }
+ }
+ }
+
+ public abstract LoadType Type { get; }
}
+
+ partial class SdfLoadProcedureType : ISdfLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Sdf; }
+ }
+ }
+
+ partial class ShpLoadProcedureType : IShpLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Shp; }
+ }
+ }
+
+ partial class DwfLoadProcedureType : IDwfLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Dwf; }
+ }
+ }
+
+ partial class DwgLoadProcedureType : IDwgLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Dwg; }
+ }
+ }
+
+ partial class RasterLoadProcedureType : IRasterLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Raster; }
+ }
+ }
+
+#if LP220
+ partial class SQLiteLoadProcedureType : ISqliteLoadProcedure
+ {
+ public override LoadType Type
+ {
+ get { return LoadType.Sqlite; }
+ }
+ }
+#endif
}
Added: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedureInterfaces.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedureInterfaces.cs (rev 0)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedureInterfaces.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -0,0 +1,173 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.ComponentModel;
+using OSGeo.MapGuide.MaestroAPI;
+
+namespace OSGeo.MapGuide.ObjectModels.LoadProcedure
+{
+ [System.SerializableAttribute()]
+ public enum SdfKeyTreatmentType
+ {
+ /// <remarks/>
+ AutogenerateAll,
+
+ /// <remarks/>
+ DiscardDuplicates,
+
+ /// <remarks/>
+ MergeDuplicates,
+ }
+
+ public enum LoadType
+ {
+ Sdf,
+ Shp,
+ Dwf,
+ Raster,
+ Dwg,
+ Sqlite
+ }
+
+ public interface ILoadProcedure : IResource
+ {
+ IBaseLoadProcedure SubType { get; }
+ }
+
+ public interface IDwgLoadProcedure : IBaseLoadProcedure
+ {
+
+ }
+
+ public interface IRasterLoadProcedure : IBaseLoadProcedure
+ {
+
+ }
+
+ public interface IBaseLoadProcedure : INotifyPropertyChanged
+ {
+ LoadType Type { get; }
+
+ BindingList<string> SourceFile { get; }
+
+ void AddFile(string file);
+
+ void RemoveFile(string file);
+
+ string RootPath { get; set; }
+
+ string CoordinateSystem { get; set; }
+
+ bool GenerateSpatialDataSources { get; set; }
+
+ string SpatialDataSourcesPath { get; set; }
+
+ string SpatialDataSourcesFolder { get; set; }
+
+ bool GenerateLayers { get; set; }
+
+ string LayersPath { get; set; }
+
+ string LayersFolder { get; set; }
+
+ bool? GenerateMaps { get; set; }
+
+ string MapsPath { get; set; }
+
+ string MapsFolder { get; set; }
+
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ bool? GenerateSymbolLibraries { get; set; }
+
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ string SymbolLibrariesPath { get; set; }
+
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ string SymbolLibrariesFolder { get; set; }
+
+ BindingList<string> ResourceId { get; set; }
+ }
+
+ public static class BaseLoadProcedureExtensions
+ {
+ /// <summary>
+ /// Adds a group of files to this load procedure
+ /// </summary>
+ /// <param name="proc"></param>
+ /// <param name="files"></param>
+ public static void AddFiles(this IBaseLoadProcedure proc, IEnumerable<string> files)
+ {
+ Check.NotNull(proc, "proc");
+ Check.NotNull(files, "files");
+ foreach (var f in files)
+ {
+ proc.AddFile(f);
+ }
+ }
+ }
+
+ public interface IDwfLoadProcedure : IBaseLoadProcedure
+ {
+
+ }
+
+ public interface ISdfLoadProcedure : IBaseLoadProcedure
+ {
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ double Generalization { get; set; }
+
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ SdfKeyTreatmentType SdfKeyTreatment { get; set; }
+ }
+
+ public interface IShpLoadProcedure : IBaseLoadProcedure
+ {
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ double Generalization { get; set; }
+
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ bool ConvertToSdf { get; set; }
+ }
+
+ public interface ISqliteLoadProcedure : IBaseLoadProcedure
+ {
+ /// <summary>
+ /// Not supported by Maestro
+ /// </summary>
+ double Generalization { get; set; }
+ }
+}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/ObjectFactory.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -38,6 +38,7 @@
namespace OSGeo.MapGuide.MaestroAPI.ObjectModels
{
public delegate ILayerDefinition LayerCreatorFunc(LayerType type);
+ public delegate ILoadProcedure LoadProcCreatorFunc();
/// <summary>
/// Factory class to create MapGuide resource objects with either pre-defined or
@@ -57,13 +58,24 @@
public static class ObjectFactory
{
private static Dictionary<Version, LayerCreatorFunc> _layerFactories;
+ private static Dictionary<LoadType, LoadProcCreatorFunc> _loadProcFactories;
static ObjectFactory()
{
_layerFactories = new Dictionary<Version,LayerCreatorFunc>();
_layerFactories.Add(
new Version(1, 0, 0),
- new LayerCreatorFunc(OSGeo.MapGuide.ObjectModels.LayerDefinition_1_0_0.LayerDefinition.CreateDefault));
+ new LayerCreatorFunc(OSGeo.MapGuide.ObjectModels.LayerDefinition_1_0_0.LdfEntryPoint.CreateDefault));
+ _loadProcFactories = new Dictionary<LoadType, LoadProcCreatorFunc>();
+ _loadProcFactories.Add(
+ LoadType.Sdf,
+ new LoadProcCreatorFunc(OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcEntryPoint.CreateDefaultSdf));
+ _loadProcFactories.Add(
+ LoadType.Shp,
+ new LoadProcCreatorFunc(OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcEntryPoint.CreateDefaultShp));
+ _loadProcFactories.Add(
+ LoadType.Dwf,
+ new LoadProcCreatorFunc(OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcEntryPoint.CreateDefaultDwf));
}
public static void RegisterLayerFactoryMethod(Version ver, LayerCreatorFunc method)
@@ -95,7 +107,8 @@
{
CurrentConnection = owner,
SourceName = string.Empty,
- CoordinateSpace = string.Empty
+ CoordinateSpace = string.Empty,
+ Sheet = new System.ComponentModel.BindingList<DrawingSourceSheet>()
};
}
@@ -689,72 +702,36 @@
};
}
- const string ARBITRARY_XYM = "LOCAL_CS[\"Non-Earth (Meter)\", LOCAL_DATUM[\"Local Datum\", 0], UNIT[\"Meter\", 1], AXIS[\"X\", EAST], AXIS[\"Y\", NORTH]]";
-
- public static LoadProcedure CreateSdfLoadProcedure(IServerConnection owner, IEnumerable<string> sdfFiles)
+ public static ILoadProcedure CreateLoadProcedure(IServerConnection owner, LoadType type, IEnumerable<string> fileNames)
{
- Check.NotNull(owner, "owner");
-
- IList<string> files = new List<string>();
- if (sdfFiles != null)
+ var proc = CreateLoadProcedure(owner, type);
+ var fproc = proc.SubType as IBaseLoadProcedure;
+ if (fproc != null)
{
- foreach (var f in sdfFiles)
+ if (fileNames != null)
{
- files.Add(f);
+ foreach (var f in fileNames)
+ {
+ fproc.SourceFile.Add(f);
+ }
}
}
- return new LoadProcedure()
- {
- CurrentConnection = owner,
- Item = new SdfLoadProcedureType()
- {
- RootPath = "Library://",
- CoordinateSystem = ARBITRARY_XYM,
- SpatialDataSourcesPath = "",
- SpatialDataSourcesFolder = "Data",
- Generalization = 100.0,
- LayersPath = "",
- LayersFolder = "Layers",
- GenerateMaps = false,
- GenerateLayers = true,
- GenerateSpatialDataSources = true,
- SourceFile = new System.ComponentModel.BindingList<string>(files)
- }
- };
+ return proc;
}
- public static LoadProcedure CreateShpLoadProcedure(IServerConnection owner, IEnumerable<string> shpFiles)
+ public static ILoadProcedure CreateLoadProcedure(IServerConnection owner, LoadType type)
{
- if (owner == null)
- throw new ArgumentNullException("owner");
+ if (type == LoadType.Dwg || type == LoadType.Raster)
+ throw new NotSupportedException("Unsupported load procedure type"); //LOCALIZEME
- IList<string> files = new List<string>();
- if (shpFiles != null)
+ if (_loadProcFactories.ContainsKey(type))
{
- foreach (var f in shpFiles)
- {
- files.Add(f);
- }
+ var proc = _loadProcFactories[type]();
+ proc.CurrentConnection = owner;
+ return proc;
}
- return new LoadProcedure()
- {
- CurrentConnection = owner,
- Item = new ShpLoadProcedureType()
- {
- RootPath = "Library://",
- CoordinateSystem = ARBITRARY_XYM,
- SpatialDataSourcesPath = "",
- SpatialDataSourcesFolder = "Data",
- Generalization = 100.0,
- LayersPath = "",
- LayersFolder = "Layers",
- GenerateMaps = false,
- GenerateLayers = true,
- GenerateSpatialDataSources = true,
- ConvertToSdf = false,
- SourceFile = new System.ComponentModel.BindingList<string>(files)
- }
- };
+
+ throw new InvalidOperationException("Could not create load procedure of type: " + type); //LOCALIZEME
}
/// <summary>
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ObjectModels/VectorLayerDefinitionImpl.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -1286,7 +1286,15 @@
[XmlAttribute("noNamespaceSchemaLocation", Namespace = "http://www.w3.org/2001/XMLSchema-instance")]
public string ValidatingSchema
{
+#if LDF_110
+ get { return "LayerDefinition-1.1.0.xsd"; }
+#elif LDF_120
+ get { return "LayerDefinition-1.2.0.xsd"; }
+#elif LDF_130
+ get { return "LayerDefinition-1.3.0.xsd"; }
+#else
get { return "LayerDefinition-1.0.0.xsd"; }
+#endif
set { }
}
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ResourceTypeRegistry.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -100,7 +100,7 @@
new ResourceSerializer()
{
Serialize = (res) => { return res.SerializeToStream(); },
- Deserialize = (xml) => { return LoadProcedure.Deserialize(xml); }
+ Deserialize = (xml) => { return OSGeo.MapGuide.ObjectModels.LoadProcedure_1_0_0.LoadProcedure.Deserialize(xml); }
});
//MapDefinition 1.0.0
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -29,6 +29,7 @@
using OSGeo.MapGuide.ObjectModels.Capabilities;
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.ObjectModels.LoadProcedure;
namespace OSGeo.MapGuide.MaestroAPI
{
@@ -1610,13 +1611,25 @@
CommandType ct = (CommandType)cmdType;
switch (ct)
{
- case CommandType.ExecuteLoadProcedure:
- return new ExecuteLoadProcedure(GetInterface());
default:
return null;
}
}
+ public virtual string[] ExecuteLoadProcedure(ILoadProcedure loadProc, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupported)
+ {
+ var cmd = new ExecuteLoadProcedure(GetInterface());
+ cmd.IgnoreUnsupportedFeatures = ignoreUnsupported;
+ return cmd.Execute(loadProc, callback);
+ }
+
+ public virtual string[] ExecuteLoadProcedure(string resourceID, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupported)
+ {
+ var cmd = new ExecuteLoadProcedure(GetInterface());
+ cmd.IgnoreUnsupportedFeatures = ignoreUnsupported;
+ return cmd.Execute(resourceID, callback);
+ }
+
/// <summary>
/// Raised when a outbound request has been dispatched
/// </summary>
Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs 2010-10-18 09:56:22 UTC (rev 5290)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs 2010-10-18 10:21:07 UTC (rev 5291)
@@ -117,7 +117,6 @@
//TODO: Work out what this can/can't do
return new int[]
{
- (int)OSGeo.MapGuide.MaestroAPI.Commands.CommandType.ExecuteLoadProcedure
};
}
}
More information about the mapguide-commits
mailing list