using System; using System.Data; using System.Windows.Forms; using GeoScene.Data; using GeoScene.Globe; namespace Cyberpipe.EMS_Forms { public partial class Form_TaskInfo : Form { DataTable dt = null; private GSOGlobeControl globeControl1; public delegate void Handle(); public event Handle showParentForm; public Form_TaskInfo(GSOGlobeControl globeControl1,DataTable dt) { this.globeControl1 = globeControl1; this.dt = dt; InitializeComponent(); } private void Form_TaskInfo_Load(object sender, EventArgs e) { try { //string sql = "select * from MARK_TASK where TASK_ID ='" + taskid + "' order by DBID"; //dt = OledbHelper.ExecuteDataTable(sql); dataGridViewX_TaskInfo.DataSource = dt; } catch (Exception ex) { throw ex; } } private void dataGridViewX_TaskInfo_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { DataGridView.HitTestInfo hittestinfo = dataGridViewX_TaskInfo.HitTest(e.X, e.Y); if (hittestinfo.RowIndex <= -1) return; WindowState = FormWindowState.Minimized; string markId = ""; markId = Convert.ToString(dataGridViewX_TaskInfo.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value); int ID = GSOProjectManager.AddProject("+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=499885 +y_0=6 +a=6378140 +b=6356755.288157528 +units=m +no_defs"); GSOFeatures features = globeControl1.Globe.Layers.GetLayerByCaption("标识器").GetFeatureByName(markId, true); if (features.Length > 0) { double x = ((GSOGeoModel)(features[0].Geometry)).PositionX; double y = ((GSOGeoModel)(features[0].Geometry)).PositionY; GSOPoint3d p = new GSOPoint3d(); GSOPoint2d pt2D = new GSOPoint2d(y, x); GSOPoint2d result = GSOProjectManager.Inverse(pt2D, ID); p.X = result.X; p.Y = result.Y; p.X = x; p.Y = y; p.Z = 2; globeControl1.Globe.JumpToFeature(features[0], 20); } else { MessageBox.Show("未找到对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } } private void Form_TaskInfo_FormClosing(object sender, FormClosingEventArgs e) { globeControl1.Globe.MemoryLayer.RemoveAllFeature(); if (showParentForm != null) showParentForm(); } } }