⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 利用CSharp进行二次开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
/*
 Copyright 1995-2005 ESRI

 All rights reserved under the copyright laws of the United States.

 You may freely redistribute and use this sample code, with or without modification.

 Disclaimer: THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 
 WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESRI OR 
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY 
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY 
 WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF 
 SUCH DAMAGE.

 For additional information contact: Environmental Systems Research Institute, Inc.

 Attn: Contracts Dept.

 380 New York Street

 Redlands, California, U.S.A. 92373 

 Email: contracts@esri.com
*/
using System;
using System.Windows.Forms;
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.GlobeCore;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SystemUI;

namespace GlobeNavigation
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private ESRI.ArcGIS.GlobeControl.AxGlobeControl axGlobeControl1;
		internal System.Windows.Forms.TrackBar TrackBar1;
		public System.Windows.Forms.CheckBox chkSpin;
		public System.Windows.Forms.RadioButton optTools1;
		public System.Windows.Forms.RadioButton optTools0;
		public System.Windows.Forms.Button cmdLoadDocument;
		public System.Windows.Forms.Button cmdZoomOut;
		public System.Windows.Forms.Button cmdZoomIn;
		public System.Windows.Forms.Button cmdFullExtent;
		public System.Windows.Forms.Label Label1;
		public System.Windows.Forms.Label lblNavigate;
		public System.Windows.Forms.Label lblZoom;
		public System.Windows.Forms.Label lblLoad;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		
		private IAoInitialize m_AoInitialize = new AoInitializeClass();
		private ISceneViewer m_ActiveView; 
		private ICamera m_Camera;
		private IPoint m_pMousePos = new PointClass();
		private bool m_bMouseDown;
		private bool m_bZooming = false;
		private double m_dSpinSpeed = 0;
		private double m_dZoom;
		
		const double cMinZoom = 1.00002;
		const double cMaxZoom = 1.1;
		const double cDistanceZoomLimit = 200.0;
		private ESRI.ArcGIS.LicenseControl.AxLicenseControl axLicenseControl1;

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.axGlobeControl1 = new ESRI.ArcGIS.GlobeControl.AxGlobeControl();
			this.TrackBar1 = new System.Windows.Forms.TrackBar();
			this.chkSpin = new System.Windows.Forms.CheckBox();
			this.optTools1 = new System.Windows.Forms.RadioButton();
			this.optTools0 = new System.Windows.Forms.RadioButton();
			this.cmdLoadDocument = new System.Windows.Forms.Button();
			this.cmdZoomOut = new System.Windows.Forms.Button();
			this.cmdZoomIn = new System.Windows.Forms.Button();
			this.cmdFullExtent = new System.Windows.Forms.Button();
			this.Label1 = new System.Windows.Forms.Label();
			this.lblNavigate = new System.Windows.Forms.Label();
			this.lblZoom = new System.Windows.Forms.Label();
			this.lblLoad = new System.Windows.Forms.Label();
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
			this.axLicenseControl1 = new ESRI.ArcGIS.LicenseControl.AxLicenseControl();
			((System.ComponentModel.ISupportInitialize)(this.axGlobeControl1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.TrackBar1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).BeginInit();
			this.SuspendLayout();
			// 
			// axGlobeControl1
			// 
			this.axGlobeControl1.Location = new System.Drawing.Point(8, 8);
			this.axGlobeControl1.Name = "axGlobeControl1";
			this.axGlobeControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axGlobeControl1.OcxState")));
			this.axGlobeControl1.Size = new System.Drawing.Size(424, 464);
			this.axGlobeControl1.TabIndex = 0;
			this.axGlobeControl1.OnMouseDown += new ESRI.ArcGIS.GlobeControl.IGlobeControlEvents_OnMouseDownEventHandler(this.axGlobeControl1_OnMouseDown);
			this.axGlobeControl1.OnMouseMove += new ESRI.ArcGIS.GlobeControl.IGlobeControlEvents_OnMouseMoveEventHandler(this.axGlobeControl1_OnMouseMove);
			this.axGlobeControl1.OnMouseUp += new ESRI.ArcGIS.GlobeControl.IGlobeControlEvents_OnMouseUpEventHandler(this.axGlobeControl1_OnMouseUp);
			// 
			// TrackBar1
			// 
			this.TrackBar1.Location = new System.Drawing.Point(440, 432);
			this.TrackBar1.Name = "TrackBar1";
			this.TrackBar1.Size = new System.Drawing.Size(104, 45);
			this.TrackBar1.TabIndex = 26;
			this.TrackBar1.Scroll += new System.EventHandler(this.TrackBar1_Scroll);
			// 
			// chkSpin
			// 
			this.chkSpin.BackColor = System.Drawing.SystemColors.Control;
			this.chkSpin.Cursor = System.Windows.Forms.Cursors.Default;
			this.chkSpin.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.chkSpin.ForeColor = System.Drawing.SystemColors.ControlText;
			this.chkSpin.Location = new System.Drawing.Point(456, 408);
			this.chkSpin.Name = "chkSpin";
			this.chkSpin.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.chkSpin.Size = new System.Drawing.Size(57, 17);
			this.chkSpin.TabIndex = 25;
			this.chkSpin.Text = "Spin";
			this.chkSpin.Click += new System.EventHandler(this.chkSpin_Click);
			// 
			// optTools1
			// 
			this.optTools1.Appearance = System.Windows.Forms.Appearance.Button;
			this.optTools1.BackColor = System.Drawing.SystemColors.Control;
			this.optTools1.Cursor = System.Windows.Forms.Cursors.Default;
			this.optTools1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.optTools1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optTools1.Location = new System.Drawing.Point(448, 328);
			this.optTools1.Name = "optTools1";
			this.optTools1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optTools1.Size = new System.Drawing.Size(81, 25);
			this.optTools1.TabIndex = 20;
			this.optTools1.TabStop = true;
			this.optTools1.Text = "Zoom In/Out";
			this.optTools1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.optTools1.Click += new System.EventHandler(this.MixedControls_Click);
			// 
			// optTools0
			// 
			this.optTools0.Appearance = System.Windows.Forms.Appearance.Button;
			this.optTools0.BackColor = System.Drawing.SystemColors.Control;
			this.optTools0.Cursor = System.Windows.Forms.Cursors.Default;
			this.optTools0.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.optTools0.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optTools0.Location = new System.Drawing.Point(448, 288);
			this.optTools0.Name = "optTools0";
			this.optTools0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optTools0.Size = new System.Drawing.Size(81, 25);
			this.optTools0.TabIndex = 19;
			this.optTools0.TabStop = true;
			this.optTools0.Text = "Navigate";
			this.optTools0.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.optTools0.Click += new System.EventHandler(this.MixedControls_Click);
			// 
			// cmdLoadDocument
			// 
			this.cmdLoadDocument.BackColor = System.Drawing.SystemColors.Control;
			this.cmdLoadDocument.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdLoadDocument.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.cmdLoadDocument.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdLoadDocument.Location = new System.Drawing.Point(456, 48);
			this.cmdLoadDocument.Name = "cmdLoadDocument";
			this.cmdLoadDocument.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdLoadDocument.Size = new System.Drawing.Size(67, 25);
			this.cmdLoadDocument.TabIndex = 18;
			this.cmdLoadDocument.Text = "Load ...";
			this.cmdLoadDocument.Click += new System.EventHandler(this.cmdLoadDocument_Click);
			// 
			// cmdZoomOut
			// 
			this.cmdZoomOut.BackColor = System.Drawing.SystemColors.Control;
			this.cmdZoomOut.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdZoomOut.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.cmdZoomOut.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdZoomOut.Location = new System.Drawing.Point(440, 168);
			this.cmdZoomOut.Name = "cmdZoomOut";
			this.cmdZoomOut.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdZoomOut.Size = new System.Drawing.Size(99, 25);
			this.cmdZoomOut.TabIndex = 17;
			this.cmdZoomOut.Text = "Fixed Zoom Out";
			this.cmdZoomOut.Click += new System.EventHandler(this.cmdZoomOut_Click);
			// 
			// cmdZoomIn
			// 
			this.cmdZoomIn.BackColor = System.Drawing.SystemColors.Control;
			this.cmdZoomIn.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdZoomIn.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.cmdZoomIn.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdZoomIn.Location = new System.Drawing.Point(440, 136);
			this.cmdZoomIn.Name = "cmdZoomIn";
			this.cmdZoomIn.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdZoomIn.Size = new System.Drawing.Size(99, 25);
			this.cmdZoomIn.TabIndex = 16;
			this.cmdZoomIn.Text = "Fixed Zoom In";
			this.cmdZoomIn.Click += new System.EventHandler(this.cmdZoomIn_Click);
			// 
			// cmdFullExtent
			// 
			this.cmdFullExtent.BackColor = System.Drawing.SystemColors.Control;
			this.cmdFullExtent.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdFullExtent.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.cmdFullExtent.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdFullExtent.Location = new System.Drawing.Point(440, 200);
			this.cmdFullExtent.Name = "cmdFullExtent";
			this.cmdFullExtent.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdFullExtent.Size = new System.Drawing.Size(99, 25);
			this.cmdFullExtent.TabIndex = 15;
			this.cmdFullExtent.Text = "Full Extent";
			this.cmdFullExtent.Click += new System.EventHandler(this.cmdFullExtent_Click);
			// 
			// Label1
			// 
			this.Label1.BackColor = System.Drawing.SystemColors.Control;
			this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label1.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Label1.ForeColor = System.Drawing.SystemColors.Highlight;
			this.Label1.Location = new System.Drawing.Point(440, 360);
			this.Label1.Name = "Label1";
			this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label1.Size = new System.Drawing.Size(97, 49);
			this.Label1.TabIndex = 24;
			this.Label1.Text = "Control the spin speed with the slider.";
			// 
			// lblNavigate
			// 
			this.lblNavigate.BackColor = System.Drawing.SystemColors.Control;
			this.lblNavigate.Cursor = System.Windows.Forms.Cursors.Default;
			this.lblNavigate.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblNavigate.ForeColor = System.Drawing.SystemColors.Highlight;
			this.lblNavigate.Location = new System.Drawing.Point(440, 232);
			this.lblNavigate.Name = "lblNavigate";
			this.lblNavigate.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.lblNavigate.Size = new System.Drawing.Size(105, 49);
			this.lblNavigate.TabIndex = 23;
			this.lblNavigate.Text = "Use the option buttons to select a navigation tool. ";
			// 
			// lblZoom
			// 
			this.lblZoom.BackColor = System.Drawing.SystemColors.Control;
			this.lblZoom.Cursor = System.Windows.Forms.Cursors.Default;
			this.lblZoom.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblZoom.ForeColor = System.Drawing.SystemColors.Highlight;
			this.lblZoom.Location = new System.Drawing.Point(440, 80);
			this.lblZoom.Name = "lblZoom";
			this.lblZoom.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.lblZoom.Size = new System.Drawing.Size(104, 49);
			this.lblZoom.TabIndex = 22;
			this.lblZoom.Text = "Use the buttons to naviagte the Globe data.";
			// 
			// lblLoad
			// 
			this.lblLoad.BackColor = System.Drawing.SystemColors.Control;
			this.lblLoad.Cursor = System.Windows.Forms.Cursors.Default;
			this.lblLoad.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblLoad.ForeColor = System.Drawing.SystemColors.Highlight;
			this.lblLoad.Location = new System.Drawing.Point(440, 8);
			this.lblLoad.Name = "lblLoad";
			this.lblLoad.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.lblLoad.Size = new System.Drawing.Size(97, 33);
			this.lblLoad.TabIndex = 21;
			this.lblLoad.Text = "Browse to a 3dd file to load.";
			// 
			// axLicenseControl1
			// 
			this.axLicenseControl1.Enabled = true;
			this.axLicenseControl1.Location = new System.Drawing.Point(200, 24);
			this.axLicenseControl1.Name = "axLicenseControl1";
			this.axLicenseControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axLicenseControl1.OcxState")));
			this.axLicenseControl1.Size = new System.Drawing.Size(200, 50);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -