[mapguide-commits] r6114 - in
trunk/Tools/Maestro/Maestro.AddIn.Local: . Services UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Sep 5 07:41:03 EDT 2011
Author: jng
Date: 2011-09-05 04:41:03 -0700 (Mon, 05 Sep 2011)
New Revision: 6114
Added:
trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Viewer.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.Designer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.resx
Modified:
trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj
trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgFoundation.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgGeometry.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsCommon.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsQueryEngine.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsResource.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgMdfModel.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgMdfParser.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgPlatformBase.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgRenderers.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/MgStylization.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs
trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx
Log:
Update mg-desktop binaries (revision babc6614c9). Replace existing map preview window to use the new map viewer component
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj 2011-09-05 07:37:53 UTC (rev 6113)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Maestro.AddIn.Local.csproj 2011-09-05 11:41:03 UTC (rev 6114)
@@ -34,6 +34,11 @@
<Reference Include="OSGeo.MapGuide.Desktop, Version=2.4.0.0, Culture=neutral, PublicKeyToken=e75f9fd7cf82dc3f, processorArchitecture=x86">
<Private>False</Private>
</Reference>
+ <Reference Include="OSGeo.MapGuide.Viewer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>.\OSGeo.MapGuide.Viewer.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@@ -61,6 +66,12 @@
<Compile Include="UI\MapPreviewWindow.Designer.cs">
<DependentUpon>MapPreviewWindow.cs</DependentUpon>
</Compile>
+ <Compile Include="UI\ZoomScaleDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="UI\ZoomScaleDialog.Designer.cs">
+ <DependentUpon>ZoomScaleDialog.cs</DependentUpon>
+ </Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Maestro.Base\Maestro.Base.csproj">
@@ -287,6 +298,9 @@
<None Include="Resources\arrow-225.png" />
<None Include="Resources\arrow-135.png" />
<None Include="Resources\arrow-045.png" />
+ <Content Include="OSGeo.MapGuide.Viewer.dll">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="xerces-c_3_1mg.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -988,6 +1002,9 @@
<EmbeddedResource Include="UI\MapPreviewWindow.resx">
<DependentUpon>MapPreviewWindow.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="UI\ZoomScaleDialog.resx">
+ <DependentUpon>ZoomScaleDialog.cs</DependentUpon>
+ </EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgFoundation.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgGeometry.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsCommon.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsQueryEngine.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgGwsResource.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgMdfModel.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgMdfParser.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgPlatformBase.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgRenderers.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgStylization.dll
===================================================================
(Binary files differ)
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
===================================================================
(Binary files differ)
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Viewer.dll
===================================================================
(Binary files differ)
Property changes on: trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Viewer.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs 2011-09-05 07:37:53 UTC (rev 6113)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Services/LocalPreviewer.cs 2011-09-05 11:41:03 UTC (rev 6114)
@@ -26,7 +26,6 @@
using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide;
-using Maestro.AddIn.Local.UI;
using OSGeo.MapGuide.ObjectModels.WatermarkDefinition;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
@@ -81,9 +80,13 @@
var mapResId = new MgResourceIdentifier("Session:" + edSvc.SessionID + "//" + Guid.NewGuid() + "." + res.ResourceType.ToString());
edSvc.ResourceService.SetResourceXmlData(mapResId.ToString(), ResourceTypeRegistry.Serialize(mapDef));
- MgdMap map = new MgdMap(mapResId);
+ //MgdMap map = new MgdMap(mapResId);
- var diag = new MapPreviewWindow(map, conn);
+ //var diag = new MapPreviewWindow(map, conn);
+ //diag.ShowDialog();
+
+ var diag = new UI.MapPreviewWindow(conn);
+ diag.Init(mapResId);
diag.ShowDialog();
}
}
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs 2011-09-05 07:37:53 UTC (rev 6113)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.Designer.cs 2011-09-05 11:41:03 UTC (rev 6114)
@@ -28,323 +28,177 @@
/// </summary>
private void InitializeComponent()
{
- this.splitContainer1 = new System.Windows.Forms.SplitContainer();
- this.mapImage = new System.Windows.Forms.PictureBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.btnZoomScale = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.numScale = new System.Windows.Forms.NumericUpDown();
- this.btnLowerRight = new System.Windows.Forms.Button();
- this.btnLowerLeft = new System.Windows.Forms.Button();
- this.btnUpperLeft = new System.Windows.Forms.Button();
- this.btnUpperRight = new System.Windows.Forms.Button();
- this.btnClearSelect = new System.Windows.Forms.Button();
- this.chkSelectFeatures = new System.Windows.Forms.CheckBox();
- this.btnZoomExtents = new System.Windows.Forms.Button();
- this.btnZoomOut = new System.Windows.Forms.Button();
- this.btnZoomIn = new System.Windows.Forms.Button();
- this.btnDown = new System.Windows.Forms.Button();
- this.btnRight = new System.Windows.Forms.Button();
- this.btnLeft = new System.Windows.Forms.Button();
- this.btnUp = new System.Windows.Forms.Button();
- this.renderWorker = new System.ComponentModel.BackgroundWorker();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapPreviewWindow));
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblCoordinates = new System.Windows.Forms.ToolStripStatusLabel();
this.lblFeaturesSelected = new System.Windows.Forms.ToolStripStatusLabel();
+ this.lblScale = new System.Windows.Forms.ToolStripStatusLabel();
+ this.lblSelectedFeatures = new System.Windows.Forms.ToolStripStatusLabel();
+ this.lblMapSize = new System.Windows.Forms.ToolStripStatusLabel();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.legend = new MapViewer.MgLegend();
+ this.propertyPane = new MapViewer.MgPropertyPane();
+ this.viewer = new MapViewer.MgMapViewer();
+ this.toolbar = new MapViewer.MgDefaultToolbar();
+ this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
+ this.statusStrip1.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.mapImage)).BeginInit();
- this.panel1.SuspendLayout();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numScale)).BeginInit();
- this.statusStrip1.SuspendLayout();
+ this.splitContainer2.Panel1.SuspendLayout();
+ this.splitContainer2.Panel2.SuspendLayout();
+ this.splitContainer2.SuspendLayout();
+ this.toolbar.SuspendLayout();
this.SuspendLayout();
//
- // splitContainer1
+ // statusStrip1
//
- this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
- this.splitContainer1.Location = new System.Drawing.Point(0, 0);
- this.splitContainer1.Name = "splitContainer1";
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.lblCoordinates,
+ this.lblFeaturesSelected,
+ this.lblScale,
+ this.lblSelectedFeatures,
+ this.lblMapSize});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 465);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(674, 22);
+ this.statusStrip1.TabIndex = 1;
+ this.statusStrip1.Text = "statusStrip1";
//
- // splitContainer1.Panel1
+ // lblCoordinates
//
- this.splitContainer1.Panel1.Controls.Add(this.mapImage);
+ this.lblCoordinates.Name = "lblCoordinates";
+ this.lblCoordinates.Size = new System.Drawing.Size(0, 17);
+ this.lblCoordinates.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
- // splitContainer1.Panel2
+ // lblFeaturesSelected
//
- this.splitContainer1.Panel2.Controls.Add(this.panel1);
- this.splitContainer1.Size = new System.Drawing.Size(674, 465);
- this.splitContainer1.SplitterDistance = 549;
- this.splitContainer1.TabIndex = 0;
+ this.lblFeaturesSelected.Name = "lblFeaturesSelected";
+ this.lblFeaturesSelected.Size = new System.Drawing.Size(659, 17);
+ this.lblFeaturesSelected.Spring = true;
//
- // mapImage
+ // lblScale
//
- this.mapImage.Dock = System.Windows.Forms.DockStyle.Fill;
- this.mapImage.Location = new System.Drawing.Point(0, 0);
- this.mapImage.Name = "mapImage";
- this.mapImage.Size = new System.Drawing.Size(549, 465);
- this.mapImage.TabIndex = 0;
- this.mapImage.TabStop = false;
- this.mapImage.MouseMove += new System.Windows.Forms.MouseEventHandler(this.mapImage_MouseMove);
- this.mapImage.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mapImage_MouseClick);
+ this.lblScale.Name = "lblScale";
+ this.lblScale.Size = new System.Drawing.Size(0, 17);
//
- // panel1
+ // lblSelectedFeatures
//
- this.panel1.Controls.Add(this.groupBox1);
- this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(121, 465);
- this.panel1.TabIndex = 0;
+ this.lblSelectedFeatures.Name = "lblSelectedFeatures";
+ this.lblSelectedFeatures.Size = new System.Drawing.Size(0, 17);
//
- // groupBox1
+ // lblMapSize
//
- this.groupBox1.Controls.Add(this.btnZoomScale);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.numScale);
- this.groupBox1.Controls.Add(this.btnLowerRight);
- this.groupBox1.Controls.Add(this.btnLowerLeft);
- this.groupBox1.Controls.Add(this.btnUpperLeft);
- this.groupBox1.Controls.Add(this.btnUpperRight);
- this.groupBox1.Controls.Add(this.btnClearSelect);
- this.groupBox1.Controls.Add(this.chkSelectFeatures);
- this.groupBox1.Controls.Add(this.btnZoomExtents);
- this.groupBox1.Controls.Add(this.btnZoomOut);
- this.groupBox1.Controls.Add(this.btnZoomIn);
- this.groupBox1.Controls.Add(this.btnDown);
- this.groupBox1.Controls.Add(this.btnRight);
- this.groupBox1.Controls.Add(this.btnLeft);
- this.groupBox1.Controls.Add(this.btnUp);
- this.groupBox1.Location = new System.Drawing.Point(4, 4);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(112, 336);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Controls";
+ this.lblMapSize.Name = "lblMapSize";
+ this.lblMapSize.Size = new System.Drawing.Size(0, 17);
//
- // btnZoomScale
+ // splitContainer1
//
- this.btnZoomScale.Location = new System.Drawing.Point(22, 295);
- this.btnZoomScale.Name = "btnZoomScale";
- this.btnZoomScale.Size = new System.Drawing.Size(66, 23);
- this.btnZoomScale.TabIndex = 17;
- this.btnZoomScale.Text = "Zoom";
- this.btnZoomScale.UseVisualStyleBackColor = true;
- this.btnZoomScale.Click += new System.EventHandler(this.btnZoomScale_Click);
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 25);
+ this.splitContainer1.Name = "splitContainer1";
//
- // label1
+ // splitContainer1.Panel1
//
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(19, 252);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(71, 13);
- this.label1.TabIndex = 16;
- this.label1.Text = "Current Scale";
+ this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
//
- // numScale
+ // splitContainer1.Panel2
//
- this.numScale.Location = new System.Drawing.Point(22, 268);
- this.numScale.Maximum = new decimal(new int[] {
- 99999,
- 0,
- 0,
- 0});
- this.numScale.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numScale.Name = "numScale";
- this.numScale.Size = new System.Drawing.Size(66, 20);
- this.numScale.TabIndex = 15;
- this.numScale.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
+ this.splitContainer1.Panel2.Controls.Add(this.viewer);
+ this.splitContainer1.Size = new System.Drawing.Size(674, 440);
+ this.splitContainer1.SplitterDistance = 224;
+ this.splitContainer1.TabIndex = 2;
//
- // btnLowerRight
+ // splitContainer2
//
- this.btnLowerRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_315;
- this.btnLowerRight.Location = new System.Drawing.Point(75, 93);
- this.btnLowerRight.Name = "btnLowerRight";
- this.btnLowerRight.Size = new System.Drawing.Size(30, 30);
- this.btnLowerRight.TabIndex = 14;
- this.btnLowerRight.UseVisualStyleBackColor = true;
- this.btnLowerRight.Click += new System.EventHandler(this.btnLowerRight_Click);
+ this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer2.Name = "splitContainer2";
+ this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
- // btnLowerLeft
+ // splitContainer2.Panel1
//
- this.btnLowerLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_225;
- this.btnLowerLeft.Location = new System.Drawing.Point(6, 93);
- this.btnLowerLeft.Name = "btnLowerLeft";
- this.btnLowerLeft.Size = new System.Drawing.Size(30, 30);
- this.btnLowerLeft.TabIndex = 13;
- this.btnLowerLeft.UseVisualStyleBackColor = true;
- this.btnLowerLeft.Click += new System.EventHandler(this.btnLowerLeft_Click);
+ this.splitContainer2.Panel1.Controls.Add(this.legend);
//
- // btnUpperLeft
+ // splitContainer2.Panel2
//
- this.btnUpperLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_135;
- this.btnUpperLeft.Location = new System.Drawing.Point(6, 20);
- this.btnUpperLeft.Name = "btnUpperLeft";
- this.btnUpperLeft.Size = new System.Drawing.Size(30, 30);
- this.btnUpperLeft.TabIndex = 12;
- this.btnUpperLeft.UseVisualStyleBackColor = true;
- this.btnUpperLeft.Click += new System.EventHandler(this.btnUpperLeft_Click);
+ this.splitContainer2.Panel2.Controls.Add(this.propertyPane);
+ this.splitContainer2.Size = new System.Drawing.Size(224, 440);
+ this.splitContainer2.SplitterDistance = 223;
+ this.splitContainer2.TabIndex = 0;
//
- // btnUpperRight
+ // legend
//
- this.btnUpperRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_045;
- this.btnUpperRight.Location = new System.Drawing.Point(74, 20);
- this.btnUpperRight.Name = "btnUpperRight";
- this.btnUpperRight.Size = new System.Drawing.Size(30, 30);
- this.btnUpperRight.TabIndex = 11;
- this.btnUpperRight.UseVisualStyleBackColor = true;
- this.btnUpperRight.Click += new System.EventHandler(this.btnUpperRight_Click);
+ this.legend.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.legend.Location = new System.Drawing.Point(0, 0);
+ this.legend.Name = "legend";
+ this.legend.Size = new System.Drawing.Size(224, 223);
+ this.legend.TabIndex = 0;
//
- // btnClearSelect
+ // propertyPane
//
- this.btnClearSelect.Image = global::Maestro.AddIn.Local.Properties.Resources.icon_clearselect;
- this.btnClearSelect.Location = new System.Drawing.Point(58, 183);
- this.btnClearSelect.Name = "btnClearSelect";
- this.btnClearSelect.Size = new System.Drawing.Size(30, 30);
- this.btnClearSelect.TabIndex = 8;
- this.btnClearSelect.UseVisualStyleBackColor = true;
- this.btnClearSelect.Click += new System.EventHandler(this.btnClearSelect_Click);
+ this.propertyPane.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.propertyPane.Location = new System.Drawing.Point(0, 0);
+ this.propertyPane.Name = "propertyPane";
+ this.propertyPane.Size = new System.Drawing.Size(224, 213);
+ this.propertyPane.TabIndex = 1;
//
- // chkSelectFeatures
+ // viewer
//
- this.chkSelectFeatures.AutoSize = true;
- this.chkSelectFeatures.Location = new System.Drawing.Point(22, 219);
- this.chkSelectFeatures.Name = "chkSelectFeatures";
- this.chkSelectFeatures.Size = new System.Drawing.Size(56, 17);
- this.chkSelectFeatures.TabIndex = 7;
- this.chkSelectFeatures.Text = "Select";
- this.chkSelectFeatures.UseVisualStyleBackColor = true;
+ this.viewer.ActiveTool = MapViewer.MapActiveTool.None;
+ this.viewer.Cursor = System.Windows.Forms.Cursors.Default;
+ this.viewer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.viewer.FeatureTooltipsEnabled = false;
+ this.viewer.Location = new System.Drawing.Point(0, 0);
+ this.viewer.Name = "viewer";
+ this.viewer.Size = new System.Drawing.Size(446, 440);
+ this.viewer.TabIndex = 0;
+ this.viewer.Text = "mgMapViewer1";
+ this.viewer.ZoomInFactor = 0.75;
+ this.viewer.ZoomOutFactor = 1.35;
//
- // btnZoomExtents
+ // toolbar
//
- this.btnZoomExtents.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_fit;
- this.btnZoomExtents.Location = new System.Drawing.Point(22, 183);
- this.btnZoomExtents.Name = "btnZoomExtents";
- this.btnZoomExtents.Size = new System.Drawing.Size(30, 30);
- this.btnZoomExtents.TabIndex = 6;
- this.btnZoomExtents.UseVisualStyleBackColor = true;
- this.btnZoomExtents.Click += new System.EventHandler(this.btnZoomExtents_Click);
+ this.toolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripButton1});
+ this.toolbar.Location = new System.Drawing.Point(0, 0);
+ this.toolbar.Name = "toolbar";
+ this.toolbar.Size = new System.Drawing.Size(674, 25);
+ this.toolbar.TabIndex = 3;
+ this.toolbar.Text = "mgDefaultToolbar1";
+ this.toolbar.Viewer = null;
//
- // btnZoomOut
+ // toolStripButton1
//
- this.btnZoomOut.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_out;
- this.btnZoomOut.Location = new System.Drawing.Point(58, 147);
- this.btnZoomOut.Name = "btnZoomOut";
- this.btnZoomOut.Size = new System.Drawing.Size(30, 30);
- this.btnZoomOut.TabIndex = 5;
- this.btnZoomOut.UseVisualStyleBackColor = true;
- this.btnZoomOut.Click += new System.EventHandler(this.btnZoomOut_Click);
+ this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
+ this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolStripButton1.Name = "toolStripButton1";
+ this.toolStripButton1.Size = new System.Drawing.Size(106, 22);
+ this.toolStripButton1.Text = "Zoom To Scale";
+ this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
- // btnZoomIn
- //
- this.btnZoomIn.Image = global::Maestro.AddIn.Local.Properties.Resources.magnifier_zoom_in;
- this.btnZoomIn.Location = new System.Drawing.Point(22, 147);
- this.btnZoomIn.Name = "btnZoomIn";
- this.btnZoomIn.Size = new System.Drawing.Size(30, 30);
- this.btnZoomIn.TabIndex = 4;
- this.btnZoomIn.UseVisualStyleBackColor = true;
- this.btnZoomIn.Click += new System.EventHandler(this.btnZoomIn_Click);
- //
- // btnDown
- //
- this.btnDown.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_270;
- this.btnDown.Location = new System.Drawing.Point(40, 93);
- this.btnDown.Name = "btnDown";
- this.btnDown.Size = new System.Drawing.Size(30, 30);
- this.btnDown.TabIndex = 3;
- this.btnDown.UseVisualStyleBackColor = true;
- this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
- //
- // btnRight
- //
- this.btnRight.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow;
- this.btnRight.Location = new System.Drawing.Point(74, 57);
- this.btnRight.Name = "btnRight";
- this.btnRight.Size = new System.Drawing.Size(30, 30);
- this.btnRight.TabIndex = 2;
- this.btnRight.UseVisualStyleBackColor = true;
- this.btnRight.Click += new System.EventHandler(this.btnRight_Click);
- //
- // btnLeft
- //
- this.btnLeft.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_180;
- this.btnLeft.Location = new System.Drawing.Point(6, 57);
- this.btnLeft.Name = "btnLeft";
- this.btnLeft.Size = new System.Drawing.Size(30, 30);
- this.btnLeft.TabIndex = 1;
- this.btnLeft.UseVisualStyleBackColor = true;
- this.btnLeft.Click += new System.EventHandler(this.btnLeft_Click);
- //
- // btnUp
- //
- this.btnUp.Image = global::Maestro.AddIn.Local.Properties.Resources.arrow_090;
- this.btnUp.Location = new System.Drawing.Point(40, 20);
- this.btnUp.Name = "btnUp";
- this.btnUp.Size = new System.Drawing.Size(30, 30);
- this.btnUp.TabIndex = 0;
- this.btnUp.UseVisualStyleBackColor = true;
- this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
- //
- // renderWorker
- //
- this.renderWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.renderWorker_DoWork);
- this.renderWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.renderWorker_RunWorkerCompleted);
- this.renderWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.renderWorker_ProgressChanged);
- //
- // statusStrip1
- //
- this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.lblCoordinates,
- this.lblFeaturesSelected});
- this.statusStrip1.Location = new System.Drawing.Point(0, 465);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(674, 22);
- this.statusStrip1.TabIndex = 1;
- this.statusStrip1.Text = "statusStrip1";
- //
- // lblCoordinates
- //
- this.lblCoordinates.Name = "lblCoordinates";
- this.lblCoordinates.Size = new System.Drawing.Size(659, 17);
- this.lblCoordinates.Spring = true;
- this.lblCoordinates.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // lblFeaturesSelected
- //
- this.lblFeaturesSelected.Name = "lblFeaturesSelected";
- this.lblFeaturesSelected.Size = new System.Drawing.Size(0, 17);
- //
// MapPreviewWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(674, 487);
this.Controls.Add(this.splitContainer1);
+ this.Controls.Add(this.toolbar);
this.Controls.Add(this.statusStrip1);
this.Name = "MapPreviewWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Map Preview";
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.mapImage)).EndInit();
- this.panel1.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numScale)).EndInit();
- this.statusStrip1.ResumeLayout(false);
- this.statusStrip1.PerformLayout();
+ this.splitContainer2.Panel1.ResumeLayout(false);
+ this.splitContainer2.Panel2.ResumeLayout(false);
+ this.splitContainer2.ResumeLayout(false);
+ this.toolbar.ResumeLayout(false);
+ this.toolbar.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -352,29 +206,18 @@
#endregion
- private System.Windows.Forms.SplitContainer splitContainer1;
- private System.Windows.Forms.PictureBox mapImage;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button btnDown;
- private System.Windows.Forms.Button btnRight;
- private System.Windows.Forms.Button btnLeft;
- private System.Windows.Forms.Button btnUp;
- private System.Windows.Forms.Button btnZoomOut;
- private System.Windows.Forms.Button btnZoomIn;
- private System.Windows.Forms.Button btnZoomExtents;
- private System.ComponentModel.BackgroundWorker renderWorker;
- private System.Windows.Forms.CheckBox chkSelectFeatures;
- private System.Windows.Forms.Button btnClearSelect;
- private System.Windows.Forms.Button btnLowerRight;
- private System.Windows.Forms.Button btnLowerLeft;
- private System.Windows.Forms.Button btnUpperLeft;
- private System.Windows.Forms.Button btnUpperRight;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.NumericUpDown numScale;
- private System.Windows.Forms.Button btnZoomScale;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblCoordinates;
private System.Windows.Forms.ToolStripStatusLabel lblFeaturesSelected;
+ private System.Windows.Forms.ToolStripStatusLabel lblScale;
+ private System.Windows.Forms.ToolStripStatusLabel lblSelectedFeatures;
+ private System.Windows.Forms.ToolStripStatusLabel lblMapSize;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.SplitContainer splitContainer2;
+ private MapViewer.MgLegend legend;
+ private MapViewer.MgPropertyPane propertyPane;
+ private MapViewer.MgMapViewer viewer;
+ private MapViewer.MgDefaultToolbar toolbar;
+ private System.Windows.Forms.ToolStripButton toolStripButton1;
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs 2011-09-05 07:37:53 UTC (rev 6113)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.cs 2011-09-05 11:41:03 UTC (rev 6114)
@@ -30,578 +30,69 @@
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.MaestroAPI;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using MapViewer;
+using ICSharpCode.Core;
namespace Maestro.AddIn.Local.UI
{
- public partial class MapPreviewWindow : Form
+ public partial class MapPreviewWindow : Form, IMapStatusBar
{
- private MgdMap _map;
- private MgRenderingService _renderSvc;
- private MgCoordinateSystem _mapCs;
- private MgdSelection _selection;
- private MgRenderingOptions _layerRenderOpts;
- private MgMeasure _mapMeasure;
- private MgWktReaderWriter _wktRW;
- private MgAgfReaderWriter _agfRW;
- private MgGeometryFactory _geomFact;
+ private IServerConnection _conn;
- private Color _mapBgColor;
-
- public MapPreviewWindow(MgdMap map, IServerConnection conn)
+ public MapPreviewWindow(IServerConnection conn)
{
InitializeComponent();
- _map = map;
- var fact = new MgCoordinateSystemFactory();
- _mapCs = fact.Create(_map.GetMapSRS());
- _mapMeasure = _mapCs.GetMeasure();
- _wktRW = new MgWktReaderWriter();
- _agfRW = new MgAgfReaderWriter();
- _geomFact = new MgGeometryFactory();
- this.Disposed += new EventHandler(OnDisposed);
+ _conn = conn;
- Init(_map, conn);
+ new MapViewerController(viewer, legend, this, propertyPane, toolbar);
+ this.Disposed += OnDisposed;
}
- void OnDisposed(object sender, EventArgs e)
- {
- if (_renderSvc != null)
- {
- _renderSvc.Dispose();
- _renderSvc = null;
- }
+ private MgdMap _map;
- if (_selection != null)
- {
- _selection.Dispose();
- _selection = null;
- }
-
- if (_mapMeasure != null)
- {
- _mapMeasure.Dispose();
- _mapMeasure = null;
- }
-
- if (_mapCs != null)
- {
- _mapCs.Dispose();
- _mapCs = null;
- }
-
- if (_wktRW != null)
- {
- _wktRW.Dispose();
- _wktRW = null;
- }
-
- if (_agfRW != null)
- {
- _agfRW.Dispose();
- _agfRW = null;
- }
-
- if (_geomFact != null)
- {
- _geomFact.Dispose();
- _geomFact = null;
- }
- }
-
- private double _orgX1;
- private double _orgX2;
- private double _orgY1;
- private double _orgY2;
-
- private double _extX1;
- private double _extX2;
- private double _extY1;
- private double _extY2;
-
- private bool _init = false;
-
-#if DEBUG
- private MgdLayer _debugLayer;
-#endif
-
- public void Init(MgdMap map, IServerConnection conn)
+ public void Init(MgResourceIdentifier mapResId)
{
- numScale.Maximum = int.MaxValue;
- _init = false;
- _renderSvc = MgServiceFactory.CreateRenderingService();
- _layerRenderOpts = new MgRenderingOptions(MgImageFormats.Png, 7, new MgColor(0, 0, 255));
-
- _map = map;
- var bgColor = _map.GetBackgroundColor();
- if (bgColor.Length == 8 || bgColor.Length == 6)
- {
- _mapBgColor = ColorTranslator.FromHtml("#" + bgColor);
- mapImage.BackColor = _mapBgColor;
- }
- _map.SetDisplaySize(mapImage.Width, mapImage.Height);
- _selection = new MgdSelection(_map);
-
- var env = _map.GetMapExtent();
- var ll = env.LowerLeftCoordinate;
- var ur = env.UpperRightCoordinate;
-
- _extX1 = _orgX1 = ll.X;
- _extY2 = _orgY2 = ll.Y;
- _extX2 = _orgX2 = ur.X;
- _extY1 = _orgY1 = ur.Y;
-
- if ((_orgX1 - _orgX2) == 0 || (_orgY1 - _orgY2) == 0)
- {
- _extX1 = _orgX1 = -.1;
- _extY2 = _orgX2 = .1;
- _extX2 = _orgY1 = -.1;
- _extY1 = _orgY2 = .1;
- }
-
- double scale = CalculateScale(Math.Abs(_orgX2 - _orgX1), Math.Abs(_orgY2 - _orgY1), this.Width, this.Height);
- numScale.Value = Convert.ToDecimal(scale);
- _map.SetViewCenterXY(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 2);
- _map.SetViewScale(scale);
-
-#if DEBUG
- CreateDebugFeatureSource(conn);
-#endif
-
- _init = true;
+ _map = new MgdMap(mapResId);
+ viewer.Init(_map);
+ viewer.RefreshMap();
}
-#if DEBUG
- private void CreateDebugFeatureSource(IServerConnection conn)
+ void OnDisposed(object sender, EventArgs e)
{
- var id = new MgDataPropertyDefinition("ID");
- id.DataType = MgPropertyType.Int32;
- id.Nullable = false;
- id.SetAutoGeneration(true);
-
- var geom = new MgGeometricPropertyDefinition("Geometry");
- geom.GeometryTypes = MgFeatureGeometricType.Point;
- geom.SpatialContextAssociation = "MapCs";
-
- var cls = new MgClassDefinition();
- cls.Name = "Debug";
- var props = cls.GetProperties();
- props.Add(id);
- props.Add(geom);
-
- var idProps = cls.GetIdentityProperties();
- idProps.Add(id);
-
- cls.DefaultGeometryPropertyName = "Geometry";
-
- var schema = new MgFeatureSchema("Default", "Default schema");
- var classes = schema.GetClasses();
- classes.Add(cls);
-
- var debugFsId = new MgResourceIdentifier("Session:" + conn.SessionID + "//Debug" + Guid.NewGuid().ToString() + ".FeatureSource");
- var createSdf = new MgCreateSdfParams("MapCs", _map.GetMapSRS(), schema);
- var featureSvc = MgServiceFactory.CreateFeatureService();
- var resSvc = MgServiceFactory.CreateResourceService();
- featureSvc.CreateFeatureSource(debugFsId, createSdf);
-
- //We use a v1.0.0 Layer Definition so that a default composite style is not created
- //A composite style would override every other basic geometry style
- var ldf = ObjectFactory.CreateDefaultLayer(conn, LayerType.Vector, new Version(1, 0, 0));
- var vl = ((IVectorLayerDefinition)ldf.SubLayer);
- vl.FeatureName = "Default:Debug";
- vl.ResourceId = debugFsId.ToString();
- vl.Geometry = "Geometry";
-
- var vsrs = new List<IVectorScaleRange>(vl.VectorScaleRange);
- var rules = new List<IPointRule>(vsrs[0].PointStyle.Rules);
- rules[0].Label = ldf.CreateDefaultTextSymbol();
- rules[0].Label.SetForegroundColor(Color.Red);
- rules[0].Label.BackgroundStyle = BackgroundStyleType.Ghosted;
- rules[0].Label.Text = "Concat(X(Geometry),',',Y(Geometry))";
-
- var debugLayerId = new MgResourceIdentifier("Session:" + conn.SessionID + "//" + debugFsId.Name + ".LayerDefinition");
- ldf.ResourceID = debugLayerId.ToString();
- conn.ResourceService.SaveResource(ldf);
-
- _debugLayer = new MgdLayer(debugLayerId, resSvc);
- _debugLayer.SetVisible(true);
- _debugLayer.SetDisplayInLegend(true);
-
- var mapLayers = _map.GetLayers();
- mapLayers.Insert(0, _debugLayer);
-
- UpdateCenterDebugPoint();
- }
-
- private MgPropertyCollection _debugCenter;
-
- private void UpdateCenterDebugPoint()
- {
- if (_debugCenter == null)
- _debugCenter = new MgPropertyCollection();
-
- var center = _wktRW.Read("POINT (" + _map.ViewCenter.Coordinate.X + " " + _map.ViewCenter.Coordinate.Y + ")");
- var agf = _agfRW.Write(center);
- if (!_debugCenter.Contains("Geometry"))
+ if (_map != null)
{
- MgGeometryProperty geom = new MgGeometryProperty("Geometry", agf);
- _debugCenter.Add(geom);
+ _map.Dispose();
+ _map = null;
}
- else
- {
- MgGeometryProperty geom = (MgGeometryProperty)_debugCenter.GetItem("Geometry");
- geom.SetValue(agf);
- }
-
- int deleted = _debugLayer.DeleteFeatures("");
- Trace.TraceInformation("Deleted {0} debug points", deleted);
- var reader = _debugLayer.InsertFeatures(_debugCenter);
- int inserted = 0;
- while (reader.ReadNext())
- {
- inserted++;
- }
- reader.Close();
- Trace.TraceInformation("Added {0} debug points", inserted);
- _debugLayer.ForceRefresh();
}
-#endif
- private double CalculateScale(double mcsW, double mcsH, int devW, int devH)
+ public void SetCursorPositionMessage(string message)
{
- var mpu = _map.GetMetersPerUnit();
- var mpp = 0.0254 / _map.DisplayDpi;
- if (devH * mcsW > devW * mcsH)
- return mcsW * mpu / (devW * mpp); //width-limited
- else
- return mcsH * mpu / (devH * mpp); //height-limited
+ lblCoordinates.Text = message;
}
- protected override void OnLoad(EventArgs e)
+ public void SetFeatureSelectedMessage(string message)
{
- base.OnLoad(e);
- ZoomExtents();
+ lblFeaturesSelected.Text = message;
}
- protected override void OnResize(EventArgs e)
+ public void SetMapScaleMessage(string message)
{
- if (!_init)
- return;
-
- base.OnResize(e);
- _map.SetDisplaySize(mapImage.Width, mapImage.Height);
- RefreshMap();
+ lblScale.Text = message;
}
- class RenderWorkArgs
+ public void SetMapSizeMessage(string message)
{
- public MgRenderingOptions RenderingOptions { get; set; }
+ lblMapSize.Text = message;
}
- class RenderResult
+ private void toolStripButton1_Click(object sender, EventArgs e)
{
- public Image Image { get; set; }
-
- public Image Overlay { get; set; }
- }
-
- public void RefreshMap()
- {
- if (renderWorker.IsBusy)
- return;
-
- if (mapImage.Image != null)
+ var diag = new ZoomScaleDialog();
+ if (diag.ShowDialog() == DialogResult.OK)
{
- mapImage.Image.Dispose();
- mapImage.Image = null;
+ viewer.ZoomToScale(diag.Value);
}
-
- renderWorker.RunWorkerAsync(new RenderWorkArgs() { RenderingOptions = _layerRenderOpts });
}
-
- public void Pan(double x, double y, bool refresh)
- {
- ZoomToView(x, y, _map.ViewScale, refresh);
- }
-
- public void ZoomToView(double x, double y, double scale, bool refresh)
- {
- _map.SetViewCenterXY(x, y);
-#if DEBUG
- UpdateCenterDebugPoint();
- //var mapExt = _map.MapExtent;
- //var dataExt = _map.DataExtent;
- //Trace.TraceInformation("Map Extent is ({0},{1} {2},{3})", mapExt.LowerLeftCoordinate.X, mapExt.LowerLeftCoordinate.Y, mapExt.UpperRightCoordinate.X, mapExt.UpperRightCoordinate.Y);
- //Trace.TraceInformation("Data Extent is ({0},{1} {2},{3})", dataExt.LowerLeftCoordinate.X, dataExt.LowerLeftCoordinate.Y, dataExt.UpperRightCoordinate.X, dataExt.UpperRightCoordinate.Y);
-
- Trace.TraceInformation("Center is (" + x + ", " + y + ")");
-#endif
- _map.SetViewScale(scale);
-
- //Update current extents
- double mpu = _map.GetMetersPerUnit();
- double mpp = 0.0254 / _map.DisplayDpi;
-
- var mcsWidth = _map.DisplayWidth * mpp * scale / mpu;
- var mcsHeight = _map.DisplayHeight * mpp * scale / mpu;
-
- _extX1 = x - mcsWidth / 2;
- _extY1 = y + mcsHeight / 2;
- _extX2 = x + mcsWidth / 2;
- _extY2 = y - mcsHeight / 2;
-
-#if DEBUG
- Trace.TraceInformation("Current extents is ({0},{1} {2},{3})", _extX1, _extY1, _extX2, _extY2);
-#endif
-
- //Then refresh
- if (refresh)
- RefreshMap();
- }
-
- private void btnLeft_Click(object sender, EventArgs e)
- {
- PanLeft(true);
- }
-
- private void btnUp_Click(object sender, EventArgs e)
- {
- PanUp(true);
- }
-
- private void btnRight_Click(object sender, EventArgs e)
- {
- PanRight(true);
- }
-
- private void btnDown_Click(object sender, EventArgs e)
- {
- PanDown(true);
- }
-
- private void PanLeft(bool refresh)
- {
- Pan(_extX1 + (_extX2 - _extX1) / 3, _extY2 + (_extY1 - _extY2) / 2, refresh);
- }
-
- private void PanUp(bool refresh)
- {
- Pan(_extX1 + (_extX2 - _extX1) / 2, _extY1 - (_extY1 - _extY2) / 3, refresh);
- }
-
- private void PanRight(bool refresh)
- {
- Pan(_extX2 - (_extX2 - _extX1) / 3, _extY2 + (_extY1 - _extY2) / 2, refresh);
- }
-
- private void PanDown(bool refresh)
- {
- Pan(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 3, refresh);
- }
-
- private void btnZoomIn_Click(object sender, EventArgs e)
- {
- var scale = _map.ViewScale * 0.8;
- ZoomToView(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 2, scale, true);
-
- //_map.SetViewScale(_map.ViewScale * 0.8);
- //RefreshMap();
- }
-
- private void btnZoomOut_Click(object sender, EventArgs e)
- {
- var scale = _map.ViewScale * 1.2;
- ZoomToView(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 2, scale, true);
-
- //_map.SetViewScale(_map.ViewScale * 1.2);
- //RefreshMap();
- }
-
- private void btnZoomExtents_Click(object sender, EventArgs e)
- {
- ZoomExtents();
- }
-
- public void ZoomExtents()
- {
- var scale = CalculateScale((_orgX2 - _orgX1), (_orgY1 - _orgY2), mapImage.Width, mapImage.Height);
- ZoomToView(_orgX1 + ((_orgX2 - _orgX1) / 2), _orgY2 + ((_orgY1 - _orgY2) / 2), scale, true);
- }
-
- private void renderWorker_DoWork(object sender, DoWorkEventArgs e)
- {
- var args = (RenderWorkArgs)e.Argument;
-
- var res = new RenderResult();
- var br = _renderSvc.RenderDynamicOverlay(_map, _selection, args.RenderingOptions);
- byte[] b = new byte[br.GetLength()];
- br.Read(b, b.Length);
-
- using (var ms = new MemoryStream(b))
- {
- res.Image = Image.FromStream(ms);
- }
-
- e.Result = res;
- }
-
- private void renderWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
-
- }
-
- private void renderWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- if (e.Error != null)
- {
- MessageBox.Show(e.Error.Message, "Error");
- }
- else
- {
- var res = (RenderResult)e.Result;
- //set the image
- mapImage.Image = res.Image;
- numScale.Value = Convert.ToDecimal(_map.ViewScale);
- }
- }
-
- private void btnClearSelect_Click(object sender, EventArgs e)
- {
- _selection.Clear();
- RefreshMap();
- }
-
- private void mapImage_MouseClick(object sender, MouseEventArgs e)
- {
- if (!chkSelectFeatures.Checked)
- return;
-
- var mapPt1 = ScreenToMapUnits(e.X-2, e.Y-2);
- var mapPt2 = ScreenToMapUnits(e.X+2, e.Y+2);
-
- var coord1 = _geomFact.CreateCoordinateXY(mapPt1.X, mapPt1.Y);
- var coord2 = _geomFact.CreateCoordinateXY(mapPt2.X, mapPt2.Y);
-
- var dist = _mapMeasure.GetDistance(coord1, coord2);
-
- MgGeometry geom = _wktRW.Read(MakeWktPolygon(mapPt1.X, mapPt1.Y, mapPt2.X, mapPt2.Y));
-
- SelectByGeometry(geom);
- }
-
- private static string MakeWktPolygon(double x1, double y1, double x2, double y2)
- {
- return "POLYGON((" + x1 + " " + y1 + ", " + x2 + " " + y1 + ", " + x2 + " " + y2 + ", " + x1 + " " + y2 + ", " + x1 + " " + y1 + "))";
- }
-
- private Dictionary<string, string> _layerGeomProps = new Dictionary<string, string>();
-
- private void SelectByGeometry(MgGeometry geom)
- {
- var layers = _map.GetLayers();
-
- //Cache geometry properties
- for (int i = 0; i < layers.GetCount(); i++)
- {
- var layer = layers.GetItem(i);
- if (!layer.Selectable || !layer.IsVisible())
- continue;
-
- var objId = layer.GetObjectId();
- if (_layerGeomProps.ContainsKey(objId))
- continue;
-
- var cls = layer.GetClassDefinition();
- var geomName = cls.DefaultGeometryPropertyName;
- if (!string.IsNullOrEmpty(geomName))
- {
- if (!_layerGeomProps.ContainsKey(objId))
- _layerGeomProps[objId] = geomName;
- }
- }
-
- _selection.Clear();
-
- for (int i = 0; i < layers.GetCount(); i++)
- {
- var layer = layers.GetItem(i);
- if (!layer.Selectable || !layer.IsVisible())
- continue;
-
- var objId = layer.GetObjectId();
- MgFeatureQueryOptions query = new MgFeatureQueryOptions();
- query.SetSpatialFilter(_layerGeomProps[objId], geom, MgFeatureSpatialOperations.Intersects);
-
- MgFeatureReader reader = layer.SelectFeatures(query);
- _selection.AddFeatures(layer, reader, 0);
- }
-
- int total = 0;
- for (int i = 0; i < layers.GetCount(); i++)
- {
- var layer = layers.GetItem(i);
- total += _selection.GetSelectedFeaturesCount(layer, layer.FeatureClassName);
- }
- lblFeaturesSelected.Text = string.Format("{0} features selected", total);
-
- string xml = _selection.ToXml();
- if (!string.IsNullOrEmpty(xml))
- RefreshMap();
- }
-
- public PointF ScreenToMapUnits(double x, double y)
- {
- return ScreenToMapUnits(x, y, false);
- }
-
- private PointF ScreenToMapUnits(double x, double y, bool allowOutsideWindow)
- {
- if (!allowOutsideWindow)
- {
- if (x > mapImage.Width - 1) x = mapImage.Width - 1;
- else if (x < 0) x = 0;
-
- if (y > mapImage.Height - 1) y = mapImage.Height - 1;
- else if (y < 0) y = 0;
- }
-
- x = _extX1 + (_extX2 - _extX1) * (x / mapImage.Width);
- y = _extY1 - (_extY1 - _extY2) * (y / mapImage.Height);
- return new PointF((float)x, (float)y);
- }
-
- private void btnUpperLeft_Click(object sender, EventArgs e)
- {
- PanUp(false);
- PanLeft(true);
- }
-
- private void btnUpperRight_Click(object sender, EventArgs e)
- {
- PanUp(false);
- PanRight(true);
- }
-
- private void btnLowerLeft_Click(object sender, EventArgs e)
- {
- PanDown(false);
- PanLeft(true);
- }
-
- private void btnLowerRight_Click(object sender, EventArgs e)
- {
- PanDown(false);
- PanRight(true);
- }
-
- private void btnZoomScale_Click(object sender, EventArgs e)
- {
- var scale = Convert.ToDouble(numScale.Value);
- ZoomToView(_extX1 + (_extX2 - _extX1) / 2, _extY2 + (_extY1 - _extY2) / 2, scale, true);
- }
-
- private void mapImage_MouseMove(object sender, MouseEventArgs e)
- {
- var mapPt = ScreenToMapUnits(e.X, e.Y);
- lblCoordinates.Text = string.Format("X: {0:0.0000000}, Y: {1:0.0000000} ({2})", mapPt.X, mapPt.Y, _mapCs.Units);
- }
}
}
Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx 2011-09-05 07:37:53 UTC (rev 6113)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/MapPreviewWindow.resx 2011-09-05 11:41:03 UTC (rev 6114)
@@ -117,10 +117,26 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <metadata name="renderWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
- </metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>144, 17</value>
</metadata>
+ <metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>260, 17</value>
+ </metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI
+ ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9
+ HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN
+ rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K
+ TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx
+ oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8
+ 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI
+ xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
+ LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
+ KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
+</value>
+ </data>
</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.Designer.cs 2011-09-05 11:41:03 UTC (rev 6114)
@@ -0,0 +1,102 @@
+namespace Maestro.AddIn.Local.UI
+{
+ partial class ZoomScaleDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.numScale = new System.Windows.Forms.NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)(this.numScale)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(64, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Zoom Scale";
+ //
+ // btnOK
+ //
+ this.btnOK.Location = new System.Drawing.Point(115, 37);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 2;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Location = new System.Drawing.Point(197, 37);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 3;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // numScale
+ //
+ this.numScale.Location = new System.Drawing.Point(102, 11);
+ this.numScale.Name = "numScale";
+ this.numScale.Size = new System.Drawing.Size(170, 20);
+ this.numScale.TabIndex = 4;
+ //
+ // ZoomScaleDialog
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(284, 72);
+ this.ControlBox = false;
+ this.Controls.Add(this.numScale);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.label1);
+ this.Name = "ZoomScaleDialog";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Zoom Scale";
+ ((System.ComponentModel.ISupportInitialize)(this.numScale)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.NumericUpDown numScale;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.cs 2011-09-05 11:41:03 UTC (rev 6114)
@@ -0,0 +1,54 @@
+#region Disclaimer / License
+// Copyright (C) 2011, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Maestro.AddIn.Local.UI
+{
+ public partial class ZoomScaleDialog : Form
+ {
+ public ZoomScaleDialog()
+ {
+ InitializeComponent();
+ numScale.Minimum = Convert.ToDecimal(1.0M);
+ numScale.Maximum = Convert.ToDecimal(int.MaxValue);
+ }
+
+ public double Value
+ {
+ get { return Convert.ToDouble(numScale.Value); }
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/UI/ZoomScaleDialog.resx 2011-09-05 11:41:03 UTC (rev 6114)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list