using System; using System.Collections; using System.Collections.Generic; using System.Windows.Forms.DataVisualization.Charting; using DevComponents.DotNetBar; using GeoScene.Data; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmProfileAnalysis : Office2007Form { GSOGlobeControl globeControl1; List<GSOFeature> features = new List<GSOFeature>(); public FrmProfileAnalysis(GSOGlobeControl _ctl,List<GSOFeature> selectFeatures) { InitializeComponent(); globeControl1 = _ctl; features = selectFeatures; } /// <summary> /// 窗体初始化事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmProfileAnalysis_Load(object sender, EventArgs e) { chart1.Titles[0].Text = "地下管线纵断面图"; chart1.ChartAreas[0].AxisX.Title = "距离(米)"; chart1.ChartAreas[0].AxisY.Title = "埋深(米)"; chart1.ChartAreas[0].AxisY.IsStartedFromZero = true; ArrayList xlist = new ArrayList(); ArrayList ylist = new ArrayList(); double lineLen = 0.0; for (int i = 0; i < features.Count; i++) { GSOGeoPolyline3D line = features[i].Geometry as GSOGeoPolyline3D ; if (line != null) { xlist.Clear(); ylist.Clear(); for (int j = 0; j < line.PartCount; j++) { GSOPoint3ds point3ds = line[j]; double partLen = 0.0; for (int k = 0; k < point3ds.Count; k++) { GSOGeoPolyline3D newLine = new GSOGeoPolyline3D(); GSOPoint3ds pts3 = new GSOPoint3ds(); pts3.Add(point3ds[0]); pts3.Add(point3ds[k]); newLine.AddPart(pts3); double len = newLine.GetSpaceLength(false, 6378137.0); partLen = len; len += lineLen; xlist.Add(Convert.ToDouble(len.ToString("0.00"))); ylist.Add(Convert.ToDouble(point3ds[k].Z.ToString("0.00"))); } lineLen += partLen; } chart1.Series.Add("管线" + i); chart1.Series["管线" + i].ChartType = SeriesChartType.Line; chart1.Series["管线" + i]["DrawingStyle"] = "Cylinder"; chart1.Series["管线" + i].IsValueShownAsLabel = false; chart1.Series["管线" + i].MarkerStyle = MarkerStyle.Circle; chart1.Series["管线" + i].Points.DataBindXY(xlist, ylist); } } } } }