Esempio n. 1
0
 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, "", "", "");
     }
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        //ÉÁ˸¶à±ßÐÎ
        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);
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
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;
            }
        }
Esempio n. 6
0
        /// <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;
            }
        }
Esempio n. 7
0
        /// <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;
            }
        }
Esempio n. 8
0
        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();
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        //绘制导入的范围
        private void drawgeometryXOR(IPolygon pPolygon, IScreenDisplay pScreenDisplay)
        {
            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_Polygon = pPolygon;
                }
                //存在已画出的多边形
                else
                {
                    if (m_Polygon != null)
                    {
                        pScreenDisplay.DrawPolygon(m_Polygon);
                    }
                }

                pScreenDisplay.FinishDrawing();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                pFillSymbol = null;
            }
        }
        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();
        }
Esempio n. 12
0
        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();
            }
        }
Esempio n. 13
0
        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();
        }
Esempio n. 14
0
        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();
        }
Esempio n. 15
0
        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();
        }
Esempio n. 16
0
        public void FlashPolygon(IScreenDisplay pDisplay, IGeometry pGeometry)
        {
            ISimpleFillSymbol symbol = new SimpleFillSymbolClass
            {
                Outline = null
            };
            IRgbColor color = new RgbColorClass
            {
                Green = 128
            };
            ISymbol sym = (ISymbol)symbol;

            sym.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            pDisplay.SetSymbol(sym);
            pDisplay.DrawPolygon(pGeometry);
            Thread.Sleep(300);
            pDisplay.DrawPolygon(pGeometry);
        }
Esempio n. 17
0
        //闪烁多边形
        private 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;

            pSymbol      = pFillSymbol as ISymbol;
            pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            pDisplay.SetSymbol(pSymbol);
            pDisplay.DrawPolygon(pGeometry);
            System.Threading.Thread.Sleep(interval);
            pDisplay.DrawPolygon(pGeometry);
        }
Esempio n. 18
0
        public static void FlashPolygon(IScreenDisplay pDisplay, IGeometry pGeometry)
        {
            ISimpleFillSymbol pFillSymbol;
            ISymbol           pSymbol;
            IRgbColor         pRGBColor;

            pRGBColor       = new RgbColorClass();
            pRGBColor.Red   = 255;
            pRGBColor.Green = 150;
            pRGBColor.Blue  = 150;

            pFillSymbol         = new SimpleFillSymbolClass();
            pFillSymbol.Outline = null;
            pFillSymbol.Color   = pRGBColor;

            pSymbol      = (ISymbol)pFillSymbol;
            pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            pDisplay.SetSymbol(pSymbol);
            pDisplay.DrawPolygon(pGeometry);
            System.Threading.Thread.Sleep(300);
            pDisplay.DrawPolygon(pGeometry);
        }
Esempio n. 19
0
        private void method_3(IScreenDisplay iscreenDisplay_0, IGeometry igeometry_0)
        {
            ISimpleFillSymbol simpleFillSymbolClass = new SimpleFillSymbol()
            {
                Style   = esriSimpleFillStyle.esriSFSNull,
                Outline = new SimpleLineSymbol()
                {
                    Width = 2
                }
            };

            iscreenDisplay_0.SetSymbol((ISymbol)simpleFillSymbolClass);
            iscreenDisplay_0.DrawPolygon(igeometry_0);
        }
Esempio n. 20
0
        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();
        }
Esempio n. 21
0
        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();
        }
Esempio n. 22
0
        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();
        }
Esempio n. 23
0
 public static void DrawGeometry(IScreenDisplay paramScreenDisplay, IGeometry paramGeom, ISymbol paramSymbol)
 {
     if ((paramScreenDisplay == null || paramGeom == null || paramGeom.IsEmpty ? false : paramSymbol != null))
     {
         paramScreenDisplay.StartDrawing(paramScreenDisplay.hDC, -2);
         paramScreenDisplay.SetSymbol(paramSymbol);
         if (paramGeom is IPoint)
         {
             paramScreenDisplay.DrawPoint(paramGeom);
         }
         else if (paramGeom is IPolyline)
         {
             paramScreenDisplay.DrawPolyline(paramGeom);
         }
         else if (paramGeom is IPolygon)
         {
             paramScreenDisplay.DrawPolygon(paramGeom);
         }
         paramScreenDisplay.FinishDrawing();
     }
 }
Esempio n. 24
0
 public override void Draw(IScreenDisplay display)
 {
     if (ShapeType == 0)
     {
         for (int i = 0; i < mGeometries.Count; i++)
         {
             RPoint pt = mGeometries[i] as RPoint;
             if (pt != null)
             {
                 display.DrawPoint(new Pen(Color.Red), pt);
             }
         }
     }
     if (ShapeType == 1)
     {
         for (int i = 0; i < mGeometries.Count; i++)
         {
             RPolyline pt = mGeometries[i] as RPolyline;
             if (pt != null)
             {
                 display.DrawPolyline(new Pen(Color.Red), pt);
             }
         }
     }
     if (ShapeType == 2)
     {
         for (int i = 0; i < mGeometries.Count; i++)
         {
             RPolygon pt = mGeometries[i] as RPolygon;
             if (pt != null)
             {
                 display.DrawPolygon(new Pen(Color.Red), pt);
             }
         }
     }
 }
Esempio n. 25
0
        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);
        }
Esempio n. 26
0
        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();
        }
        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;
        }
Esempio n. 28
0
        public static void DrawWinkFeature(IScreenDisplay pDisplay, IGeometry pGeo)
        {
            IRgbColor rgbColorClass = new RgbColor()
            {
                Blue  = 0,
                Green = 0,
                Red   = 255,
            };
            short activeCache = pDisplay.ActiveCache;

            pDisplay.ActiveCache = -1;
            pDisplay.StartDrawing(pDisplay.hDC, -1);
            switch (pGeo.GeometryType)
            {
            case esriGeometryType.esriGeometryPoint:
            {
                ISimpleMarkerSymbol simpleMarkerSymbolClass = new SimpleMarkerSymbol();
                ((ISymbol)simpleMarkerSymbolClass).ROP2 = esriRasterOpCode.esriROPNotXOrPen;
                simpleMarkerSymbolClass.Color           = rgbColorClass;
                simpleMarkerSymbolClass.Size            = (double)9;
                pDisplay.SetSymbol((ISymbol)simpleMarkerSymbolClass);
                pDisplay.DrawPoint(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.DrawPoint(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.FinishDrawing();
                pDisplay.ActiveCache = activeCache;
                //mUiCurrentCounter = this;
                //mUiCurrentCounter.m_uiCurrentCounter = mUiCurrentCounter.m_uiCurrentCounter + 1;
                return;
            }

            case esriGeometryType.esriGeometryMultipoint:
            {
                pDisplay.FinishDrawing();
                pDisplay.ActiveCache = activeCache;
                //mUiCurrentCounter = this;
                //mUiCurrentCounter.m_uiCurrentCounter = mUiCurrentCounter.m_uiCurrentCounter + 1;
                return;
            }

            case esriGeometryType.esriGeometryPolyline:
            {
                ISimpleLineSymbol simpleLineSymbolClass = new SimpleLineSymbol();
                ((ISymbol)simpleLineSymbolClass).ROP2 = esriRasterOpCode.esriROPNotXOrPen;
                simpleLineSymbolClass.Color           = rgbColorClass;
                simpleLineSymbolClass.Width           = (double)3;
                pDisplay.SetSymbol((ISymbol)simpleLineSymbolClass);
                pDisplay.DrawPolyline(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.DrawPolyline(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.FinishDrawing();
                pDisplay.ActiveCache = activeCache;
                //mUiCurrentCounter = this;
                //mUiCurrentCounter.m_uiCurrentCounter = mUiCurrentCounter.m_uiCurrentCounter + 1;
                return;
            }

            case esriGeometryType.esriGeometryPolygon:
            {
                ISimpleFillSymbol simpleFillSymbolClass = new SimpleFillSymbol();
                ((ISymbol)simpleFillSymbolClass).ROP2 = esriRasterOpCode.esriROPNotXOrPen;
                simpleFillSymbolClass.Color           = rgbColorClass;
                pDisplay.SetSymbol((ISymbol)simpleFillSymbolClass);
                pDisplay.DrawPolygon(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.DrawPolygon(pGeo);
                Thread.Sleep((int)1000);
                pDisplay.FinishDrawing();
                pDisplay.ActiveCache = activeCache;
                //mUiCurrentCounter = this;
                //mUiCurrentCounter.m_uiCurrentCounter = mUiCurrentCounter.m_uiCurrentCounter + 1;
                return;
            }

            default:
            {
                pDisplay.FinishDrawing();
                pDisplay.ActiveCache = activeCache;
                //mUiCurrentCounter = this;
                //mUiCurrentCounter.m_uiCurrentCounter = mUiCurrentCounter.m_uiCurrentCounter + 1;
                return;
            }
            }
        }
Esempio n. 29
0
        private void drawgeometryXOR(IGeometry pGeometry)
        {
            if (pGeometry == null)//如果窗体关闭或者取消 就不绘制 xisheng 2011.06.28
            {
                return;
            }
            IScreenDisplay pScreenDisplay = m_pMapControl.ActiveView.ScreenDisplay;
            ISymbol        pSymbol        = null;
            //颜色对象
            IRgbColor pRGBColor = new RgbColorClass();

            pRGBColor.UseWindowsDithering = false;
            pRGBColor = getRGB(255, 0, 0);
            pRGBColor.Transparency = 255;
            try
            {
                switch (pGeometry.GeometryType.ToString())
                {
                case "esriGeometryPoint":    //点要素
                    ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
                    pMarkerSymbol.Size  = 7.0;
                    pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
                    pMarkerSymbol.Color = pRGBColor;
                    pSymbol             = (ISymbol)pMarkerSymbol;
                    pSymbol.ROP2        = esriRasterOpCode.esriROPCopyPen;
                    break;

                case "esriGeometryPolyline":    //线要素
                    ISimpleLineSymbol pPolyLineSymbol = new SimpleLineSymbolClass();
                    pPolyLineSymbol.Color = pRGBColor;
                    pPolyLineSymbol.Width = 2.5;
                    pPolyLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                    pSymbol = (ISymbol)pPolyLineSymbol;
                    ///ZQ  20111117 modify
                    pSymbol.ROP2 = esriRasterOpCode.esriROPCopyPen;
                    break;

                case "esriGeometryPolygon":    //面要素
                    ISimpleFillSymbol pFillSymbol = new SimpleFillSymbolClass();
                    ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();

                    pSymbol      = (ISymbol)pFillSymbol;
                    pSymbol.ROP2 = esriRasterOpCode.esriROPCopyPen;
                    /// end
                    pLineSymbol.Color   = pRGBColor;
                    pLineSymbol.Width   = 1.5;
                    pLineSymbol.Style   = esriSimpleLineStyle.esriSLSSolid;
                    pFillSymbol.Outline = pLineSymbol;

                    pFillSymbol.Color = pRGBColor;
                    pFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross;
                    break;
                }


                pScreenDisplay.StartDrawing(pScreenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache);  //esriScreenCache.esriNoScreenCache -1
                pScreenDisplay.SetSymbol(pSymbol);
                switch (pGeometry.GeometryType.ToString())
                {
                case "esriGeometryPoint":    //点要素
                    pScreenDisplay.DrawPoint(pGeometry);
                    break;

                case "esriGeometryPolyline":    //线要素
                    pScreenDisplay.DrawPolyline(pGeometry);
                    break;

                case "esriGeometryPolygon":    //面要素
                    pScreenDisplay.DrawPolygon(pGeometry);
                    break;
                }
                pScreenDisplay.FinishDrawing();
            }
            catch
            { }
            finally
            {
                pSymbol   = null;
                pRGBColor = null;
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 绘制线、矩形和面的函数
        /// </summary>
        /// <param name="pGeometry"></param>
        /// <param name="pScrDisplay"></param>
        public static void DrawGeometryXOR(IGeometry pGeometry, IScreenDisplay pScrDisplay)
        {
            if (pGeometry == null || pScrDisplay == null || pGeometry.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                return;
            }

            IFillSymbol pFillSymbol;
            ILineSymbol pLineSymbol;
            ISymbol     pSymbol;
            IRgbColor   pRGBColor;
            ISymbol     pLSymbol;
            IPolygon    pPolygon;
            IEnvelope   pEnvelope;
            IPolyline   pPolyline;

            try
            {
                pRGBColor = new RgbColorClass();
                pRGBColor.UseWindowsDithering = false;
                pRGBColor.Red   = 45;
                pRGBColor.Green = 45;
                pRGBColor.Blue  = 45;

                pFillSymbol       = new SimpleFillSymbolClass();
                pSymbol           = (ISymbol)pFillSymbol;
                pSymbol.ROP2      = esriRasterOpCode.esriROPXOrPen;
                pFillSymbol.Color = (IColor)pRGBColor;

                pLineSymbol         = pFillSymbol.Outline;
                pLSymbol            = (ISymbol)pLineSymbol;
                pLSymbol.ROP2       = esriRasterOpCode.esriROPXOrPen;
                pRGBColor.Red       = 145;
                pRGBColor.Green     = 145;
                pRGBColor.Blue      = 145;
                pLineSymbol.Color   = (IColor)pRGBColor;
                pLineSymbol.Width   = 0.8;
                pFillSymbol.Outline = pLineSymbol;

                pScrDisplay.StartDrawing(0, -1);  //esriScreenCache.esriNoScreenCache -1
                if (pGeometry.GeometryType == esriGeometryType.esriGeometryPolyline)
                {
                    pScrDisplay.SetSymbol((ISymbol)pLineSymbol);
                    pPolyline = (IPolyline)pGeometry;
                    pScrDisplay.DrawPolyline(pPolyline);
                }
                else if (pGeometry.GeometryType == esriGeometryType.esriGeometryEnvelope)
                {
                    pScrDisplay.SetSymbol(pSymbol);
                    pEnvelope = (IEnvelope)pGeometry;
                    pScrDisplay.DrawRectangle(pEnvelope);
                }
                else
                {
                    pScrDisplay.SetSymbol(pSymbol);
                    pPolygon = (IPolygon)pGeometry;
                    pScrDisplay.DrawPolygon(pPolygon);
                }
                pScrDisplay.FinishDrawing();
            }
            catch (Exception ex)
            {
                MessageBox.Show("绘制缓冲范围出错:" + ex.Message, "提示");
            }
            finally
            {
                pFillSymbol = null;
                pLineSymbol = null;
                pSymbol     = null;
                pRGBColor   = null;
                pLSymbol    = null;
            }
        }
Esempio n. 31
0
        /// <summary>
        /// ZQ 2011 1129  modify
        /// </summary>
        /// <param name="pPolygon"></param>
        public void drawgeometryXOR(IGeometry geo)
        {
            //Áª¶¯
            //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.esriSFSNull;

                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);
                //    }
                //}
                //foreach (IGeometry geo in ListGeometrys)
                //{
                //    pScreenDisplay.DrawPolygon(geo);
                //}

                if (geo == null)
                {
                    foreach (IGeometry geo2 in ListGeometrys)
                    {
                        pScreenDisplay.DrawPolygon(geo2);
                    }
                }
                else
                {
                    pScreenDisplay.DrawPolygon(geo);
                }


                pScreenDisplay.FinishDrawing();
            }
            catch (Exception ex)
            {
                MessageBox.Show("»æÖÆ»º³å·¶Î§³ö´í:" + ex.Message, "Ìáʾ");
                pFillSymbol = null;
            }
        }
Esempio n. 32
0
        public override void OnMouseMove(int x, int y)
        {
            if (n == 1)
            {
            }
            if (n == 2)
            {
                j++;
                tmpVertices = new List <SharpMap.Geometries.Point>();
                SharpMap.Geometries.Point P0 = vertices[0];
                SharpMap.Geometries.Point P1 = vertices[1];
                SharpMap.Geometries.Point P2 = new SharpMap.Geometries.Point(x, y);
                tmpVertices.Add(P0);
                tmpVertices.Add(P1);
                tmpVertices.Add(P2);
                LinearRing tmpLine = new LinearRing(tmpVertices);
                tempPolygon.ExteriorRing = tmpLine;

                if (j == 1)
                {
                    BoundingBox box            = tempPolygon.GetBoundingBox();
                    double      xmin           = box.Left;
                    double      ymin           = box.Bottom;
                    double      w              = box.Width;
                    double      h              = box.Height;
                    Rectangle   invalidaterect = new Rectangle((int)xmin, (int)ymin, (int)w, (int)h);
                    invalidaterect.Inflate(2, 2);
                    (mScreenDisplay as ScreenDisplay).RepaintStatic(invalidaterect);
                    j = 0;
                }

                //LinearRing tmpLine = new LinearRing(tmpVertices);
                //tempPolygon.ExteriorRing = tmpLine;
                SolidBrush brush = new SolidBrush(Color.Blue);
                Pen        pen   = new Pen(brush);
                mScreenDisplay.DrawPolygon(tempPolygon, brush, pen, false);
            }
            else if (n > 2)
            {
                BoundingBox box            = tempPolygon.GetBoundingBox();
                double      xmin           = box.Left;
                double      ymin           = box.Bottom;
                double      w              = box.Width;
                double      h              = box.Height;
                Rectangle   invalidaterect = new Rectangle((int)xmin, (int)ymin, (int)w, (int)h);
                invalidaterect.Inflate(2, 2);

                (mScreenDisplay as ScreenDisplay).RepaintStatic(invalidaterect);

                tmpVertices = new List <SharpMap.Geometries.Point>();
                SharpMap.Geometries.Point P0 = vertices[0];
                SharpMap.Geometries.Point P1 = vertices[n - 1];
                SharpMap.Geometries.Point P2 = new SharpMap.Geometries.Point(x, y);
                tmpVertices.Add(P0);
                tmpVertices.Add(P1);
                tmpVertices.Add(P2);
                LinearRing tmpLine = new LinearRing(tmpVertices);
                tempPolygon.ExteriorRing = tmpLine;
                SolidBrush brush  = new SolidBrush(Color.Blue);
                SolidBrush brush2 = new SolidBrush(Color.Pink);
                Pen        pen    = new Pen(brush2);
                mScreenDisplay.DrawPolygon(tempPolygon, brush, pen, false);
                //PointF p1 = new PointF((float)line.P0.X, (float)line.P0.Y);
                //PointF p2 = new PointF(x, y);

                //mScreenDisplay.DrawPolygon(Pens.Blue, p1, p2);
                //line.P1 = new RPoint(x, y, 0);
            }
        }
Esempio n. 33
0
        public void DrawDifferenceGeometry(IGeometry igeometry_0, IScreenDisplay iscreenDisplay_0)
        {
            IRgbColor rgbColorClass = new RgbColor()
            {
                Red = 255
            };

            iscreenDisplay_0.StartDrawing(iscreenDisplay_0.hDC, -1);
            switch (igeometry_0.GeometryType)
            {
            case esriGeometryType.esriGeometryPoint:
            {
                ISimpleMarkerSymbol simpleMarkerSymbolClass = new SimpleMarkerSymbol()
                {
                    Color = rgbColorClass,
                    Size  = 10
                };
                iscreenDisplay_0.SetSymbol(simpleMarkerSymbolClass as ISymbol);
                iscreenDisplay_0.DrawPoint(igeometry_0);
                iscreenDisplay_0.FinishDrawing();
                return;
            }

            case esriGeometryType.esriGeometryMultipoint:
            {
                iscreenDisplay_0.FinishDrawing();
                return;
            }

            case esriGeometryType.esriGeometryPolyline:
            {
                ISimpleLineSymbol simpleLineSymbolClass = new SimpleLineSymbol()
                {
                    Color = rgbColorClass,
                    Width = 2
                };
                iscreenDisplay_0.SetSymbol(simpleLineSymbolClass as ISymbol);
                iscreenDisplay_0.DrawPolyline(igeometry_0);
                iscreenDisplay_0.FinishDrawing();
                return;
            }

            case esriGeometryType.esriGeometryPolygon:
            {
                ISimpleFillSymbol simpleFillSymbolClass = new SimpleFillSymbol();
                simpleFillSymbolClass.Outline.Color = rgbColorClass;
                simpleFillSymbolClass.Outline.Width = 2;
                simpleFillSymbolClass.Style         = esriSimpleFillStyle.esriSFSForwardDiagonal;
                iscreenDisplay_0.SetSymbol(simpleFillSymbolClass as ISymbol);
                iscreenDisplay_0.DrawPolygon(igeometry_0);
                iscreenDisplay_0.FinishDrawing();
                return;
            }

            default:
            {
                iscreenDisplay_0.FinishDrawing();
                return;
            }
            }
        }