在
Scene或Globe中绘制
橡皮条线的工具,其中wsUtilityBaseTool是我自己封装的基类,
大家只需要把它替换成AE的BaseTool,把其中相应的代码放在相应的函数中,然后再进行一些简单的修改就好了
附上VB.Net源码
Imports ESRI.ArcGIS.Analyst3D
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Controls
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.GlobeCore
Imports ESRI.ArcGIS.SystemUI
Public Class ws
SceneDrawLine
Inherits wsUtilityBaseTool
Private Declare Function Polygon Lib "gdi32" (ByVal hDC As Integer, ByVal lpPoint As Integer, ByVal nCount As Integer) As Integer
Private Declare Function SetCapture Lib "USER32" (ByVal hWnd As Integer) As Integer
Private Declare Function GetCapture Lib "USER32" () As Integer
Private Declare Function ReleaseCapture Lib "USER32" () As Integer
Private Declare Function GetCursorPos Lib "USER32" (ByVal lpPoint As Point
API) As Integer
Private Declare Function SetCursor Lib "USER32" (ByVal hCursor As Integer) As Integer
Private Declare Function GetClientRect Lib "USER32" (ByVal hWnd As Integer, ByVal lpRect As rect) As Integer
Private Declare Function GetWindowRect Lib "USER32" (ByVal hWnd As Integer, ByVal lpRect As rect) As Integer
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Integer, ByVal nWidth As Integer, ByVal crColor As Integer) As Integer
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Integer) As Integer
Private Declare Function GetROP2 Lib "gdi32" (ByVal hDC As Integer) As Integer
Private Declare Function SetROP2 Lib "gdi32" (ByVal hDC As Integer, ByVal nDrawMode As Integer) As Integer
Private Declare Function Rectangle Lib "gdi32" (ByVal hDC As Integer, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Integer) As Integer
Private Declare Function Polyline Lib "gdi32" (ByVal hDC As Integer, ByVal lpPoint() As Point
API, ByVal nCount As Integer) As Integer
Private Declare Function CreatePolygonRgn Lib "gdi32" (ByVal lpPoint As Integer, ByVal nCount As Integer, ByVal nPolyFillMode As Integer) As Integer
Private Structure rect
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Private Structure Point
APIDim x As Integer
Dim y As Integer
End Structure
Private m_p
SceneHookhelper As I
SceneHookHelper
Private m_pGlobeHookhelper As IGlobeHookHelper
Private m_bInUse As Boolean
Private m_Pen As Long, m_Brush As Long
Private m_lDrawMode As Long
Private m_pUserLine As IPointCollection
Private m_pGeoLine As IPointCollection
Private m_MovePoint_Old As IPoint '当前点
Private m_p
Scene As I
ScenePrivate m_p
SceneViewer As I
SceneViewer
Public Sub New()
MyBase.New()
MyBase.Tool = New Controls
ScenePanTool
MyBase.m_Caption = "画线"
MyBase.m_ToolTip = "画线"
MyBase.m_Name = "画线"
MyBase.m_Message = "画线"
m_p
SceneHookHelper = New
SceneHookHelper
End Sub
Public Overrides Sub OnCreate(ByVal hook As Object)
m_p
SceneHookhelper = New
SceneHookHelper
m_p
SceneHookhelper.Hook = hook
m_p
SceneViewer = m_p
SceneHookhelper.ActiveViewer
m_p
Scene = m_p
SceneHookhelper.
SceneIf m_p
Scene Is Nothing Then
m_pGlobeHookhelper = New GlobeHookHelper
m_pGlobeHookhelper.Hook = hook
m_p
SceneViewer = m_pGlobeHookhelper.ActiveViewer
m_p
Scene = m_pGlobeHookhelper.Globe
End If
End Sub
Public Overrides ReadOnly Property Enabled() As Boolean
Get
If (m_p
SceneHookhelper.
Scene Is Nothing) Then
Return False
Else
Return True
End If
End Get
End Property