[mapguide-commits] r9119 - in trunk/Tools/Maestro: Maestro.Base/Commands Maestro.Editors Maestro.Editors/Preview Maestro.LiveMapEditor

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jan 20 03:15:58 PST 2017


Author: jng
Date: 2017-01-20 03:15:58 -0800 (Fri, 20 Jan 2017)
New Revision: 9119

Added:
   trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.cs
   trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.resx
Modified:
   trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
   trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
   trunk/Tools/Maestro/Maestro.Editors/Preview/LocalMapPreviewer.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.resx
   trunk/Tools/Maestro/Maestro.LiveMapEditor/Program.cs
Log:
Make local map previews non-modal

Fixes #2758

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/StartupCommand.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -43,11 +43,12 @@
                 PreviewSettings.UseLocalPreview = PropertyService.Get(ConfigProperties.UseLocalPreview, ConfigProperties.DefaultUseLocalPreview);
 
                 var urlLauncher = ServiceRegistry.GetService<UrlLauncherService>();
-                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher)); //NOXLATE
-                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Rest", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher)); //NOXLATE
+                var vcMgr = ServiceRegistry.GetService<ViewContentManager>();
+                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, vcMgr)); //NOXLATE
+                ResourcePreviewerFactory.RegisterPreviewer("Maestro.Rest", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, vcMgr)); //NOXLATE
                 //A stub previewer does nothing, but will use local map previews for applicable resources if the configuration
                 //property is set
-                ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher)); //NOXLATE
+                ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher, vcMgr)); //NOXLATE
 
                 ServiceRegistry.GetService<NewItemTemplateService>().InitUserTemplates();
                 var wb = Workbench.Instance;
@@ -57,14 +58,12 @@
 
                 wb.FormClosing += new System.Windows.Forms.FormClosingEventHandler(OnWorkbenchClosing);
                 wb.Text = "MapGuide Maestro"; //NOXLATE
-
-                var mgr = ServiceRegistry.GetService<ViewContentManager>();
-
+                
                 if (Props.Get(ConfigProperties.ShowMessages, true))
-                    mgr.OpenContent<MessageViewer>(ViewRegion.Bottom);
+                    vcMgr.OpenContent<MessageViewer>(ViewRegion.Bottom);
 
                 if (Props.Get(ConfigProperties.ShowOutboundRequests, true))
-                    mgr.OpenContent<OutboundRequestViewer>(ViewRegion.Bottom);
+                    vcMgr.OpenContent<OutboundRequestViewer>(ViewRegion.Bottom);
 
                 LoginCommand.RunInternal(true);
             };

Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj	2017-01-20 11:15:58 UTC (rev 9119)
@@ -1066,6 +1066,12 @@
     <Compile Include="Preview\MapPreviewDialog.Designer.cs">
       <DependentUpon>MapPreviewDialog.cs</DependentUpon>
     </Compile>
+    <Compile Include="Preview\MapPreviewViewContent.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Preview\MapPreviewViewContent.Designer.cs">
+      <DependentUpon>MapPreviewViewContent.cs</DependentUpon>
+    </Compile>
     <Compile Include="Preview\PreviewSettings.cs" />
     <Compile Include="Preview\ResourcePreviewEngine.cs" />
     <Compile Include="Preview\ResourcePreviewFactory.cs" />
@@ -1875,6 +1881,9 @@
     <EmbeddedResource Include="Preview\MapPreviewDialog.resx">
       <DependentUpon>MapPreviewDialog.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Preview\MapPreviewViewContent.resx">
+      <DependentUpon>MapPreviewViewContent.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="PrintLayout\LogoDialog.resx">
       <DependentUpon>LogoDialog.cs</DependentUpon>
     </EmbeddedResource>

Modified: trunk/Tools/Maestro/Maestro.Editors/Preview/LocalMapPreviewer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Preview/LocalMapPreviewer.cs	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.Editors/Preview/LocalMapPreviewer.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -37,18 +37,21 @@
     /// </summary>
     public class LocalMapPreviewer : IResourcePreviewer
     {
-        private readonly IResourcePreviewer _inner;
-        private readonly IUrlLauncherService _launcher;
+        readonly IResourcePreviewer _inner;
+        readonly IUrlLauncherService _launcher;
+        readonly IViewContentManager _viewManager;
 
         /// <summary>
         /// Initializes a new instance of the LocalMapPreviewer class
         /// </summary>
         /// <param name="inner">The inner resource previewer</param>
         /// <param name="launcher">The URL launcher service</param>
-        public LocalMapPreviewer(IResourcePreviewer inner, IUrlLauncherService launcher)
+        /// <param name="viewManager">The view content manager</param>
+        public LocalMapPreviewer(IResourcePreviewer inner, IUrlLauncherService launcher, IViewContentManager viewManager)
         {
             _inner = inner;
             _launcher = launcher;
+            _viewManager = viewManager;
         }
 
         /// <summary>
@@ -164,8 +167,15 @@
                     if (obj != null)
                     {
                         var rtMap = (RuntimeMap)obj;
-                        var diag = new MapPreviewDialog(rtMap, _launcher, (edSvc.IsNew) ? null : edSvc.ResourceID);
-                        diag.Show(null);
+                        if (_viewManager != null)
+                        {
+                            _viewManager.OpenContent(ViewRegion.Document, () => new MapPreviewViewContent(rtMap, _launcher, (edSvc.IsNew) ? null : edSvc.ResourceID));
+                        }
+                        else
+                        {
+                            var diag = new MapPreviewDialog(rtMap, _launcher, (edSvc.IsNew) ? null : edSvc.ResourceID);
+                            diag.Show(null);
+                        }
                     }
                     else //Fallback, shouldn't happen
                     {

Added: trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.Designer.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.Designer.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -0,0 +1,372 @@
+namespace Maestro.Editors.Preview
+{
+    partial class MapPreviewViewContent
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.defaultToolbar = new Maestro.MapViewer.DefaultToolbar();
+            this.statusStrip = new System.Windows.Forms.StatusStrip();
+            this.lblCoordinates = new System.Windows.Forms.ToolStripStatusLabel();
+            this.lblSelected = new System.Windows.Forms.ToolStripStatusLabel();
+            this.lblScale = new System.Windows.Forms.ToolStripStatusLabel();
+            this.legend = new Maestro.MapViewer.Legend();
+            this.rightPanel = new System.Windows.Forms.Panel();
+            this.mapViewer = new Maestro.MapViewer.MapViewer();
+            this.mapStatusTracker = new Maestro.MapViewer.MapStatusTracker();
+            this.grpOtherTools = new System.Windows.Forms.GroupBox();
+            this.btnGetMapKml = new System.Windows.Forms.Button();
+            this.lnkZoomToScale = new System.Windows.Forms.LinkLabel();
+            this.numZoomToScale = new System.Windows.Forms.NumericUpDown();
+            this.label5 = new System.Windows.Forms.Label();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.txtCoordinateSystem = new System.Windows.Forms.TextBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.txtMaxY = new System.Windows.Forms.TextBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.txtMaxX = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.txtMinY = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.txtMinX = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.statusStrip.SuspendLayout();
+            this.rightPanel.SuspendLayout();
+            this.grpOtherTools.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.numZoomToScale)).BeginInit();
+            this.groupBox1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // defaultToolbar
+            // 
+            this.defaultToolbar.Location = new System.Drawing.Point(0, 0);
+            this.defaultToolbar.Name = "defaultToolbar";
+            this.defaultToolbar.Size = new System.Drawing.Size(821, 25);
+            this.defaultToolbar.TabIndex = 0;
+            this.defaultToolbar.Text = "defaultToolbar1";
+            this.defaultToolbar.Viewer = this.mapViewer;
+            // 
+            // statusStrip
+            // 
+            this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.lblCoordinates,
+            this.lblSelected,
+            this.lblScale});
+            this.statusStrip.Location = new System.Drawing.Point(0, 525);
+            this.statusStrip.Name = "statusStrip";
+            this.statusStrip.Size = new System.Drawing.Size(821, 22);
+            this.statusStrip.TabIndex = 4;
+            this.statusStrip.Text = "statusStrip1";
+            // 
+            // lblCoordinates
+            // 
+            this.lblCoordinates.Name = "lblCoordinates";
+            this.lblCoordinates.Size = new System.Drawing.Size(0, 17);
+            // 
+            // lblSelected
+            // 
+            this.lblSelected.Name = "lblSelected";
+            this.lblSelected.Size = new System.Drawing.Size(775, 17);
+            this.lblSelected.Spring = true;
+            // 
+            // lblScale
+            // 
+            this.lblScale.Name = "lblScale";
+            this.lblScale.Size = new System.Drawing.Size(0, 17);
+            // 
+            // legend
+            // 
+            this.legend.Dock = System.Windows.Forms.DockStyle.Left;
+            this.legend.GroupContextMenu = null;
+            this.legend.LayerContextMenu = null;
+            this.legend.Location = new System.Drawing.Point(0, 25);
+            this.legend.Name = "legend";
+            this.legend.SelectOnRightClick = false;
+            this.legend.ShowAllLayersAndGroups = false;
+            this.legend.ShowTooltips = true;
+            this.legend.Size = new System.Drawing.Size(210, 500);
+            this.legend.TabIndex = 5;
+            this.legend.ThemeCompressionLimit = 25;
+            this.legend.Viewer = this.mapViewer;
+            // 
+            // rightPanel
+            // 
+            this.rightPanel.Controls.Add(this.grpOtherTools);
+            this.rightPanel.Controls.Add(this.groupBox1);
+            this.rightPanel.Dock = System.Windows.Forms.DockStyle.Right;
+            this.rightPanel.Location = new System.Drawing.Point(593, 25);
+            this.rightPanel.Name = "rightPanel";
+            this.rightPanel.Size = new System.Drawing.Size(228, 500);
+            this.rightPanel.TabIndex = 6;
+            // 
+            // mapViewer
+            // 
+            this.mapViewer.Cursor = System.Windows.Forms.Cursors.Default;
+            this.mapViewer.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.mapViewer.Location = new System.Drawing.Point(210, 25);
+            this.mapViewer.MaxScale = 1000000000;
+            this.mapViewer.MinScale = 10;
+            this.mapViewer.MouseWheelDelayRenderInterval = 800;
+            this.mapViewer.Name = "mapViewer";
+            this.mapViewer.PointPixelBuffer = 2;
+            this.mapViewer.SelectionColor = System.Drawing.Color.Blue;
+            this.mapViewer.Size = new System.Drawing.Size(383, 500);
+            this.mapViewer.TabIndex = 7;
+            this.mapViewer.Text = "mapViewer1";
+            this.mapViewer.TooltipDelayInterval = 1000;
+            this.mapViewer.ZoomInFactor = 0.5D;
+            this.mapViewer.ZoomOutFactor = 2D;
+            this.mapViewer.MapScaleChanged += new System.EventHandler(this.mapViewer_MapScaleChanged);
+            this.mapViewer.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.mapViewer_PropertyChanged);
+            // 
+            // mapStatusTracker
+            // 
+            this.mapStatusTracker.CoordinatesLabel = this.lblCoordinates;
+            this.mapStatusTracker.ScaleLabel = this.lblScale;
+            this.mapStatusTracker.SelectedLabel = this.lblSelected;
+            this.mapStatusTracker.Viewer = this.mapViewer;
+            // 
+            // grpOtherTools
+            // 
+            this.grpOtherTools.Controls.Add(this.btnGetMapKml);
+            this.grpOtherTools.Controls.Add(this.lnkZoomToScale);
+            this.grpOtherTools.Controls.Add(this.numZoomToScale);
+            this.grpOtherTools.Controls.Add(this.label5);
+            this.grpOtherTools.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.grpOtherTools.Location = new System.Drawing.Point(0, 385);
+            this.grpOtherTools.Name = "grpOtherTools";
+            this.grpOtherTools.Size = new System.Drawing.Size(228, 115);
+            this.grpOtherTools.TabIndex = 9;
+            this.grpOtherTools.TabStop = false;
+            this.grpOtherTools.Text = "Other Tools";
+            // 
+            // btnGetMapKml
+            // 
+            this.btnGetMapKml.Location = new System.Drawing.Point(10, 74);
+            this.btnGetMapKml.Name = "btnGetMapKml";
+            this.btnGetMapKml.Size = new System.Drawing.Size(94, 23);
+            this.btnGetMapKml.TabIndex = 4;
+            this.btnGetMapKml.Text = "Get Map KML";
+            this.btnGetMapKml.UseVisualStyleBackColor = true;
+            this.btnGetMapKml.Click += new System.EventHandler(this.btnGetMapKml_Click);
+            // 
+            // lnkZoomToScale
+            // 
+            this.lnkZoomToScale.AutoSize = true;
+            this.lnkZoomToScale.Location = new System.Drawing.Point(93, 32);
+            this.lnkZoomToScale.Name = "lnkZoomToScale";
+            this.lnkZoomToScale.Size = new System.Drawing.Size(40, 13);
+            this.lnkZoomToScale.TabIndex = 3;
+            this.lnkZoomToScale.TabStop = true;
+            this.lnkZoomToScale.Text = "(Zoom)";
+            this.lnkZoomToScale.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkZoomToScale_LinkClicked);
+            // 
+            // numZoomToScale
+            // 
+            this.numZoomToScale.Location = new System.Drawing.Point(10, 48);
+            this.numZoomToScale.Name = "numZoomToScale";
+            this.numZoomToScale.Size = new System.Drawing.Size(135, 20);
+            this.numZoomToScale.TabIndex = 2;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(7, 32);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(80, 13);
+            this.label5.TabIndex = 1;
+            this.label5.Text = "Zoom To Scale";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.txtCoordinateSystem);
+            this.groupBox1.Controls.Add(this.label6);
+            this.groupBox1.Controls.Add(this.txtMaxY);
+            this.groupBox1.Controls.Add(this.label4);
+            this.groupBox1.Controls.Add(this.txtMaxX);
+            this.groupBox1.Controls.Add(this.label3);
+            this.groupBox1.Controls.Add(this.txtMinY);
+            this.groupBox1.Controls.Add(this.label2);
+            this.groupBox1.Controls.Add(this.txtMinX);
+            this.groupBox1.Controls.Add(this.label1);
+            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.groupBox1.Location = new System.Drawing.Point(0, 0);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(228, 500);
+            this.groupBox1.TabIndex = 8;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "Current Extents";
+            // 
+            // txtCoordinateSystem
+            // 
+            this.txtCoordinateSystem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtCoordinateSystem.Location = new System.Drawing.Point(10, 207);
+            this.txtCoordinateSystem.Multiline = true;
+            this.txtCoordinateSystem.Name = "txtCoordinateSystem";
+            this.txtCoordinateSystem.ReadOnly = true;
+            this.txtCoordinateSystem.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+            this.txtCoordinateSystem.Size = new System.Drawing.Size(198, 123);
+            this.txtCoordinateSystem.TabIndex = 9;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(7, 190);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(95, 13);
+            this.label6.TabIndex = 8;
+            this.label6.Text = "Coordinate System";
+            // 
+            // txtMaxY
+            // 
+            this.txtMaxY.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtMaxY.Location = new System.Drawing.Point(10, 167);
+            this.txtMaxY.Name = "txtMaxY";
+            this.txtMaxY.ReadOnly = true;
+            this.txtMaxY.Size = new System.Drawing.Size(198, 20);
+            this.txtMaxY.TabIndex = 7;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(7, 150);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(37, 13);
+            this.label4.TabIndex = 6;
+            this.label4.Text = "Max Y";
+            // 
+            // txtMaxX
+            // 
+            this.txtMaxX.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtMaxX.Location = new System.Drawing.Point(10, 129);
+            this.txtMaxX.Name = "txtMaxX";
+            this.txtMaxX.ReadOnly = true;
+            this.txtMaxX.Size = new System.Drawing.Size(198, 20);
+            this.txtMaxX.TabIndex = 5;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(7, 112);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(37, 13);
+            this.label3.TabIndex = 4;
+            this.label3.Text = "Max X";
+            // 
+            // txtMinY
+            // 
+            this.txtMinY.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtMinY.Location = new System.Drawing.Point(10, 89);
+            this.txtMinY.Name = "txtMinY";
+            this.txtMinY.ReadOnly = true;
+            this.txtMinY.Size = new System.Drawing.Size(198, 20);
+            this.txtMinY.TabIndex = 3;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(7, 72);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(34, 13);
+            this.label2.TabIndex = 2;
+            this.label2.Text = "Min Y";
+            // 
+            // txtMinX
+            // 
+            this.txtMinX.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtMinX.Location = new System.Drawing.Point(10, 49);
+            this.txtMinX.Name = "txtMinX";
+            this.txtMinX.ReadOnly = true;
+            this.txtMinX.Size = new System.Drawing.Size(198, 20);
+            this.txtMinX.TabIndex = 1;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(7, 32);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(34, 13);
+            this.label1.TabIndex = 0;
+            this.label1.Text = "Min X";
+            // 
+            // MapPreviewViewContent
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.mapViewer);
+            this.Controls.Add(this.rightPanel);
+            this.Controls.Add(this.legend);
+            this.Controls.Add(this.statusStrip);
+            this.Controls.Add(this.defaultToolbar);
+            this.Name = "MapPreviewViewContent";
+            this.Size = new System.Drawing.Size(821, 547);
+            this.statusStrip.ResumeLayout(false);
+            this.statusStrip.PerformLayout();
+            this.rightPanel.ResumeLayout(false);
+            this.grpOtherTools.ResumeLayout(false);
+            this.grpOtherTools.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.numZoomToScale)).EndInit();
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private MapViewer.DefaultToolbar defaultToolbar;
+        private System.Windows.Forms.StatusStrip statusStrip;
+        private System.Windows.Forms.ToolStripStatusLabel lblCoordinates;
+        private System.Windows.Forms.ToolStripStatusLabel lblSelected;
+        private System.Windows.Forms.ToolStripStatusLabel lblScale;
+        private System.Windows.Forms.Panel rightPanel;
+        private MapViewer.MapViewer mapViewer;
+        private MapViewer.Legend legend;
+        private MapViewer.MapStatusTracker mapStatusTracker;
+        private System.Windows.Forms.GroupBox grpOtherTools;
+        private System.Windows.Forms.Button btnGetMapKml;
+        private System.Windows.Forms.LinkLabel lnkZoomToScale;
+        private System.Windows.Forms.NumericUpDown numZoomToScale;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.TextBox txtCoordinateSystem;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.TextBox txtMaxY;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox txtMaxX;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox txtMinY;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox txtMinX;
+        private System.Windows.Forms.Label label1;
+    }
+}

Added: trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -0,0 +1,115 @@
+#region Disclaimer / License
+
+// Copyright (C) 2017, 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 Disclaimer / License
+
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Mapping;
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace Maestro.Editors.Preview
+{
+    public partial class MapPreviewViewContent : ViewContentBase
+    {
+        private readonly RuntimeMap _map;
+        private readonly IUrlLauncherService _launcher;
+        private readonly IServerConnection _conn;
+        private readonly string _resourceId;
+        
+        public MapPreviewViewContent(RuntimeMap map, IUrlLauncherService urlLauncher, string resourceId)
+        {
+            InitializeComponent();
+            _map = map;
+            _resourceId = resourceId;
+            txtCoordinateSystem.Text = map.CoordinateSystem;
+            numZoomToScale.Minimum = 1;
+            numZoomToScale.Maximum = Int32.MaxValue;
+            _launcher = urlLauncher;
+            _conn = map.CurrentConnection;
+            btnGetMapKml.Enabled = (_conn.ProviderName.ToUpper() == "MAESTRO.HTTP"); //NOXLATE
+        }
+
+        protected override void OnLoad(EventArgs e)
+        {
+            base.OnLoad(e);
+            if (!string.IsNullOrEmpty(_resourceId))
+                this.Title = $"{Strings.ResourcePreviewTitle} - {_resourceId}"; //NOXLATE
+            this.Description = _resourceId;
+            if (_map.Layers.Count == 1) //Single-layer preview
+            {
+                var maxScale = _map.Layers.Max(x => x.ScaleRanges.Max(y => y.MaxScale));
+                var initScale = Math.Floor(maxScale - 0.5);
+                var env = _map.MapExtent;
+                double mcsW = env.MaxX - env.MinX;
+                double mcsH = env.MaxY - env.MinY;
+                var bboxScale = Maestro.MapViewer.MapViewer.CalculateScale(_map, mcsW, mcsH, mapViewer.Width, mapViewer.Height);
+                double desiredScale = Math.Min(initScale, bboxScale);
+                mapViewer.LoadMap(_map, desiredScale);
+            }
+            else
+            {
+                mapViewer.LoadMap(_map);
+            }
+        }
+
+        private void mapViewer_MapScaleChanged(object sender, EventArgs e)
+        {
+            numZoomToScale.Value = Convert.ToDecimal(mapViewer.GetMap().ViewScale);
+        }
+
+        private void lnkZoomToScale_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            mapViewer.ZoomToScale(Convert.ToDouble(numZoomToScale.Value));
+        }
+
+        private void mapViewer_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == nameof(mapViewer.IsBusy))
+            {
+                grpOtherTools.Enabled = !mapViewer.IsBusy;
+
+                if (!mapViewer.IsBusy)
+                {
+                    double minx, miny, maxx, maxy;
+                    mapViewer.GetViewExtent(out minx, out miny, out maxx, out maxy);
+
+                    txtMinX.Text = minx.ToString(CultureInfo.InvariantCulture);
+                    txtMinY.Text = miny.ToString(CultureInfo.InvariantCulture);
+                    txtMaxX.Text = maxx.ToString(CultureInfo.InvariantCulture);
+                    txtMaxY.Text = maxy.ToString(CultureInfo.InvariantCulture);
+                }
+            }
+        }
+
+        private void btnGetMapKml_Click(object sender, EventArgs e)
+        {
+            var mapagent = _conn.GetCustomProperty("BaseUrl").ToString(); //NOXLATE
+            mapagent += "mapagent/mapagent.fcgi?SESSION=" + _conn.SessionID + "&VERSION=1.0.0&OPERATION=GETMAPKML&DPI=96&MAPDEFINITION=" + _map.MapDefinition + "&FORMAT=KML&CLIENTAGENT=Maestro Local Map Previewer"; //NOXLATE
+            _launcher.OpenUrl(mapagent);
+        }
+
+        public override ViewRegion DefaultRegion => ViewRegion.Document;
+    }
+}

Added: trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.resx	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Preview/MapPreviewViewContent.resx	2017-01-20 11:15:58 UTC (rev 9119)
@@ -0,0 +1,129 @@
+<?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>
+  <metadata name="defaultToolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>148, 17</value>
+  </metadata>
+  <metadata name="mapStatusTracker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>257, 17</value>
+  </metadata>
+</root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -1,17 +1,17 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.34209
+//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace Maestro.Editors
-{
-
-
+namespace Maestro.Editors {
+    using System;
+    
+    
     /// <summary>
     ///   A strongly-typed resource class, for looking up localized strings, etc.
     /// </summary>
@@ -2558,6 +2558,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Resource Preview.
+        /// </summary>
+        internal static string ResourcePreviewTitle {
+            get {
+                return ResourceManager.GetString("ResourcePreviewTitle", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Saved tile set to: {0}.
         /// </summary>
         internal static string SavedTileSet {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2017-01-20 11:15:58 UTC (rev 9119)
@@ -1721,4 +1721,7 @@
   <data name="MgCookerIncompatibleTileSet" xml:space="preserve">
     <value>MgCooker only works with Tile Sets using the 'Default' tile provider</value>
   </data>
+  <data name="ResourcePreviewTitle" xml:space="preserve">
+    <value>Resource Preview</value>
+  </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.LiveMapEditor/Program.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.LiveMapEditor/Program.cs	2017-01-11 15:11:06 UTC (rev 9118)
+++ trunk/Tools/Maestro/Maestro.LiveMapEditor/Program.cs	2017-01-20 11:15:58 UTC (rev 9119)
@@ -50,10 +50,10 @@
 
             //Register previewers
             var urlLauncher = new OurUrlLauncher();
-            ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher)); //NOXLATE
+            ResourcePreviewerFactory.RegisterPreviewer("Maestro.Http", new LocalMapPreviewer(new DefaultResourcePreviewer(urlLauncher), urlLauncher, null)); //NOXLATE
             //A stub previewer does nothing, but will use local map previews for applicable resources if the configuration
             //property is set
-            ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher)); //NOXLATE
+            ResourcePreviewerFactory.RegisterPreviewer("Maestro.LocalNative", new LocalMapPreviewer(new StubPreviewer(), urlLauncher, null)); //NOXLATE
 
             //Can't use this code, it requires a call to MgdPlatform.Initialize which we can't call indirectly :(
             /*



More information about the mapguide-commits mailing list