[mapguide-commits] r8015 - in trunk/Tools/Maestro: Maestro.Base Maestro.Base/Commands/SiteExplorer Maestro.Editors Maestro.Editors/SymbolDefinition OSGeo.MapGuide.MaestroAPI/Resource/Conversion
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Apr 7 08:01:59 PDT 2014
Author: jng
Date: 2014-04-07 08:01:59 -0700 (Mon, 07 Apr 2014)
New Revision: 8015
Added:
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ExtractSymbolsCommand.cs
trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.cs
trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.resx
Modified:
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Strings.resx
trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs
Log:
#2131: Add new context menu command to extract image symbols from a SymbolLibrary to individual Symbol Definition resources.
Added: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ExtractSymbolsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ExtractSymbolsCommand.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/ExtractSymbolsCommand.cs 2014-04-07 15:01:59 UTC (rev 8015)
@@ -0,0 +1,91 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 ICSharpCode.Core;
+using Maestro.Base.Services;
+using Maestro.Editors.SymbolDefinition;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Resource.Conversion;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Maestro.Base.Commands.SiteExplorer
+{
+ internal class ExtractSymbolsCommand : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ var wb = Workbench.Instance;
+ if (wb != null)
+ {
+ if (wb.ActiveSiteExplorer != null)
+ {
+ var items = wb.ActiveSiteExplorer.SelectedItems;
+ if (items.Length == 1)
+ {
+ var it = items[0];
+ if (it.ResourceType == ResourceTypes.SymbolLibrary.ToString())
+ {
+ var connMgr = ServiceRegistry.GetService<ServerConnectionManager>();
+ var conn = connMgr.GetConnection(wb.ActiveSiteExplorer.ConnectionName);
+ var diag = new ExtractSymbolLibraryDialog(conn, it.ResourceId);
+ if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ string symbolLib = diag.SymbolLibrary;
+ string targetFolder = diag.TargetFolder;
+ IEnumerable<string> symbols = diag.SelectedSymbols;
+
+ DoSymbolExtraction(conn, symbolLib, symbols, targetFolder);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private object SymbolExtractionWorker(BackgroundWorker worker, DoWorkEventArgs e, params object[] args)
+ {
+ int processed = 0;
+ IServerConnection conn = (IServerConnection)args[0];
+ string symbolLib = (string)args[1];
+ List<string> symbols = (List<string>)args[2];
+ string targetFolder = (string)args[3];
+
+ ImageSymbolConverter conv = new ImageSymbolConverter(conn, symbolLib);
+ conv.ExtractSymbols(targetFolder, symbols, (count, total) =>
+ {
+ processed = count;
+ int pc = (int)((double)count / (double)total);
+ worker.ReportProgress(pc);
+ });
+
+ return processed;
+ }
+
+ private void DoSymbolExtraction(IServerConnection conn, string symbolLib, IEnumerable<string> symbols, string targetFolder)
+ {
+ var wb = Workbench.Instance;
+ var list = new List<string>(symbols);
+ var diag = new ProgressDialog();
+ var worker = new ProgressDialog.DoBackgroundWork(SymbolExtractionWorker);
+ diag.RunOperationAsync(wb, worker, conn, symbolLib, list, targetFolder);
+ }
+ }
+}
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.addin 2014-04-07 15:01:59 UTC (rev 8015)
@@ -611,6 +611,11 @@
<MenuItem id="CompileDependencyList"
label="${res:SiteExplorer_SelectedItem_CompileDependencyList}"
class="Maestro.Base.Commands.SiteExplorer.CompileFullDependencyListCommand" />
+ <Condition action="Disable" name="ResourceType" types="SymbolLibrary">
+ <MenuItem id="ExtractImageSymbols"
+ label="${res:SiteExplorer_SelectedItem_ExtractImageSymbols}"
+ class="Maestro.Base.Commands.SiteExplorer.ExtractSymbolsCommand" />
+ </Condition>
<MenuItem type="Separator" />
<MenuItem id="Properties"
label="${res:SiteExplorer_SelectedItem_Properties}"
Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj 2014-04-07 15:01:59 UTC (rev 8015)
@@ -116,6 +116,7 @@
<Compile Include="Commands\SaveResourceCommand.cs" />
<Compile Include="Commands\SiteExplorer\CopyResourceIdCommand.cs" />
<Compile Include="Commands\SiteExplorer\DuplicateResourceCommand.cs" />
+ <Compile Include="Commands\SiteExplorer\ExtractSymbolsCommand.cs" />
<Compile Include="Commands\SiteExplorer\FindReplaceXmlContentCommand.cs" />
<Compile Include="Commands\SiteExplorer\GetLayerSpatialContextCommand.cs" />
<Compile Include="Commands\SiteExplorer\PurgeFeatureSourceCacheCommand.cs" />
Modified: trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs 2014-04-07 15:01:59 UTC (rev 8015)
@@ -2042,6 +2042,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Extract symbols to Symbol Definitions.
+ /// </summary>
+ internal static string SiteExplorer_SelectedItem_ExtractImageSymbols {
+ get {
+ return ResourceManager.GetString("SiteExplorer_SelectedItem_ExtractImageSymbols", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Open.
/// </summary>
internal static string SiteExplorer_SelectedItem_Open {
Modified: trunk/Tools/Maestro/Maestro.Base/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Strings.resx 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/Maestro.Base/Strings.resx 2014-04-07 15:01:59 UTC (rev 8015)
@@ -992,4 +992,7 @@
<data name="SiteExplorer_GetLayerSpatialContext" xml:space="preserve">
<value>Get Layer's Spatial Context</value>
</data>
+ <data name="SiteExplorer_SelectedItem_ExtractImageSymbols" xml:space="preserve">
+ <value>Extract symbols to Symbol Definitions</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2014-04-07 15:01:59 UTC (rev 8015)
@@ -1054,6 +1054,12 @@
<Compile Include="SymbolDefinition\CompoundSymbolDefinitionEditorCtrl.Designer.cs">
<DependentUpon>CompoundSymbolDefinitionEditorCtrl.cs</DependentUpon>
</Compile>
+ <Compile Include="SymbolDefinition\ExtractSymbolLibraryDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="SymbolDefinition\ExtractSymbolLibraryDialog.Designer.cs">
+ <DependentUpon>ExtractSymbolLibraryDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="SymbolDefinition\GeneralSettingsCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -1759,6 +1765,9 @@
<EmbeddedResource Include="SymbolDefinition\CompoundSymbolDefinitionEditorCtrl.resx">
<DependentUpon>CompoundSymbolDefinitionEditorCtrl.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="SymbolDefinition\ExtractSymbolLibraryDialog.resx">
+ <DependentUpon>ExtractSymbolLibraryDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="SymbolDefinition\GeneralSettingsCtrl.resx">
<DependentUpon>GeneralSettingsCtrl.cs</DependentUpon>
</EmbeddedResource>
Added: trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.Designer.cs 2014-04-07 15:01:59 UTC (rev 8015)
@@ -0,0 +1,147 @@
+namespace Maestro.Editors.SymbolDefinition
+{
+ partial class ExtractSymbolLibraryDialog
+ {
+ /// <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()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractSymbolLibraryDialog));
+ this.btnSource = new System.Windows.Forms.Button();
+ this.grpAvailableSymbols = new System.Windows.Forms.GroupBox();
+ this.lstSymbols = new System.Windows.Forms.ListView();
+ this.txtSymbolLibrary = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnTarget = new System.Windows.Forms.Button();
+ this.txtTargetFolder = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.grpAvailableSymbols.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // btnSource
+ //
+ resources.ApplyResources(this.btnSource, "btnSource");
+ this.btnSource.Name = "btnSource";
+ this.btnSource.UseVisualStyleBackColor = true;
+ this.btnSource.Click += new System.EventHandler(this.btnSource_Click);
+ //
+ // grpAvailableSymbols
+ //
+ resources.ApplyResources(this.grpAvailableSymbols, "grpAvailableSymbols");
+ this.grpAvailableSymbols.Controls.Add(this.lstSymbols);
+ this.grpAvailableSymbols.Name = "grpAvailableSymbols";
+ this.grpAvailableSymbols.TabStop = false;
+ //
+ // lstSymbols
+ //
+ resources.ApplyResources(this.lstSymbols, "lstSymbols");
+ this.lstSymbols.Name = "lstSymbols";
+ this.lstSymbols.UseCompatibleStateImageBehavior = false;
+ this.lstSymbols.View = System.Windows.Forms.View.Tile;
+ this.lstSymbols.SelectedIndexChanged += new System.EventHandler(this.lstSymbols_SelectedIndexChanged);
+ //
+ // txtSymbolLibrary
+ //
+ resources.ApplyResources(this.txtSymbolLibrary, "txtSymbolLibrary");
+ this.txtSymbolLibrary.Name = "txtSymbolLibrary";
+ this.txtSymbolLibrary.ReadOnly = true;
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // btnTarget
+ //
+ resources.ApplyResources(this.btnTarget, "btnTarget");
+ this.btnTarget.Name = "btnTarget";
+ this.btnTarget.UseVisualStyleBackColor = true;
+ this.btnTarget.Click += new System.EventHandler(this.btnTarget_Click);
+ //
+ // txtTargetFolder
+ //
+ resources.ApplyResources(this.txtTargetFolder, "txtTargetFolder");
+ this.txtTargetFolder.Name = "txtTargetFolder";
+ this.txtTargetFolder.ReadOnly = true;
+ //
+ // label2
+ //
+ resources.ApplyResources(this.label2, "label2");
+ this.label2.Name = "label2";
+ //
+ // btnOK
+ //
+ resources.ApplyResources(this.btnOK, "btnOK");
+ this.btnOK.Name = "btnOK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ resources.ApplyResources(this.btnCancel, "btnCancel");
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // ExtractSymbolLibraryDialog
+ //
+ this.AcceptButton = this.btnOK;
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ControlBox = false;
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.btnTarget);
+ this.Controls.Add(this.txtTargetFolder);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.btnSource);
+ this.Controls.Add(this.grpAvailableSymbols);
+ this.Controls.Add(this.txtSymbolLibrary);
+ this.Controls.Add(this.label1);
+ this.Name = "ExtractSymbolLibraryDialog";
+ this.grpAvailableSymbols.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnSource;
+ private System.Windows.Forms.GroupBox grpAvailableSymbols;
+ private System.Windows.Forms.ListView lstSymbols;
+ private System.Windows.Forms.TextBox txtSymbolLibrary;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnTarget;
+ private System.Windows.Forms.TextBox txtTargetFolder;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.cs 2014-04-07 15:01:59 UTC (rev 8015)
@@ -0,0 +1,177 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 Maestro.Editors.Generic;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Resource.Conversion;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.Editors.SymbolDefinition
+{
+ public partial class ExtractSymbolLibraryDialog : Form
+ {
+ private ExtractSymbolLibraryDialog()
+ {
+ InitializeComponent();
+ }
+
+ private IServerConnection _conn;
+
+ public ExtractSymbolLibraryDialog(IServerConnection conn)
+ : this()
+ {
+ _conn = conn;
+ }
+
+ public ExtractSymbolLibraryDialog(IServerConnection conn, string symbolLibId)
+ : this(conn)
+ {
+ txtSymbolLibrary.Text = symbolLibId;
+ LoadSymbols(symbolLibId);
+ EvaluateCommands();
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+
+ private void btnSource_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_conn.ResourceService, ResourceTypes.SymbolLibrary, ResourcePickerMode.OpenResource))
+ {
+ if (picker.ShowDialog() == DialogResult.OK)
+ {
+ LastSelectedFolder.FolderId = picker.SelectedFolder;
+ LoadSymbols(picker.ResourceID);
+ txtSymbolLibrary.Text = picker.ResourceID;
+ EvaluateCommands();
+ }
+ }
+ }
+
+ private void LoadSymbols(string symResId)
+ {
+ var ds = ImageSymbolConverter.PrepareSymbolDrawingSource(_conn, symResId);
+ //Now we should be able to query it via Drawing Service APIs
+ var drawSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing);
+
+ //Each section in the symbols.dwf represents a symbol
+ var sectionList = drawSvc.EnumerateDrawingSections(ds.ResourceID);
+
+ lstSymbols.Items.Clear();
+
+ int idx = 0;
+ var imgList = new ImageList();
+ imgList.ImageSize = new Size(32, 32);
+ var symbols = new List<ListViewItem>();
+
+ foreach (var sect in sectionList.Section)
+ {
+ var sectResources = drawSvc.EnumerateDrawingSectionResources(ds.ResourceID, sect.Name);
+
+ foreach (var res in sectResources.SectionResource)
+ {
+ if (res.Role.ToUpper() == StringConstants.Thumbnail.ToUpper())
+ {
+ using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href))
+ {
+ Image img = Image.FromStream(rs);
+ imgList.Images.Add(img);
+
+ var item = new ListViewItem(sect.Title);
+ item.ImageIndex = idx;
+ symbols.Add(item);
+
+ idx++;
+ }
+ }
+ }
+ }
+
+ lstSymbols.SmallImageList = imgList;
+ lstSymbols.LargeImageList = imgList;
+ foreach (var sym in symbols)
+ {
+ lstSymbols.Items.Add(sym);
+ }
+ }
+
+ private void btnTarget_Click(object sender, EventArgs e)
+ {
+ using (var picker = new ResourcePicker(_conn.ResourceService, ResourcePickerMode.OpenFolder))
+ {
+ if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ txtTargetFolder.Text = picker.SelectedFolder;
+ }
+ }
+ }
+
+ private void EvaluateCommands()
+ {
+ btnOK.Enabled = !string.IsNullOrEmpty(txtSymbolLibrary.Text) &&
+ !string.IsNullOrEmpty(txtTargetFolder.Text) &&
+ lstSymbols.SelectedItems.Count > 0 &&
+ _conn.ResourceService.ResourceExists(txtSymbolLibrary.Text);
+ }
+
+ /// <summary>
+ /// Gets the selected symbol library
+ /// </summary>
+ public string SymbolLibrary { get { return txtSymbolLibrary.Text; } }
+
+ /// <summary>
+ /// Gets the selected target folder
+ /// </summary>
+ public string TargetFolder { get { return txtTargetFolder.Text; } }
+
+ /// <summary>
+ /// Gets the list of symbols to extract
+ /// </summary>
+ public IEnumerable<string> SelectedSymbols
+ {
+ get
+ {
+ foreach (ListViewItem item in lstSymbols.SelectedItems)
+ {
+ yield return item.Text;
+ }
+ }
+ }
+
+ private void lstSymbols_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ EvaluateCommands();
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/SymbolDefinition/ExtractSymbolLibraryDialog.resx 2014-04-07 15:01:59 UTC (rev 8015)
@@ -0,0 +1,408 @@
+<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="btnSource.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Right</value>
+ </data>
+ <data name="btnSource.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="btnSource.Location" type="System.Drawing.Point, System.Drawing">
+ <value>583, 10</value>
+ </data>
+ <data name="btnSource.Size" type="System.Drawing.Size, System.Drawing">
+ <value>25, 23</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="btnSource.TabIndex" type="System.Int32, mscorlib">
+ <value>9</value>
+ </data>
+ <data name="btnSource.Text" xml:space="preserve">
+ <value>...</value>
+ </data>
+ <data name=">>btnSource.Name" xml:space="preserve">
+ <value>btnSource</value>
+ </data>
+ <data name=">>btnSource.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnSource.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnSource.ZOrder" xml:space="preserve">
+ <value>5</value>
+ </data>
+ <data name="grpAvailableSymbols.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
+ </data>
+ <data name="lstSymbols.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
+ <value>Fill</value>
+ </data>
+ <data name="lstSymbols.Location" type="System.Drawing.Point, System.Drawing">
+ <value>3, 16</value>
+ </data>
+ <data name="lstSymbols.Size" type="System.Drawing.Size, System.Drawing">
+ <value>589, 169</value>
+ </data>
+ <data name="lstSymbols.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name=">>lstSymbols.Name" xml:space="preserve">
+ <value>lstSymbols</value>
+ </data>
+ <data name=">>lstSymbols.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ListView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lstSymbols.Parent" xml:space="preserve">
+ <value>grpAvailableSymbols</value>
+ </data>
+ <data name=">>lstSymbols.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <data name="grpAvailableSymbols.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 39</value>
+ </data>
+ <data name="grpAvailableSymbols.Size" type="System.Drawing.Size, System.Drawing">
+ <value>595, 188</value>
+ </data>
+ <data name="grpAvailableSymbols.TabIndex" type="System.Int32, mscorlib">
+ <value>8</value>
+ </data>
+ <data name="grpAvailableSymbols.Text" xml:space="preserve">
+ <value>Available Symbols</value>
+ </data>
+ <data name=">>grpAvailableSymbols.Name" xml:space="preserve">
+ <value>grpAvailableSymbols</value>
+ </data>
+ <data name=">>grpAvailableSymbols.Type" xml:space="preserve">
+ <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>grpAvailableSymbols.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>grpAvailableSymbols.ZOrder" xml:space="preserve">
+ <value>6</value>
+ </data>
+ <data name="txtSymbolLibrary.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
+ </data>
+ <data name="txtSymbolLibrary.Location" type="System.Drawing.Point, System.Drawing">
+ <value>128, 12</value>
+ </data>
+ <data name="txtSymbolLibrary.Size" type="System.Drawing.Size, System.Drawing">
+ <value>449, 20</value>
+ </data>
+ <data name="txtSymbolLibrary.TabIndex" type="System.Int32, mscorlib">
+ <value>7</value>
+ </data>
+ <data name=">>txtSymbolLibrary.Name" xml:space="preserve">
+ <value>txtSymbolLibrary</value>
+ </data>
+ <data name=">>txtSymbolLibrary.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtSymbolLibrary.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>txtSymbolLibrary.ZOrder" xml:space="preserve">
+ <value>7</value>
+ </data>
+ <data name="label1.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 15</value>
+ </data>
+ <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 13</value>
+ </data>
+ <data name="label1.TabIndex" type="System.Int32, mscorlib">
+ <value>6</value>
+ </data>
+ <data name="label1.Text" xml:space="preserve">
+ <value>Symbol Library</value>
+ </data>
+ <data name=">>label1.Name" xml:space="preserve">
+ <value>label1</value>
+ </data>
+ <data name=">>label1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label1.ZOrder" xml:space="preserve">
+ <value>8</value>
+ </data>
+ <data name="btnTarget.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Right</value>
+ </data>
+ <data name="btnTarget.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="btnTarget.Location" type="System.Drawing.Point, System.Drawing">
+ <value>583, 231</value>
+ </data>
+ <data name="btnTarget.Size" type="System.Drawing.Size, System.Drawing">
+ <value>25, 23</value>
+ </data>
+ <data name="btnTarget.TabIndex" type="System.Int32, mscorlib">
+ <value>12</value>
+ </data>
+ <data name="btnTarget.Text" xml:space="preserve">
+ <value>...</value>
+ </data>
+ <data name=">>btnTarget.Name" xml:space="preserve">
+ <value>btnTarget</value>
+ </data>
+ <data name=">>btnTarget.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnTarget.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnTarget.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="txtTargetFolder.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Left, Right</value>
+ </data>
+ <data name="txtTargetFolder.Location" type="System.Drawing.Point, System.Drawing">
+ <value>128, 233</value>
+ </data>
+ <data name="txtTargetFolder.Size" type="System.Drawing.Size, System.Drawing">
+ <value>449, 20</value>
+ </data>
+ <data name="txtTargetFolder.TabIndex" type="System.Int32, mscorlib">
+ <value>11</value>
+ </data>
+ <data name=">>txtTargetFolder.Name" xml:space="preserve">
+ <value>txtTargetFolder</value>
+ </data>
+ <data name=">>txtTargetFolder.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtTargetFolder.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>txtTargetFolder.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name="label2.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="label2.Location" type="System.Drawing.Point, System.Drawing">
+ <value>13, 236</value>
+ </data>
+ <data name="label2.Size" type="System.Drawing.Size, System.Drawing">
+ <value>94, 13</value>
+ </data>
+ <data name="label2.TabIndex" type="System.Int32, mscorlib">
+ <value>10</value>
+ </data>
+ <data name="label2.Text" xml:space="preserve">
+ <value>Extract Symbols to</value>
+ </data>
+ <data name=">>label2.Name" xml:space="preserve">
+ <value>label2</value>
+ </data>
+ <data name=">>label2.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label2.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label2.ZOrder" xml:space="preserve">
+ <value>4</value>
+ </data>
+ <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
+ <value>452, 267</value>
+ </data>
+ <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnOK.TabIndex" type="System.Int32, mscorlib">
+ <value>13</value>
+ </data>
+ <data name="btnOK.Text" xml:space="preserve">
+ <value>OK</value>
+ </data>
+ <data name=">>btnOK.Name" xml:space="preserve">
+ <value>btnOK</value>
+ </data>
+ <data name=">>btnOK.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnOK.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnOK.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
+ <value>533, 267</value>
+ </data>
+ <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
+ <value>14</value>
+ </data>
+ <data name="btnCancel.Text" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name=">>btnCancel.Name" xml:space="preserve">
+ <value>btnCancel</value>
+ </data>
+ <data name=">>btnCancel.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnCancel.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnCancel.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
+ <value>6, 13</value>
+ </data>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>620, 302</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Extract Symbols</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>ExtractSymbolLibraryDialog</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs 2014-04-07 12:56:29 UTC (rev 8014)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs 2014-04-07 15:01:59 UTC (rev 8015)
@@ -57,6 +57,46 @@
_conn = conn;
}
+ public void ExtractSymbols(string targetFolder, IEnumerable<string> symbols, Action<int, int> progressCallback)
+ {
+ Check.NotEmpty(targetFolder, "targetFolder"); //NOXLATE
+ Check.Precondition(ResourceIdentifier.IsFolderResource(targetFolder), "ResourceIdentifier.IsFolderResource(targetFolder)"); //NOXLATE
+
+ if (symbols == null)
+ {
+ ExtractSymbols(targetFolder);
+ }
+ else
+ {
+ IDrawingService drawSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing);
+ IDrawingSource ds = PrepareSymbolDrawingSource(_conn, _symbolLibId);
+
+ //Each section in the symbols.dwf represents a symbol
+ var sectionList = drawSvc.EnumerateDrawingSections(ds.ResourceID);
+ var symbolNames = new HashSet<string>(symbols);
+ int processed = 0;
+
+ foreach (var sect in sectionList.Section)
+ {
+ var sectResources = drawSvc.EnumerateDrawingSectionResources(ds.ResourceID, sect.Name);
+
+ if (!symbolNames.Contains(sect.Title))
+ continue;
+
+ foreach (var res in sectResources.SectionResource)
+ {
+ if (res.Role.ToUpper() == StringConstants.Thumbnail.ToUpper())
+ {
+ ExtractSymbol(targetFolder, drawSvc, ds, sect, res);
+ processed++;
+ if (progressCallback != null)
+ progressCallback(processed, symbolNames.Count);
+ }
+ }
+ }
+ }
+ }
+
/// <summary>
/// Creates an image-based Symbol Definition in the specified folder for each image symbol in the Symbol Library.
///
@@ -82,52 +122,56 @@
{
if (res.Role.ToUpper() == StringConstants.Thumbnail.ToUpper())
{
- using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href))
- {
- using (Image img = Image.FromStream(rs))
- {
+ ExtractSymbol(targetFolder, drawSvc, ds, sect, res);
+ }
+ }
+ }
+ }
- string targetId = targetFolder + sect.Title + "." + ResourceTypes.SymbolDefinition.ToString();
- string dataName = sect.Title + "." + GetImageFormat(img.RawFormat);
+ private void ExtractSymbol(string targetFolder, IDrawingService drawSvc, IDrawingSource ds, ObjectModels.Common.DrawingSectionListSection sect, ObjectModels.Common.DrawingSectionResourceListSectionResource res)
+ {
+ using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href))
+ {
+ using (Image img = Image.FromStream(rs))
+ {
+ string targetId = targetFolder + sect.Title + "." + ResourceTypes.SymbolDefinition.ToString();
+ string dataName = sect.Title + "." + GetImageFormat(img.RawFormat);
- var symDef = ObjectFactory.CreateSimpleSymbol(_conn, sect.Title, "Image symbol definition extracted from a Symbol Library by Maestro"); //NOXLATE
- var imgGraphics = symDef.CreateImageGraphics();
- symDef.AddGraphics(imgGraphics);
+ var symDef = ObjectFactory.CreateSimpleSymbol(_conn, sect.Title, "Image symbol definition extracted from a Symbol Library by Maestro"); //NOXLATE
+ var imgGraphics = symDef.CreateImageGraphics();
+ symDef.AddGraphics(imgGraphics);
- imgGraphics.Item = symDef.CreateImageReference(string.Empty, Utility.FdoStringifiyLiteral(dataName)); //Empty resource id = self reference
+ imgGraphics.Item = symDef.CreateImageReference(string.Empty, Utility.FdoStringifiyLiteral(dataName)); //Empty resource id = self reference
- imgGraphics.SizeScalable = "True"; //NOXLATE
- imgGraphics.ResizeControl = Utility.FdoStringifiyLiteral("ResizeNone"); //NOXLATE
- imgGraphics.Angle = "0.0"; //NOXLATE
- imgGraphics.PositionX = "0.0"; //NOXLATE
- imgGraphics.PositionY = "4.0"; //NOXLATE
+ imgGraphics.SizeScalable = "True"; //NOXLATE
+ imgGraphics.ResizeControl = Utility.FdoStringifiyLiteral("ResizeNone"); //NOXLATE
+ imgGraphics.Angle = "0.0"; //NOXLATE
+ imgGraphics.PositionX = "0.0"; //NOXLATE
+ imgGraphics.PositionY = "4.0"; //NOXLATE
- imgGraphics.SizeX = PxToMillimeters(img.Width).ToString(CultureInfo.InvariantCulture);
- imgGraphics.SizeY = PxToMillimeters(img.Height).ToString(CultureInfo.InvariantCulture);
+ imgGraphics.SizeX = PxToMillimeters(img.Width).ToString(CultureInfo.InvariantCulture);
+ imgGraphics.SizeY = PxToMillimeters(img.Height).ToString(CultureInfo.InvariantCulture);
- symDef.PointUsage = symDef.CreatePointUsage();
- symDef.PointUsage.Angle = "%ROTATION_ANGLE%"; //NOXLATE
+ symDef.PointUsage = symDef.CreatePointUsage();
+ symDef.PointUsage.Angle = "%ROTATION_ANGLE%"; //NOXLATE
- var rotParam = symDef.CreateParameter();
- rotParam.DataType = "String"; //NOXLATE
- rotParam.Identifier = "ROTATION_ANGLE"; //NOXLATE
- rotParam.DisplayName = "Angle to rotate symbol"; //NOXLATE
- rotParam.DefaultValue = "0.0"; //NOXLATE
+ var rotParam = symDef.CreateParameter();
+ rotParam.DataType = "String"; //NOXLATE
+ rotParam.Identifier = "ROTATION_ANGLE"; //NOXLATE
+ rotParam.DisplayName = "Angle to rotate symbol"; //NOXLATE
+ rotParam.DefaultValue = "0.0"; //NOXLATE
- symDef.ParameterDefinition.AddParameter(rotParam);
+ symDef.ParameterDefinition.AddParameter(rotParam);
- _conn.ResourceService.SaveResourceAs(symDef, targetId);
- using (var ms = new MemoryStream())
- {
- img.Save(ms, ImageFormat.Png);
- ms.Position = 0L; //Rewind
- _conn.ResourceService.SetResourceData(targetId, dataName, ObjectModels.Common.ResourceDataType.File, ms);
- }
+ _conn.ResourceService.SaveResourceAs(symDef, targetId);
+ using (var ms = new MemoryStream())
+ {
+ img.Save(ms, ImageFormat.Png);
+ ms.Position = 0L; //Rewind
+ _conn.ResourceService.SetResourceData(targetId, dataName, ObjectModels.Common.ResourceDataType.File, ms);
+ }
- Trace.TraceInformation("Extracted symbol: " + targetId);
- }
- }
- }
+ Trace.TraceInformation("Extracted symbol: " + targetId);
}
}
}
More information about the mapguide-commits
mailing list