Index: Core/Common/src/Core.Common.Controls.Swf/Core.Common.Controls.Swf.csproj
===================================================================
diff -u -re29972e3a754b192d4f792639e599eb193e6ea8d -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Common/src/Core.Common.Controls.Swf/Core.Common.Controls.Swf.csproj (.../Core.Common.Controls.Swf.csproj) (revision e29972e3a754b192d4f792639e599eb193e6ea8d)
+++ Core/Common/src/Core.Common.Controls.Swf/Core.Common.Controls.Swf.csproj (.../Core.Common.Controls.Swf.csproj) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -188,7 +188,6 @@
ExceptionDialog.cs
-
UserControl
@@ -237,12 +236,6 @@
True
Resources.resx
-
- Form
-
-
- ImageResolutionDialog.cs
-
@@ -320,9 +313,6 @@
Resources.Designer.cs
Designer
-
- ImageResolutionDialog.cs
-
TableView.cs
Designer
Fisheye: Tag 045f766f6da1214f0a810d537952cf1f170a4d99 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Controls.Swf/ExportImageHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 045f766f6da1214f0a810d537952cf1f170a4d99 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Controls.Swf/ImageResolutionDialog.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 045f766f6da1214f0a810d537952cf1f170a4d99 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Controls.Swf/ImageResolutionDialog.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 045f766f6da1214f0a810d537952cf1f170a4d99 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Controls.Swf/ImageResolutionDialog.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.Designer.cs
===================================================================
diff -u -r83b9621346f7f3ca887096468de965815eb609ac -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 83b9621346f7f3ca887096468de965815eb609ac)
+++ Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -61,15 +61,6 @@
}
///
- /// Looks up a localized string similar to Alle bestanden (*.*)|*.*.
- ///
- internal static string AllFilesFilter {
- get {
- return ResourceManager.GetString("AllFilesFilter", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
internal static System.Drawing.Bitmap binocular {
@@ -368,24 +359,6 @@
}
///
- /// Looks up a localized string similar to Exporteer als afbeelding....
- ///
- internal static string Export_as_Image {
- get {
- return ResourceManager.GetString("Export_as_Image", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to {0} bestanden (*.{0})|*.{0}.
- ///
- internal static string ExportImageHelper_Format_0_as_filter {
- get {
- return ResourceManager.GetString("ExportImageHelper_Format_0_as_filter", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Mijn Computer.
///
internal static string FileSystemTreeView_FileSystemTreeView_My_Computer {
Index: Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.resx
===================================================================
diff -u -r83b9621346f7f3ca887096468de965815eb609ac -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.resx (.../Resources.resx) (revision 83b9621346f7f3ca887096468de965815eb609ac)
+++ Core/Common/src/Core.Common.Controls.Swf/Properties/Resources.resx (.../Resources.resx) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -267,9 +267,6 @@
X-waarde wordt vastgelegd (rechter limiet) {0} => {1}.
-
- Exporteer als afbeelding...
-
Niet te klonen subitems in menu-item.
@@ -287,15 +284,9 @@
Er is een kritieke fout opgetreden. Ringtoets moet herstart worden.
-
- Alle bestanden (*.*)|*.*
-
{0} tot {1}
-
- {0} bestanden (*.{0})|*.{0}
-
Er is een fout opgetreden. Verifieer de invoer alstublieft.
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Core.Plugins.SharpMapGis.csproj
===================================================================
diff -u -r13f47cf031a0cb759b4685bcdcde112f039d00d3 -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Core.Plugins.SharpMapGis.csproj (.../Core.Plugins.SharpMapGis.csproj) (revision 13f47cf031a0cb759b4685bcdcde112f039d00d3)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Core.Plugins.SharpMapGis.csproj (.../Core.Plugins.SharpMapGis.csproj) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -92,14 +92,24 @@
+
+
+ Form
+
+
+ ImageResolutionDialog.cs
+
PublicResXFileCodeGenerator
Resources.Designer.cs
Designer
+
+ ImageResolutionDialog.cs
+
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.Designer.cs
===================================================================
diff -u -r02d4fb099ae6e6c228220838181eaa0f06d1d06f -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 02d4fb099ae6e6c228220838181eaa0f06d1d06f)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -61,6 +61,15 @@
}
///
+ /// Looks up a localized string similar to Alle bestanden (*.*)|*.*.
+ ///
+ public static string AllFilesFilter {
+ get {
+ return ResourceManager.GetString("AllFilesFilter", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Achtergrond ({0}).
///
public static string BackGroundMapLayer_UpdateLayers_Background_BackgroundMapName {
@@ -70,6 +79,15 @@
}
///
+ /// Looks up a localized string similar to Exporteer als afbeelding....
+ ///
+ public static string Export_as_Image {
+ get {
+ return ResourceManager.GetString("Export_as_Image", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap exportIcon {
@@ -80,6 +98,15 @@
}
///
+ /// Looks up a localized string similar to {0} bestanden (*.{0})|*.{0}.
+ ///
+ public static string ExportImageHelper_Format_0_as_filter {
+ get {
+ return ResourceManager.GetString("ExportImageHelper_Format_0_as_filter", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Exporteer kaart als figuren.
///
public static string ExportMapToImageMapTool_OnBeforeContextMenu_Export_map_as_image {
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.resx
===================================================================
diff -u -r02d4fb099ae6e6c228220838181eaa0f06d1d06f -r045f766f6da1214f0a810d537952cf1f170a4d99
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.resx (.../Resources.resx) (revision 02d4fb099ae6e6c228220838181eaa0f06d1d06f)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Properties/Resources.resx (.../Resources.resx) (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -133,4 +133,13 @@
..\Resources\MapZoomToExtentsImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Exporteer als afbeelding...
+
+
+ {0} bestanden (*.{0})|*.{0}
+
+
+ Alle bestanden (*.*)|*.*
+
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ExportImageHelper.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ExportImageHelper.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ExportImageHelper.cs (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -0,0 +1,116 @@
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.Controls.Swf.Properties;
+using Core.Plugins.SharpMapGis.Properties;
+
+namespace Core.Plugins.SharpMapGis.Tools
+{
+ public static class ExportImageHelper
+ {
+ private static readonly Dictionary ImageFormats = new Dictionary
+ {
+ {
+ "png", ImageFormat.Png
+ },
+ {
+ "jpg", ImageFormat.Jpeg
+ },
+ {
+ "bmp", ImageFormat.Bmp
+ },
+ {
+ "gif", ImageFormat.Gif
+ },
+ {
+ "emf", ImageFormat.Emf
+ },
+ {
+ "tiff", ImageFormat.Tiff
+ },
+ };
+
+ public static void Export(Image image, string filePath, string imageType, double factor = 1)
+ {
+ if (image == null)
+ {
+ return;
+ }
+
+ var imageToWrite = CreateResizedImage(image, (int) (image.Width*factor), (int) (image.Height*factor));
+ if (imageToWrite == null)
+ {
+ return;
+ }
+
+ imageToWrite.Save(filePath, ImageFormats[imageType.ToLower()]);
+ }
+
+ public static void ExportWithDialog(Image image)
+ {
+ if (image == null)
+ {
+ return;
+ }
+
+ var filter = GetFileFormatFilter(ImageFormats);
+
+ var saveFileDialog = new SaveFileDialog
+ {
+ Filter = filter,
+ FilterIndex = 1,
+ RestoreDirectory = true,
+ Title = Resources.Export_as_Image
+ };
+
+ if (saveFileDialog.ShowDialog() != DialogResult.OK)
+ {
+ return;
+ }
+
+ var imageResolutionDialog = new ImageResolutionDialog
+ {
+ BaseImage = image
+ };
+
+ if (imageResolutionDialog.ShowModal() != DialogResult.OK)
+ {
+ return;
+ }
+
+ var factor = imageResolutionDialog.Resolution/100;
+ Export(image, saveFileDialog.FileName, ImageFormats.Keys.ElementAt(saveFileDialog.FilterIndex), factor);
+ }
+
+ public static Bitmap CreateResizedImage(Image image, int width, int height)
+ {
+ //a holder for the result
+ var result = new Bitmap(width, height);
+
+ //use a graphics object to draw the resized image into the bitmap
+ using (var graphics = Graphics.FromImage(result))
+ {
+ //set the resize quality modes to high quality
+ graphics.CompositingQuality = CompositingQuality.HighQuality;
+ graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ graphics.SmoothingMode = SmoothingMode.HighQuality;
+
+ //draw the image into the target bitmap
+ graphics.DrawImage(image, 0, 0, result.Width, result.Height);
+ }
+
+ //return the resulting bitmap
+ return result;
+ }
+
+ private static string GetFileFormatFilter(Dictionary imageFormats)
+ {
+ List filters = imageFormats.Keys.Select(ext => string.Format(Resources.ExportImageHelper_Format_0_as_filter, ext)).ToList();
+ filters.Add(Resources.AllFilesFilter);
+ return string.Join("|",filters);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.Designer.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.Designer.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.Designer.cs (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -0,0 +1,183 @@
+namespace Core.Plugins.SharpMapGis.Tools
+{
+ partial class ImageResolutionDialog
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageResolutionDialog));
+ this.trackBar1 = new System.Windows.Forms.TrackBar();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBoxPercentage = new System.Windows.Forms.TextBox();
+ this.labelHeight = new System.Windows.Forms.Label();
+ this.widthLabel = new System.Windows.Forms.Label();
+ this.textBoxHeight = new System.Windows.Forms.TextBox();
+ this.textBoxWidth = new System.Windows.Forms.TextBox();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // trackBar1
+ //
+ resources.ApplyResources(this.trackBar1, "trackBar1");
+ this.trackBar1.Maximum = 500;
+ this.trackBar1.Minimum = 1;
+ this.trackBar1.Name = "trackBar1";
+ this.trackBar1.TickFrequency = 20;
+ this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
+ this.trackBar1.Value = 100;
+ this.trackBar1.ValueChanged += new System.EventHandler(this.ResolutionTrackBarValueChanged);
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.BackColor = System.Drawing.Color.White;
+ resources.ApplyResources(this.pictureBox1, "pictureBox1");
+ this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Default;
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.TabStop = false;
+ //
+ // splitContainer1
+ //
+ resources.ApplyResources(this.splitContainer1, "splitContainer1");
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.label1);
+ this.splitContainer1.Panel1.Controls.Add(this.textBoxPercentage);
+ this.splitContainer1.Panel1.Controls.Add(this.labelHeight);
+ this.splitContainer1.Panel1.Controls.Add(this.widthLabel);
+ this.splitContainer1.Panel1.Controls.Add(this.textBoxHeight);
+ this.splitContainer1.Panel1.Controls.Add(this.textBoxWidth);
+ this.splitContainer1.Panel1.Controls.Add(this.trackBar1);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.pictureBox1);
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // textBoxPercentage
+ //
+ resources.ApplyResources(this.textBoxPercentage, "textBoxPercentage");
+ this.textBoxPercentage.Name = "textBoxPercentage";
+ this.textBoxPercentage.TextChanged += new System.EventHandler(this.TextBoxPercentageTextChanged);
+ //
+ // labelHeight
+ //
+ resources.ApplyResources(this.labelHeight, "labelHeight");
+ this.labelHeight.Name = "labelHeight";
+ //
+ // widthLabel
+ //
+ resources.ApplyResources(this.widthLabel, "widthLabel");
+ this.widthLabel.Name = "widthLabel";
+ //
+ // textBoxHeight
+ //
+ resources.ApplyResources(this.textBoxHeight, "textBoxHeight");
+ this.textBoxHeight.Name = "textBoxHeight";
+ this.textBoxHeight.TextChanged += new System.EventHandler(this.TextBoxHeightTextChanged);
+ //
+ // textBoxWidth
+ //
+ resources.ApplyResources(this.textBoxWidth, "textBoxWidth");
+ this.textBoxWidth.Name = "textBoxWidth";
+ this.textBoxWidth.TextChanged += new System.EventHandler(this.TextBoxWidthTextChanged);
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.button2);
+ this.panel1.Controls.Add(this.button1);
+ resources.ApplyResources(this.panel1, "panel1");
+ this.panel1.Name = "panel1";
+ //
+ // button2
+ //
+ resources.ApplyResources(this.button2, "button2");
+ this.button2.Name = "button2";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.CancelButtonClicked);
+ //
+ // button1
+ //
+ resources.ApplyResources(this.button1, "button1");
+ this.button1.Name = "button1";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.OkButtonClicked);
+ //
+ // ImageResolutionDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.splitContainer1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "ImageResolutionDialog";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.TopMost = true;
+ ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel1.PerformLayout();
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.panel1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TrackBar trackBar1;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBoxPercentage;
+ private System.Windows.Forms.Label labelHeight;
+ private System.Windows.Forms.Label widthLabel;
+ private System.Windows.Forms.TextBox textBoxHeight;
+ private System.Windows.Forms.TextBox textBoxWidth;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button1;
+ public System.Windows.Forms.PictureBox pictureBox1;
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.cs (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -0,0 +1,194 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Core.Plugins.SharpMapGis.Tools
+{
+ public partial class ImageResolutionDialog : Form
+ {
+ private DialogResult result;
+ private bool updatingControls;
+
+ private Image baseImage;
+
+ public ImageResolutionDialog()
+ {
+ InitializeComponent();
+ Resolution = 100;
+ }
+
+ public double Resolution { get; set; }
+
+ public Image BaseImage
+ {
+ private get
+ {
+ return baseImage;
+ }
+ set
+ {
+ baseImage = value;
+ double minWidthResolution = 100.0/BaseImage.Width;
+ double minHeightResolution = 100.0/BaseImage.Width;
+ if (minHeightResolution > 1.0 || minWidthResolution > 1.0)
+ {
+ trackBar1.Minimum = (int) Math.Max(minHeightResolution, minHeightResolution);
+ }
+ else
+ {
+ trackBar1.Minimum = 1;
+ }
+ }
+ }
+
+ public string Title { get; set; }
+
+ public DialogResult ShowModal()
+ {
+ if (BaseImage == null)
+ {
+ return DialogResult.Cancel;
+ }
+
+ result = DialogResult.Cancel;
+
+ UpdateControls();
+
+ Show();
+
+ while (Visible)
+ {
+ Application.DoEvents();
+ }
+
+ return result;
+ }
+
+ private void OkButtonClicked(object sender, EventArgs e)
+ {
+ result = DialogResult.OK;
+ CloseDialog();
+ }
+
+ private void CancelButtonClicked(object sender, EventArgs e)
+ {
+ CloseDialog();
+ }
+
+ private void CloseDialog()
+ {
+ Hide();
+ Dispose();
+ }
+
+ private void ResolutionTrackBarValueChanged(object sender, EventArgs e)
+ {
+ if (updatingControls)
+ {
+ return;
+ }
+
+ Resolution = trackBar1.Value;
+ UpdateControls(trackBar1);
+ }
+
+ private void TextBoxWidthTextChanged(object sender, EventArgs e)
+ {
+ if (updatingControls)
+ {
+ return;
+ }
+
+ double newWidth;
+ if (!Double.TryParse(textBoxWidth.Text, out newWidth))
+ {
+ textBoxWidth.BackColor = Color.Red;
+ return;
+ }
+ SetResolution((newWidth/BaseImage.Width)*100, textBoxWidth);
+ }
+
+ private void TextBoxHeightTextChanged(object sender, EventArgs e)
+ {
+ if (updatingControls)
+ {
+ return;
+ }
+
+ double newHeight;
+ if (!Double.TryParse(textBoxHeight.Text, out newHeight))
+ {
+ textBoxHeight.BackColor = Color.Red;
+ return;
+ }
+ var newResolution = (newHeight/BaseImage.Height)*100;
+ SetResolution(newResolution, textBoxHeight);
+ }
+
+ private void TextBoxPercentageTextChanged(object sender, EventArgs e)
+ {
+ if (updatingControls)
+ {
+ return;
+ }
+
+ double newResolution;
+ if (!Double.TryParse(textBoxPercentage.Text, out newResolution))
+ {
+ textBoxPercentage.BackColor = Color.Red;
+ return;
+ }
+ SetResolution(newResolution, textBoxPercentage);
+ }
+
+ private void UpdateControls(Control controlToIgnore = null)
+ {
+ updatingControls = true;
+ if (controlToIgnore != trackBar1)
+ {
+ trackBar1.Value = (int) Resolution;
+ }
+ if (controlToIgnore != textBoxPercentage)
+ {
+ textBoxPercentage.Text = Resolution.ToString();
+ }
+ if (controlToIgnore != textBoxWidth)
+ {
+ textBoxWidth.Text = (Resolution/100*BaseImage.Width).ToString();
+ }
+ if (controlToIgnore != textBoxHeight)
+ {
+ textBoxHeight.Text = (Resolution/100*BaseImage.Height).ToString();
+ }
+ updatingControls = false;
+ UpdateImageBox();
+ }
+
+ private void UpdateImageBox()
+ {
+ pictureBox1.Image = ExportImageHelper.CreateResizedImage(BaseImage, (int) (Resolution/100*BaseImage.Width), (int) (Resolution/100*BaseImage.Height));
+ pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
+ }
+
+ private void SetResolution(double newResolution, Control control)
+ {
+ if (!ValidResolution(newResolution))
+ {
+ control.BackColor = Color.Red;
+ return;
+ }
+ Resolution = newResolution;
+
+ control.BackColor = Color.White;
+ UpdateControls(control);
+ }
+
+ private bool ValidResolution(double newResolution)
+ {
+ return newResolution >= trackBar1.Minimum &&
+ newResolution <= trackBar1.Maximum &&
+ Resolution/100*BaseImage.Width > 1 &&
+ Resolution/100*BaseImage.Height > 1;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.resx
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.resx (revision 0)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/Tools/ImageResolutionDialog.resx (revision 045f766f6da1214f0a810d537952cf1f170a4d99)
@@ -0,0 +1,474 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Fill
+
+
+
+ 0, 0
+
+
+ 449, 74
+
+
+
+ 0
+
+
+ trackBar1
+
+
+ System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 6
+
+
+ Center
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 449, 294
+
+
+ CenterImage
+
+
+ 1
+
+
+ pictureBox1
+
+
+ System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel2
+
+
+ 0
+
+
+ True
+
+
+ Fill
+
+
+ True
+
+
+ 0, 0
+
+
+ Horizontal
+
+
+ True
+
+
+ 384, 45
+
+
+ 15, 13
+
+
+ 7
+
+
+ %
+
+
+ label1
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 0
+
+
+ 321, 38
+
+
+ 57, 20
+
+
+ 6
+
+
+ textBoxPercentage
+
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 1
+
+
+ True
+
+
+ 156, 45
+
+
+ 42, 13
+
+
+ 4
+
+
+ Hoogte
+
+
+ labelHeight
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 2
+
+
+ True
+
+
+ 9, 45
+
+
+ 44, 13
+
+
+ 3
+
+
+ Breedte
+
+
+ widthLabel
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 3
+
+
+ 204, 38
+
+
+ 93, 20
+
+
+ 2
+
+
+ textBoxHeight
+
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 4
+
+
+ 59, 38
+
+
+ 91, 20
+
+
+ 1
+
+
+ textBoxWidth
+
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1.Panel1
+
+
+ 5
+
+
+ splitContainer1.Panel1
+
+
+ System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1
+
+
+ 0
+
+
+ splitContainer1.Panel2
+
+
+ System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ splitContainer1
+
+
+ 1
+
+
+ 449, 372
+
+
+ 74
+
+
+ 2
+
+
+ splitContainer1
+
+
+ System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
+
+
+ 370, 5
+
+
+ 75, 23
+
+
+ 1
+
+
+ Annuleren
+
+
+ button2
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ panel1
+
+
+ 0
+
+
+ 289, 5
+
+
+ 75, 23
+
+
+ 0
+
+
+ OK
+
+
+ button1
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ panel1
+
+
+ 1
+
+
+ Bottom
+
+
+ 0, 339
+
+
+ 449, 33
+
+
+ 3
+
+
+ panel1
+
+
+ System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ True
+
+
+ 6, 13
+
+
+ 449, 372
+
+
+ Specificeer de beeldresolutie voor export
+
+
+ ImageResolutionDialog
+
+
+ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file