private void LoadDynamicObjectAndLineFromFile() { ICameraTour tour = null; string tourPath = (strMediaPath + @"\xml\CameraTour_2.xml"); if (File.Exists(tourPath)) { StreamReader sr = new StreamReader(tourPath); string xmlstring = sr.ReadToEnd(); sr.Close(); tour = this.axRenderControl1.ObjectManager.CreateCameraTour(rootId); tour.FromXml(xmlstring); } if (tour == null) { MessageBox.Show("xml文件读取失败"); } dynamicObject.CrsWKT = tour.CrsWKT; point.SpatialCRS = new CRSFactory().CreateFromWKT(tour.CrsWKT) as ISpatialCRS; line.SpatialCRS = new CRSFactory().CreateFromWKT(tour.CrsWKT) as ISpatialCRS; for (int i = 0; i < tour.WaypointsNumber; i++) { double duration; gviCameraTourMode mode; tour.GetWaypoint(i, out position, out angle, out duration, out mode); dynamicObject.AddWaypoint(position, 10); point.Position = position; if (line.PointCount == 0) { line.StartPoint = point; } else { line.AddPointAfter(i - 1, point); } } ICurveSymbol cur = new CurveSymbol(); cur.Color = System.Drawing.Color.Yellow; cur.Width = -2; rline = this.axRenderControl1.ObjectManager.CreateRenderPolyline(line, cur, rootId); }