private void AxGlobeControlEx_Load(object sender, EventArgs e) { IGlobeDisplayEvents_Event m_GlobeDisplayEvents = axGlobeControl1.Globe.GlobeDisplay as IGlobeDisplayEvents_Event; this.MouseWheel += new MouseEventHandler(GlobleControl_MouseWheel); //将三维视图重绘事件委托给m_GlobeDisplayEvents_AfterDraw方法 m_GlobeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(GlobeControl_DisplayEvents_AfterDraw); axMapControl1.OnMouseDown += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnMouseDownEventHandler(axMapControl1_OnMouseDown); axMapControl1.Extent = axMapControl1.FullExtent; // 初始化地图框架 MapFrame.Logic.InitMapFrame mapFrame = new MapFrame.Logic.InitMapFrame(MapEngineType.ArcGlobe, axGlobeControl1); mapLogic = mapFrame.GetMapLogic(); mfMap = mapLogic.GetIMFMap(); Load3dFile(); // 加载3d文档 LoadMxdFile(); // 自定义显示鹰眼工具 ShowEagleEyeCmd showEagleEyeCmd = new ShowEagleEyeCmd(this); axToolbarControl1.AddItem(showEagleEyeCmd, -1, 22, false, -1, esriCommandStyles.esriCommandStyleIconOnly); globeBusiness = new ArcGlobeBusiness(mapLogic, trackMgr); eagleEyePanel.Visible = false; InitBookmark(); // 初始化书签 }
private void Form1_Load(object sender, EventArgs e) { m_Globe = axGlobeControl1.Globe; m_GlobeDisplay = m_Globe.GlobeDisplay; m_SceneView = m_GlobeDisplay.ActiveViewer; m_GlobeViewUtil = axGlobeControl1.GlobeCamera as IGlobeViewUtil; IGlobeDisplayEvents_Event m_GlobeDisplayEvents = axGlobeControl1.Globe.GlobeDisplay as IGlobeDisplayEvents_Event; //将三维视图重绘事件委托给m_GlobeDisplayEvents_AfterDraw方法 m_GlobeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(m_GlobeDisplayEvents_AfterDraw); axMapControl1.Extent = axMapControl1.FullExtent; comboBox1.SelectedIndex = 0; }
public GlobeControl() { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop); InitializeComponent(); IGlobeDisplayEvents_Event m_GlobeDisplayEvents = axGlobeControl1.Globe.GlobeDisplay as IGlobeDisplayEvents_Event; this.MouseWheel += new MouseEventHandler(GlobleControl_MouseWheel);; //将三维视图重绘事件委托给m_GlobeDisplayEvents_AfterDraw方法 m_GlobeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(GlobeControl_DisplayEvents_AfterDraw); axMapControl1.OnMouseDown += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnMouseDownEventHandler(axMapControl1_OnMouseDown); axMapControl1.Extent = axMapControl1.FullExtent; Load3dFile(); ShowEagleEyeCmd showEagleEyeCmd = new ShowEagleEyeCmd(this); axToolbarControl1.AddItem(showEagleEyeCmd, -1, 22, false, -1, esriCommandStyles.esriCommandStyleIconOnly); }
private void Form1_Load(object sender, System.EventArgs e) { //relative file path to the sample data from project location string sGlbData = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); sGlbData = Path.Combine(sGlbData, @"ArcGIS\data\Globe\World Imagery.3dd"); var filePath = new DirectoryInfo(sGlbData); System.Diagnostics.Debug.WriteLine(string.Format("File path for data root: {0} [{1}]", filePath.FullName, Directory.GetCurrentDirectory())); if (!File.Exists(sGlbData)) { throw new Exception(string.Format("Fix code to point to your sample data: {0} [{1}] was not found", filePath.FullName, Directory.GetCurrentDirectory())); } 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.. m_globeDisplay = axGlobeControl1.GlobeDisplay; globeDisplayEvents = (IGlobeDisplayEvents_Event)m_globeDisplay; globeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //globeDisplayEvents += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //afterDrawE = new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //((IGlobeDisplayEvents_Event)axGlobeControl1.GlobeDisplay).AfterDraw+=afterDrawE; //globeDisplayEvents.AfterDraw += new (globeDisplayEvents_AfterDraw); }
private void Form1_Load(object sender, System.EventArgs e) { // Get the SDK location string sGlbData = RuntimeManager.ActiveRuntime.Path.ToString(); sGlbData = Directory.GetParent(sGlbData).ToString(); // first time removes the directory separator sGlbData = Directory.GetParent(sGlbData).ToString(); sGlbData = sGlbData + "\\DeveloperKit" + RuntimeManager.ActiveRuntime.Version + "\\Samples\\data\\Globe\\World Imagery.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.. m_globeDisplay = axGlobeControl1.GlobeDisplay; globeDisplayEvents = (IGlobeDisplayEvents_Event)m_globeDisplay; globeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //globeDisplayEvents += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //afterDrawE = new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //((IGlobeDisplayEvents_Event)axGlobeControl1.GlobeDisplay).AfterDraw+=afterDrawE; //globeDisplayEvents.AfterDraw += new (globeDisplayEvents_AfterDraw); }
private void Form1_Load(object sender, System.EventArgs e) { // Get the SDK location string sGlbData = RuntimeManager.ActiveRuntime.Path.ToString(); sGlbData = Directory.GetParent(sGlbData).ToString(); // first time removes the directory separator sGlbData = Directory.GetParent(sGlbData).ToString(); sGlbData = sGlbData + "\\DeveloperKit" + RuntimeManager.ActiveRuntime.Version + "\\Samples\\data\\Globe\\World Imagery.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.. m_globeDisplay = axGlobeControl1.GlobeDisplay; globeDisplayEvents = (IGlobeDisplayEvents_Event)m_globeDisplay; globeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //globeDisplayEvents += new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //afterDrawE = new IGlobeDisplayEvents_AfterDrawEventHandler(OnAfterDraw); //((IGlobeDisplayEvents_Event)axGlobeControl1.GlobeDisplay).AfterDraw+=afterDrawE; //globeDisplayEvents.AfterDraw += new (globeDisplayEvents_AfterDraw); }