zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    ElasticSearch第三步-中文分词
    centos 6.7 搭建tornado + nginx + supervisor的方法(已经实践)
    python ConfigParser 模块
    collections 模块(namedtuple, deque, Counter )
    Kali 开机报错解决方案
    debian 或者kali 安装git
    kali python pip3 的安装和卸载
    Kali 使用ssh,安装vmware tools 和字体重叠
    装饰器
    python2.7 报错(UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128))
  • 原文地址:https://www.cnblogs.com/gisoracle/p/3966058.html
Copyright © 2011-2022 走看看