using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using DevComponents.DotNetBar; namespace PipeLine.Forms { public partial class FrmAddPipelineCoordinate : Office2007Form { public FrmAddPipelineCoordinate() { InitializeComponent(); } public GSOGeoPolyline3D polyline; private void btnOK_Click(object sender, EventArgs e) { // 新建管线 polyline = new GSOGeoPolyline3D(); //把管线的段点坐标设置好 GSOPoint3ds pts = new GSOPoint3ds(); pts.Add(CreatePoint(txtX1.Text,txtY1.Text)); pts.Add(CreatePoint(txtX2.Text,txtY2.Text)); polyline.AddPart(pts); this.DialogResult = DialogResult.OK; this.Close(); } private GSOPoint3d CreatePoint(string _x, string _y) { int id = GeoScene.Data.GSOProjectManager.AddProject("+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=555484.8092 +y_0=-4114948.631 +ellps=krass +units=m +no_defs"); double x = Convert.ToDouble(_x); double y = Convert.ToDouble(_y); GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); // double z = Convert.ToDouble(_z); GSOPoint3d pt3d = new GSOPoint3d(result.X, result.Y, 0); return pt3d; } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } }