private void DrawElement(IGeometry pGeo) { if (pGeo == null) { return; } //线 if (pGeo is IPolyline) { ISimpleLineSymbol linesymbol = new SimpleLineSymbolClass(); linesymbol.Color = ExportMap.Getcolor(255, 255, 255); linesymbol.Width = 1; ILineElement m_LineElement = new LineElementClass(); m_LineElement.Symbol = linesymbol; // IElement pEle = m_LineElement as IElement; pEle.Geometry = pGeo; this.axMapcontrol.ActiveView.GraphicsContainer.AddElement(pEle, 0); this.axMapcontrol.ActiveView.Refresh(); } }
private void DrawFlowDirection(IFeature feature, IMapControlDefault mapc, esriFlowDirection flowdir) { //获取线段中点 IPolyline polyline = feature.Shape as IPolyline; IPoint midpoint = new PointClass(); polyline.QueryPoint(esriSegmentExtension.esriNoExtension, polyline.Length / 2, false, midpoint); //绘制特征符号 IArrowMarkerSymbol arrowSymbol = new ArrowMarkerSymbolClass(); ISimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbolClass(); IElement element = null; //绘制沿顺着数字化流向 if (flowdir == esriFlowDirection.esriFDWithFlow) { arrowSymbol.Size = 12; arrowSymbol.Color = ExportMap.Getcolor(0, 0, 0); arrowSymbol.Angle = GetlineAngle(polyline.FromPoint, polyline.ToPoint); //绘制 element = new MarkerElementClass(); element.Geometry = midpoint; ((IMarkerElement)element).Symbol = arrowSymbol; //设置绘制元素名称 ((IElementProperties)element).Name = "Flow"; } //方向顺着逆数字化的 if (flowdir == esriFlowDirection.esriFDAgainstFlow) { arrowSymbol.Size = 12; arrowSymbol.Color = ExportMap.Getcolor(0, 0, 0); arrowSymbol.Angle = GetlineAngle(polyline.FromPoint, polyline.ToPoint); //绘制 element = new MarkerElementClass(); element.Geometry = midpoint; ((IMarkerElement)element).Symbol = arrowSymbol; //设置绘制元素名称 ((IElementProperties)element).Name = "Flow"; } //方向未初始化的 if (flowdir == esriFlowDirection.esriFDUninitialized) { markerSymbol.Color = ExportMap.Getcolor(0, 0, 0); markerSymbol.Size = 8; element = new MarkerElementClass(); element.Geometry = midpoint; ((IMarkerElement)element).Symbol = markerSymbol; //设置绘制元素名称 ((IElementProperties)element).Name = "Flow"; } //方向未定义的 if (flowdir == esriFlowDirection.esriFDIndeterminate) { markerSymbol.Color = ExportMap.Getcolor(0, 0, 0); markerSymbol.Size = 8; element = new MarkerElementClass(); element.Geometry = midpoint; ((IMarkerElement)element).Symbol = markerSymbol; //设置绘制元素名称 ((IElementProperties)element).Name = "Flow"; } mapc.ActiveView.GraphicsContainer.AddElement(element, 0); }