[mapguide-commits] r6100 - in trunk/Tools/Maestro: Install Maestro
Maestro.AddIn.ExtendedObjectModels Maestro.AddIn.Local
Maestro.AddIn.Local/Commands Maestro.AddIn.Local/Properties
Maestro.AddIn.Local/Resources Maestro.AddIn.Local/Services
Maestro.AddIn.Local/UI Maestro.Base Maestro.Base/Commands
Maestro.Base/Commands/SiteExplorer Maestro.Base/Editor
Maestro.Base/Services Maestro.Editors Maestro.Login
Maestro.Packaging Maestro.Shared.UI MaestroFsPreview
OSGeo.MapGuide.MaestroAPI/Mapping Properties SDK
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Aug 28 12:40:57 EDT 2011
Author: jng
Date: 2011-08-28 09:40:57 -0700 (Sun, 28 Aug 2011)
New Revision: 6100
Added:
trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.resx
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-045.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-090.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-135.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-180.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-225.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-270.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-315.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/icon_clearselect.gif
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/lc_select.gif
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-fit.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-in.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-out.png
trunk/Tools/Maestro/Maestro.AddIn.Local/Services/
trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx
trunk/Tools/Maestro/Maestro.Base/Services/ResourcePreviewerFactory.cs
trunk/Tools/Maestro/Properties/SignedAssemblyInfo2.cs
Modified:
trunk/Tools/Maestro/Install/Maestro.nsi
trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Maestro.AddIn.ExtendedObjectModels.csproj
trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj
trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
trunk/Tools/Maestro/Maestro.Base/Commands/PreviewResourceCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs
trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs
trunk/Tools/Maestro/Maestro.Base/Editor/IEditorViewContent.cs
trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj
trunk/Tools/Maestro/Maestro.Packaging/Maestro.Packaging.csproj
trunk/Tools/Maestro/Maestro.Shared.UI/Maestro.Shared.UI.csproj
trunk/Tools/Maestro/Maestro/Maestro.sln
trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
trunk/Tools/Maestro/SDK/SDK.sln
Log:
- #1788: Refactor resource previewing. Local connection mode now has its own previewing mechanism
- #1784: Update OpenResourceManager to be multi-connection aware.
- Update MgDesktop binaries
- Ensure all projects are signed, as a result of referencing OSGeo.MapGuide.Desktop.dll (which is a signed assembly itself)
Modified: trunk/Tools/Maestro/Install/Maestro.nsi
===================================================================
--- trunk/Tools/Maestro/Install/Maestro.nsi 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Install/Maestro.nsi 2011-08-28 16:40:57 UTC (rev 6100)
@@ -248,6 +248,7 @@
# main executables
File "${INST_OUTPUT_MAESTRO}\${EXE_MAESTRO}"
+ File "${INST_OUTPUT_MAESTRO}\LocalConfigure.exe"
File "${INST_OUTPUT_MAESTRO}\MgCooker.exe"
File "${INST_OUTPUT_MAESTRO}\MgCookerCmd.exe"
File "${INST_OUTPUT_MAESTRO}\MaestroFsPreview.exe"
Modified: trunk/Tools/Maestro/Maestro/Maestro.sln
===================================================================
--- trunk/Tools/Maestro/Maestro/Maestro.sln 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro/Maestro.sln 2011-08-28 16:40:57 UTC (rev 6100)
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C# Express 2008
+# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro", "Maestro.csproj", "{E0C36475-2B70-4F6D-ACE0-8943167806DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\Thirdparty\SharpDevelop\ICSharpCode.Core\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
@@ -17,6 +17,13 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MgCooker.Cmd", "..\MgCooker.Cmd\MgCooker.Cmd.csproj", "{0FD82B7B-1264-410F-86D1-47E9CCACD68E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maestro.AddIn.Local", "..\Maestro.AddIn.Local\Maestro.AddIn.Local.csproj", "{2419F940-BFB7-4F3F-B5DA-1052EB4706E5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalConfigure", "..\LocalConfigure\LocalConfigure.csproj", "{6EE16FFD-296E-42FF-B994-8902C27AA0F4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {E0C36475-2B70-4F6D-ACE0-8943167806DC} = {E0C36475-2B70-4F6D-ACE0-8943167806DC}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -55,6 +62,14 @@
{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FD82B7B-1264-410F-86D1-47E9CCACD68E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2419F940-BFB7-4F3F-B5DA-1052EB4706E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2419F940-BFB7-4F3F-B5DA-1052EB4706E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2419F940-BFB7-4F3F-B5DA-1052EB4706E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2419F940-BFB7-4F3F-B5DA-1052EB4706E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6EE16FFD-296E-42FF-B994-8902C27AA0F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6EE16FFD-296E-42FF-B994-8902C27AA0F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6EE16FFD-296E-42FF-B994-8902C27AA0F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6EE16FFD-296E-42FF-B994-8902C27AA0F4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Maestro.AddIn.ExtendedObjectModels.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Maestro.AddIn.ExtendedObjectModels.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Maestro.AddIn.ExtendedObjectModels.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -48,6 +48,7 @@
<Reference Include="OSGeo.MapGuide.ExtendedObjectModels, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SDK\bin\OSGeo.MapGuide.ExtendedObjectModels.dll</HintPath>
+ <Private>False</Private>
</Reference>
<Reference Include="OSGeo.MapGuide.MaestroAPI, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -24,6 +24,8 @@
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide.MaestroAPI.Local;
using System.IO;
+using Maestro.Base.Services;
+using Maestro.AddIn.Local.Services;
namespace Maestro.AddIn.Local.Commands
{
@@ -36,6 +38,8 @@
ConnectionProviderRegistry.RegisterProvider(
LocalConnection.ProviderInfo,
LocalConnection.Create);
+
+ ResourcePreviewerFactory.RegisterPreviewer(LocalConnection.PROVIDER_NAME, new LocalPreviewer());
}
else
{
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -31,19 +31,36 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="OSGeo.MapGuide.Desktop, Version=2.4.0.0, Culture=neutral, PublicKeyToken=e75f9fd7cf82dc3f, processorArchitecture=x86">
+ <Private>False</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
- <Compile Include="..\Properties\SignedAssemblyInfo.cs">
- <Link>SignedAssemblyInfo.cs</Link>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
</Compile>
<Compile Include="Commands\StartupCommand.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Services\LocalPreviewer.cs" />
+ <Compile Include="UI\MapPreviewWindow.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\MapPreviewWindow.Designer.cs">
+ <DependentUpon>MapPreviewWindow.cs</DependentUpon>
+ </Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Maestro.Base\Maestro.Base.csproj">
@@ -51,6 +68,11 @@
<Name>Maestro.Base</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\Maestro.Editors\Maestro.Editors.csproj">
+ <Project>{5AD2CDBA-952E-4148-98A1-31D2E0D540D5}</Project>
+ <Name>Maestro.Editors</Name>
+ <Private>False</Private>
+ </ProjectReference>
<ProjectReference Include="..\Maestro.Shared.UI\Maestro.Shared.UI.csproj">
<Project>{CFD19053-2172-41D3-8460-0FD2123A1E88}</Project>
<Name>Maestro.Shared.UI</Name>
@@ -252,6 +274,19 @@
<Content Include="OSGeo.MapGuide.Desktop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <None Include="Resources\arrow-090.png" />
+ <None Include="Resources\arrow-180.png" />
+ <None Include="Resources\arrow.png" />
+ <None Include="Resources\arrow-270.png" />
+ <None Include="Resources\magnifier-zoom-in.png" />
+ <None Include="Resources\magnifier-zoom-out.png" />
+ <None Include="Resources\magnifier-zoom-fit.png" />
+ <None Include="Resources\lc_select.gif" />
+ <None Include="Resources\icon_clearselect.gif" />
+ <None Include="Resources\arrow-315.png" />
+ <None Include="Resources\arrow-225.png" />
+ <None Include="Resources\arrow-135.png" />
+ <None Include="Resources\arrow-045.png" />
<Content Include="xerces-c_3_1mg.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -945,6 +980,15 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <EmbeddedResource Include="UI\MapPreviewWindow.resx">
+ <DependentUpon>MapPreviewWindow.cs</DependentUpon>
+ </EmbeddedResource>
+ </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: trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
===================================================================
(Binary files differ)
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.Designer.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,154 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4959
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Maestro.AddIn.Local.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Maestro.AddIn.Local.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow {
+ get {
+ object obj = ResourceManager.GetObject("arrow", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_045 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-045", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_090 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-090", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_135 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-135", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_180 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-180", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_225 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-225", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_270 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-270", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap arrow_315 {
+ get {
+ object obj = ResourceManager.GetObject("arrow-315", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap icon_clearselect {
+ get {
+ object obj = ResourceManager.GetObject("icon_clearselect", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap lc_select {
+ get {
+ object obj = ResourceManager.GetObject("lc_select", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap magnifier_zoom_fit {
+ get {
+ object obj = ResourceManager.GetObject("magnifier-zoom-fit", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap magnifier_zoom_in {
+ get {
+ object obj = ResourceManager.GetObject("magnifier-zoom-in", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap magnifier_zoom_out {
+ get {
+ object obj = ResourceManager.GetObject("magnifier-zoom-out", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Properties/Resources.resx 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,160 @@
+<?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>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="arrow-180" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-180.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-090" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-090.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-135" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-135.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-225" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-225.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="icon_clearselect" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\icon_clearselect.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-315" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-315.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="lc_select" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\lc_select.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="magnifier-zoom-fit" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\magnifier-zoom-fit.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="magnifier-zoom-in" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\magnifier-zoom-in.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-270" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-270.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="magnifier-zoom-out" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\magnifier-zoom-out.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+ <data name="arrow-045" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\arrow-045.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-045.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-045.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-090.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-090.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-135.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-135.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-180.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-180.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-225.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-225.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-270.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-270.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-315.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow-315.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/arrow.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Copied: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/icon_clearselect.gif (from rev 5814, branches/2.2/MgDev/Web/src/stdicons/icon_clearselect.gif)
===================================================================
(Binary files differ)
Copied: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/lc_select.gif (from rev 5814, branches/2.2/MgDev/Web/src/stdicons/lc_select.gif)
===================================================================
(Binary files differ)
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-fit.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-fit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-in.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-in.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-out.png
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/Resources/magnifier-zoom-out.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,90 @@
+#region Disclaimer / License
+// Copyright (C) 2011, 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 Maestro.Base.Services;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using OSGeo.MapGuide.ObjectModels;
+using OSGeo.MapGuide.ObjectModels.Common;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide;
+using Maestro.AddIn.Local.UI;
+using OSGeo.MapGuide.ObjectModels.WatermarkDefinition;
+using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+
+namespace Maestro.AddIn.Local.Services
+{
+ public class LocalPreviewer : IResourcePreviewer
+ {
+ public bool IsPreviewable(OSGeo.MapGuide.MaestroAPI.Resource.IResource res)
+ {
+ var rt = res.ResourceType;
+ return (rt == ResourceTypes.LayerDefinition ||
+ rt == ResourceTypes.MapDefinition ||
+ rt == ResourceTypes.WatermarkDefinition);
+ }
+
+ public void Preview(OSGeo.MapGuide.MaestroAPI.Resource.IResource res, Maestro.Editors.IEditorService edSvc)
+ {
+ IMapDefinition mapDef = null;
+ var conn = res.CurrentConnection;
+
+ if (res.ResourceType == ResourceTypes.LayerDefinition)
+ {
+ var ldf = (ILayerDefinition)res;
+ string wkt;
+ var env = ldf.GetSpatialExtent(true, out wkt);
+ mapDef = ObjectFactory.CreateMapDefinition(conn, "Preview");
+ mapDef.CoordinateSystem = wkt;
+ mapDef.SetExtents(env.MinX, env.MinY, env.MaxX, env.MaxY);
+ string resId = "Session:" + edSvc.SessionID + "//" + Guid.NewGuid() + "." + res.ResourceType.ToString();
+ edSvc.ResourceService.SetResourceXmlData(resId, ResourceTypeRegistry.Serialize(res));
+ mapDef.AddLayer(null, "PreviewLayer", resId);
+ }
+ else if (res.ResourceType == ResourceTypes.MapDefinition)
+ {
+ mapDef = (IMapDefinition)res;
+ }
+ else if (res.ResourceType == ResourceTypes.WatermarkDefinition)
+ {
+ string resId = "Session:" + edSvc.SessionID + "//" + Guid.NewGuid() + "." + res.ResourceType.ToString();
+ edSvc.ResourceService.SetResourceXmlData(resId, ResourceTypeRegistry.Serialize(res));
+
+ var wm = ((IWatermarkDefinition)res).CreateInstance();
+ wm.ResourceId = resId;
+ var csFact = new MgCoordinateSystemFactory();
+ var arbXY = csFact.ConvertCoordinateSystemCodeToWkt("XY-M");
+ mapDef = ObjectFactory.CreateMapDefinition(conn, new Version(2, 3, 0), "Preview");
+ mapDef.CoordinateSystem = arbXY;
+ mapDef.SetExtents(-100000, -100000, 100000, 100000);
+ ((IMapDefinition2)mapDef).AddWatermark(wm);
+ }
+
+ var mapResId = new MgResourceIdentifier("Session:" + edSvc.SessionID + "//" + Guid.NewGuid() + "." + res.ResourceType.ToString());
+ edSvc.ResourceService.SetResourceXmlData(mapResId.ToString(), ResourceTypeRegistry.Serialize(mapDef));
+
+ MgdMap map = new MgdMap(mapResId);
+
+ var diag = new MapPreviewWindow(map);
+ diag.ShowDialog();
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,345 @@
+namespace Maestro.AddIn.Local.UI
+{
+ partial class MapPreviewWindow
+ {
+ /// <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 Windows Form 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.chkSelectFeatures = new System.Windows.Forms.CheckBox();
+ this.renderWorker = new System.ComponentModel.BackgroundWorker();
+ this.mapImage = new System.Windows.Forms.PictureBox();
+ this.btnLowerRight = new System.Windows.Forms.Button();
+ this.btnLowerLeft = new System.Windows.Forms.Button();
+ this.btnUpperLeft = new System.Windows.Forms.Button();
+ this.btnUpperRight = new System.Windows.Forms.Button();
+ this.btnClearSelect = new System.Windows.Forms.Button();
+ this.btnZoomExtents = new System.Windows.Forms.Button();
+ this.btnZoomOut = new System.Windows.Forms.Button();
+ this.btnZoomIn = new System.Windows.Forms.Button();
+ this.btnDown = new System.Windows.Forms.Button();
+ this.btnRight = new System.Windows.Forms.Button();
+ this.btnLeft = new System.Windows.Forms.Button();
+ this.btnUp = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.numScale = new System.Windows.Forms.NumericUpDown();
+ this.btnZoomScale = new System.Windows.Forms.Button();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.mapImage)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numScale)).BeginInit();
+ this.SuspendLayout();
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.mapImage);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.panel1);
+ this.splitContainer1.Size = new System.Drawing.Size(674, 487);
+ this.splitContainer1.SplitterDistance = 549;
+ this.splitContainer1.TabIndex = 0;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.groupBox1);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(0, 0);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(121, 487);
+ this.panel1.TabIndex = 0;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.btnZoomScale);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.numScale);
+ this.groupBox1.Controls.Add(this.btnLowerRight);
+ this.groupBox1.Controls.Add(this.btnLowerLeft);
+ this.groupBox1.Controls.Add(this.btnUpperLeft);
+ this.groupBox1.Controls.Add(this.btnUpperRight);
+ this.groupBox1.Controls.Add(this.btnClearSelect);
+ this.groupBox1.Controls.Add(this.chkSelectFeatures);
+ this.groupBox1.Controls.Add(this.btnZoomExtents);
+ this.groupBox1.Controls.Add(this.btnZoomOut);
+ this.groupBox1.Controls.Add(this.btnZoomIn);
+ this.groupBox1.Controls.Add(this.btnDown);
+ this.groupBox1.Controls.Add(this.btnRight);
+ this.groupBox1.Controls.Add(this.btnLeft);
+ this.groupBox1.Controls.Add(this.btnUp);
+ this.groupBox1.Location = new System.Drawing.Point(4, 4);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(112, 336);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Controls";
+ //
+ // chkSelectFeatures
+ //
+ this.chkSelectFeatures.AutoSize = true;
+ this.chkSelectFeatures.Location = new System.Drawing.Point(22, 219);
+ this.chkSelectFeatures.Name = "chkSelectFeatures";
+ this.chkSelectFeatures.Size = new System.Drawing.Size(56, 17);
+ this.chkSelectFeatures.TabIndex = 7;
+ this.chkSelectFeatures.Text = "Select";
+ this.chkSelectFeatures.UseVisualStyleBackColor = true;
+ //
+ // renderWorker
+ //
+ this.renderWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.renderWorker_DoWork);
+ this.renderWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.renderWorker_RunWorkerCompleted);
+ this.renderWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.renderWorker_ProgressChanged);
+ //
+ // mapImage
+ //
+ this.mapImage.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mapImage.Location = new System.Drawing.Point(0, 0);
+ this.mapImage.Name = "mapImage";
+ this.mapImage.Size = new System.Drawing.Size(549, 487);
+ this.mapImage.TabIndex = 0;
+ this.mapImage.TabStop = false;
+ this.mapImage.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mapImage_MouseClick);
+ //
+ // btnLowerRight
+ //
+ this.btnLowerRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_315;
+ this.btnLowerRight.Location = new System.Drawing.Point(75, 93);
+ this.btnLowerRight.Name = "btnLowerRight";
+ this.btnLowerRight.Size = new System.Drawing.Size(30, 30);
+ this.btnLowerRight.TabIndex = 14;
+ this.btnLowerRight.UseVisualStyleBackColor = true;
+ this.btnLowerRight.Click += new System.EventHandler(this.btnLowerRight_Click);
+ //
+ // btnLowerLeft
+ //
+ this.btnLowerLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_225;
+ this.btnLowerLeft.Location = new System.Drawing.Point(6, 93);
+ this.btnLowerLeft.Name = "btnLowerLeft";
+ this.btnLowerLeft.Size = new System.Drawing.Size(30, 30);
+ this.btnLowerLeft.TabIndex = 13;
+ this.btnLowerLeft.UseVisualStyleBackColor = true;
+ this.btnLowerLeft.Click += new System.EventHandler(this.btnLowerLeft_Click);
+ //
+ // btnUpperLeft
+ //
+ this.btnUpperLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_135;
+ this.btnUpperLeft.Location = new System.Drawing.Point(6, 20);
+ this.btnUpperLeft.Name = "btnUpperLeft";
+ this.btnUpperLeft.Size = new System.Drawing.Size(30, 30);
+ this.btnUpperLeft.TabIndex = 12;
+ this.btnUpperLeft.UseVisualStyleBackColor = true;
+ this.btnUpperLeft.Click += new System.EventHandler(this.btnUpperLeft_Click);
+ //
+ // btnUpperRight
+ //
+ this.btnUpperRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_045;
+ this.btnUpperRight.Location = new System.Drawing.Point(74, 20);
+ this.btnUpperRight.Name = "btnUpperRight";
+ this.btnUpperRight.Size = new System.Drawing.Size(30, 30);
+ this.btnUpperRight.TabIndex = 11;
+ this.btnUpperRight.UseVisualStyleBackColor = true;
+ this.btnUpperRight.Click += new System.EventHandler(this.btnUpperRight_Click);
+ //
+ // btnClearSelect
+ //
+ this.btnClearSelect.Image = global::Maestro.AddIn.Local.Properties.Resources.icon_clearselect;
+ this.btnClearSelect.Location = new System.Drawing.Point(58, 183);
+ this.btnClearSelect.Name = "btnClearSelect";
+ this.btnClearSelect.Size = new System.Drawing.Size(30, 30);
+ this.btnClearSelect.TabIndex = 8;
+ this.btnClearSelect.UseVisualStyleBackColor = true;
+ this.btnClearSelect.Click += new System.EventHandler(this.btnClearSelect_Click);
+ //
+ // btnZoomExtents
+ //
+ this.btnZoomExtents.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_fit;
+ this.btnZoomExtents.Location = new System.Drawing.Point(22, 183);
+ this.btnZoomExtents.Name = "btnZoomExtents";
+ this.btnZoomExtents.Size = new System.Drawing.Size(30, 30);
+ this.btnZoomExtents.TabIndex = 6;
+ this.btnZoomExtents.UseVisualStyleBackColor = true;
+ this.btnZoomExtents.Click += new System.EventHandler(this.btnZoomExtents_Click);
+ //
+ // btnZoomOut
+ //
+ this.btnZoomOut.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_out;
+ this.btnZoomOut.Location = new System.Drawing.Point(58, 147);
+ this.btnZoomOut.Name = "btnZoomOut";
+ this.btnZoomOut.Size = new System.Drawing.Size(30, 30);
+ this.btnZoomOut.TabIndex = 5;
+ this.btnZoomOut.UseVisualStyleBackColor = true;
+ this.btnZoomOut.Click += new System.EventHandler(this.btnZoomOut_Click);
+ //
+ // btnZoomIn
+ //
+ this.btnZoomIn.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_in;
+ this.btnZoomIn.Location = new System.Drawing.Point(22, 147);
+ this.btnZoomIn.Name = "btnZoomIn";
+ this.btnZoomIn.Size = new System.Drawing.Size(30, 30);
+ this.btnZoomIn.TabIndex = 4;
+ this.btnZoomIn.UseVisualStyleBackColor = true;
+ this.btnZoomIn.Click += new System.EventHandler(this.btnZoomIn_Click);
+ //
+ // btnDown
+ //
+ this.btnDown.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_270;
+ this.btnDown.Location = new System.Drawing.Point(40, 93);
+ this.btnDown.Name = "btnDown";
+ this.btnDown.Size = new System.Drawing.Size(30, 30);
+ this.btnDown.TabIndex = 3;
+ this.btnDown.UseVisualStyleBackColor = true;
+ this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
+ //
+ // btnRight
+ //
+ this.btnRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow;
+ this.btnRight.Location = new System.Drawing.Point(74, 57);
+ this.btnRight.Name = "btnRight";
+ this.btnRight.Size = new System.Drawing.Size(30, 30);
+ this.btnRight.TabIndex = 2;
+ this.btnRight.UseVisualStyleBackColor = true;
+ this.btnRight.Click += new System.EventHandler(this.btnRight_Click);
+ //
+ // btnLeft
+ //
+ this.btnLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_180;
+ this.btnLeft.Location = new System.Drawing.Point(6, 57);
+ this.btnLeft.Name = "btnLeft";
+ this.btnLeft.Size = new System.Drawing.Size(30, 30);
+ this.btnLeft.TabIndex = 1;
+ this.btnLeft.UseVisualStyleBackColor = true;
+ this.btnLeft.Click += new System.EventHandler(this.btnLeft_Click);
+ //
+ // btnUp
+ //
+ this.btnUp.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_090;
+ this.btnUp.Location = new System.Drawing.Point(40, 20);
+ this.btnUp.Name = "btnUp";
+ this.btnUp.Size = new System.Drawing.Size(30, 30);
+ this.btnUp.TabIndex = 0;
+ this.btnUp.UseVisualStyleBackColor = true;
+ this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(19, 252);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(71, 13);
+ this.label1.TabIndex = 16;
+ this.label1.Text = "Current Scale";
+ //
+ // numScale
+ //
+ this.numScale.Location = new System.Drawing.Point(22, 268);
+ this.numScale.Maximum = new decimal(new int[] {
+ 99999,
+ 0,
+ 0,
+ 0});
+ this.numScale.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.numScale.Name = "numScale";
+ this.numScale.Size = new System.Drawing.Size(66, 20);
+ this.numScale.TabIndex = 15;
+ this.numScale.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // btnZoomScale
+ //
+ this.btnZoomScale.Location = new System.Drawing.Point(22, 295);
+ this.btnZoomScale.Name = "btnZoomScale";
+ this.btnZoomScale.Size = new System.Drawing.Size(66, 23);
+ this.btnZoomScale.TabIndex = 17;
+ this.btnZoomScale.Text = "Zoom";
+ this.btnZoomScale.UseVisualStyleBackColor = true;
+ this.btnZoomScale.Click += new System.EventHandler(this.btnZoomScale_Click);
+ //
+ // MapPreviewWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(674, 487);
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "MapPreviewWindow";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Map Preview";
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.panel1.ResumeLayout(false);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.mapImage)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numScale)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.PictureBox mapImage;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button btnDown;
+ private System.Windows.Forms.Button btnRight;
+ private System.Windows.Forms.Button btnLeft;
+ private System.Windows.Forms.Button btnUp;
+ private System.Windows.Forms.Button btnZoomOut;
+ private System.Windows.Forms.Button btnZoomIn;
+ private System.Windows.Forms.Button btnZoomExtents;
+ private System.ComponentModel.BackgroundWorker renderWorker;
+ private System.Windows.Forms.CheckBox chkSelectFeatures;
+ private System.Windows.Forms.Button btnClearSelect;
+ private System.Windows.Forms.Button btnLowerRight;
+ private System.Windows.Forms.Button btnLowerLeft;
+ private System.Windows.Forms.Button btnUpperLeft;
+ private System.Windows.Forms.Button btnUpperRight;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.NumericUpDown numScale;
+ private System.Windows.Forms.Button btnZoomScale;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,480 @@
+#region Disclaimer / License
+// Copyright (C) 2011, 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.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide;
+using System.IO;
+using System.Diagnostics;
+
+namespace Maestro.AddIn.Local.UI
+{
+ public partial class MapPreviewWindow : Form
+ {
+ private MgdMap _map;
+ private MgRenderingService _renderSvc;
+ private MgCoordinateSystem _mapCs;
+ private MgdSelection _selection;
+ private MgRenderingOptions _layerRenderOpts;
+ private MgMeasure _mapMeasure;
+ private MgWktReaderWriter _wktRW;
+ private MgGeometryFactory _geomFact;
+
+ private Color _mapBgColor;
+
+ public MapPreviewWindow(MgdMap map)
+ {
+ InitializeComponent();
+ _map = map;
+ var fact = new MgCoordinateSystemFactory();
+ _mapCs = fact.Create(_map.GetMapSRS());
+ _mapMeasure = _mapCs.GetMeasure();
+ _wktRW = new MgWktReaderWriter();
+ _geomFact = new MgGeometryFactory();
+ this.Disposed += new EventHandler(OnDisposed);
+
+ Init(_map);
+ }
+
+ void OnDisposed(object sender, EventArgs e)
+ {
+ if (_renderSvc != null)
+ {
+ _renderSvc.Dispose();
+ _renderSvc = null;
+ }
+
+ if (_selection != null)
+ {
+ _selection.Dispose();
+ _selection = null;
+ }
+
+ if (_mapMeasure != null)
+ {
+ _mapMeasure.Dispose();
+ _mapMeasure = null;
+ }
+
+ if (_mapCs != null)
+ {
+ _mapCs.Dispose();
+ _mapCs = null;
+ }
+
+ if (_wktRW != null)
+ {
+ _wktRW.Dispose();
+ _wktRW = null;
+ }
+
+ if (_geomFact != null)
+ {
+ _geomFact.Dispose();
+ _geomFact = null;
+ }
+ }
+
+ private double _orgX1;
+ private double _orgX2;
+ private double _orgY1;
+ private double _orgY2;
+
+ private double _extX1;
+ private double _extX2;
+ private double _extY1;
+ private double _extY2;
+
+ private bool _init = false;
+
+ public void Init(MgdMap map)
+ {
+ numScale.Maximum = int.MaxValue;
+ _init = false;
+ _renderSvc = MgServiceFactory.CreateRenderingService();
+ _layerRenderOpts = new MgRenderingOptions(MgImageFormats.Png, 7, new MgColor(0, 0, 255));
+
+ _map = map;
+ var bgColor = _map.GetBackgroundColor();
+ if (bgColor.Length == 8 || bgColor.Length == 6)
+ {
+ _mapBgColor = ColorTranslator.FromHtml("#" + bgColor);
+ mapImage.BackColor = _mapBgColor;
+ }
+ _map.SetDisplaySize(mapImage.Width, mapImage.Height);
+ _selection = new MgdSelection(_map);
+
+ var env = _map.GetMapExtent();
+ var ll = env.LowerLeftCoordinate;
+ var ur = env.UpperRightCoordinate;
+
+ _extX1 = _orgX1 = ll.X;
+ _extY2 = _orgY2 = ll.Y;
+ _extX2 = _orgX2 = ur.X;
+ _extY1 = _orgY1 = ur.Y;
+
+ if ((_orgX1 - _orgX2) == 0 || (_orgY1 - _orgY2) == 0)
+ {
+ _extX1 = _orgX1 = -.1;
+ _extY2 = _orgX2 = .1;
+ _extX2 = _orgY1 = -.1;
+ _extY1 = _orgY2 = .1;
+ }
+
+ double scale = CalculateScale(Math.Abs(_orgX2 - _orgX1), Math.Abs(_orgY2 - _orgY1), this.Width, this.Height);
+ numScale.Value = Convert.ToDecimal(scale);
+ _map.SetViewScale(scale);
+
+ _init = true;
+ }
+
+ private double CalculateScale(double mcsW, double mcsH, int devW, int devH)
+ {
+ var mpu = _map.GetMetersPerUnit();
+ var mpp = 0.0254 / _map.DisplayDpi;
+ if (devH * mcsW > devW * mcsH)
+ return mcsW * mpu / (devW * mpp); //width-limited
+ else
+ return mcsH * mpu / (devH * mpp); //height-limited
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+ ZoomExtents();
+ }
+
+ protected override void OnResize(EventArgs e)
+ {
+ if (!_init)
+ return;
+
+ base.OnResize(e);
+ _map.SetDisplaySize(mapImage.Width, mapImage.Height);
+ RefreshMap();
+ }
+
+ class RenderWorkArgs
+ {
+ public MgRenderingOptions RenderingOptions { get; set; }
+ }
+
+ class RenderResult
+ {
+ public Image Image { get; set; }
+
+ public Image Overlay { get; set; }
+ }
+
+ public void RefreshMap()
+ {
+ if (renderWorker.IsBusy)
+ return;
+
+ if (mapImage.Image != null)
+ {
+ mapImage.Image.Dispose();
+ mapImage.Image = null;
+ }
+
+ renderWorker.RunWorkerAsync(new RenderWorkArgs() { RenderingOptions = _layerRenderOpts });
+ }
+
+ public void Pan(double x, double y, bool refresh)
+ {
+ ZoomToView(x, y, _map.ViewScale, refresh);
+ }
+
+ public void ZoomToView(double x, double y, double scale, bool refresh)
+ {
+ _map.SetViewCenterXY(x, y);
+#if DEBUG
+ //var mapExt = _map.MapExtent;
+ //var dataExt = _map.DataExtent;
+ //Trace.TraceInformation("Map Extent is ({0},{1} {2},{3})", mapExt.LowerLeftCoordinate.X, mapExt.LowerLeftCoordinate.Y, mapExt.UpperRightCoordinate.X, mapExt.UpperRightCoordinate.Y);
+ //Trace.TraceInformation("Data Extent is ({0},{1} {2},{3})", dataExt.LowerLeftCoordinate.X, dataExt.LowerLeftCoordinate.Y, dataExt.UpperRightCoordinate.X, dataExt.UpperRightCoordinate.Y);
+
+ Trace.TraceInformation("Center is (" + x + ", " + y + ")");
+#endif
+ _map.SetViewScale(scale);
+
+ //Update current extents
+ double mpu = _map.GetMetersPerUnit();
+ double mpp = 0.0254 / _map.DisplayDpi;
+
+ var mcsWidth = _map.DisplayWidth * mpp * scale / mpu;
+ var mcsHeight = _map.DisplayHeight * mpp * scale / mpu;
+
+ _extX1 = x - mcsWidth / 2;
+ _extY1 = y + mcsHeight / 2;
+ _extX2 = x + mcsWidth / 2;
+ _extY2 = y - mcsHeight / 2;
+
+#if DEBUG
+ Trace.TraceInformation("Current extents is ({0},{1} {2},{3})", _extX1, _extY1, _extX2, _extY2);
+#endif
+
+ //Then refresh
+ if (refresh)
+ RefreshMap();
+ }
+
+ private void btnLeft_Click(object sender, EventArgs e)
+ {
+ PanLeft(true);
+ }
+
+ private void btnUp_Click(object sender, EventArgs e)
+ {
+ PanUp(true);
+ }
+
+ private void btnRight_Click(object sender, EventArgs e)
+ {
+ PanRight(true);
+ }
+
+ private void btnDown_Click(object sender, EventArgs e)
+ {
+ PanDown(true);
+ }
+
+ private void PanLeft(bool refresh)
+ {
+ Pan(_extX1 + (_extX2 - _extX1) / 3, _extY2 + (_extY1 - _extY2) / 2, refresh);
+ }
+
+ private void PanUp(bool refresh)
+ {
+ Pan(_extX1 + (_extX2 - _extX1) / 2, _extY1 - (_extY1 - _extY2) / 3, refresh);
+ }
+
+ private void PanRight(bool refresh)
+ {
+ Pan(_extX2 - (_extX2 - _extX1) / 3, _extY2 + (_extY1 - _extY2) / 2, refresh);
+ }
+
+ private void PanDown(bool refresh)
+ {
+ Pan(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 3, refresh);
+ }
+
+ private void btnZoomIn_Click(object sender, EventArgs e)
+ {
+ _map.SetViewScale(_map.ViewScale * 0.8);
+ RefreshMap();
+ }
+
+ private void btnZoomOut_Click(object sender, EventArgs e)
+ {
+ _map.SetViewScale(_map.ViewScale * 1.2);
+ RefreshMap();
+ }
+
+ private void btnZoomExtents_Click(object sender, EventArgs e)
+ {
+ ZoomExtents();
+ }
+
+ public void ZoomExtents()
+ {
+ var scale = CalculateScale((_orgX2 - _orgX1), (_orgY1 - _orgY2), mapImage.Width, mapImage.Height);
+ ZoomToView(_orgX1 + ((_orgX2 - _orgX1) / 2), _orgY2 + ((_orgY1 - _orgY2) / 2), scale, true);
+ }
+
+ private void renderWorker_DoWork(object sender, DoWorkEventArgs e)
+ {
+ var args = (RenderWorkArgs)e.Argument;
+
+ var res = new RenderResult();
+ var br = _renderSvc.RenderDynamicOverlay(_map, _selection, args.RenderingOptions);
+ byte[] b = new byte[br.GetLength()];
+ br.Read(b, b.Length);
+
+ using (var ms = new MemoryStream(b))
+ {
+ res.Image = Image.FromStream(ms);
+ }
+
+ e.Result = res;
+ }
+
+ private void renderWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
+ {
+
+ }
+
+ private void renderWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ if (e.Error != null)
+ {
+ MessageBox.Show(e.Error.Message, "Error");
+ }
+ else
+ {
+ var res = (RenderResult)e.Result;
+ //set the image
+ mapImage.Image = res.Image;
+ numScale.Value = Convert.ToDecimal(_map.ViewScale);
+ }
+ }
+
+ private void btnClearSelect_Click(object sender, EventArgs e)
+ {
+ _selection.Clear();
+ RefreshMap();
+ }
+
+ private void mapImage_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (!chkSelectFeatures.Checked)
+ return;
+
+ var mapPt1 = ScreenToMapUnits(e.X-2, e.Y-2);
+ var mapPt2 = ScreenToMapUnits(e.X+2, e.Y+2);
+
+ var coord1 = _geomFact.CreateCoordinateXY(mapPt1.X, mapPt1.Y);
+ var coord2 = _geomFact.CreateCoordinateXY(mapPt2.X, mapPt2.Y);
+
+ var dist = _mapMeasure.GetDistance(coord1, coord2);
+
+ MgGeometry geom = _wktRW.Read(MakeWktPolygon(mapPt1.X, mapPt1.Y, mapPt2.X, mapPt2.Y));
+
+ SelectByGeometry(geom);
+ }
+
+ private static string MakeWktPolygon(double x1, double y1, double x2, double y2)
+ {
+ return "POLYGON((" + x1 + " " + y1 + ", " + x2 + " " + y1 + ", " + x2 + " " + y2 + ", " + x1 + " " + y2 + ", " + x1 + " " + y1 + "))";
+ }
+
+ private Dictionary<string, string> _layerGeomProps = new Dictionary<string, string>();
+
+ private void SelectByGeometry(MgGeometry geom)
+ {
+ var layers = _map.GetLayers();
+
+ //Cache geometry properties
+ for (int i = 0; i < layers.GetCount(); i++)
+ {
+ var layer = layers.GetItem(i);
+ if (!layer.Selectable && !layer.IsVisible())
+ continue;
+
+ var objId = layer.GetObjectId();
+ if (_layerGeomProps.ContainsKey(objId))
+ continue;
+
+ var cls = layer.GetClassDefinition();
+ var geomName = cls.DefaultGeometryPropertyName;
+ if (!string.IsNullOrEmpty(geomName))
+ {
+ if (!_layerGeomProps.ContainsKey(objId))
+ _layerGeomProps[objId] = geomName;
+ }
+ }
+
+ _selection.Clear();
+
+ for (int i = 0; i < layers.GetCount(); i++)
+ {
+ var layer = layers.GetItem(i);
+ if (!layer.Selectable && !layer.IsVisible())
+ continue;
+
+ var objId = layer.GetObjectId();
+ MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ query.SetSpatialFilter(_layerGeomProps[objId], geom, MgFeatureSpatialOperations.Intersects);
+
+ MgFeatureReader reader = layer.SelectFeatures(query);
+ _selection.AddFeatures(layer, reader, 0);
+ }
+
+#if DEBUG
+ int total = 0;
+ for (int i = 0; i < layers.GetCount(); i++)
+ {
+ var layer = layers.GetItem(i);
+ total += _selection.GetSelectedFeaturesCount(layer, layer.FeatureClassName);
+ }
+ Trace.TraceInformation("Selecting {0} features", total);
+#endif
+
+ string xml = _selection.ToXml();
+ if (!string.IsNullOrEmpty(xml))
+ RefreshMap();
+ }
+
+ public PointF ScreenToMapUnits(double x, double y)
+ {
+ return ScreenToMapUnits(x, y, false);
+ }
+
+ private PointF ScreenToMapUnits(double x, double y, bool allowOutsideWindow)
+ {
+ if (!allowOutsideWindow)
+ {
+ if (x > mapImage.Width - 1) x = mapImage.Width - 1;
+ else if (x < 0) x = 0;
+
+ if (y > mapImage.Height - 1) y = mapImage.Height - 1;
+ else if (y < 0) y = 0;
+ }
+
+ x = _extX1 + (_extX2 - _extX1) * (x / mapImage.Width);
+ y = _extY1 - (_extY1 - _extY2) * (y / mapImage.Height);
+ return new PointF((float)x, (float)y);
+ }
+
+ private void btnUpperLeft_Click(object sender, EventArgs e)
+ {
+ PanUp(false);
+ PanLeft(true);
+ }
+
+ private void btnUpperRight_Click(object sender, EventArgs e)
+ {
+ PanUp(false);
+ PanRight(true);
+ }
+
+ private void btnLowerLeft_Click(object sender, EventArgs e)
+ {
+ PanDown(false);
+ PanLeft(true);
+ }
+
+ private void btnLowerRight_Click(object sender, EventArgs e)
+ {
+ PanDown(false);
+ PanRight(true);
+ }
+
+ private void btnZoomScale_Click(object sender, EventArgs e)
+ {
+ _map.SetViewScale(Convert.ToDouble(numScale.Value));
+ RefreshMap();
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,123 @@
+<?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>
+ <metadata name="renderWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/PreviewResourceCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/PreviewResourceCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/PreviewResourceCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -40,16 +40,7 @@
var exp = wb.ActiveSiteExplorer;
if (exp != null)
{
- //var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
- //var conn = connMgr.GetConnection(exp.ConnectionName);
- var conn = ed.Resource.CurrentConnection;
- var launcher = ServiceRegistry.GetService<UrlLauncherService>();
-
- //HACK: This is a bit dodgy as we assume we're dealing with the http
- //impl of the IServerConnection
- string url = ed.SetupPreviewUrl((string)conn.GetCustomProperty("BaseUrl"));
-
- launcher.OpenUrl(url);
+ ed.Preview();
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -60,7 +60,7 @@
var oldId = ed.EditorService.ResourceID;
ed.EditorService.SaveAs(picker.ResourceID);
if (oldId != ed.EditorService.ResourceID)
- omgr.RenameResourceId(oldId, ed.EditorService.ResourceID, exp);
+ omgr.RenameResourceId(oldId, ed.EditorService.ResourceID, conn, exp);
try
{
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -54,7 +54,7 @@
//Close any open editors on these resources before deleting them
foreach (var i in items)
{
- omgr.CloseEditors(i.ResourceId, true);
+ omgr.CloseEditors(conn, i.ResourceId, true);
foreach (var ed in omgr.OpenEditors)
{
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -53,7 +53,7 @@
//the find/replace
if (omgr.IsOpen(item.ResourceId))
{
- omgr.CloseEditors(item.ResourceId, false);
+ omgr.CloseEditors(conn, item.ResourceId, false);
//Still open. Must've said no
if (omgr.IsOpen(item.ResourceId))
{
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -43,6 +43,8 @@
ServiceRegistry.Initialize();
EventWatcher.Initialize();
+ ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new DefaultResourcePreviewer());
+
Workbench.WorkbenchInitialized += (sender, e) =>
{
ServiceRegistry.GetService<NewItemTemplateService>().InitUserTemplates();
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -34,6 +34,7 @@
using Maestro.Shared.UI;
using OSGeo.MapGuide.MaestroAPI.Resource.Conversion;
using System.IO;
+using Maestro.Base.Services;
namespace Maestro.Base.Editor
{
@@ -220,8 +221,12 @@
var res = this.Resource;
if (res != null)
{
- var rt = res.ResourceType;
- return ResourcePreviewEngine.IsPreviewableType(rt) && res.CurrentConnection.Capabilities.SupportsResourcePreviews;
+ var type = res.CurrentConnection.ProviderName;
+ var previewer = ResourcePreviewerFactory.GetPreviewer(type);
+ if (previewer != null)
+ {
+ return previewer.IsPreviewable(res);
+ }
}
return false;
}
@@ -263,18 +268,12 @@
get { return true; }
}
- public virtual string SetupPreviewUrl(string mapguideRootUrl)
+ public virtual void Preview()
{
- //Save the current resource to another session copy
- string resId = "Session:" + this.EditorService.SessionID + "//" + Guid.NewGuid() + "." + this.Resource.ResourceType.ToString();
- this.EditorService.ResourceService.SetResourceXmlData(resId, ResourceTypeRegistry.Serialize(this.Resource));
-
- //Copy any resource data
- var previewCopy = this.EditorService.ResourceService.GetResource(resId);
- this.Resource.CopyResourceDataTo(previewCopy);
-
- //Now feed it to the preview engine
- return new ResourcePreviewEngine(mapguideRootUrl, this.EditorService).GeneratePreviewUrl(previewCopy);
+ var conn = this.Resource.CurrentConnection;
+ var previewer = ResourcePreviewerFactory.GetPreviewer(conn.ProviderName);
+ if (previewer != null)
+ previewer.Preview(this.Resource, this.EditorService);
}
public virtual void SyncSessionCopy()
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/IEditorViewContent.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/IEditorViewContent.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/IEditorViewContent.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -92,13 +92,9 @@
bool IsDirty { get; }
/// <summary>
- /// Returns a URL that can be opened to preview this resource. If the
- /// <see cref="CanBePreviewed"/> property is false, this method should
- /// throw a <see cref="NotSupportedException"/>
+ /// Performs a preview of the edited resource
/// </summary>
- /// <param name="mapguideRootUrl"></param>
- /// <returns></returns>
- string SetupPreviewUrl(string mapguideRootUrl);
+ void Preview();
/// <summary>
/// Raised when the value of <see cref="IsDirty"/> changes
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -35,6 +35,7 @@
using OSGeo.MapGuide.MaestroAPI.Resource.Validation;
using System.Xml.Schema;
using Maestro.Base.UI.Preferences;
+using Maestro.Base.Services;
namespace Maestro.Base.Editor
{
@@ -128,7 +129,7 @@
}
}
- public override string SetupPreviewUrl(string mapguideRootUrl)
+ public override void Preview()
{
//Save the current resource to another session copy
string resId = "Session:" + this.EditorService.SessionID + "//" + Guid.NewGuid() + "." + this.Resource.ResourceType.ToString();
@@ -138,10 +139,12 @@
var previewCopy = this.EditorService.ResourceService.GetResource(resId);
this.Resource.CopyResourceDataTo(previewCopy);
- //Now feed it to the preview engine
- return new ResourcePreviewEngine(mapguideRootUrl, this.EditorService).GeneratePreviewUrl(previewCopy);
+ var conn = previewCopy.CurrentConnection;
+ var previewer = ResourcePreviewerFactory.GetPreviewer(conn.ProviderName);
+ if (previewer != null)
+ previewer.Preview(previewCopy, this.EditorService);
}
-
+
public override void SyncSessionCopy()
{
//Write our XML changes back into the edited resource copy and re-read
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -71,6 +71,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="Commands\AboutCommand.cs" />
<Compile Include="Commands\CacheViewerCommand.cs" />
<Compile Include="Commands\CloseActiveDocumentCommand.cs" />
@@ -249,6 +252,7 @@
<Compile Include="Services\IDragDropHandler.cs" />
<Compile Include="Services\NewItemTemplateService.cs" />
<Compile Include="Services\OpenResourceManager.cs" />
+ <Compile Include="Services\ResourcePreviewerFactory.cs" />
<Compile Include="Services\ServerConnectionManager.cs" />
<Compile Include="Services\ServiceBase.cs" />
<Compile Include="Services\ServiceRegistry.cs" />
Modified: trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -40,20 +40,22 @@
get { return new List<IEditorViewContent>(_openItems.Values).ToArray(); }
}
- public void CloseEditors(string resourceId, bool discardChanges)
+ public void CloseEditors(IServerConnection conn, string resourceId, bool discardChanges)
{
- if (_openItems.ContainsKey(resourceId))
+ string key = ComputeResourceKey(resourceId, conn);
+ if (_openItems.ContainsKey(key))
{
- var ed = _openItems[resourceId];
+ var ed = _openItems[key];
ed.Close(discardChanges);
}
}
- public void CloseEditorsExceptFor(string resourceId, bool discardChanges)
+ public void CloseEditorsExceptFor(IServerConnection conn, string resourceId, bool discardChanges)
{
+ string key = ComputeResourceKey(resourceId, conn);
var eds = new List<IEditorViewContent>(_openItems.Values);
- if (_openItems.ContainsKey(resourceId))
- eds.Remove(_openItems[resourceId]);
+ if (_openItems.ContainsKey(key))
+ eds.Remove(_openItems[key]);
foreach (var ed in eds)
{
@@ -98,27 +100,41 @@
return GetRegisteredEditor(rtd);
}
- internal void RenameResourceId(string oldId, string newId, ISiteExplorer siteExp)
+ internal void RenameResourceId(string oldId, string newId, IServerConnection conn, ISiteExplorer siteExp)
{
Check.NotEmpty(oldId, "oldId");
Check.NotEmpty(newId, "newId");
Check.NotNull(siteExp, "siteExp");
+ Check.NotNull(conn, "conn");
- if (oldId.Equals(newId))
+ string oldKey = ComputeResourceKey(oldId, conn);
+ string newKey = ComputeResourceKey(newId, conn);
+
+ if (oldKey.Equals(newKey))
return;
//Original must exist and new id must not
- if (_openItems.ContainsKey(oldId) && !_openItems.ContainsKey(newId))
+ if (_openItems.ContainsKey(oldKey) && !_openItems.ContainsKey(newKey))
{
- var ed = _openItems[oldId];
- _openItems.Remove(oldId);
- _openItems[newId] = ed;
+ var ed = _openItems[oldKey];
+ _openItems.Remove(oldKey);
+ _openItems[newKey] = ed;
- siteExp.FlagNode(oldId, NodeFlagAction.None);
- siteExp.FlagNode(newId, NodeFlagAction.HighlightOpen);
+ siteExp.FlagNode(conn.DisplayName, oldId, NodeFlagAction.None);
+ siteExp.FlagNode(conn.DisplayName, newId, NodeFlagAction.HighlightOpen);
}
}
+ private static string ComputeResourceKey(string resId, IServerConnection conn)
+ {
+ return conn.DisplayName + "|" + resId;
+ }
+
+ private static string ComputeResourceKey(IResource res, IServerConnection conn)
+ {
+ return conn.DisplayName + "|" + res.ResourceID;
+ }
+
/// <summary>
/// Opens the specified resource using its assigned editor. If the resource is already
/// open, the the existing editor view is activated instead. If the resource has no assigned
@@ -130,8 +146,8 @@
/// <param name="useXmlEditor"></param>
public IEditorViewContent Open(IResource res, IServerConnection conn, bool useXmlEditor, ISiteExplorer siteExp)
{
- string resourceId = res.ResourceID;
- if (!_openItems.ContainsKey(resourceId))
+ string key = ComputeResourceKey(res, conn);
+ if (!_openItems.ContainsKey(key))
{
var svc = ServiceRegistry.GetService<ViewContentManager>();
IEditorViewContent ed = null;
@@ -144,9 +160,9 @@
ed = FindEditor(svc, res.GetResourceTypeDescriptor());
}
var launcher = ServiceRegistry.GetService<UrlLauncherService>();
- var editorSvc = new ResourceEditorService(resourceId, conn, launcher, siteExp, this);
+ var editorSvc = new ResourceEditorService(res.ResourceID, conn, launcher, siteExp, this);
ed.EditorService = editorSvc;
- _openItems[resourceId] = ed;
+ _openItems[key] = ed;
ed.ViewContentClosing += (sender, e) =>
{
if (ed.IsDirty && !ed.DiscardChangesOnClose)
@@ -160,29 +176,29 @@
};
ed.ViewContentClosed += (sender, e) =>
{
- _openItems.Remove(ed.EditorService.ResourceID);
- siteExp.FlagNode(ed.EditorService.ResourceID, NodeFlagAction.None);
+ _openItems.Remove(key);
+ siteExp.FlagNode(conn.DisplayName, ed.EditorService.ResourceID, NodeFlagAction.None);
};
ed.EditorService.Saved += (sender, e) =>
{
//If saved from new resource, the resource id would be session based
//So we need to update this to the new resource id as defined by the
//editor service
- if (_openItems.ContainsKey(resourceId))
+ if (_openItems.ContainsKey(key))
{
- var ed2 = _openItems[resourceId];
- _openItems.Remove(resourceId);
- _openItems[ed.EditorService.ResourceID] = ed2;
+ var ed2 = _openItems[key];
+ _openItems.Remove(key);
+ _openItems[ComputeResourceKey(ed.EditorService.ResourceID, conn)] = ed2;
}
};
ed.DirtyStateChanged += (sender, e) =>
{
- siteExp.FlagNode(resourceId, ed.IsDirty ? NodeFlagAction.HighlightDirty : NodeFlagAction.HighlightOpen);
+ siteExp.FlagNode(key, ed.IsDirty ? NodeFlagAction.HighlightDirty : NodeFlagAction.HighlightOpen);
};
}
- _openItems[resourceId].Activate();
- siteExp.FlagNode(resourceId, NodeFlagAction.HighlightOpen);
- return _openItems[resourceId];
+ _openItems[key].Activate();
+ siteExp.FlagNode(conn.DisplayName, res.ResourceID, NodeFlagAction.HighlightOpen);
+ return _openItems[key];
}
/// <summary>
Added: trunk/Tools/Maestro/Maestro.Base/Services/ResourcePreviewerFactory.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Services/ResourcePreviewerFactory.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Services/ResourcePreviewerFactory.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,88 @@
+#region Disclaimer / License
+// Copyright (C) 2011, 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 OSGeo.MapGuide.MaestroAPI;
+using Maestro.Base.Editor;
+using Maestro.Editors;
+
+namespace Maestro.Base.Services
+{
+ public interface IResourcePreviewer
+ {
+ bool IsPreviewable(IResource res);
+
+ void Preview(IResource res, IEditorService edSvc);
+ }
+
+ public class DefaultResourcePreviewer : IResourcePreviewer
+ {
+ public void Preview(IResource res, IEditorService edSvc)
+ {
+ IServerConnection conn = res.CurrentConnection;
+ string mapguideRootUrl = (string)conn.GetCustomProperty("BaseUrl");
+
+ //Save the current resource to another session copy
+ string resId = "Session:" + edSvc.SessionID + "//" + Guid.NewGuid() + "." + res.ResourceType.ToString();
+ edSvc.ResourceService.SetResourceXmlData(resId, ResourceTypeRegistry.Serialize(res));
+
+ //Copy any resource data
+ var previewCopy = edSvc.ResourceService.GetResource(resId);
+ res.CopyResourceDataTo(previewCopy);
+
+ //Now feed it to the preview engine
+ var url = new ResourcePreviewEngine(mapguideRootUrl, edSvc).GeneratePreviewUrl(previewCopy);
+ var launcher = ServiceRegistry.GetService<UrlLauncherService>();
+
+ launcher.OpenUrl(url);
+ }
+
+ public bool IsPreviewable(IResource res)
+ {
+ var rt = res.ResourceType;
+ return ResourcePreviewEngine.IsPreviewableType(rt) && res.CurrentConnection.Capabilities.SupportsResourcePreviews;
+ }
+ }
+
+ public static class ResourcePreviewerFactory
+ {
+ static Dictionary<string, IResourcePreviewer> _previewers = new Dictionary<string, IResourcePreviewer>();
+
+ public static void RegisterPreviewer(string provider, IResourcePreviewer previewer)
+ {
+ _previewers[provider.ToUpper()] = previewer;
+ }
+
+ public static bool HasPreviewer(string provider)
+ {
+ return _previewers.ContainsKey(provider.ToUpper());
+ }
+
+ public static IResourcePreviewer GetPreviewer(string provider)
+ {
+ if (HasPreviewer(provider))
+ return _previewers[provider.ToUpper()];
+
+ return null;
+ }
+ }
+}
Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -47,6 +47,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="Common\ColorComboBox.cs">
<SubType>Component</SubType>
</Compile>
Modified: trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -42,6 +42,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="LocalLoginCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
Modified: trunk/Tools/Maestro/Maestro.Packaging/Maestro.Packaging.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Packaging/Maestro.Packaging.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Packaging/Maestro.Packaging.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -47,6 +47,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="NsDoc.cs" />
<Compile Include="PackageBuilder.cs" />
<Compile Include="PackageProgress.cs">
Modified: trunk/Tools/Maestro/Maestro.Shared.UI/Maestro.Shared.UI.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Shared.UI/Maestro.Shared.UI.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/Maestro.Shared.UI/Maestro.Shared.UI.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -42,6 +42,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="CancelException.cs" />
<Compile Include="CheckBoxBinder.cs" />
<Compile Include="CollapsiblePanel.cs">
Modified: trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/MaestroFsPreview/MaestroFsPreview.csproj 2011-08-28 16:40:57 UTC (rev 6100)
@@ -65,6 +65,9 @@
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
+ <Compile Include="..\Properties\SignedAssemblyInfo2.cs">
+ <Link>SignedAssemblyInfo2.cs</Link>
+ </Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -137,8 +137,8 @@
/// </summary>
protected Dictionary<string, RuntimeMapLayer> _layerIdMap;
- private IMappingService _mapSvc;
- private IGetResourceContents _getRes;
+ protected IMappingService _mapSvc;
+ protected IGetResourceContents _getRes;
public const double Z_ORDER_INCREMENT = 100.0;
Added: trunk/Tools/Maestro/Properties/SignedAssemblyInfo2.cs
===================================================================
--- trunk/Tools/Maestro/Properties/SignedAssemblyInfo2.cs (rev 0)
+++ trunk/Tools/Maestro/Properties/SignedAssemblyInfo2.cs 2011-08-28 16:40:57 UTC (rev 6100)
@@ -0,0 +1,26 @@
+#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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("..\\Properties\\maestroapi.key")]
+[assembly: AssemblyKeyName("")]
\ No newline at end of file
Modified: trunk/Tools/Maestro/SDK/SDK.sln
===================================================================
--- trunk/Tools/Maestro/SDK/SDK.sln 2011-08-28 09:56:59 UTC (rev 6099)
+++ trunk/Tools/Maestro/SDK/SDK.sln 2011-08-28 16:40:57 UTC (rev 6100)
@@ -43,6 +43,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ExtendedObjectModels", "..\OSGeo.MapGuide.ExtendedObjectModels\OSGeo.MapGuide.ExtendedObjectModels.csproj", "{B3A2B816-9F41-4857-A111-09D2DF2550D6}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.MaestroAPI.Local", "..\OSGeo.MapGuide.MaestroAPI.Local\OSGeo.MapGuide.MaestroAPI.Local.csproj", "{3DDF6501-0148-474C-8674-7C7DA49C7F02}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -133,6 +135,10 @@
{B3A2B816-9F41-4857-A111-09D2DF2550D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3A2B816-9F41-4857-A111-09D2DF2550D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3A2B816-9F41-4857-A111-09D2DF2550D6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3DDF6501-0148-474C-8674-7C7DA49C7F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3DDF6501-0148-474C-8674-7C7DA49C7F02}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3DDF6501-0148-474C-8674-7C7DA49C7F02}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DDF6501-0148-474C-8674-7C7DA49C7F02}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
More information about the mapguide-commits
mailing list