public void ShowFlow(IActiveView ipAV) { if (this.m_pPointcol != null) { double num = 4.0 * Math.Atan(1.0); IScreenDisplay screenDisplay = ipAV.ScreenDisplay; screenDisplay.StartDrawing(0, 0); IMarkerSymbol determinateFolwArrow = NetworkAnalyst.m_pFlowSymbol.DeterminateFolwArrow as IMarkerSymbol; for (int i = 0; i < this.m_pPointcol.PointCount; i++) { esriFlowDirection direction = (esriFlowDirection)this.m_eFlowDirection[i]; if (direction == esriFlowDirection.esriFDWithFlow) { determinateFolwArrow.Angle = (180.0 * ((double)this.m_angle[i])) / num; screenDisplay.SetSymbol(determinateFolwArrow as ISymbol); } else if (direction == esriFlowDirection.esriFDAgainstFlow) { determinateFolwArrow.Angle = ((180.0 * ((double)this.m_angle[i])) / num) + 180.0; screenDisplay.SetSymbol(determinateFolwArrow as ISymbol); } else if (direction == esriFlowDirection.esriFDIndeterminate) { screenDisplay.SetSymbol(NetworkAnalyst.m_pFlowSymbol.IndeterminateFolwArrow); } else { screenDisplay.SetSymbol(NetworkAnalyst.m_pFlowSymbol.UninitializedFolwArrow); } IPoint point = this.m_pPointcol.get_Point(i); screenDisplay.DrawPoint(point); } screenDisplay.FinishDrawing(); } }
private void ActiveViewEventsOnAfterDraw(IDisplay display, esriViewDrawPhase phase) { if (!_drawFence) { return; } if (_fenceArray == null || _fenceArray.Count == 0) { return; } IScreenDisplay paramScreenDisplay = ((IActiveView)_context.FocusMap).ScreenDisplay; paramScreenDisplay.StartDrawing(paramScreenDisplay.hDC, -2); for (int i = 0; i < _fenceArray.Count; i++) { IGeometry fence = _fenceArray.Element[i]; if (fence.IsEmpty) { continue; } if (fence is IPolyline) { paramScreenDisplay.SetSymbol(_lineSymbol); paramScreenDisplay.DrawPolyline(fence); } else if (fence is IPolygon) { paramScreenDisplay.SetSymbol(_fillSymbol); paramScreenDisplay.DrawPolygon(fence); } } if (_drawPage && _pageInfos != null && _pageInfos.Count > 0) { IFontDisp disp = new StdFont() as IFontDisp; disp.Name = "Arial"; disp.Size = new decimal(16); foreach (IPrintPageInfo pageInfo in _pageInfos) { IGeometry pageBoundary = pageInfo.Boundary; paramScreenDisplay.SetSymbol(_fillSymbol); paramScreenDisplay.DrawPolygon(pageBoundary); _textSymbol = SymbolHelper.CreateTextSymbol(Color.Red, disp, 16, pageInfo.PageName); paramScreenDisplay.SetSymbol(_textSymbol as ISymbol); if (!string.IsNullOrEmpty(pageInfo.PageName)) { IPoint centerPoint = new ESRI.ArcGIS.Geometry.Point(); IEnvelope pEnv = pageBoundary.Envelope; centerPoint.PutCoords((pEnv.XMin + pEnv.Width / 2.0), pEnv.YMin + pEnv.Height / 2.0); paramScreenDisplay.DrawText(centerPoint, pageInfo.PageName); } } } paramScreenDisplay.FinishDrawing(); }
public void DrawDifferenceGeometry(IGeometry igeometry_0, IScreenDisplay iscreenDisplay_0) { IRgbColor color = new RgbColorClass { Red = 255 }; iscreenDisplay_0.StartDrawing(iscreenDisplay_0.hDC, -1); switch (igeometry_0.GeometryType) { case esriGeometryType.esriGeometryPoint: { ISimpleMarkerSymbol symbol = new SimpleMarkerSymbolClass { Color = color, Size = 10.0 }; iscreenDisplay_0.SetSymbol(symbol as ISymbol); iscreenDisplay_0.DrawPoint(igeometry_0); break; } case esriGeometryType.esriGeometryPolyline: { ISimpleLineSymbol symbol2 = new SimpleLineSymbolClass { Color = color, Width = 2.0 }; iscreenDisplay_0.SetSymbol(symbol2 as ISymbol); iscreenDisplay_0.DrawPolyline(igeometry_0); break; } case esriGeometryType.esriGeometryPolygon: { ISimpleFillSymbol symbol3 = new SimpleFillSymbolClass { Outline = { Color = color, Width = 2.0 }, Style = esriSimpleFillStyle.esriSFSForwardDiagonal }; iscreenDisplay_0.SetSymbol(symbol3 as ISymbol); iscreenDisplay_0.DrawPolygon(igeometry_0); break; } } iscreenDisplay_0.FinishDrawing(); }
public static void FlashGeometry(IScreenDisplay display, IEnumerable <IGeometry> geometries) { IRgbColor color = new RgbColor(); color.Green = color.Blue = 0; color.Red = 255; short cacheId = display.AddCache(); display.StartDrawing(display.hDC, cacheId); geometries.ToList().ForEach(geometry => { if (symbolsToFlash.ContainsKey(geometry.GeometryType)) { var symbol = symbolsToFlash[geometry.GeometryType].Invoke(color); display.SetSymbol(symbol); actionToFlash[geometry.GeometryType].Invoke(display, geometry); } else { throw new KeyNotFoundException("{0} cannot be found in the Symbol dictionary".InvariantFormat(geometry.GeometryType)); } }); display.FinishDrawing(); tagRECT rect = new tagRECT(); display.DrawCache(display.hDC, cacheId, ref rect, ref rect); System.Threading.Thread.Sleep(300); display.Invalidate(rect: null, erase: true, cacheIndex: cacheId); display.RemoveCache(cacheId); }
//ÉÁ˸¶à±ßÐÎ private static void FlashPolygon(IActiveView pActiveView, IGeometry pGeometry, int interval) { IScreenDisplay pDisplay = pActiveView.ScreenDisplay; ISimpleFillSymbol pFillSymbol; ISymbol pSymbol; IRgbColor pRGBColor; pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Outline = null; pRGBColor = new RgbColorClass(); pRGBColor.Green = 148; pRGBColor.Red = 32; pRGBColor.Blue = 0; pFillSymbol.Color = pRGBColor as IColor; //added by chulili 20110805 pSymbol = pFillSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPolygon(pGeometry); System.Threading.Thread.Sleep(interval); pDisplay.DrawPolygon(pGeometry); IElement pEle = new PolygonElementClass();//yjl¸ßÁÁÏÔʾ pEle.Geometry = pGeometry; (pEle as IFillShapeElement).Symbol = pSymbol as IFillSymbol; (pEle as IElementProperties).Name = _FlashTagName; (pActiveView as IGraphicsContainer).AddElement(pEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pEle, null); //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, pEle, null); }
public static void FlashGeometry(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0, ISymbol isymbol_0) { if (igeometry_0 != null) { ISymbol symbol = (isymbol_0 as IClone).Clone() as ISymbol; iscreenDisplay_0.StartDrawing(0, -1); symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; iscreenDisplay_0.SetSymbol(isymbol_0); switch (igeometry_0.GeometryType) { case esriGeometryType.esriGeometryPoint: { iscreenDisplay_0.DrawPoint(igeometry_0); Thread.Sleep(300); iscreenDisplay_0.DrawPoint(igeometry_0); goto case esriGeometryType.esriGeometryPolygon; } case esriGeometryType.esriGeometryMultipoint: case esriGeometryType.esriGeometryPolyline: case esriGeometryType.esriGeometryPolygon: { iscreenDisplay_0.FinishDrawing(); break; } default: { goto case esriGeometryType.esriGeometryPolygon; } } } }
//ÉÁ˸µã private static void FlashPoint(IActiveView pActiveView, IGeometry pGeometry, int interval) { IScreenDisplay pDisplay = pActiveView.ScreenDisplay; ISimpleMarkerSymbol pMarkerSymbol; ISymbol pSymbol; IRgbColor pRGBColor; pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pRGBColor = new RgbColorClass(); pRGBColor.Green = 148; pRGBColor.Red = 32; pRGBColor.Blue = 0; pSymbol = pMarkerSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPoint(pGeometry); System.Threading.Thread.Sleep(interval); pDisplay.DrawPoint(pGeometry); IElement pEle = new MarkerElementClass();//yjl¸ßÁÁÏÔʾ pEle.Geometry = pGeometry; (pEle as IMarkerElement).Symbol = pSymbol as ISimpleMarkerSymbol; (pEle as IElementProperties).Name = _FlashTagName; (pActiveView as IGraphicsContainer).AddElement(pEle, 0); pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pEle, null); //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, pEle, null); }
public static void FlashPoint(IScreenDisplay pDisplay, IGeometry pGeometry) { try { ISimpleMarkerSymbol pMarkerSymbol; ISymbol pSymbol; IRgbColor pRGBColor; pRGBColor = new RgbColorClass(); pRGBColor.Red = 255; pRGBColor.Green = 150; pRGBColor.Blue = 150; pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pMarkerSymbol.Color = pRGBColor; pSymbol = (ISymbol)pMarkerSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPoint(pGeometry); System.Threading.Thread.Sleep(300); pDisplay.DrawPoint(pGeometry); } catch (Exception) { throw; } }
/// <summary> /// 高亮显示多边形 /// </summary> /// <param name="pDisplay">用于操作的显示屏幕</param> /// <param name="pGeometry">欲高亮显示的几何图形</param> private void FlashPolygon(IScreenDisplay pDisplay, IGeometry pGeometry) { if (pGeometry == null) { return; } //设置显示格式 ISimpleFillSymbol pFillSymbol = null; pFillSymbol = new SimpleFillSymbol(); pFillSymbol.Outline = null; pFillSymbol.Color = GetRGBColor(255, 150, 150); ISymbol pSymbol = default(ISymbol); pSymbol = pFillSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //用所设置的格式绘制几何图形 pDisplay.SetSymbol((ISymbol)pFillSymbol); pDisplay.DrawPolygon(pGeometry); Thread.Sleep(100); pDisplay.DrawPolygon(pGeometry); }
private void FlashPolygon(IScreenDisplay pScreenDisplay, IGeometry pGeometry, bool bFlashFlag, long lFlashRate, bool bDoubleFlag) { try { ISimpleFillSymbol symbol = new SimpleFillSymbolClass { Outline = null }; ISymbol symbol2 = symbol as ISymbol; symbol2.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pScreenDisplay.SetSymbol(symbol as ISymbol); pScreenDisplay.DrawPolygon(pGeometry); if (bFlashFlag) { Thread.Sleep((int)lFlashRate); pScreenDisplay.DrawPolygon(pGeometry); } if (bDoubleFlag) { Thread.Sleep((int)(((int)lFlashRate) / 2)); pScreenDisplay.DrawPolygon(pGeometry); Thread.Sleep((int)(((int)lFlashRate) / 2)); pScreenDisplay.DrawPolygon(pGeometry); } } catch (Exception exception) { this.mErrOpt.ErrorOperate(this.mSubSysName, "FunFactory.FlashFun", "FlashPolygon", exception.GetHashCode().ToString(), exception.Source, exception.Message, "", "", ""); } }
private void FlashGeometry(IGeometry geometry, int flashCount, int interval) { IScreenDisplay display = m_activeView.ScreenDisplay; ISymbol symbol = CreateSimpleSymbol(geometry.GeometryType); display.StartDrawing(0, (short)esriScreenCache.esriNoScreenCache); display.SetSymbol(symbol); for (int i = 0; i < flashCount; i++) { switch (geometry.GeometryType) { case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint: display.DrawPoint(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint: display.DrawMultipoint(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline: display.DrawPolyline(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon: display.DrawPolygon(geometry); break; default: break; } System.Threading.Thread.Sleep(interval); } display.FinishDrawing(); }
/// <summary> /// 使用线要素刷新(已解决重叠问题)(推荐使用) /// 使用IScreenDisplay的DrawPolyline方法,在鹰眼视图画出红线框 /// </summary> /// <param name="activeView">鹰眼视图的活动窗体</param> /// <param name="geometry">制框范围</param> private void DrawPolyline(IActiveView activeView, IGeometry geometry) { if (activeView == null) { return; //如果活动窗体为空, 则返回 } //强行刷新鹰眼视图, 目的: 清除前一次的绘图框, 避免重复绘图框 axMapControl2.ActiveView.ScreenDisplay.UpdateWindow(); //解决重复绘图框的关键代码 IScreenDisplay screenDisplay = activeView.ScreenDisplay; //Screen的绘图状态处于准备状态 //参数: (指定设备(Dc=Device), 缓冲区(-1=NoScreenCache,-2=AllScreenCache, -3=ScreenRecoding)) //解析: 设备(Device)参数指图形的绘制区域 //缓冲区(Cache)参数指图形是否经由缓存后再绘制在屏幕(Window/Screen)上。 //一般默认为NoScreenCache, 即不经过缓存直接绘制 screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache); //实例化颜色对象 IRgbColor rgbColor = new RgbColorClass(); rgbColor.Red = 255; IColor color = rgbColor; //实例化符号(Symbol)对象 ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass(); simpleLineSymbol.Color = color; simpleLineSymbol.Width = 2; ISymbol symbol = (ISymbol)simpleLineSymbol; screenDisplay.SetSymbol(symbol); screenDisplay.DrawPolyline(geometry); screenDisplay.FinishDrawing(); }
public override void OnDblClick() { //base.OnDblClick(); if (m_pNewPolygonFeedback != null) { m_pPolygon = m_pNewPolygonFeedback.Stop(); m_pNewPolygonFeedback = null; } ISimpleFillSymbol pSimFillSym; IRgbColor pRGB; pSimFillSym = new SimpleFillSymbolClass(); pRGB = new RgbColorClass(); pRGB.Red = 255; pRGB.Green = 50; pRGB.Blue = 50; pRGB.Transparency = 0; pSimFillSym.Color = pRGB; if (m_pPolygon != null) { m_pScreenDisplay.StartDrawing(m_pScreenDisplay.hDC, -1); m_pScreenDisplay.SetSymbol((ISymbol)pSimFillSym); m_pScreenDisplay.DrawPolygon(m_pPolygon); m_pScreenDisplay.FinishDrawing(); } }
public void SelectByPolygon(int IndexOfLayer, RubberPolygonClass Polygon) { int ConstantNum = 255; IActiveView CurrentView = axMapControl1.ActiveView; IScreenDisplay MyScreenDispaly = CurrentView.ScreenDisplay; MyScreenDispaly.StartDrawing(MyScreenDispaly.hDC, (System.Int16)esriScreenCache.esriNoScreenCache); IRgbColor MYRGBCOLOR = new RgbColorClass(); MYRGBCOLOR.Red = ConstantNum; IColor MyColor = MYRGBCOLOR; ISimpleFillSymbol MySimpleFillPolygon = new SimpleFillSymbolClass(); MySimpleFillPolygon.Color = MyColor; ISymbol MySymbol = MySimpleFillPolygon as ISymbol; IRubberBand MyIRubberBand = Polygon; IGeometry MyGeometry = MyIRubberBand.TrackNew(MyScreenDispaly, MySymbol); MyScreenDispaly.SetSymbol(MySymbol); MyScreenDispaly.DrawPolygon(MyGeometry); MyScreenDispaly.FinishDrawing(); ISpatialFilter MyISpatialFilter = new SpatialFilterClass(); MyISpatialFilter.Geometry = MyGeometry; MyISpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureLayer SelectedLayer = axMapControl1.ActiveView.FocusMap.get_Layer(IndexOfLayer) as IFeatureLayer; IFeatureSelection SelectedFeature = SelectedLayer as IFeatureSelection; SelectedFeature.SelectFeatures(MyISpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, false); ISelectionSet MyISelectionSet = SelectedFeature.SelectionSet; axMapControl1.ActiveView.Refresh(); }
public void SelectByLine(int IndexOfLayer, RubberLineClass Line) { int ConstantNum = 255; IActiveView CurrentView = axMapControl1.ActiveView; IScreenDisplay CurScreenDisplay = CurrentView.ScreenDisplay; CurScreenDisplay.StartDrawing(CurScreenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache); IRgbColor RGBCOLORS = new ESRI.ArcGIS.Display.RgbColorClass(); RGBCOLORS.Red = ConstantNum; IColor MyColor = RGBCOLORS; ISimpleFillSymbol MySimpleFillSymbol = new SimpleFillSymbolClass(); MySimpleFillSymbol.Color = MyColor; ISymbol MySymbol = MySimpleFillSymbol as ISymbol; IRubberBand MyIRubberBand = Line; IGeometry MyGeometry = MyIRubberBand.TrackNew(CurScreenDisplay, MySymbol); CurScreenDisplay.SetSymbol(MySymbol); CurScreenDisplay.DrawPolygon(MyGeometry); CurScreenDisplay.FinishDrawing(); ISpatialFilter MySpatialFilter = new SpatialFilterClass(); MySpatialFilter.Geometry = MyGeometry; MySpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureLayer SelectedLayer = axMapControl1.ActiveView.FocusMap.get_Layer(IndexOfLayer) as IFeatureLayer; IFeatureSelection SelectedFeatures = SelectedLayer as IFeatureSelection; SelectedFeatures.SelectFeatures(MySpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, false); ISelectionSet FinalSelection = SelectedFeatures.SelectionSet; axMapControl1.ActiveView.Refresh(); }
/// <summary> /// /// </summary> /// <param name="pDisplay">用于操作的显示屏幕</param> /// <param name="pGeometry">欲高亮显示的几何图形</param> private void FlashPoint(IScreenDisplay pDisplay, IGeometry pGeometry) { if (pGeometry == null) { return; } //设置显示格式 ISimpleMarkerSymbol pMarkerSymbol = null; pMarkerSymbol = new SimpleMarkerSymbol(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pMarkerSymbol.Color = GetRGBColor(255, 150, 150); ISymbol pSymbol = null; pSymbol = pMarkerSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //用所设置的格式绘制几何图形 pDisplay.SetSymbol((ISymbol)pMarkerSymbol); pDisplay.DrawPoint(pGeometry); Thread.Sleep(100); pDisplay.DrawPoint(pGeometry); }
private void DrawSymbol(ISymbol symbol, IGeometry geometry) { IScreenDisplay pDisplay = m_activeView.ScreenDisplay; pDisplay.StartDrawing(0, (short)esriScreenCache.esriNoScreenCache); pDisplay.SetSymbol(symbol); for (int i = 0; i < 10; i++) { switch (geometry.GeometryType) { case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint: pDisplay.DrawPoint(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint: pDisplay.DrawMultipoint(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline: pDisplay.DrawPolyline(geometry); break; case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon: pDisplay.DrawPolygon(geometry); break; default: break; } System.Threading.Thread.Sleep(100); } //m_mapControl.FlashShape(geometry, 5, 300, symbol); pDisplay.FinishDrawing(); }
/// <summary> /// 高亮显示线 /// </summary> /// <param name="pDisplay">用于操作的显示屏幕</param> /// <param name="pGeometry">欲高亮显示的几何图形</param> private void FlashLine(IScreenDisplay pDisplay, IGeometry pGeometry) { if (pGeometry == null) { return; } //设置显示格式 ISimpleLineSymbol pLineSymbol = null; pLineSymbol = new SimpleLineSymbol(); pLineSymbol.Width = 4; pLineSymbol.Color = GetRGBColor(255, 150, 150); ISymbol pSymbol = null; pSymbol = pLineSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //用所设置的格式绘制几何图形 pDisplay.SetSymbol((ISymbol)pLineSymbol); pDisplay.DrawPolyline(pGeometry); Thread.Sleep(100); pDisplay.DrawPolyline(pGeometry); }
public override void OnMouseDown(int Button, int Shift, int X, int Y) { if (Button == 1) { //产生一个当前的点击的点对象 IPoint pPoint; pPoint = new PointClass(); pPoint.SpatialReference = pmap.SpatialReference; pPoint = pactiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); //判断是否为第一个点 if (pPointStd == null) { pPointStd = pPoint; //在屏幕上绘制 IScreenDisplay screenDisplay = pactiveView.ScreenDisplay; screenDisplay.StartDrawing(screenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache); screenDisplay.SetSymbol(new SimpleMarkerSymbolClass()); screenDisplay.DrawPoint(pPointStd); screenDisplay.FinishDrawing(); } else { IProximityOperator pProximity; pProximity = pPointStd as IProximityOperator; double pDistance; pDistance = pProximity.ReturnDistance(pPoint); //标签对象上出现两点间的距离 MessageBox.Show(pDistance.ToString()); } } }
/// <summary> /// Flash a line feature on the map /// <param name="pDisplay">The map screen</param> /// <param name="pGeometry">The geometry of the feature to be flashed</param> /// <param name="direction">The digitized direction of the barrier with respect to the underlying source feature</param> /// </summary> private void FlashLine(IScreenDisplay pDisplay, IGeometry pGeometry, esriNetworkEdgeDirection direction) { // The flash will be on a line symbol with an arrow on it ICartographicLineSymbol ipArrowLineSymbol = new CartographicLineSymbolClass(); // the line color will be red IRgbColor ipRgbRedColor = new RgbColorClass(); ipRgbRedColor.Red = 192; // the arrow will be black IRgbColor ipRgbBlackColor = new RgbColorClass(); ipRgbBlackColor.RGB = 0; // set up the arrow that will be displayed along the line IArrowMarkerSymbol ipArrowMarker = new ArrowMarkerSymbolClass(); ipArrowMarker.Style = esriArrowMarkerStyle.esriAMSPlain; ipArrowMarker.Length = 18; ipArrowMarker.Width = 12; ipArrowMarker.Color = ipRgbBlackColor; // set up the line itself ipArrowLineSymbol.Width = 4; ipArrowLineSymbol.Color = ipRgbRedColor; // Set up the Raster Op-Code to help the flash mechanism ((ISymbol)ipArrowMarker).ROP2 = esriRasterOpCode.esriROPNotXOrPen; ((ISymbol)ipArrowLineSymbol).ROP2 = esriRasterOpCode.esriROPNotXOrPen; // decorate the line with the arrow symbol ISimpleLineDecorationElement ipSimpleLineDecorationElement = new SimpleLineDecorationElementClass(); ipSimpleLineDecorationElement.Rotate = true; ipSimpleLineDecorationElement.PositionAsRatio = true; ipSimpleLineDecorationElement.MarkerSymbol = ipArrowMarker; ipSimpleLineDecorationElement.AddPosition(0.5); ILineDecoration ipLineDecoration = new LineDecorationClass(); ipLineDecoration.AddElement(ipSimpleLineDecorationElement); ((ILineProperties)ipArrowLineSymbol).LineDecoration = ipLineDecoration; // the arrow is initially set to correspond to the digitized direction of the line // if the barrier direction is against digitized, then we need to flip the arrow direction if (direction == esriNetworkEdgeDirection.esriNEDAgainstDigitized) { ipSimpleLineDecorationElement.FlipAll = true; } // Flash the line // Two calls are made to Draw. Since the ROP2 setting is NotXOrPen, the first call // draws the symbol with our new symbology and the second call redraws what was originally // in the place of the symbol pDisplay.SetSymbol(ipArrowLineSymbol as ISymbol); pDisplay.DrawPolyline(pGeometry); System.Threading.Thread.Sleep(300); pDisplay.DrawPolyline(pGeometry); }
private void method_0(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0) { iscreenDisplay_0.SetSymbol((ISymbol)(new SimpleMarkerSymbol() { Style = esriSimpleMarkerStyle.esriSMSCircle })); iscreenDisplay_0.DrawPoint(igeometry_0); }
private void method_2(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0) { iscreenDisplay_0.SetSymbol((ISymbol)(new SimpleLineSymbol() { Width = 4 })); iscreenDisplay_0.DrawPolyline(igeometry_0); }
/// <summary> /// 绘制pGeometry的图形 /// </summary> /// <param name="pGeometry"> 几何体实例</param> /// <param name="pScreenDisplay"> 当前屏幕显示</param> private void drawgeometryXOR(IPolygon pPolygon, IScreenDisplay pScreenDisplay) { IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass(); try { //颜色对象 IRgbColor pRGBColor = new RgbColorClass(); pRGBColor.UseWindowsDithering = false; pRGBColor.Red = 45; pRGBColor.Green = 45; pRGBColor.Blue = 45; //填充符号以及画笔 ISymbol pSymbol = pFillSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen; pFillSymbol.Color = pRGBColor; //边缘线颜色以及画笔 ISymbol pLSymbol = pLineSymbol as ISymbol; pLSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen; pRGBColor.Red = 145; pRGBColor.Green = 145; pRGBColor.Blue = 145; pLineSymbol.Color = (IColor)pRGBColor; pLineSymbol.Width = 0.8; pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; pFillSymbol.Outline = pLineSymbol; pScreenDisplay.StartDrawing(m_pScreenDisplay.hDC, -1); //esriScreenCache.esriNoScreenCache -1 pScreenDisplay.SetSymbol(pSymbol); //不存在已画出的多边形 if (pPolygon != null) { pScreenDisplay.DrawPolygon(pPolygon); m_pPolygon = pPolygon; } //存在已画出的多边形 else { if (m_pPolygon != null) { pScreenDisplay.DrawPolygon(m_pPolygon); } } pScreenDisplay.FinishDrawing(); } catch (Exception ex) { MessageBox.Show("绘制缓冲范围出错:" + ex.Message, "提示"); pFillSymbol = null; } }
/// <summary> /// ZQ 2011 1129 modify /// </summary> /// <param name="pPolygon"></param> private void drawgeometryXOR(IGeometry pPolygon) { //联动 //this.sliderBuffer.Value = Convert.ToInt32(dblBuffLen.Text); //获得缓冲范围 IScreenDisplay pScreenDisplay = m_MapControl.ActiveView.ScreenDisplay; ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass(); try { //颜色对象 IRgbColor pRGBColor = new RgbColorClass(); pRGBColor.UseWindowsDithering = false; ISymbol pSymbol = (ISymbol)pFillSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pRGBColor.Red = 255; pRGBColor.Green = 170; pRGBColor.Blue = 0; pLineSymbol.Color = pRGBColor; pLineSymbol.Width = 1.0; pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; pFillSymbol.Outline = pLineSymbol; pFillSymbol.Color = pRGBColor; pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross; pScreenDisplay.StartDrawing(pScreenDisplay.hDC, -1); //esriScreenCache.esriNoScreenCache -1 pScreenDisplay.SetSymbol(pSymbol); //不存在已画出的多边形 if (pPolygon != null) { pScreenDisplay.DrawPolygon(pPolygon); m_Polygon = pPolygon; } //存在已画出的多边形 else { if (m_Polygon != null) { pScreenDisplay.DrawPolygon(m_Polygon); } } pScreenDisplay.FinishDrawing(); } catch (Exception ex) { MessageBox.Show("绘制缓冲范围出错:" + ex.Message, "提示"); pFillSymbol = null; } }
/// <summary> /// 绘制pGeometry的图形 /// </summary> /// <param name="pGeometry"> 几何体实例</param> /// <param name="pScreenDisplay"> 当前屏幕显示</param> private void drawgeometryXOR(IPolygon pPolygon, IScreenDisplay pScreenDisplay) { if (this.IsDisposed && m_bOk == false)//如果窗体关闭或者取消 就不绘制 xisheng 2011.06.28 { return; } ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass(); try { //颜色对象 IRgbColor pRGBColor = new RgbColorClass(); pRGBColor.UseWindowsDithering = false; ISymbol pSymbol = (ISymbol)pFillSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pRGBColor.Red = 255; pRGBColor.Green = 170; pRGBColor.Blue = 0; pLineSymbol.Color = pRGBColor; pLineSymbol.Width = 0.8; pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; pFillSymbol.Outline = pLineSymbol; pFillSymbol.Color = pRGBColor; pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross; pScreenDisplay.StartDrawing(m_pScreenDisplay.hDC, -1); //esriScreenCache.esriNoScreenCache -1 pScreenDisplay.SetSymbol(pSymbol); //不存在已画出的多边形 if (pPolygon != null) { pScreenDisplay.DrawPolygon(pPolygon); m_pPolygon = pPolygon; } //存在已画出的多边形 else { if (m_pPolygon != null) { pScreenDisplay.DrawPolygon(m_pPolygon); } } pScreenDisplay.FinishDrawing(); } catch (Exception ex) { MessageBox.Show("绘制缓冲范围出错:" + ex.Message, "提示"); pFillSymbol = null; } }
private void OnViewRefreshed(IActiveView view, esriViewDrawPhase phase, object data, IEnvelope envelope) { if (phase != esriViewDrawPhase.esriViewGraphics) { return; } if (view is IPageLayout) { return; } if (!_drawFence) { return; } if (_fenceArray == null || _fenceArray.Count == 0) { return; } IScreenDisplay paramScreenDisplay = ((IActiveView)_context.FocusMap).ScreenDisplay; paramScreenDisplay.StartDrawing(paramScreenDisplay.hDC, -2); for (int i = 0; i < _fenceArray.Count; i++) { IGeometry fence = _fenceArray.Element[i]; if (!fence.IsEmpty) { continue; } if (fence is IPolyline) { paramScreenDisplay.SetSymbol(_lineSymbol); paramScreenDisplay.DrawPolyline(fence); } else if (fence is IPolygon) { paramScreenDisplay.SetSymbol(_fillSymbol); paramScreenDisplay.DrawPolygon(fence); } } paramScreenDisplay.FinishDrawing(); }
public static void DrawPolyline(IScreenDisplay pDisplay) { if (m_ipPolyline == null) { if ((m_ipEnumNetEID_Junctions != null) && (m_ipEnumNetEID_Junctions.Count == 1)) { IEIDHelper helper = new EIDHelperClass { GeometricNetwork = m_pAnalystGN, ReturnGeometries = true }; IEnumEIDInfo info = helper.CreateEnumEIDInfo(m_ipEnumNetEID_Junctions); info.Reset(); IGeometry point = info.Next().Geometry; ISimpleMarkerSymbol symbol = new SimpleMarkerSymbolClass { Style = esriSimpleMarkerStyle.esriSMSCircle, Size = 2.0, Color = ColorManage.Red }; pDisplay.StartDrawing(0, -1); pDisplay.SetSymbol(symbol as ISymbol); pDisplay.DrawPoint(point); pDisplay.FinishDrawing(); } } else { ISimpleLineSymbol symbol2 = new SimpleLineSymbolClass { Style = esriSimpleLineStyle.esriSLSSolid, Width = 2.0, Color = ColorManage.Red }; pDisplay.StartDrawing(0, -1); pDisplay.SetSymbol(symbol2 as ISymbol); pDisplay.DrawPolyline(m_ipPolyline); pDisplay.FinishDrawing(); } }
public void FlashObjects() { screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); //注意其先后顺序 //画面 screenDisplay.SetSymbol(regionSymbol); for (int i = 0; i < polygonsFlashObject.Count; i++) { screenDisplay.DrawPolygon(polygonsFlashObject[i]); } //画线 screenDisplay.SetSymbol(lineSymbol); for (int i = 0; i < polylinesFlashObject.Count; i++) { screenDisplay.DrawPolyline(polylinesFlashObject[i]); } //画点 screenDisplay.SetSymbol(pointSymbol); for (int i = 0; i < pointsFlashObject.Count; i++) { screenDisplay.DrawPoint(pointsFlashObject[i]); } Thread.Sleep(500); screenDisplay.FinishDrawing(); mapControl2.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); }
private static void FlashPolygon(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0) { ISymbol simpleFillSymbolClass = (ISymbol)(new SimpleFillSymbol() { Outline = null }); simpleFillSymbolClass.ROP2 = esriRasterOpCode.esriROPNotXOrPen; iscreenDisplay_0.SetSymbol(simpleFillSymbolClass); iscreenDisplay_0.DrawPolygon(igeometry_0); Thread.Sleep(300); iscreenDisplay_0.DrawPolygon(igeometry_0); }
private static void FlashPoint(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0) { ISymbol simpleMarkerSymbolClass = (ISymbol)(new SimpleMarkerSymbol() { Style = esriSimpleMarkerStyle.esriSMSCircle }); simpleMarkerSymbolClass.ROP2 = esriRasterOpCode.esriROPNotXOrPen; iscreenDisplay_0.SetSymbol(simpleMarkerSymbolClass); iscreenDisplay_0.DrawPoint(igeometry_0); Thread.Sleep(300); iscreenDisplay_0.DrawPoint(igeometry_0); }
/// <summary> /// Flash a line feature on the map /// <param name="pDisplay">The map screen</param> /// <param name="pGeometry">The geometry of the feature to be flashed</param> /// <param name="direction">The digitized direction of the barrier with respect to the underlying source feature</param> /// </summary> private void FlashLine(IScreenDisplay pDisplay, IGeometry pGeometry, esriNetworkEdgeDirection direction) { // The flash will be on a line symbol with an arrow on it ICartographicLineSymbol ipArrowLineSymbol = new CartographicLineSymbolClass(); // the line color will be red IRgbColor ipRgbRedColor = new RgbColorClass(); ipRgbRedColor.Red = 192; // the arrow will be black IRgbColor ipRgbBlackColor = new RgbColorClass(); ipRgbBlackColor.RGB = 0; // set up the arrow that will be displayed along the line IArrowMarkerSymbol ipArrowMarker = new ArrowMarkerSymbolClass(); ipArrowMarker.Style = esriArrowMarkerStyle.esriAMSPlain; ipArrowMarker.Length = 18; ipArrowMarker.Width = 12; ipArrowMarker.Color = ipRgbBlackColor; // set up the line itself ipArrowLineSymbol.Width = 4; ipArrowLineSymbol.Color = ipRgbRedColor; // Set up the Raster Op-Code to help the flash mechanism ((ISymbol)ipArrowMarker).ROP2 = esriRasterOpCode.esriROPNotXOrPen; ((ISymbol)ipArrowLineSymbol).ROP2 = esriRasterOpCode.esriROPNotXOrPen; // decorate the line with the arrow symbol ISimpleLineDecorationElement ipSimpleLineDecorationElement = new SimpleLineDecorationElementClass(); ipSimpleLineDecorationElement.Rotate = true; ipSimpleLineDecorationElement.PositionAsRatio = true; ipSimpleLineDecorationElement.MarkerSymbol = ipArrowMarker; ipSimpleLineDecorationElement.AddPosition(0.5); ILineDecoration ipLineDecoration = new LineDecorationClass(); ipLineDecoration.AddElement(ipSimpleLineDecorationElement); ((ILineProperties)ipArrowLineSymbol).LineDecoration = ipLineDecoration; // the arrow is initially set to correspond to the digitized direction of the line // if the barrier direction is against digitized, then we need to flip the arrow direction if (direction == esriNetworkEdgeDirection.esriNEDAgainstDigitized) ipSimpleLineDecorationElement.FlipAll = true; // Flash the line // Two calls are made to Draw. Since the ROP2 setting is NotXOrPen, the first call // draws the symbol with our new symbology and the second call redraws what was originally // in the place of the symbol pDisplay.SetSymbol(ipArrowLineSymbol as ISymbol); pDisplay.DrawPolyline(pGeometry); System.Threading.Thread.Sleep(300); pDisplay.DrawPolyline(pGeometry); }
public static void FlashPolyline(IScreenDisplay pDisplay, IGeometry pGeometry) { ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass(); pLineSymbol.Width = 4; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Green = 100; pRgbColor.Red = 150; pRgbColor.Blue = 100; pLineSymbol.Color = pRgbColor as IColor; ISymbol pSymbol = pLineSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPolyline(pGeometry); Thread.Sleep(300); pDisplay.DrawPolyline(pGeometry); }
public static void FlashPolygon(IScreenDisplay pDisplay, IGeometry pGeometry) { ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = 255; pRgbColor.Green = 0; pRgbColor.Blue = 0; pFillSymbol.Color = pRgbColor as IColor; ISymbol pSymbol = pFillSymbol as ISymbol; //pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPolygon(pGeometry); Thread.Sleep(300); pDisplay.DrawPolygon(pGeometry); }
//��˸�������� public static void FlashPoint(IScreenDisplay pDisplay, IGeometry pGeometry) { ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = 150; pRgbColor.Green = 100; pRgbColor.Blue = 100; pMarkerSymbol.Color = pRgbColor as IColor; pMarkerSymbol.Outline = true; ISymbol pSymbol = pMarkerSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.SetSymbol(pSymbol); pDisplay.DrawPoint(pGeometry); Thread.Sleep(300); pDisplay.DrawPoint(pGeometry); }
public void FlashGeometry(IGeometry Geom, IScreenDisplay Display, IColor Color, int Size, int Interval) { if (Geom == null) return; short Cache = Display.ActiveCache; Display.ActiveCache = (short)esriScreenCache.esriNoScreenCache; Display.StartDrawing(0, Cache); if (Geom.GeometryType == esriGeometryType.esriGeometryLine || Geom.GeometryType == esriGeometryType.esriGeometryCircularArc) { ILineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass(); ISymbol pSymbol = (ISymbol)pSimpleLineSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice pSimpleLineSymbol.Width = Size; pSimpleLineSymbol.Color = Color; Display.SetSymbol((ISymbol)pSimpleLineSymbol); ISegmentCollection pPath = new PathClass(); pPath.AddSegment((ISegment)Geom); IGeometryCollection pPolyL = new PolylineClass(); pPolyL.AddGeometry((IGeometry)pPath); Display.DrawPolyline((IGeometry)pPolyL); System.Threading.Thread.Sleep(Interval); Display.DrawPolyline((IGeometry)pPolyL); } else if (Geom.GeometryType == esriGeometryType.esriGeometryPolyline) { ILineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass(); ISymbol pSymbol = (ISymbol)pSimpleLineSymbol; //'QI pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice pSimpleLineSymbol.Width = Size; pSimpleLineSymbol.Color = Color; Display.SetSymbol((ISymbol)pSimpleLineSymbol); Display.DrawPolyline(Geom); System.Threading.Thread.Sleep(Interval); Display.DrawPolyline(Geom); } else if (Geom.GeometryType == esriGeometryType.esriGeometryPolygon) { ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass(); ISymbol pSymbol = (ISymbol)pSimpleFillSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice pSimpleFillSymbol.Color = Color; Display.SetSymbol((ISymbol)pSimpleFillSymbol); Display.DrawPolygon(Geom); System.Threading.Thread.Sleep(Interval); Display.DrawPolygon(Geom); } else if (Geom.GeometryType == esriGeometryType.esriGeometryPoint) { ISimpleMarkerSymbol pSimpleMarkersymbol = new SimpleMarkerSymbolClass(); ISymbol pSymbol = (ISymbol)pSimpleMarkersymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pSimpleMarkersymbol.Color = Color; pSimpleMarkersymbol.Size = Size; Display.SetSymbol((ISymbol)pSimpleMarkersymbol); Display.DrawPoint(Geom); System.Threading.Thread.Sleep(Interval); Display.DrawPoint(Geom); } Display.FinishDrawing(); //reset the cache Display.ActiveCache = Cache; }
public static void FlashPolygon(IScreenDisplay pDisplay, IGeometry pGeometry, int nTimer, int time) { ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass(); IRgbColor pRGBColor = new RgbColorClass(); pRGBColor.Green = 60; pRGBColor.Red = 255; pRGBColor.Blue = 0; pFillSymbol.Outline = null; pFillSymbol.Color = pRGBColor; ISymbol pSymbol = (ISymbol)pFillSymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; pDisplay.StartDrawing(0, (short)esriScreenCache.esriNoScreenCache); pDisplay.SetSymbol(pSymbol); for (int i = 0; i < nTimer; i++) { pDisplay.DrawPolygon(pGeometry); System.Threading.Thread.Sleep(time); } pDisplay.FinishDrawing(); }
/// <summary> /// Flash a point feature on the map /// <param name="pDisplay">The map screen</param> /// <param name="pGeometry">The geometry of the feature to be flashed</param> /// </summary> private void FlashPoint(IScreenDisplay pDisplay, IGeometry pGeometry) { // for a point, we only flash a simple circle ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; // Set up the Raster Op-Code to help the flash mechanism ISymbol pSymbol = pMarkerSymbol as ISymbol; pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; // Flash the point // Two calls are made to Draw. Since the ROP2 setting is NotXOrPen, the first call // draws the symbol with our new symbology and the second call redraws what was originally // in the place of the symbol pDisplay.SetSymbol(pSymbol); pDisplay.DrawPoint(pGeometry); System.Threading.Thread.Sleep(300); pDisplay.DrawPoint(pGeometry); }
//闪烁面 static void FlashPolygon(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry) { ISimpleFillSymbol iFillSymbol; ISymbol iSymbol; IRgbColor iRgbColor; iFillSymbol = new SimpleFillSymbol(); iFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; iFillSymbol.Outline.Width = 12; iRgbColor = new RgbColor(); iRgbColor.RGB = System.Drawing.Color.FromArgb(100, 180, 180).ToArgb(); iFillSymbol.Color = iRgbColor; iSymbol = (ISymbol)iFillSymbol; iSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; iScreenDisplay.SetSymbol(iSymbol); mapControl.FlashShape(iGeometry, 3, 200, iSymbol); }