ArcGis实现贝特兹曲线(NewBezierFeedBack)



 

privatevoid axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvente)spa

       {xml

           IPoint pPoint = newPointClass();blog

           pPoint.PutCoords(e.mapX, e.mapY);get

           pActiveView=axMapControl1.ActiveView;it

           if (pFeedBack == null)table

           {class

               pFeedBack = newNewBezierCurveFeedbackClass();object

               pFeedBack.Display = pActiveView.ScreenDisplay;file

               pFeedBack.Start(pPoint);map

           }

           else

            {

               pFeedBack.AddPoint(pPoint);

           }

       }

 

       privatevoid axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvente)

       {

           if (pFeedBack != null)

           {

               IPoint pPoint = newPointClass();

               pPoint.PutCoords(e.mapX, e.mapY);

               pFeedBack.MoveTo(pPoint);

           }

       }

 

 

       privatevoid AddBezier(IGeometry pGeometry, IActiveView pActiveView)

       {

           IElementpElement;

           ILineElementpLineElement = newLineElementClass();

           ISimpleLineSymbolpSimpleLineSymbol = newSimpleLineSymbolClass();

 

           pElement = pLineElement asIElement;

           pElement.Geometry = pGeometry;

 

           pSimpleLineSymbol.Color = GetRGBColor(255, 215,0);

           pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;

           pSimpleLineSymbol.Width = 2;

 

           pLineElement.Symbol = pSimpleLineSymbol;

 

           IGraphicsContainerpGraphicsContainer =axMapControl1.ActiveView asIGraphicsContainer;

           pGraphicsContainer.AddElement((IElement)pLineElement, 0);

           axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

 

       }

       privateIRgbColor GetRGBColor(int red, int green, int blue)

       {

           IRgbColorrGBColor = newRgbColorClass();

           rGBColor.Red= red;

           rGBColor.Green = green;

           rGBColor.Blue = blue;

           return rGBColor;

       }

 

       privatevoid axMapControl1_OnDoubleClick(object sender, IMapControlEvents2_OnDoubleClickEvente)

       {

           IGeometrypGeometry;

           pGeometry = pFeedBack.Stop();

           pActiveView = axMapControl1.ActiveView;

           AddBezier(pGeometry, pActiveView);

           pFeedBack = null;

       }