ArcGis实现贝特兹曲线(NewBezierFeedBack)

来源:互联网 发布:unity3d 模型闪烁 编辑:程序博客网 时间:2024/06/06 01:55



 

privatevoidaxMapControl1_OnMouseDown(objectsender, IMapControlEvents2_OnMouseDownEvente)

       {

           IPointpPoint = newPointClass();

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

           pActiveView=axMapControl1.ActiveView;

           if(pFeedBack == null)

           {

               pFeedBack = newNewBezierCurveFeedbackClass();

               pFeedBack.Display = pActiveView.ScreenDisplay;

               pFeedBack.Start(pPoint);

           }

           else

           {

               pFeedBack.AddPoint(pPoint);

           }

       }

 

       privatevoidaxMapControl1_OnMouseMove(objectsender, IMapControlEvents2_OnMouseMoveEvente)

       {

           if(pFeedBack != null)

           {

               IPointpPoint = newPointClass();

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

               pFeedBack.MoveTo(pPoint);

           }

       }

 

 

       privatevoidAddBezier(IGeometrypGeometry, IActiveViewpActiveView)

       {

           IElementpElement;

           ILineElementpLineElement = newLineElementClass();

           ISimpleLineSymbolpSimpleLineSymbol = newSimpleLineSymbolClass();

 

           pElement = pLineElementasIElement;

           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);

 

       }

       privateIRgbColorGetRGBColor(intred, int green, int blue)

       {

           IRgbColorrGBColor = newRgbColorClass();

           rGBColor.Red= red;

           rGBColor.Green = green;

           rGBColor.Blue = blue;

           returnrGBColor;

       }

 

       privatevoidaxMapControl1_OnDoubleClick(objectsender, IMapControlEvents2_OnDoubleClickEvente)

       {

           IGeometrypGeometry;

           pGeometry = pFeedBack.Stop();

           pActiveView = axMapControl1.ActiveView;

           AddBezier(pGeometry, pActiveView);

           pFeedBack =null;

       }

原创粉丝点击