• ArcEngine交互画线


    代码
    
    Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Private pMap As IMap 
    Private pActiveView As IActiveView 
    Private pGraphicsContainer As IGraphicsContainer 
    
    Private Sub axMapControl1_OnMouseDown(ByVal sender As Object, ByVal e As ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent) Handles axMapControl1.OnMouseDown 
    
    
            '获得鼠标在控件上的点击的位置,产生一个点对象 
            Dim pPt As IPoint    '添加引用Imports ESRI.ArcGIS.Geometry 
            pPt = New Point 
            pPt.PutCoords(e.mapX, e.mapY) 
    
            If pLineFeedback Is Nothing Then 
                pLineFeedback = New NewLineFeedback 
    
                pLineFeedback.Display = pActiveView.ScreenDisplay 
                pLineFeedback.Start(pPt) 
    
            Else 
                '已经画了第一条线,则只需要添加点 
                pLineFeedback.AddPoint(pPt) 
            End If 
        End Sub 
    
        Private Sub axMapControl1_OnMouseMove(ByVal sender As Object, ByVal e As IMapControlEvents2_OnMouseMoveEvent) Handles axMapControl1.OnMouseMove 
    
            Dim pPt As IPoint 
            pPt = New Point 
            pPt.PutCoords(e.mapX, e.mapY) 
    
            If Not pLineFeedback Is Nothing Then 
                pLineFeedback.MoveTo(pPt) 
            End If 
        End Sub 
    
        Private Sub axMapControl1_OnDoubleClick(ByVal sender As Object, ByVal e As ESRI.ArcGIS.Controls.IMapControlEvents2_OnDoubleClickEvent) Handles axMapControl1.OnDoubleClick 
            pGraphicsContainer = pMap 
    
            Dim pGeom As IGeometry 
            pGeom = pLineFeedback.Stop() 
            pLineFeedback = Nothing 
    
            '添加一个元素 
            addElement(pGeom, pGraphicsContainer) 
        End Sub 
        Private Sub addElement(ByVal pGeom As IGeometry, ByVal pGraphicsContainer As IGraphicsContainer) 
    
            pMap = axMapControl1.Map 
            pActiveView = pMap 
            pGraphicsContainer = pMap 
    
            Dim pLineSym As ISimpleLineSymbol 
            pLineSym = New SimpleLineSymbol 
    
            Dim pColor As IRgbColor 
            pColor = New RgbColor 
            pColor.Red = 220 
            pColor.Blue = 123 
            pColor.Green = 21 
            pLineSym.Color = pColor 
            pLineSym.Style = esriSimpleLineStyle.esriSLSSolid 
    
            Dim plineEle As ILineElement 
            plineEle = New LineElement 
            plineEle.Symbol = pLineSym 
    
            Dim pEles As IElement 
            pEles = plineEle 
            pEles.Geometry = pGeom 
    
            pGraphicsContainer.AddElement(pEles, 0) 
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, Nothing) 
    
        End Sub

    来自:http://www.cnblogs.com/xionglee/articles/1617901.html

  • 相关阅读:
    golang之panic,recover,defer
    Golang之函数练习
    Golang之strings包
    Golang之字符串操作(反转中英文字符串)
    keil中使用——变参数宏__VA_ARGS__
    到底该不该用RTOS——rtos的优点
    c语言联合union的使用用途
    c语言的#和##的用法
    c语言位域的使用注意事项——数据溢出
    基于 Keil MDK 移植 RT-Thread Nano
  • 原文地址:https://www.cnblogs.com/gisoracle/p/3966058.html
Copyright © 2020-2023  润新知