About the Effects in the GlobeControl Sample
[C#]
Effects.cs
using System;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.GlobeCore;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS;
namespace GlobeControlEffects
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Effects : System.Windows.Forms.Form
{
public System.Windows.Forms.GroupBox Frame2_1;
public System.Windows.Forms.Label lblDelay;
public System.Windows.Forms.TextBox TxtTipDelay;
public System.Windows.Forms.ComboBox cmbTipType;
public System.Windows.Forms.CheckBox ChkHUD;
public System.Windows.Forms.CheckBox ChkArrow;
public System.Windows.Forms.CheckBox ChkTip;
public System.Windows.Forms.Label LblTips;
public System.Windows.Forms.GroupBox Frame2;
public System.Windows.Forms.Label lblLatVal;
public System.Windows.Forms.Label LblLonVal;
public System.Windows.Forms.Label LblAltVal;
public System.Windows.Forms.Label LblLat;
public System.Windows.Forms.Label LblLon;
public System.Windows.Forms.Label LblALt;
public System.Windows.Forms.GroupBox _Frame2_0;
public System.Windows.Forms.Button CmdAmbient;
public System.Windows.Forms.TextBox TxtAmbient;
public System.Windows.Forms.Button CmdSetSun;
public System.Windows.Forms.CheckBox chkSun;
public System.Windows.Forms.Label Label2;
private esriGlobeTipsType m_penumTips;
private System.Windows.Forms.ColorDialog colorDialog1;
private IGlobeDisplayEvents_AfterDrawEventHandler afterDrawE;
private ESRI.ArcGIS.Controls.AxToolbarControl axToolbarControl1;
private ESRI.ArcGIS.Controls.AxTOCControl axTOCControl1;
private ESRI.ArcGIS.Controls.AxGlobeControl axGlobeControl1;
private ESRI.ArcGIS.Controls.AxLicenseControl axLicenseControl1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Effects()
{
//
// 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 )
{
//Release COM objects
ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown();
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(Effects));
this.Frame2_1 = new System.Windows.Forms.GroupBox();
this.lblDelay = new System.Windows.Forms.Label();
this.TxtTipDelay = new System.Windows.Forms.TextBox();
this.cmbTipType = new System.Windows.Forms.ComboBox();
this.ChkHUD = new System.Windows.Forms.CheckBox();
this.ChkArrow = new System.Windows.Forms.CheckBox();
this.ChkTip = new System.Windows.Forms.CheckBox();
this.LblTips = new System.Windows.Forms.Label();
this.Frame2 = new System.Windows.Forms.GroupBox();
this.lblLatVal = new System.Windows.Forms.Label();
this.LblLonVal = new System.Windows.Forms.Label();
this.LblAltVal = new System.Windows.Forms.Label();
this.LblLat = new System.Windows.Forms.Label();
this.LblLon = new System.Windows.Forms.Label();
this.LblALt = new System.Windows.Forms.Label();
this._Frame2_0 = new System.Windows.Forms.GroupBox();
this.CmdAmbient = new System.Windows.Forms.Button();
this.TxtAmbient = new System.Windows.Forms.TextBox();
this.CmdSetSun = new System.Windows.Forms.Button();
this.chkSun = new System.Windows.Forms.CheckBox();
this.Label2 = new System.Windows.Forms.Label();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.axToolbarControl1 = new ESRI.ArcGIS.Controls.AxToolbarControl();
this.axTOCControl1 = new ESRI.ArcGIS.Controls.AxTOCControl();
this.axGlobeControl1 = new ESRI.ArcGIS.Controls.AxGlobeControl();
this.axLicenseControl1 = new ESRI.ArcGIS.Controls.AxLicenseControl();
this.Frame2_1.SuspendLayout();
this.Frame2.SuspendLayout();
this._Frame2_0.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axGlobeControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).BeginInit();
this.SuspendLayout();
//
// Frame2_1
//
this.Frame2_1.BackColor = System.Drawing.SystemColors.Control;
this.Frame2_1.Controls.Add(this.lblDelay);
this.Frame2_1.Controls.Add(this.TxtTipDelay);
this.Frame2_1.Controls.Add(this.cmbTipType);
this.Frame2_1.Controls.Add(this.ChkHUD);
this.Frame2_1.Controls.Add(this.ChkArrow);
this.Frame2_1.Controls.Add(this.ChkTip);
this.Frame2_1.Controls.Add(this.LblTips);
this.Frame2_1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Frame2_1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Frame2_1.Location = new System.Drawing.Point(256, 376);
this.Frame2_1.Name = "Frame2_1";
this.Frame2_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Frame2_1.Size = new System.Drawing.Size(224, 69);
this.Frame2_1.TabIndex = 16;
this.Frame2_1.TabStop = false;
this.Frame2_1.Text = "HUD";
//
// lblDelay
//
this.lblDelay.BackColor = System.Drawing.SystemColors.Control;
this.lblDelay.Cursor = System.Windows.Forms.Cursors.Default;
this.lblDelay.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblDelay.ForeColor = System.Drawing.SystemColors.ControlText;
this.lblDelay.Location = new System.Drawing.Point(136, 9);
this.lblDelay.Name = "lblDelay";
this.lblDelay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lblDelay.Size = new System.Drawing.Size(72, 13);
this.lblDelay.TabIndex = 18;
this.lblDelay.Text = "Delay(mSec.)";
//
// TxtTipDelay
//
this.TxtTipDelay.AcceptsReturn = true;
this.TxtTipDelay.AutoSize = false;
this.TxtTipDelay.BackColor = System.Drawing.SystemColors.Window;
this.TxtTipDelay.Cursor = System.Windows.Forms.Cursors.IBeam;
this.TxtTipDelay.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.TxtTipDelay.ForeColor = System.Drawing.SystemColors.WindowText;
this.TxtTipDelay.Location = new System.Drawing.Point(160, 24);
this.TxtTipDelay.MaxLength = 0;
this.TxtTipDelay.Name = "TxtTipDelay";
this.TxtTipDelay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TxtTipDelay.Size = new System.Drawing.Size(48, 15);
this.TxtTipDelay.TabIndex = 16;
this.TxtTipDelay.Text = "500";
//
// cmbTipType
//
this.cmbTipType.BackColor = System.Drawing.SystemColors.Window;
this.cmbTipType.Cursor = System.Windows.Forms.Cursors.Default;
this.cmbTipType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTipType.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmbTipType.ForeColor = System.Drawing.SystemColors.WindowText;
this.cmbTipType.Location = new System.Drawing.Point(69, 42);
this.cmbTipType.Name = "cmbTipType";
this.cmbTipType.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmbTipType.Size = new System.Drawing.Size(139, 22);
this.cmbTipType.TabIndex = 17;
this.cmbTipType.SelectedIndexChanged += new System.EventHandler(this.cmbTipType_SelectedIndexChanged);
//
// ChkHUD
//
this.ChkHUD.BackColor = System.Drawing.SystemColors.Control;
this.ChkHUD.Cursor = System.Windows.Forms.Cursors.Default;
this.ChkHUD.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.ChkHUD.ForeColor = System.Drawing.SystemColors.ControlText;
this.ChkHUD.Location = new System.Drawing.Point(13, 19);
this.ChkHUD.Name = "ChkHUD";
this.ChkHUD.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.ChkHUD.Size = new System.Drawing.Size(51, 16);
this.ChkHUD.TabIndex = 15;
this.ChkHUD.Text = "HUD";
this.ChkHUD.CheckedChanged += new System.EventHandler(this.ChkHUD_CheckedChanged);
//
// ChkArrow
//
this.ChkArrow.BackColor = System.Drawing.SystemColors.Control;
this.ChkArrow.Cursor = System.Windows.Forms.Cursors.Default;
this.ChkArrow.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.ChkArrow.ForeColor = System.Drawing.SystemColors.ControlText;
this.ChkArrow.Location = new System.Drawing.Point(13, 33);
this.ChkArrow.Name = "ChkArrow";
this.ChkArrow.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.ChkArrow.Size = new System.Drawing.Size(59, 31);
this.ChkArrow.TabIndex = 14;
this.ChkArrow.Text = "North Arrow";
this.ChkArrow.CheckedChanged += new System.EventHandler(this.ChkArrow_CheckedChanged);
//
// ChkTip
//
this.ChkTip.BackColor = System.Drawing.SystemColors.Control;
this.ChkTip.Cursor = System.Windows.Forms.Cursors.Default;
this.ChkTip.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.ChkTip.ForeColor = System.Drawing.SystemColors.ControlText;
this.ChkTip.Location = new System.Drawing.Point(69, 25);
this.ChkTip.Name = "ChkTip";
this.ChkTip.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.ChkTip.Size = new System.Drawing.Size(14, 15);
this.ChkTip.TabIndex = 20;
this.ChkTip.Text = "Check1";
this.ChkTip.CheckedChanged += new System.EventHandler(this.ChkTip_CheckedChanged);
//
// LblTips
//
this.LblTips.BackColor = System.Drawing.SystemColors.Control;
this.LblTips.Cursor = System.Windows.Forms.Cursors.Default;
this.LblTips.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblTips.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblTips.Location = new System.Drawing.Point(84, 16);
this.LblTips.Name = "LblTips";
this.LblTips.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblTips.Size = new System.Drawing.Size(58, 28);
this.LblTips.TabIndex = 19;
this.LblTips.Text = "Enable Globe Tips";
//
// Frame2
//
this.Frame2.BackColor = System.Drawing.SystemColors.Control;
this.Frame2.Controls.Add(this.lblLatVal);
this.Frame2.Controls.Add(this.LblLonVal);
this.Frame2.Controls.Add(this.LblAltVal);
this.Frame2.Controls.Add(this.LblLat);
this.Frame2.Controls.Add(this.LblLon);
this.Frame2.Controls.Add(this.LblALt);
this.Frame2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Frame2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Frame2.Location = new System.Drawing.Point(488, 376);
this.Frame2.Name = "Frame2";
this.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Frame2.Size = new System.Drawing.Size(236, 69);
this.Frame2.TabIndex = 15;
this.Frame2.TabStop = false;
this.Frame2.Text = "Alternate HUD";
//
// lblLatVal
//
this.lblLatVal.BackColor = System.Drawing.SystemColors.Control;
this.lblLatVal.Cursor = System.Windows.Forms.Cursors.Default;
this.lblLatVal.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblLatVal.ForeColor = System.Drawing.SystemColors.ControlText;
this.lblLatVal.Location = new System.Drawing.Point(33, 30);
this.lblLatVal.Name = "lblLatVal";
this.lblLatVal.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lblLatVal.Size = new System.Drawing.Size(86, 13);
this.lblLatVal.TabIndex = 9;
this.lblLatVal.Text = "lblLatVal";
//
// LblLonVal
//
this.LblLonVal.BackColor = System.Drawing.SystemColors.Control;
this.LblLonVal.Cursor = System.Windows.Forms.Cursors.Default;
this.LblLonVal.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblLonVal.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblLonVal.Location = new System.Drawing.Point(33, 45);
this.LblLonVal.Name = "LblLonVal";
this.LblLonVal.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblLonVal.Size = new System.Drawing.Size(86, 13);
this.LblLonVal.TabIndex = 7;
this.LblLonVal.Text = "LblLonVal";
//
// LblAltVal
//
this.LblAltVal.BackColor = System.Drawing.SystemColors.Control;
this.LblAltVal.Cursor = System.Windows.Forms.Cursors.Default;
this.LblAltVal.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblAltVal.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblAltVal.Location = new System.Drawing.Point(134, 44);
this.LblAltVal.Name = "LblAltVal";
this.LblAltVal.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblAltVal.Size = new System.Drawing.Size(86, 11);
this.LblAltVal.TabIndex = 8;
this.LblAltVal.Text = "LblAltVal";
//
// LblLat
//
this.LblLat.BackColor = System.Drawing.SystemColors.Control;
this.LblLat.Cursor = System.Windows.Forms.Cursors.Default;
this.LblLat.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblLat.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblLat.Location = new System.Drawing.Point(8, 32);
this.LblLat.Name = "LblLat";
this.LblLat.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblLat.Size = new System.Drawing.Size(24, 15);
this.LblLat.TabIndex = 12;
this.LblLat.Text = "Lat:";
//
// LblLon
//
this.LblLon.BackColor = System.Drawing.SystemColors.Control;
this.LblLon.Cursor = System.Windows.Forms.Cursors.Default;
this.LblLon.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblLon.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblLon.Location = new System.Drawing.Point(9, 46);
this.LblLon.Name = "LblLon";
this.LblLon.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblLon.Size = new System.Drawing.Size(27, 16);
this.LblLon.TabIndex = 11;
this.LblLon.Text = "Lon:";
//
// LblALt
//
this.LblALt.BackColor = System.Drawing.SystemColors.Control;
this.LblALt.Cursor = System.Windows.Forms.Cursors.Default;
this.LblALt.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblALt.ForeColor = System.Drawing.SystemColors.ControlText;
this.LblALt.Location = new System.Drawing.Point(133, 23);
this.LblALt.Name = "LblALt";
this.LblALt.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.LblALt.Size = new System.Drawing.Size(83, 19);
this.LblALt.TabIndex = 10;
this.LblALt.Text = "Alt (in Kms.)";
//
// _Frame2_0
//
this._Frame2_0.BackColor = System.Drawing.SystemColors.Control;
this._Frame2_0.Controls.Add(this.CmdAmbient);
this._Frame2_0.Controls.Add(this.TxtAmbient);
this._Frame2_0.Controls.Add(this.CmdSetSun);
this._Frame2_0.Controls.Add(this.chkSun);
this._Frame2_0.Controls.Add(this.Label2);
this._Frame2_0.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this._Frame2_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Frame2_0.Location = new System.Drawing.Point(8, 376);
this._Frame2_0.Name = "_Frame2_0";
this._Frame2_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Frame2_0.Size = new System.Drawing.Size(236, 69);
this._Frame2_0.TabIndex = 14;
this._Frame2_0.TabStop = false;
this._Frame2_0.Text = "Sun and Ambient Light Prop";
//
// CmdAmbient
//
this.CmdAmbient.BackColor = System.Drawing.SystemColors.Control;
this.CmdAmbient.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdAmbient.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.CmdAmbient.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdAmbient.Location = new System.Drawing.Point(10, 43);
this.CmdAmbient.Name = "CmdAmbient";
this.CmdAmbient.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdAmbient.Size = new System.Drawing.Size(78, 22);
this.CmdAmbient.TabIndex = 4;
this.CmdAmbient.Text = "Set Ambient";
this.CmdAmbient.Click += new System.EventHandler(this.CmdAmbient_Click);
//
// TxtAmbient
//
this.TxtAmbient.AcceptsReturn = true;
this.TxtAmbient.AutoSize = false;
this.TxtAmbient.BackColor = System.Drawing.SystemColors.Window;
this.TxtAmbient.Cursor = System.Windows.Forms.Cursors.IBeam;
this.TxtAmbient.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.TxtAmbient.ForeColor = System.Drawing.SystemColors.WindowText;
this.TxtAmbient.Location = new System.Drawing.Point(168, 45);
this.TxtAmbient.MaxLength = 0;
this.TxtAmbient.Name = "TxtAmbient";
this.TxtAmbient.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TxtAmbient.Size = new System.Drawing.Size(48, 20);
this.TxtAmbient.TabIndex = 3;
this.TxtAmbient.Text = "";
//
// CmdSetSun
//
this.CmdSetSun.BackColor = System.Drawing.SystemColors.Control;
this.CmdSetSun.Cursor = System.Windows.Forms.Cursors.Default;
this.CmdSetSun.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.CmdSetSun.ForeColor = System.Drawing.SystemColors.ControlText;
this.CmdSetSun.Location = new System.Drawing.Point(144, 15);
this.CmdSetSun.Name = "CmdSetSun";
this.CmdSetSun.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.CmdSetSun.Size = new System.Drawing.Size(80, 20);
this.CmdSetSun.TabIndex = 2;
this.CmdSetSun.Text = "Set Sun Color";
this.CmdSetSun.Click += new System.EventHandler(this.CmdSetSun_Click);
//
// chkSun
//
this.chkSun.BackColor = System.Drawing.SystemColors.Control;
this.chkSun.Cursor = System.Windows.Forms.Cursors.Default;
this.chkSun.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.chkSun.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkSun.Location = new System.Drawing.Point(15, 17);
this.chkSun.Name = "chkSun";
this.chkSun.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkSun.Size = new System.Drawing.Size(81, 22);
this.chkSun.TabIndex = 1;
this.chkSun.Text = "Enable Sun";
this.chkSun.CheckedChanged += new System.EventHandler(this.chkSun_CheckedChanged);
//
// Label2
//
this.Label2.BackColor = System.Drawing.SystemColors.Control;
this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
this.Label2.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label2.Location = new System.Drawing.Point(96, 48);
this.Label2.Name = "Label2";
this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label2.Size = new System.Drawing.Size(64, 16);
this.Label2.TabIndex = 5;
this.Label2.Text = "Values 0 -1";
//
// axToolbarControl1
//
this.axToolbarControl1.Location = new System.Drawing.Point(8, 8);
this.axToolbarControl1.Name = "axToolbarControl1";
this.axToolbarControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axToolbarControl1.OcxState")));
this.axToolbarControl1.Size = new System.Drawing.Size(720, 28);
this.axToolbarControl1.TabIndex = 17;
//
// axTOCControl1
//
this.axTOCControl1.Location = new System.Drawing.Point(8, 40);
this.axTOCControl1.Name = "axTOCControl1";
this.axTOCControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axTOCControl1.OcxState")));
this.axTOCControl1.Size = new System.Drawing.Size(192, 328);
this.axTOCControl1.TabIndex = 18;
//
// axGlobeControl1
//
this.axGlobeControl1.Location = new System.Drawing.Point(208, 40);
this.axGlobeControl1.Name = "axGlobeControl1";
this.axGlobeControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axGlobeControl1.OcxState")));
this.axGlobeControl1.Size = new System.Drawing.Size(520, 328);
this.axGlobeControl1.TabIndex = 19;
this.axGlobeControl1.OnGlobeReplaced += new ESRI.ArcGIS.Controls.IGlobeControlEvents_Ax_OnGlobeReplacedEventHandler(this.axGlobeControl1_OnGlobeReplaced);
//
// axLicenseControl1
//
this.axLicenseControl1.Enabled = true;
this.axLicenseControl1.Location = new System.Drawing.Point(512, 56);
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);
this.axLicenseControl1.TabIndex = 20;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(736, 454);
this.Controls.Add(this.axLicenseControl1);
this.Controls.Add(this.axGlobeControl1);
this.Controls.Add(this.axTOCControl1);
this.Controls.Add(this.axToolbarControl1);
this.Controls.Add(this.Frame2_1);
this.Controls.Add(this.Frame2);
this.Controls.Add(this._Frame2_0);
this.Name = "Form1";
this.Text = "GlobeControl";
this.Load += new System.EventHandler(this.Form1_Load);
this.Frame2_1.ResumeLayout(false);
this.Frame2.ResumeLayout(false);
this._Frame2_0.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.axToolbarControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axTOCControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axGlobeControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.axLicenseControl1)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
if (!RuntimeManager.Bind(ProductCode.Engine))
{
if (!RuntimeManager.Bind(ProductCode.Desktop))
{
MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.");
return;
}
}
Application.Run(new Effects());
}
private void Form1_Load(object sender, System.EventArgs e)
{
//if default Desktop's document exists use as default
string sRegkeyDesktop = "SOFTWARE\\ESRI\\ArcGIS";
string sGlbData = routin_ReadRegistry(sRegkeyDesktop);
//if that fails check to see if the coreRntime exists registry...
if (sGlbData == "")
{
string sRegkeyEngine = "SOFTWARE\\ESRI\\CoreRuntime";
sGlbData = routin_ReadRegistry(sRegkeyEngine);
}
if (sGlbData != "")
{
sGlbData = sGlbData + "ArcGlobeData\\Default_Document.3dd";
if (axGlobeControl1.Check3dFile(sGlbData)) axGlobeControl1.Load3dFile(sGlbData);
}
//Enable north arrow, HUD and GlobeTips.
bool bChkArrow = axGlobeControl1.GlobeViewer.NorthArrowEnabled;
bool bHUD = axGlobeControl1.GlobeViewer.HUDEnabled;
ChkHUD.Checked = bHUD;
ChkArrow.Checked = bChkArrow;
//get the state of globetips from the loaded doc.....
m_penumTips = axGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips;
//if no tip value (not set) in the loaded doc set it to default..
if (m_penumTips <= 0)
{
m_penumTips = esriGlobeTipsType.esriGlobeTipsTypeLatLon;
}
cmbTipType.Items.Insert(0, "esriGlobeTipsTypeNone");
cmbTipType.Items.Insert(1, "esriGlobeTipsTypeLatLon");
cmbTipType.Items.Insert(2, "esriGlobeTipsTypeElevation");
cmbTipType.Items.Insert(3, "esriGlobeTipsTypeLatLonElevation");
ChkTip.Checked = true;//tip value of the doc...
//set the list...
cmbTipType.SelectedIndex = (int) m_penumTips;
//populate tip type values..
axGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid;
axGlobeControl1.TipDelay = 500; //default..
axGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips = m_penumTips;
axGlobeControl1.GlobeDisplay.RefreshViewers();
//Get current sun property..
IGlobeDisplayRendering pglbDispRend = (IGlobeDisplayRendering)axGlobeControl1.GlobeDisplay;
bool bsun = pglbDispRend.IsSunEnabled;
if (bsun == true) chkSun.Checked = true; //checked
//Get Ambient light...
TxtAmbient.Text = pglbDispRend.AmbientLight.ToString();
//Listen to events..
afterDrawE = new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw);
((IGlobeDisplayEvents_Event)axGlobeControl1.GlobeDisplay).AfterDraw+=afterDrawE;
}
private void cmbTipType_SelectedIndexChanged(object sender, System.EventArgs e)
{
m_penumTips = (esriGlobeTipsType) cmbTipType.SelectedIndex;
if (ChkTip.Checked == true)
{
string sVal = TxtTipDelay.Text;
if (Convert.ToSingle(sVal) == 0) sVal="500"; //set it to default..miliseconds
axGlobeControl1.TipDelay = Convert.ToInt32(sVal);
axGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid;
axGlobeControl1.ShowGlobeTips = m_penumTips;
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
}
private void CmdAmbient_Click(object sender, System.EventArgs e)
{
string sVal = TxtAmbient.Text;
if (Convert.ToSingle(sVal) > (double) 1.0) sVal = "1";
if (Convert.ToSingle(sVal) < (double) 0.0) sVal = "0";
IGlobeDisplayRendering pglbDispRend = (IGlobeDisplayRendering) axGlobeControl1.GlobeDisplay;
pglbDispRend.AmbientLight = Convert.ToSingle(sVal);
//update textbox
TxtAmbient.Text = sVal;
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
private void CmdSetSun_Click(object sender, System.EventArgs e)
{
IRgbColor pCmDRgb = new RgbColorClass();
if (colorDialog1.ShowDialog() == DialogResult.Cancel) return;
pCmDRgb.Red = colorDialog1.Color.R;
pCmDRgb.Blue = colorDialog1.Color.B;
pCmDRgb.Green = colorDialog1.Color.G;
ChangeIllumination(pCmDRgb);
}
private string routin_ReadRegistry(string sKey)
{
//Open the subkey for reading
Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey,true);
if (rk == null) return "";
// Get the data from a specified item in the key.
return (string) rk.GetValue("InstallDir");
}
private void ChangeIllumination(IRgbColor prgb)
{
IGlobeDisplayRendering pglbDispRend = (IGlobeDisplayRendering) axGlobeControl1.GlobeDisplay;
double platitude=0; double plongitude=0;
Single pSunred; Single pSungreen; Single pSunblue; Single pAmbientLght;
if ((pglbDispRend.IsSunEnabled == true) & (chkSun.Checked == true))
{
//get the Default position and color...
pglbDispRend.GetSunPosition(out platitude, out plongitude);
pglbDispRend.GetSunColor(out pSunred, out pSungreen, out pSunblue);
//Set AmbientLght
string sVal = TxtAmbient.Text;
if (Convert.ToSingle(sVal) > 1) sVal = "1";
if (Convert.ToSingle(sVal) < 0) sVal = "0";
pglbDispRend.AmbientLight = Convert.ToSingle(sVal);
//update textbox
TxtAmbient.Text = sVal;
pAmbientLght = pglbDispRend.AmbientLight;
IColor pIcolor = prgb;
IGlobeDisplay pglbDisp = EnableSetSun(pAmbientLght, platitude, plongitude, pIcolor);
axGlobeControl1.GlobeDisplay = pglbDisp;
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
}
private IGlobeDisplay EnableSetSun(Single pAmbientLght, double platitude, double plongitude, IColor pColor )
{
Single pSunred; Single pSungreen; Single pSunblue;
IRgbColor pRgbColor = new RgbColorClass();
pRgbColor.RGB = Convert.ToInt32(pColor.RGB);
pSunred = pRgbColor.Red;
pSungreen = pRgbColor.Green;
pSunblue = pRgbColor.Blue;
IGlobeDisplayRendering pglbDispRend = (IGlobeDisplayRendering) axGlobeControl1.GlobeDisplay;
pglbDispRend.SetSunColor(pSunred, pSungreen, pSunblue);
pglbDispRend.SetSunPosition(platitude, plongitude);
pglbDispRend.AmbientLight = pAmbientLght;
return axGlobeControl1.GlobeDisplay;
}
private void ChkArrow_CheckedChanged(object sender, System.EventArgs e)
{
bool bChkArrow = axGlobeControl1.GlobeViewer.NorthArrowEnabled;
if ((ChkArrow.Checked == false) & (bChkArrow == true))
{
axGlobeControl1.GlobeViewer.NorthArrowEnabled = false; //unchecked
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
else if ((ChkArrow.Checked == true) & (bChkArrow == false))
{
axGlobeControl1.GlobeViewer.NorthArrowEnabled = true; //checked
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
}
private void ChkHUD_CheckedChanged(object sender, System.EventArgs e)
{
//Default HUD
bool bHUD = axGlobeControl1.GlobeViewer.HUDEnabled;
if ((ChkHUD.Checked == false) & (bHUD == true))
{
axGlobeControl1.GlobeViewer.HUDEnabled = false; //unchecked
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
else if ((ChkHUD.Checked == true) & (bHUD==false))
{
axGlobeControl1.GlobeViewer.HUDEnabled = true; //checked
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
}
private void chkSun_CheckedChanged(object sender, System.EventArgs e)
{
IGlobeDisplayRendering pglbDispRend = (IGlobeDisplayRendering) axGlobeControl1.GlobeDisplay;
bool bsun = pglbDispRend.IsSunEnabled;
if ((chkSun.Checked == false) & (bsun == true))
{
pglbDispRend.IsSunEnabled = false; //unchecked
CmdSetSun.Enabled = false;
}
else if ((chkSun.Checked == true) & (bsun==false))
{
pglbDispRend.IsSunEnabled = true; //checked
CmdSetSun.Enabled = true;
}
}
private void ChkTip_CheckedChanged(object sender, System.EventArgs e)
{
if (ChkTip.Checked == false)
{
axGlobeControl1.ShowGlobeTips = esriGlobeTipsType.esriGlobeTipsTypeNone;
axGlobeControl1.GlobeDisplay.RefreshViewers();
cmbTipType.Enabled = false;
TxtTipDelay.Enabled = false;
}
else
{
cmbTipType.Enabled = true;
TxtTipDelay.Enabled = true;
string sVal = TxtTipDelay.Text;
if (Convert.ToInt32(sVal) == 0) sVal="500"; //set it to default..miliseconds
if (cmbTipType.SelectedIndex >= 0) m_penumTips = (esriGlobeTipsType) cmbTipType.SelectedIndex;
axGlobeControl1.TipDelay = Convert.ToInt32(sVal);
axGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid;
axGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips = m_penumTips;
axGlobeControl1.GlobeDisplay.RefreshViewers();
}
}
private void GetObserVerLatLong(ISceneViewer pViewer, out double pLatDD, out double pLonDD, out double pAltKms, out double pRoll, out double pIncl)
{
IGlobeCamera pCam = (IGlobeCamera) pViewer.Camera;
pCam.GetObserverLatLonAlt( out pLatDD, out pLonDD, out pAltKms);
ICamera pIcam = (ICamera) pCam;
pRoll = pIcam.RollAngle;
pIncl = pIcam.Inclination;
}
private void UpdateCustomHUD(double pLatDD, double pLonDD, double pAltKms, double pRoll, double pIncl)
{
LblAltVal.Text = pAltKms.ToString();
lblLatVal.Text = pLatDD.ToString();
LblLonVal.Text = pLonDD.ToString();
}
private void OnAfterDraw(ISceneViewer pViewer)
{
double pLatDD=0; double pLonDD=0; double pAltKms=0; double pRoll=0; double pIncl=0;
GetObserVerLatLong(pViewer, out pLatDD, out pLonDD, out pAltKms, out pRoll, out pIncl);
UpdateCustomHUD(pLatDD, pLonDD, pAltKms, pRoll, pIncl);
}
private void axGlobeControl1_OnGlobeReplaced(object sender, ESRI.ArcGIS.Controls.IGlobeControlEvents_OnGlobeReplacedEvent e)
{
IGlobeDisplayRendering pglbbDispRend = (IGlobeDisplayRendering) axGlobeControl1.GlobeDisplay;
bool bsun = pglbbDispRend.IsSunEnabled;
if (bsun==true) chkSun.Checked = true; //checked
//get the state of globetips from the loaded doc.....
m_penumTips = axGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips;
}
}
}
[Visual Basic .NET]
Effects.vb
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.GlobeCore
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.SystemUI
Imports ESRI.ArcGIS.Analyst3D
Imports System.Windows.Forms
Imports ESRI.ArcGIS
Public Class Effects
Inherits System.Windows.Forms.Form
<STAThread()> _
Shared Sub Main()
'Load runtime
If Not RuntimeManager.Bind(ProductCode.Engine) Then
If Not RuntimeManager.Bind(ProductCode.Desktop) Then
MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.")
System.Environment.Exit(1) ' Force exit or other indication in the application
End If
End If
Application.Run(New Effects())
End Sub
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
'Release COM objects
ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown()
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public WithEvents TxtTipDelay As System.Windows.Forms.TextBox
Public WithEvents cmbTipType As System.Windows.Forms.ComboBox
Public WithEvents ChkTip As System.Windows.Forms.CheckBox
Public WithEvents LblTips As System.Windows.Forms.Label
Public WithEvents lblDelay As System.Windows.Forms.Label
Public WithEvents lblLatVal As System.Windows.Forms.Label
Public WithEvents LblLonVal As System.Windows.Forms.Label
Public WithEvents LblAltVal As System.Windows.Forms.Label
Public WithEvents LblLat As System.Windows.Forms.Label
Public WithEvents LblLon As System.Windows.Forms.Label
Public WithEvents LblALt As System.Windows.Forms.Label
Public WithEvents CmdAmbient As System.Windows.Forms.Button
Public WithEvents TxtAmbient As System.Windows.Forms.TextBox
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents _Frame2_0 As System.Windows.Forms.GroupBox
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Public WithEvents ChkHUD As System.Windows.Forms.CheckBox
Public WithEvents ChkArrow As System.Windows.Forms.CheckBox
Public WithEvents Frame2_1 As System.Windows.Forms.GroupBox
Public WithEvents Frame2 As System.Windows.Forms.GroupBox
Public WithEvents CmdSetSun As System.Windows.Forms.Button
Public WithEvents chkSun As System.Windows.Forms.CheckBox
Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
Friend WithEvents AxToolbarControl1 As ESRI.ArcGIS.Controls.AxToolbarControl
Friend WithEvents AxTOCControl1 As ESRI.ArcGIS.Controls.AxTOCControl
Friend WithEvents AxGlobeControl1 As ESRI.ArcGIS.Controls.AxGlobeControl
Friend WithEvents AxLicenseControl1 As ESRI.ArcGIS.Controls.AxLicenseControl
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Effects))
Me.ChkHUD = New System.Windows.Forms.CheckBox
Me.ChkArrow = New System.Windows.Forms.CheckBox
Me.Frame2_1 = New System.Windows.Forms.GroupBox
Me.lblDelay = New System.Windows.Forms.Label
Me.TxtTipDelay = New System.Windows.Forms.TextBox
Me.cmbTipType = New System.Windows.Forms.ComboBox
Me.ChkTip = New System.Windows.Forms.CheckBox
Me.LblTips = New System.Windows.Forms.Label
Me.Frame2 = New System.Windows.Forms.GroupBox
Me.lblLatVal = New System.Windows.Forms.Label
Me.LblLonVal = New System.Windows.Forms.Label
Me.LblAltVal = New System.Windows.Forms.Label
Me.LblLat = New System.Windows.Forms.Label
Me.LblLon = New System.Windows.Forms.Label
Me.LblALt = New System.Windows.Forms.Label
Me._Frame2_0 = New System.Windows.Forms.GroupBox
Me.CmdAmbient = New System.Windows.Forms.Button
Me.TxtAmbient = New System.Windows.Forms.TextBox
Me.CmdSetSun = New System.Windows.Forms.Button
Me.chkSun = New System.Windows.Forms.CheckBox
Me.Label2 = New System.Windows.Forms.Label
Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
Me.AxToolbarControl1 = New ESRI.ArcGIS.Controls.AxToolbarControl
Me.AxTOCControl1 = New ESRI.ArcGIS.Controls.AxTOCControl
Me.AxGlobeControl1 = New ESRI.ArcGIS.Controls.AxGlobeControl
Me.AxLicenseControl1 = New ESRI.ArcGIS.Controls.AxLicenseControl
Me.Frame2_1.SuspendLayout()
Me.Frame2.SuspendLayout()
Me._Frame2_0.SuspendLayout()
CType(Me.AxToolbarControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxTOCControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxGlobeControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxLicenseControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'ChkHUD
'
Me.ChkHUD.BackColor = System.Drawing.SystemColors.Control
Me.ChkHUD.Cursor = System.Windows.Forms.Cursors.Default
Me.ChkHUD.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ChkHUD.ForeColor = System.Drawing.SystemColors.ControlText
Me.ChkHUD.Location = New System.Drawing.Point(13, 19)
Me.ChkHUD.Name = "ChkHUD"
Me.ChkHUD.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.ChkHUD.Size = New System.Drawing.Size(51, 16)
Me.ChkHUD.TabIndex = 15
Me.ChkHUD.Text = "HUD"
'
'ChkArrow
'
Me.ChkArrow.BackColor = System.Drawing.SystemColors.Control
Me.ChkArrow.Cursor = System.Windows.Forms.Cursors.Default
Me.ChkArrow.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ChkArrow.ForeColor = System.Drawing.SystemColors.ControlText
Me.ChkArrow.Location = New System.Drawing.Point(13, 33)
Me.ChkArrow.Name = "ChkArrow"
Me.ChkArrow.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.ChkArrow.Size = New System.Drawing.Size(59, 31)
Me.ChkArrow.TabIndex = 14
Me.ChkArrow.Text = "North Arrow"
'
'Frame2_1
'
Me.Frame2_1.BackColor = System.Drawing.SystemColors.Control
Me.Frame2_1.Controls.Add(Me.lblDelay)
Me.Frame2_1.Controls.Add(Me.TxtTipDelay)
Me.Frame2_1.Controls.Add(Me.cmbTipType)
Me.Frame2_1.Controls.Add(Me.ChkHUD)
Me.Frame2_1.Controls.Add(Me.ChkArrow)
Me.Frame2_1.Controls.Add(Me.ChkTip)
Me.Frame2_1.Controls.Add(Me.LblTips)
Me.Frame2_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Frame2_1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Frame2_1.Location = New System.Drawing.Point(248, 448)
Me.Frame2_1.Name = "Frame2_1"
Me.Frame2_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Frame2_1.Size = New System.Drawing.Size(224, 69)
Me.Frame2_1.TabIndex = 13
Me.Frame2_1.TabStop = False
Me.Frame2_1.Text = "HUD"
'
'lblDelay
'
Me.lblDelay.BackColor = System.Drawing.SystemColors.Control
Me.lblDelay.Cursor = System.Windows.Forms.Cursors.Default
Me.lblDelay.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblDelay.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblDelay.Location = New System.Drawing.Point(136, 9)
Me.lblDelay.Name = "lblDelay"
Me.lblDelay.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblDelay.Size = New System.Drawing.Size(72, 13)
Me.lblDelay.TabIndex = 18
Me.lblDelay.Text = "Delay(mSec.)"
'
'TxtTipDelay
'
Me.TxtTipDelay.AcceptsReturn = True
Me.TxtTipDelay.AutoSize = False
Me.TxtTipDelay.BackColor = System.Drawing.SystemColors.Window
Me.TxtTipDelay.Cursor = System.Windows.Forms.Cursors.IBeam
Me.TxtTipDelay.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TxtTipDelay.ForeColor = System.Drawing.SystemColors.WindowText
Me.TxtTipDelay.Location = New System.Drawing.Point(160, 24)
Me.TxtTipDelay.MaxLength = 0
Me.TxtTipDelay.Name = "TxtTipDelay"
Me.TxtTipDelay.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.TxtTipDelay.Size = New System.Drawing.Size(48, 15)
Me.TxtTipDelay.TabIndex = 16
Me.TxtTipDelay.Text = "500"
'
'cmbTipType
'
Me.cmbTipType.BackColor = System.Drawing.SystemColors.Window
Me.cmbTipType.Cursor = System.Windows.Forms.Cursors.Default
Me.cmbTipType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbTipType.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cmbTipType.ForeColor = System.Drawing.SystemColors.WindowText
Me.cmbTipType.Location = New System.Drawing.Point(69, 42)
Me.cmbTipType.Name = "cmbTipType"
Me.cmbTipType.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmbTipType.Size = New System.Drawing.Size(139, 22)
Me.cmbTipType.TabIndex = 17
'
'ChkTip
'
Me.ChkTip.BackColor = System.Drawing.SystemColors.Control
Me.ChkTip.Cursor = System.Windows.Forms.Cursors.Default
Me.ChkTip.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ChkTip.ForeColor = System.Drawing.SystemColors.ControlText
Me.ChkTip.Location = New System.Drawing.Point(69, 25)
Me.ChkTip.Name = "ChkTip"
Me.ChkTip.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.ChkTip.Size = New System.Drawing.Size(14, 15)
Me.ChkTip.TabIndex = 20
Me.ChkTip.Text = "Check1"
'
'LblTips
'
Me.LblTips.BackColor = System.Drawing.SystemColors.Control
Me.LblTips.Cursor = System.Windows.Forms.Cursors.Default
Me.LblTips.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblTips.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblTips.Location = New System.Drawing.Point(84, 16)
Me.LblTips.Name = "LblTips"
Me.LblTips.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblTips.Size = New System.Drawing.Size(58, 28)
Me.LblTips.TabIndex = 19
Me.LblTips.Text = "Enable Globe Tips"
'
'Frame2
'
Me.Frame2.BackColor = System.Drawing.SystemColors.Control
Me.Frame2.Controls.Add(Me.lblLatVal)
Me.Frame2.Controls.Add(Me.LblLonVal)
Me.Frame2.Controls.Add(Me.LblAltVal)
Me.Frame2.Controls.Add(Me.LblLat)
Me.Frame2.Controls.Add(Me.LblLon)
Me.Frame2.Controls.Add(Me.LblALt)
Me.Frame2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Frame2.Location = New System.Drawing.Point(480, 448)
Me.Frame2.Name = "Frame2"
Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Frame2.Size = New System.Drawing.Size(236, 69)
Me.Frame2.TabIndex = 6
Me.Frame2.TabStop = False
Me.Frame2.Text = "Alternate HUD"
'
'lblLatVal
'
Me.lblLatVal.BackColor = System.Drawing.SystemColors.Control
Me.lblLatVal.Cursor = System.Windows.Forms.Cursors.Default
Me.lblLatVal.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblLatVal.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblLatVal.Location = New System.Drawing.Point(33, 30)
Me.lblLatVal.Name = "lblLatVal"
Me.lblLatVal.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblLatVal.Size = New System.Drawing.Size(86, 13)
Me.lblLatVal.TabIndex = 9
Me.lblLatVal.Text = "lblLatVal"
'
'LblLonVal
'
Me.LblLonVal.BackColor = System.Drawing.SystemColors.Control
Me.LblLonVal.Cursor = System.Windows.Forms.Cursors.Default
Me.LblLonVal.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblLonVal.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblLonVal.Location = New System.Drawing.Point(33, 45)
Me.LblLonVal.Name = "LblLonVal"
Me.LblLonVal.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblLonVal.Size = New System.Drawing.Size(86, 13)
Me.LblLonVal.TabIndex = 7
Me.LblLonVal.Text = "LblLonVal"
'
'LblAltVal
'
Me.LblAltVal.BackColor = System.Drawing.SystemColors.Control
Me.LblAltVal.Cursor = System.Windows.Forms.Cursors.Default
Me.LblAltVal.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblAltVal.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblAltVal.Location = New System.Drawing.Point(134, 44)
Me.LblAltVal.Name = "LblAltVal"
Me.LblAltVal.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblAltVal.Size = New System.Drawing.Size(86, 11)
Me.LblAltVal.TabIndex = 8
Me.LblAltVal.Text = "LblAltVal"
'
'LblLat
'
Me.LblLat.BackColor = System.Drawing.SystemColors.Control
Me.LblLat.Cursor = System.Windows.Forms.Cursors.Default
Me.LblLat.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblLat.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblLat.Location = New System.Drawing.Point(8, 32)
Me.LblLat.Name = "LblLat"
Me.LblLat.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblLat.Size = New System.Drawing.Size(24, 15)
Me.LblLat.TabIndex = 12
Me.LblLat.Text = "Lat:"
'
'LblLon
'
Me.LblLon.BackColor = System.Drawing.SystemColors.Control
Me.LblLon.Cursor = System.Windows.Forms.Cursors.Default
Me.LblLon.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblLon.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblLon.Location = New System.Drawing.Point(9, 46)
Me.LblLon.Name = "LblLon"
Me.LblLon.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblLon.Size = New System.Drawing.Size(27, 16)
Me.LblLon.TabIndex = 11
Me.LblLon.Text = "Lon:"
'
'LblALt
'
Me.LblALt.BackColor = System.Drawing.SystemColors.Control
Me.LblALt.Cursor = System.Windows.Forms.Cursors.Default
Me.LblALt.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LblALt.ForeColor = System.Drawing.SystemColors.ControlText
Me.LblALt.Location = New System.Drawing.Point(133, 23)
Me.LblALt.Name = "LblALt"
Me.LblALt.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.LblALt.Size = New System.Drawing.Size(83, 19)
Me.LblALt.TabIndex = 10
Me.LblALt.Text = "Alt (in Kms.)"
'
'_Frame2_0
'
Me._Frame2_0.BackColor = System.Drawing.SystemColors.Control
Me._Frame2_0.Controls.Add(Me.CmdAmbient)
Me._Frame2_0.Controls.Add(Me.TxtAmbient)
Me._Frame2_0.Controls.Add(Me.CmdSetSun)
Me._Frame2_0.Controls.Add(Me.chkSun)
Me._Frame2_0.Controls.Add(Me.Label2)
Me._Frame2_0.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me._Frame2_0.ForeColor = System.Drawing.SystemColors.ControlText
Me._Frame2_0.Location = New System.Drawing.Point(4, 446)
Me._Frame2_0.Name = "_Frame2_0"
Me._Frame2_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._Frame2_0.Size = New System.Drawing.Size(236, 69)
Me._Frame2_0.TabIndex = 0
Me._Frame2_0.TabStop = False
Me._Frame2_0.Text = "Sun and Ambient Light Prop"
'
'CmdAmbient
'
Me.CmdAmbient.BackColor = System.Drawing.SystemColors.Control
Me.CmdAmbient.Cursor = System.Windows.Forms.Cursors.Default
Me.CmdAmbient.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CmdAmbient.ForeColor = System.Drawing.SystemColors.ControlText
Me.CmdAmbient.Location = New System.Drawing.Point(10, 43)
Me.CmdAmbient.Name = "CmdAmbient"
Me.CmdAmbient.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmdAmbient.Size = New System.Drawing.Size(78, 22)
Me.CmdAmbient.TabIndex = 4
Me.CmdAmbient.Text = "Set Ambient"
'
'TxtAmbient
'
Me.TxtAmbient.AcceptsReturn = True
Me.TxtAmbient.AutoSize = False
Me.TxtAmbient.BackColor = System.Drawing.SystemColors.Window
Me.TxtAmbient.Cursor = System.Windows.Forms.Cursors.IBeam
Me.TxtAmbient.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TxtAmbient.ForeColor = System.Drawing.SystemColors.WindowText
Me.TxtAmbient.Location = New System.Drawing.Point(168, 45)
Me.TxtAmbient.MaxLength = 0
Me.TxtAmbient.Name = "TxtAmbient"
Me.TxtAmbient.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.TxtAmbient.Size = New System.Drawing.Size(48, 20)
Me.TxtAmbient.TabIndex = 3
Me.TxtAmbient.Text = ""
'
'CmdSetSun
'
Me.CmdSetSun.BackColor = System.Drawing.SystemColors.Control
Me.CmdSetSun.Cursor = System.Windows.Forms.Cursors.Default
Me.CmdSetSun.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CmdSetSun.ForeColor = System.Drawing.SystemColors.ControlText
Me.CmdSetSun.Location = New System.Drawing.Point(144, 15)
Me.CmdSetSun.Name = "CmdSetSun"
Me.CmdSetSun.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmdSetSun.Size = New System.Drawing.Size(80, 20)
Me.CmdSetSun.TabIndex = 2
Me.CmdSetSun.Text = "Set Sun Color"
'
'chkSun
'
Me.chkSun.BackColor = System.Drawing.SystemColors.Control
Me.chkSun.Cursor = System.Windows.Forms.Cursors.Default
Me.chkSun.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.chkSun.ForeColor = System.Drawing.SystemColors.ControlText
Me.chkSun.Location = New System.Drawing.Point(15, 17)
Me.chkSun.Name = "chkSun"
Me.chkSun.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.chkSun.Size = New System.Drawing.Size(81, 22)
Me.chkSun.TabIndex = 1
Me.chkSun.Text = "Enable Sun"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(96, 48)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(64, 16)
Me.Label2.TabIndex = 5
Me.Label2.Text = "Values 0 -1"
'
'AxToolbarControl1
'
Me.AxToolbarControl1.Location = New System.Drawing.Point(8, 8)
Me.AxToolbarControl1.Name = "AxToolbarControl1"
Me.AxToolbarControl1.OcxState = CType(resources.GetObject("AxToolbarControl1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxToolbarControl1.Size = New System.Drawing.Size(704, 28)
Me.AxToolbarControl1.TabIndex = 14
'
'AxTOCControl1
'
Me.AxTOCControl1.Location = New System.Drawing.Point(8, 40)
Me.AxTOCControl1.Name = "AxTOCControl1"
Me.AxTOCControl1.OcxState = CType(resources.GetObject("AxTOCControl1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxTOCControl1.Size = New System.Drawing.Size(192, 400)
Me.AxTOCControl1.TabIndex = 15
'
'AxGlobeControl1
'
Me.AxGlobeControl1.Location = New System.Drawing.Point(208, 40)
Me.AxGlobeControl1.Name = "AxGlobeControl1"
Me.AxGlobeControl1.OcxState = CType(resources.GetObject("AxGlobeControl1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxGlobeControl1.Size = New System.Drawing.Size(504, 400)
Me.AxGlobeControl1.TabIndex = 16
'
'AxLicenseControl1
'
Me.AxLicenseControl1.Enabled = True
Me.AxLicenseControl1.Location = New System.Drawing.Point(504, 48)
Me.AxLicenseControl1.Name = "AxLicenseControl1"
Me.AxLicenseControl1.OcxState = CType(resources.GetObject("AxLicenseControl1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxLicenseControl1.Size = New System.Drawing.Size(200, 50)
Me.AxLicenseControl1.TabIndex = 17
'
'frmGlbCntrl
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.Control
Me.ClientSize = New System.Drawing.Size(722, 520)
Me.Controls.Add(Me.AxLicenseControl1)
Me.Controls.Add(Me.AxGlobeControl1)
Me.Controls.Add(Me.AxTOCControl1)
Me.Controls.Add(Me.AxToolbarControl1)
Me.Controls.Add(Me.Frame2_1)
Me.Controls.Add(Me.Frame2)
Me.Controls.Add(Me._Frame2_0)
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Location = New System.Drawing.Point(3, 22)
Me.MaximizeBox = False
Me.Name = "frmGlbCntrl"
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text = "GlobeControl"
Me.Frame2_1.ResumeLayout(False)
Me.Frame2.ResumeLayout(False)
Me._Frame2_0.ResumeLayout(False)
CType(Me.AxToolbarControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxTOCControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxGlobeControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxLicenseControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private m_penumTips As esriGlobeTipsType
Public WithEvents m_pglbDisplay As GlobeDisplay
Private Sub cmbTipType_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbTipType.SelectedIndexChanged
m_penumTips = cmbTipType.SelectedIndex
Dim sVal As Object
If Not ChkTip.CheckState = 0 Then
sVal = TxtTipDelay.Text
On Error Resume Next 'handle non numeric characters...
sVal = CInt(sVal)
If sVal = 0 Then sVal = 500 'set it to default..miliseconds
AxGlobeControl1.TipDelay = sVal
AxGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid
AxGlobeControl1.ShowGlobeTips = m_penumTips
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End If
End Sub
Private Sub CmdAmbient_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdAmbient.Click
Dim sVal As String
sVal = TxtAmbient.Text
sVal = CSng(sVal)
If sVal > 1.0# Then sVal = 1
If sVal < 0.0# Then sVal = 0
Dim pglbDispRend As IGlobeDisplayRendering
pglbDispRend = AxGlobeControl1.GlobeDisplay
pglbDispRend.AmbientLight = sVal
'update textbox
TxtAmbient.Text = sVal
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End Sub
Private Sub CmdSetSun_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdSetSun.Click
Dim pCmDRgb As New RgbColorClass
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub
pCmDRgb.Red = ColorDialog1.Color.R
pCmDRgb.Blue = ColorDialog1.Color.B
pCmDRgb.Green = ColorDialog1.Color.G
ChangeIllumination(pCmDRgb)
End Sub
Private Sub frmGlbCntrl_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
'if default Desktop's document exists use as default
Dim sGlbData As String, sRegkeyDesktop As String, sRegkeyEngine As String
sRegkeyDesktop = "SOFTWARE\ESRI\ArcGIS"
sGlbData = routin_ReadRegistry(sRegkeyDesktop)
'if that fails check to see if the coreRntime exists registry...
If sGlbData = "" Then
sRegkeyEngine = "SOFTWARE\ESRI\CoreRuntime"
sGlbData = routin_ReadRegistry(sRegkeyEngine)
End If
If sGlbData <> "" Then
sGlbData = sGlbData & "ArcGlobeData\Default_Document.3dd"
If AxGlobeControl1.Check3dFile(sGlbData) Then AxGlobeControl1.Load3dFile(sGlbData)
End If
'Enable north arrow, HUD and GlobeTips..
Dim bChkArrow As Boolean, bHUD As Boolean
bChkArrow = AxGlobeControl1.GlobeViewer.NorthArrowEnabled
bHUD = AxGlobeControl1.GlobeViewer.HUDEnabled
ChkHUD.Checked = bHUD
ChkArrow.Checked = bChkArrow
'get the state of globetips from the loaded doc.....
m_penumTips = AxGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips
'if no tip value (not set) in the loaded doc set it to default..
If m_penumTips <= 0 Then
m_penumTips = esriGlobeTipsType.esriGlobeTipsTypeLatLon
End If
cmbTipType.Items.Insert(0, "esriGlobeTipsTypeNone")
cmbTipType.Items.Insert(1, "esriGlobeTipsTypeLatLon")
cmbTipType.Items.Insert(2, "esriGlobeTipsTypeElevation")
cmbTipType.Items.Insert(3, "esriGlobeTipsTypeLatLonElevation")
ChkTip.Checked = True 'tip value of the doc...
'set the list...
cmbTipType.SelectedIndex = m_penumTips
'populate tip type values..
AxGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid
AxGlobeControl1.TipDelay = 500 'default..
AxGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips = m_penumTips
AxGlobeControl1.GlobeDisplay.RefreshViewers()
'Get current sun property..
Dim pglbDispRend As IGlobeDisplayRendering
pglbDispRend = AxGlobeControl1.GlobeDisplay
Dim bsun As Boolean
bsun = pglbDispRend.IsSunEnabled
If bsun = True Then chkSun.Checked = True 'checked
'Get Ambient light...
TxtAmbient.Text = CStr(pglbDispRend.AmbientLight)
'Listen to events..
m_pglbDisplay = AxGlobeControl1.GlobeDisplay
End Sub
Private Function routin_ReadRegistry(ByRef sKey As String) As String
'Open the subkey for reading
'Dim rk As Microsoft.Win32.RegistryKey
'rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey, True)
'If rk Is Nothing Then routin_ReadRegistry = ""
'Get the data from a specified item in the key.
Dim installationFolder As String = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path
'routin_ReadRegistry = rk.GetValue("InstallDir")
routin_ReadRegistry = installationFolder
End Function
Private Sub ChangeIllumination(ByRef prgb As RgbColorClass)
Dim pglbDispRend As IGlobeDisplayRendering
pglbDispRend = AxGlobeControl1.GlobeDisplay
Dim platitude As Double, plongitude As Double
Dim pSunred As Single, pSungreen As Single, pSunblue As Single
If pglbDispRend.IsSunEnabled = True And chkSun.Checked = True Then
'get the Default position and color...
pglbDispRend.GetSunPosition(platitude, plongitude)
pglbDispRend.GetSunColor(pSunred, pSungreen, pSunblue)
'Set AmbientLght
Dim sVal As String
sVal = TxtAmbient.Text
sVal = CSng(sVal)
If sVal > 1 Then sVal = 1
If sVal < 0 Then sVal = 0
pglbDispRend.AmbientLight = sVal
'update textbox
TxtAmbient.Text = sVal
Dim pAmbientLght As Single
pAmbientLght = pglbDispRend.AmbientLight
Dim pIcolor As IColor
pIcolor = prgb
Dim pglbDisp As IGlobeDisplay
pglbDisp = EnableSetSun(pAmbientLght, platitude, plongitude, pIcolor)
AxGlobeControl1.GlobeDisplay = pglbDisp
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End If
End Sub
Private Function EnableSetSun(ByRef pAmbientLght As Single, ByRef platitude As Double, ByRef plongitude As Double, ByRef pColor As IColor) As IGlobeDisplay
Dim pRgbColor As IRgbColor
pRgbColor = New RgbColorClass
pRgbColor.RGB = System.Convert.ToInt32(pColor.RGB)
Dim pSunred As Single, pSungreen As Single, pSunblue As Single
pSunred = CSng(pRgbColor.Red)
pSungreen = CSng(pRgbColor.Green)
pSunblue = CSng(pRgbColor.Blue)
Dim pglbDispRend As IGlobeDisplayRendering
pglbDispRend = AxGlobeControl1.GlobeDisplay
pglbDispRend.SetSunColor(pSunred, pSungreen, pSunblue)
pglbDispRend.SetSunPosition(platitude, plongitude)
pglbDispRend.AmbientLight = pAmbientLght
EnableSetSun = AxGlobeControl1.GlobeDisplay
End Function
Public Sub GetObserVerLatLong(ByRef pViewer As ESRI.ArcGIS.Analyst3D.ISceneViewer, ByRef pLatDD As Double, ByRef pLonDD As Double, ByRef pAltKms As Double, ByRef pRoll As Double, ByRef pIncl As Double)
Dim pCam As IGlobeCamera
pCam = pViewer.Camera
pCam.GetObserverLatLonAlt(pLatDD, pLonDD, pAltKms)
Dim pIcam As ICamera
pIcam = pCam
pRoll = pIcam.RollAngle
pIncl = pIcam.Inclination
End Sub
Public Sub UpdateCustomHUD(ByRef pLatDD As Double, ByRef pLonDD As Double, ByRef pAltKms As Double, ByRef pRoll As Double, ByRef pIncl As Double)
LblAltVal.Text = pAltKms.ToString
lblLatVal.Text = pLatDD.ToString
LblLonVal.Text = pLonDD.ToString
End Sub
Private Sub m_pglbDisplay_AfterDraw(ByVal pViewer As ESRI.ArcGIS.Analyst3D.ISceneViewer) Handles m_pglbDisplay.AfterDraw
Dim pLatDD As Double, pLonDD As Double, pAltKms As Double, pRoll As Double, pIncl As Double
GetObserVerLatLong(pViewer, pLatDD, pLonDD, pAltKms, pRoll, pIncl)
UpdateCustomHUD(pLatDD, pLonDD, pAltKms, pRoll, pIncl)
End Sub
Private Sub ChkArrow_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkArrow.CheckedChanged
Dim bChkArrow As Boolean
bChkArrow = AxGlobeControl1.GlobeViewer.NorthArrowEnabled
If ChkArrow.Checked = False And bChkArrow = True Then
AxGlobeControl1.GlobeViewer.NorthArrowEnabled = False 'unchecked
AxGlobeControl1.GlobeDisplay.RefreshViewers()
ElseIf ChkArrow.Checked = True And bChkArrow = False Then
AxGlobeControl1.GlobeViewer.NorthArrowEnabled = True 'checked
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End If
End Sub
Private Sub ChkHUD_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkHUD.CheckedChanged
'Default HUD
Dim bHUD As Boolean
bHUD = AxGlobeControl1.GlobeViewer.HUDEnabled
If ChkHUD.Checked = False And bHUD = True Then
AxGlobeControl1.GlobeViewer.HUDEnabled = False 'unchecked
AxGlobeControl1.GlobeDisplay.RefreshViewers()
ElseIf ChkHUD.Checked = True And bHUD = False Then
AxGlobeControl1.GlobeViewer.HUDEnabled = True 'checked
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End If
End Sub
Private Sub chkSun_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSun.CheckedChanged
Dim pglbDispRend As IGlobeDisplayRendering
pglbDispRend = AxGlobeControl1.GlobeDisplay
Dim bsun As Boolean
bsun = pglbDispRend.IsSunEnabled
If chkSun.Checked = False And bsun = True Then
pglbDispRend.IsSunEnabled = False 'unchecked
CmdSetSun.Enabled = False
ElseIf chkSun.Checked = True And bsun = False Then
pglbDispRend.IsSunEnabled = True 'checked
CmdSetSun.Enabled = True
End If
End Sub
Private Sub ChkTip_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkTip.CheckedChanged
If ChkTip.Checked = False Then
AxGlobeControl1.ShowGlobeTips = esriGlobeTipsType.esriGlobeTipsTypeNone
AxGlobeControl1.GlobeDisplay.RefreshViewers()
cmbTipType.Enabled = False
TxtTipDelay.Enabled = False
Else
Dim sVal As String
cmbTipType.Enabled = True
TxtTipDelay.Enabled = True
sVal = TxtTipDelay.Text
If sVal = 0 Then sVal = 500 'set it to default..miliseconds
If cmbTipType.SelectedIndex >= 0 Then m_penumTips = cmbTipType.SelectedIndex
AxGlobeControl1.TipDelay = sVal
AxGlobeControl1.TipStyle = esriTipStyle.esriTipStyleSolid
AxGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips = m_penumTips
AxGlobeControl1.GlobeDisplay.RefreshViewers()
End If
End Sub
Private Sub AxGlobeControl1_OnGlobeReplaced(ByVal sender As Object, ByVal e As ESRI.ArcGIS.Controls.IGlobeControlEvents_OnGlobeReplacedEvent) Handles AxGlobeControl1.OnGlobeReplaced
Dim pglbbDispRend As IGlobeDisplayRendering
pglbbDispRend = AxGlobeControl1.GlobeDisplay
Dim bsun As Boolean
bsun = pglbbDispRend.IsSunEnabled
If bsun = True Then chkSun.Checked = True 'checked
'get the state of globetips from the loaded doc.....
m_penumTips = AxGlobeControl1.GlobeViewer.GlobeDisplay.Globe.ShowGlobeTips
End Sub
End Class