• 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

  • 相关阅读:
    ALOS卫星概况
    如何安装和配置jdk6u18windowsi586.exe
    请问是否可以直接发布切片好的服务 arcgis serever
    eclipse and myeclipse
    GISer还有机会屌丝逆袭吗?
    ArcGIS中加载百度地图
    细说委托
    白话地图投影之Proj.4地图投影库简介
    让OpenLayers添加百度地图(未完版)
    白话地图投影之墨卡托投影
  • 原文地址:https://www.cnblogs.com/gisoracle/p/3966058.html
Copyright © 2020-2023  润新知