private void btnAnalyse_Click(object sender, EventArgs e) { try { WaitForm.Start("正在分析...", "请稍后"); IPoint ptStart = this._geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); ptStart.X = (double)this.seObserX.Value; ptStart.Y = (double)this.seObserY.Value; ptStart.Z = (double)this.seObserZ.Value + (double)this.seObserZOff.Value; IPoint ptEnd = this._geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); ptEnd.X = (double)this.seObjX.Value; ptEnd.Y = (double)this.seObjY.Value; ptEnd.Z = (double)this.seObjZ.Value + (double)this.seObjZOff.Value; double HorizontalAngle = (double)this.seAngle.Value; ClearViewshed(); this._vs = this._3DControl.ObjectManager.CreateViewshed(ptStart, this._3DControl.ProjectTree.RootID); IEulerAngle ang = this._3DControl.Camera.GetAimingAngles2(ptStart, ptEnd);; //ang.Set(ang.Heading, 0, ang.Roll); this._vs.AspectRatio = 1; this._vs.DisplayMode = gviTVDisplayMode.gviTVShowPicture; this._vs.Angle = ang; this._vs.FarClip = Math.Sqrt((ptStart.X - ptEnd.X) * (ptStart.X - ptEnd.X) + (ptStart.Y - ptEnd.Y) * (ptStart.Y - ptEnd.Y) + (ptStart.Z - ptEnd.Z) * (ptStart.Z - ptEnd.Z)); this._vs.FieldOfView = HorizontalAngle; this._3DControl.HighlightHelper.VisibleMask = 0; } catch (Exception ex) { } finally { WaitForm.Stop(); } }
/// <summary> /// 离散Polygon /// </summary> /// <param name="polygon"></param> /// <param name="distance"></param> private IPolygon DiscretePolygon(IPolygon polygon, double distance) { string wkt = "PROJCS[\"<Custom Coordinate>\",GEOGCS[\"GCS_Beijing_1954\",DATUM[\"D_Beijing_1954\",SPHEROID[\"Krasovsky_1940\",6378245.0,298.3]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"false_easting\",64685.26],PARAMETER[\"false_northing\",-3267460.1405],PARAMETER[\"central_meridian\",120.0],PARAMETER[\"scale_factor\",1.0],PARAMETER[\"latitude_of_origin\",0.0],UNIT[\"Meter\",1.0]]"; ICoordinateReferenceSystem tempcrs = crsFactory.CreateFromWKT(wkt); IRing ring = polygon.ExteriorRing; IPolygon resPolygon = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; resPolygon.SpatialCRS = crs as ISpatialCRS; for (int i = 0; i < ring.PointCount - 1; i++) { IPoint point1 = ring.GetPoint(i); IPoint point2 = ring.GetPoint(i + 1); resPolygon.ExteriorRing.AppendPoint(point1); point1.Project(tempcrs as ISpatialCRS); point2.Project(tempcrs as ISpatialCRS); IVector3 p1 = point1.Position; IVector3 p2 = point2.Position; IEulerAngle angle = this.axRenderControl1.Camera.GetAimingAngles(p1, p2); p2.MultiplyByScalar(-1); double length = p1.Add(p2).Length; for (int j = 0; j < (int)(length / distance); j++) { IVector3 tempv3 = this.axRenderControl1.Camera.GetAimingPoint(p1, angle, (distance * (j + 1))); IPoint tempPoint = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); tempPoint.Position = tempv3; tempPoint.SpatialCRS = tempcrs as ISpatialCRS; tempPoint.Project(crs as ISpatialCRS); resPolygon.ExteriorRing.AppendPoint(tempPoint); } } resPolygon.Close(); return(resPolygon); }
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBoxEdit1.SelectedIndex == 0) { this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } else if (this.comboBoxEdit1.SelectedIndex == 1) { this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; this.layoutControlItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; Clear(); if (this._drawTool != null) { this._drawTool.OnStartDraw -= new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw -= new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Close(); this._drawTool.End(); this._drawTool = null; } IPoint pt = null; IEulerAngle ang = null; app.Current3DMapControl.Camera.GetCamera2(out pt, out ang); if (pt != null) { this.seX.EditValue = pt.X; this.seY.EditValue = pt.Y; this.seZ.EditValue = pt.Z; } } }
private bool OnLocation() { if (d3 == null) { return(false); } bool bX = double.TryParse(this.te_X.Text, out x); bool bY = double.TryParse(this.te_Y.Text, out y); if (!bX || !bY) { return(false); } IVector3 vect = null; IEulerAngle angle = null; d3.Camera.GetCamera(out vect, out angle); if (d3.Terrain.IsRegistered) { double z = d3.Terrain.GetElevation(x, y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase); vect.Set(x, y, z); } else { vect.Set(x, y, vect.Z); } IImagePointSymbol imagePointSymbol = new ImagePointSymbolClass(); imagePointSymbol.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\Location.png"); imagePointSymbol.Size = SystemInfo.Instance.SymbolSize; imagePointSymbol.Alignment = gviPivotAlignment.gviPivotAlignBottomCenter; IPoint pt = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pt.SetCoords(vect.X, vect.Y, vect.Z, 0, 0); IRenderPoint renderPoint = d3.ObjectManager.CreateRenderPoint(pt, imagePointSymbol, d3.ProjectTree.RootID); renderPoint.MaxVisibleDistance = 10000000000.0; ITextSymbol textSymbol = new TextSymbolClass(); textSymbol.TextAttribute = new TextAttributeClass { TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16), TextSize = SystemInfo.Instance.TextSize }; textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignTopCenter; ILabel label = d3.ObjectManager.CreateLabel(d3.ProjectTree.RootID); label.Position = pt; label.MaxVisibleDistance = 10000000000.0; label.TextSymbol = textSymbol; label.Text = this.te_X.Text + "," + this.te_Y.Text; this.listRender.Add(renderPoint); this.listRender.Add(label); d3.Camera.LookAt(vect, 500, angle); return(true); }
private void SetCamera(IVector3 position, IEulerAngle angle, bool isLookAt, double distance) { if (isLookAt) { _axRenderControl.Camera.LookAt(position, distance, angle); } else { _axRenderControl.Camera.SetCamera(position, angle, i3dSetCameraFlags.i3dSetCameraNoFlags); } }
public void SetCameraValues(double x, double y, double z, double heading = 0, double tilt = -60, double roll = 0, double distance = 2000, bool isLookAt = true) { IVector3 position = new Vector3() { X = x, Y = y, Z = z }; IEulerAngle angle = SetAngle(heading, tilt, roll); SetCamera(position, angle, isLookAt, distance); }
private void btnFlyToObjective_Click(object sender, EventArgs e) { IPoint ptStart = this._geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); ptStart.X = (double)this.seObserX.Value; ptStart.Y = (double)this.seObserY.Value; ptStart.Z = (double)this.seObserZ.Value + (double)this.seObserZOff.Value; IPoint ptEnd = this._geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); ptEnd.X = (double)this.seObjX.Value; ptEnd.Y = (double)this.seObjY.Value; ptEnd.Z = (double)this.seObjZ.Value + (double)this.seObjZOff.Value; IEulerAngle ang = this._3DControl.Camera.GetAimingAngles2(ptEnd, ptStart); this._3DControl.Camera.SetCamera2(ptEnd, ang, gviSetCameraFlags.gviSetCameraNoFlags); }
private void FormLocByCoordinate_Load(object sender, EventArgs e) { this.cbe_History.Properties.Items.Clear(); IVector3 vect = null; IEulerAngle angle = null; d3.Camera.GetCamera(out vect, out angle); this.te_X.Text = vect.X.ToString("0.00"); this.te_Y.Text = vect.Y.ToString("0.00"); // 加载历史记录 try { if (File.Exists(filePath)) { StreamReader sr = new StreamReader(filePath); string str = sr.ReadLine(); while (!string.IsNullOrEmpty(str)) { string[] arr = str.Split(','); if (arr.Length >= 2) { string str1 = arr[0]; string str2 = arr[1]; double tempx, tempy; bool bRes1 = double.TryParse(str1, out tempx); bool bRes2 = double.TryParse(str2, out tempy); if (bRes1 && bRes2) { this.cbe_History.Properties.Items.Add(str1 + "," + str2); } } str = sr.ReadLine(); } sr.Close(); } } catch (Exception ex) { } }
void axRenderControl1_RcObjectEditing(IGeometry Geometry) { polyline = Geometry as IPolyline; if (polyline.PointCount == 2) { this.axRenderControl1.ObjectEditor.FinishEdit(); this.axRenderControl1.InteractMode = gviInteractMode.gviInteractNormal; this.axRenderControl1.MouseSelectMode = gviMouseSelectMode.gviMouseSelectDrag; this.axRenderControl1.RcObjectEditing -= new _IRenderControlEvents_RcObjectEditingEventHandler(axRenderControl1_RcObjectEditing); IEulerAngle angle = this.axRenderControl1.Camera.GetAimingAngles2(polyline.GetPoint(0), polyline.GetPoint(1)); IEulerAngle cameraAngle = new EulerAngle(); cameraAngle.Heading = angle.Heading - 90; cameraAngle.Tilt = cameraAngle.Roll = 0; IPoint center = polyline.Midpoint; IEnvelope newEnv = new Envelope(); //newEnv表示相机出图范围 newEnv.MinX = -polyline.Length / 2; //相机出图宽度 newEnv.MaxX = polyline.Length / 2; newEnv.MinY = -10; //相机出图高度 newEnv.MaxY = 100; newEnv.MinZ = -100; //相机出图深度 newEnv.MaxZ = 100; SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "Image Files(*.BMP)|*.BMP|Image Files(*.PNG)|*.PNG|Image Files(*.JPG)|*.JPG"; dlg.DefaultExt = ".bmp"; if (dlg.ShowDialog() == DialogResult.OK) { bool b = this.axRenderControl1.ExportManager.ExportOrthoImage(dlg.FileName, 1024, center, cameraAngle, newEnv, false, System.Drawing.Color.Blue); if (!b) { MessageBox.Show("错误码为:" + this.axRenderControl1.GetLastError().ToString()); } } } }
public void SetAngle(IEulerAngle g) { tv.Angle = g; Angle = g.Heading.ToString() + "," + g.Tilt.ToString() + "," + g.Roll.ToString(); }
void printfEulerAngle(IEulerAngle ang) { Logger.WriteMsg(ang.Heading + "\t" + ang.Tilt + "\t" + ang.Roll); Logger.WriteMsg(""); }
private void DrawBox() { try { IPolyline line = this._drawTool.GetGeo() as IPolyline; if (line == null || line.PointCount != 2) { return; } DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } if (this._renderBox != null) { app.Current3DMapControl.ObjectManager.DeleteObject(this._renderBox.Guid); this._renderBox = null; } if (this._renderPolygon != null) { app.Current3DMapControl.ObjectManager.DeleteObject(this._renderPolygon.Guid); this._renderPolygon = null; } double middleZ = (line.StartPoint.Z + line.EndPoint.Z) / 2; double minZ = middleZ + (double)this.seMinHeight.Value; double maxZ = middleZ + (double)this.seMaxHeight.Value; IPoint startPoint = line.StartPoint; IPoint endPoint = line.EndPoint; IEulerAngle ang = app.Current3DMapControl.Camera.GetAimingAngles2(startPoint, endPoint); IEulerAngle angcz = new EulerAngle(); angcz.Set(ang.Heading - 90, ang.Tilt, ang.Roll); IPoint pt1 = app.Current3DMapControl.Camera.GetAimingPoint2(startPoint, angcz, this.tbcClipDis.Value); IPoint pt2 = app.Current3DMapControl.Camera.GetAimingPoint2(endPoint, angcz, this.tbcClipDis.Value); ICRSFactory crsFact = new CRSFactory(); ISpatialCRS crs = crsFact.CreateFromWKT(app.Current3DMapControl.GetCurrentCrsWKT()) as ISpatialCRS; IGeometryFactory geoFact = new GeometryFactoryClass(); IPoint pointb1 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointb1.SpatialCRS = crs; pointb1.SetCoords(startPoint.X, startPoint.Y, minZ, 0, 0); IPoint pointb2 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointb2.SpatialCRS = crs; pointb2.SetCoords(endPoint.X, endPoint.Y, minZ, 0, 0); IPoint pointb3 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointb3.SpatialCRS = crs; pointb3.SetCoords(pt2.X, pt2.Y, minZ, 0, 0); IPoint pointb4 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointb1.SpatialCRS = crs; pointb4.SetCoords(pt1.X, pt1.Y, minZ, 0, 0); IPolygon polygonBottom = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygonBottom.SpatialCRS = crs; polygonBottom.ExteriorRing.AppendPoint(pointb1); polygonBottom.ExteriorRing.AppendPoint(pointb2); polygonBottom.ExteriorRing.AppendPoint(pointb3); polygonBottom.ExteriorRing.AppendPoint(pointb4); IPoint pointt1 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointt1.SpatialCRS = crs; pointt1.SetCoords(startPoint.X, startPoint.Y, maxZ, 0, 0); IPoint pointt2 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointt2.SpatialCRS = crs; pointt2.SetCoords(endPoint.X, endPoint.Y, maxZ, 0, 0); IPoint pointt3 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointt3.SpatialCRS = crs; pointt3.SetCoords(pt2.X, pt2.Y, maxZ, 0, 0); IPoint pointt4 = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointt4.SpatialCRS = crs; pointt4.SetCoords(pt1.X, pt1.Y, maxZ, 0, 0); IPolygon polygonTop = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygonTop.SpatialCRS = crs; polygonTop.ExteriorRing.AppendPoint(pointt1); polygonTop.ExteriorRing.AppendPoint(pointt2); polygonTop.ExteriorRing.AppendPoint(pointt3); polygonTop.ExteriorRing.AppendPoint(pointt4); IPolygon polygon1 = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon1.SpatialCRS = crs; polygon1.ExteriorRing.AppendPoint(pointb1); polygon1.ExteriorRing.AppendPoint(pointb2); polygon1.ExteriorRing.AppendPoint(pointt2); polygon1.ExteriorRing.AppendPoint(pointt1); IPolygon polygon2 = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon2.SpatialCRS = crs; polygon2.ExteriorRing.AppendPoint(pointb1); polygon2.ExteriorRing.AppendPoint(pointb4); polygon2.ExteriorRing.AppendPoint(pointt4); polygon2.ExteriorRing.AppendPoint(pointt1); IPolygon polygon3 = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon3.SpatialCRS = crs; polygon3.ExteriorRing.AppendPoint(pointb2); polygon3.ExteriorRing.AppendPoint(pointb3); polygon3.ExteriorRing.AppendPoint(pointt3); polygon3.ExteriorRing.AppendPoint(pointt2); IPolygon polygon4 = geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon4.SpatialCRS = crs; polygon4.ExteriorRing.AppendPoint(pointb3); polygon4.ExteriorRing.AppendPoint(pointb4); polygon4.ExteriorRing.AppendPoint(pointt4); polygon4.ExteriorRing.AppendPoint(pointt3); IMultiPolygon multiPolygon = geoFact.CreateGeometry(gviGeometryType.gviGeometryMultiPolygon, gviVertexAttribute.gviVertexAttributeZ) as IMultiPolygon; multiPolygon.SpatialCRS = crs; multiPolygon.AddPolygon(polygonBottom); multiPolygon.AddPolygon(polygonTop); //multiPolygon.AddPolygon(polygon1); multiPolygon.AddPolygon(polygon2); multiPolygon.AddPolygon(polygon3); multiPolygon.AddPolygon(polygon4); ISurfaceSymbol ss = new SurfaceSymbolClass(); ss.Color = 0x550000AA; ICurveSymbol cs = new CurveSymbolClass(); cs.Color = 0xff0000AA; ss.BoundarySymbol = cs; this._renderPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon1, ss, app.Current3DMapControl.ProjectTree.RootID); ISurfaceSymbol ss1 = new SurfaceSymbolClass(); ss1.Color = 0x88FFFFFF; ICurveSymbol cs1 = new CurveSymbolClass(); cs1.Color = 0xffffffff; ss1.BoundarySymbol = cs1; this._renderBox = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(multiPolygon, ss1, app.Current3DMapControl.ProjectTree.RootID); _env = null; _ang = null; _center = null; _env = new EnvelopeClass(); double xdis = Math.Sqrt((pointb1.X - pointb2.X) * (pointb1.X - pointb2.X) + (pointb1.Y - pointb2.Y) * (pointb1.Y - pointb2.Y)) / 2; double ydis = Math.Sqrt((pointb1.X - pointb4.X) * (pointb1.X - pointb4.X) + (pointb1.Y - pointb4.Y) * (pointb1.Y - pointb4.Y)) / 2; _env.MinZ = -ydis; _env.MaxZ = ydis; _env.MinX = -xdis; _env.MaxX = xdis; _env.MinY = -(maxZ - minZ) / 2.0; _env.MaxY = (maxZ - minZ) / 2.0; _center = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); _center.SpatialCRS = crs; _center.X = polygonBottom.Centroid.X; _center.Y = polygonBottom.Centroid.Y; _center.Z = polygon1.Centroid.Z; _ang = new EulerAngleClass(); _ang.Set(angcz.Heading, 0, 0); } catch (Exception ex) { } }
private void ShowFlowDirect(IFeatureLayerPickResult pr) { if (pr == null) { return; } IRowBuffer row = null; IFdeCursor cursor = null; try { int fid = pr.FeatureId; DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(pr.FeatureLayer.FeatureClassId.ToString()); if (dffc == null) { return; } IFeatureClass fc = dffc.GetFeatureClass(); FacilityClass fac = dffc.GetFacilityClass(); if (fc == null || fac == null || fac.Name != "PipeLine") { return; } DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("FlowDirect"); if (fi == null) { return; } IFieldInfoCollection fiCol = fc.GetFields(); int index = fiCol.IndexOf(fi.Name); if (index == -1) { return; } int indexShape = fiCol.IndexOf("Shape"); IQueryFilter filter = new QueryFilter(); filter.WhereClause = "oid=" + fid; cursor = fc.Search(filter, false); row = cursor.NextRow(); if (row == null) { return; } IPolyline line = null; if (indexShape != -1 && !row.IsNull(indexShape)) { object obj = row.GetValue(indexShape); if (obj != null && obj is IPolyline) { line = obj as IPolyline; } } string flowDirectValue = "0"; int type = 1;// 1表示具有流向字段;2表示从高到低 if (!row.IsNull(index)) { flowDirectValue = row.GetValue(index).ToString(); if (flowDirectValue != "0" && flowDirectValue != "1") { flowDirectValue = "0"; } type = 1; } else if (line != null) { if (line.StartPoint.Z > line.EndPoint.Z) { flowDirectValue = "0"; } else { flowDirectValue = "1"; } type = 2; } if (line == null) { return; } if (this._isAuth) { #region 流向渲染1 FacClassReg reg = FacilityInfoService.GetFacClassRegByFeatureClassID(fc.Guid.ToString()); if (reg == null) { return; } TopoClass tc = FacilityInfoService.GetTopoClassByFacClassCode(reg.FacClassCode); if (tc == null) { return; } FacStyleClass style = null; List <FacStyleClass> facilityStyles = FacilityInfoService.GetFacStyleByFacClassCode(reg.FacClassCode); if ((facilityStyles != null) && (facilityStyles.Count > 0)) { style = facilityStyles[0]; } PipeLineFac plfac = new PipeLineFac(reg, style, row, tc); IRenderModelPoint rmp = null; DrawGeometry.Ocx = DF3DApplication.Application.Current3DMapControl; plfac.ShowFlowDirection(int.Parse(flowDirectValue), out rmp); if (rmp != null) { this._listRender.Add(rmp.Guid); } #endregion } else { #region 流向渲染2 IEulerAngle angle = DF3DApplication.Application.Current3DMapControl.Camera.GetAimingAngles2(line.StartPoint, line.EndPoint); double dia = 0.0; string diaField = fac.GetFieldInfoNameBySystemName("Diameter"); int indexDia = fiCol.IndexOf(diaField); if (indexDia != -1 && !row.IsNull(indexDia)) { string diaStr = row.GetValue(indexDia).ToString(); int indexDia1 = diaStr.ToString().IndexOf('*'); if (indexDia1 != -1) { var dia1 = int.Parse(diaStr.ToString().Substring(0, indexDia1)); var dia2 = int.Parse(diaStr.ToString().Substring(indexDia1 + 1, diaStr.ToString().Length)); dia = ((dia1 > dia2) ? dia1 : dia2) * 0.001; } else { dia = int.Parse(diaStr) * 0.001; } } List <IPoint> points = new List <IPoint>(); if (flowDirectValue == "0") { for (int i = 0; i < line.PointCount; i++) { IPoint pt = line.GetPoint(i); pt.Z += dia / 2; points.Add(pt); } } else if (flowDirectValue == "1") { for (int i = line.PointCount - 1; i >= 0; i--) { IPoint pt = line.GetPoint(i); pt.Z += dia / 2; points.Add(pt); } } for (int i = 0; i < points.Count - 1; i++) { IPoint pt1 = points[i]; var pt2 = points[i + 1]; double delt = 0; double _rate, _distance; if (!(Math.Abs(dia) < 0.0000001)) { delt = 2.0 * dia; if (dia <= 0.5 && dia >= 0.3) { _rate = 7 * dia; _distance = 3 * dia / 0.4; } else if (dia < 0.3 && dia > 0.1) { _rate = 12 * dia; _distance = 6 * dia / 0.4; } else if (dia <= 0.1) { _rate = 22 * dia; _distance = 9 * dia / 0.4; } else { _rate = 3.5 * dia; _distance = 1.5 * dia / 0.4; } } else { _rate = 2.0; _distance = 3.0; //z = maxZ + 0.2; delt = 0.2; } List <IPoint> list = DisPerseLine(pt1, pt2, _distance); if (list.Count < 2) { return; } List <IPoint> list1 = new List <IPoint>(); IGeometryFactory geoFact = new GeometryFactoryClass(); for (int j = 0; j < list.Count - 1; j++) { IPoint p = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); p.X = (list[j].X + list[j + 1].X) / 2; p.Y = (list[j].Y + list[j + 1].Y) / 2; p.Z = (list[j].Z + list[j + 1].Z) / 2; list1.Add(p); } for (var m = 0; m < list1.Count; m++) { IPosition pos = new PositionClass(); pos.X = list1[m].X; pos.Y = list1[m].Y; pos.Altitude = list1[m].Z + delt; pos.AltitudeType = gviAltitudeType.gviAltitudeTerrainAbsolute; pos.Heading = angle.Heading; pos.Tilt = angle.Tilt; pos.Roll = angle.Roll; UInt32 color; if (type == 1) { color = 0xFFFFFF00; } else { color = 0xFF00FFFF; } ITerrainArrow rArrow = DF3DApplication.Application.Current3DMapControl.ObjectManager.CreateArrow(pos, 0.8 * _rate, 3, color, color, DF3DApplication.Application.Current3DMapControl.ProjectTree.RootID); this._listRender.Add(rArrow.Guid); } } #endregion } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }