anty-1983
路人甲
路人甲
  • 注册日期2006-04-29
  • 发帖数15
  • QQ
  • 铜币190枚
  • 威望1点
  • 贡献值0点
  • 银元0个
阅读:1807回复:3

关于AE自定义工具的问题

楼主#
更多 发布于:2007-04-01 19:39
<P>   AE学习中,我在toolbarcontrol里自定义了一个按钮,目的是为了实现对feature(比如线)的旋转。就像在acrmap中:先选择一个要素,然后在点击旋转(rotate tool)按钮,最后就可以在视图中拖动鼠标,以实现旋转。</P>
<P>  我用的是vb.net开发平台,我首先建立一个类class rotate:BaseTool;</P>
<P>                                               接着成功添加了一个按钮;</P>
<P>  但是怎么实现旋转的功能,希望大家指教哈!</P>
喜欢0 评分0
anty-1983
路人甲
路人甲
  • 注册日期2006-04-29
  • 发帖数15
  • QQ
  • 铜币190枚
  • 威望1点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-04-02 11:19
<P>  我现在想用自定义工具实现一个对地图旋转的功能,但是程序运行后点击自定义按纽,功能实现不了,主要部分代码如下,问题出在哪里?</P>
<P>   Private m_hookHelper As IHookHelper<BR>   Private mapcontrol As IMapControl3</P>
<P>   ......<BR>   Public Overrides Sub OnCreate(ByVal hook As Object)<BR>        If (m_hookHelper Is Nothing) Then m_hookHelper = New HookHelper</P>
<P>        If Not hook Is Nothing Then<BR>            m_hookHelper.Hook = hook<BR>        End If</P>
<P>        'TOD Add other initialization code<BR>    End Sub</P>
<P>    Public Overrides Sub OnClick()<BR>        'TOD Add rotate.OnClick implementation<BR>        mapcontrol.Enabled = True<BR>    End Sub</P>
<P>    Public Overrides Sub OnMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)<BR>        'TOD Add rotate.OnMouseDown implementation</P>
<P>        If Button = 1 Then<BR>            mapcontrol.Enabled = True<BR>            mapcontrol.Extent = mapcontrol.TrackRectangle<BR>        ElseIf Button = 2 Then</P>
<P>            Dim ppoint As IPoint<BR>            ppoint = New ESRI.ArcGIS.Geometry.Point<BR>            ppoint.PutCoords(X, Y)<BR>            Dim pcen As IPoint<BR>            pcen = New ESRI.ArcGIS.Geometry.Point<BR>            pcen.X = mapcontrol.Extent.XMin + (mapcontrol.Extent.Width / 2)<BR>            pcen.Y = mapcontrol.Extent.YMin + (mapcontrol.Extent.Height / 2)<BR>            mapcontrol.ActiveView.ScreenDisplay.RotateStart(ppoint, pcen)<BR>        End If<BR>    End Sub</P>
<P>    Public Overrides Sub OnMouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)<BR>        'TOD Add rotate.OnMouseMove implementation<BR>        Dim ppt As IPoint<BR>        ppt = New ESRI.ArcGIS.Geometry.Point<BR>        ppt.PutCoords(X, Y)<BR>        mapcontrol.ActiveView.ScreenDisplay.RotateMoveTo(ppt)<BR>        mapcontrol.ActiveView.ScreenDisplay.RotateTimer()<BR>    End Sub</P>
<P>    Public Overrides Sub OnMouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer)<BR>        'TOD Add rotate.OnMouseUp implementation<BR>        Dim dangel As Double<BR>        dangel = mapcontrol.ActiveView.ScreenDisplay.RotateStop<BR>        mapcontrol.Rotation = dangel<BR>        mapcontrol.Refresh(esriViewDrawPhase.esriViewGraphics)<BR>    End Sub<BR>End Class<BR></P>
举报 回复(0) 喜欢(0)     评分
anty-1983
路人甲
路人甲
  • 注册日期2006-04-29
  • 发帖数15
  • QQ
  • 铜币190枚
  • 威望1点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-04-02 16:30
自己顶下!
举报 回复(0) 喜欢(0)     评分
jixg1800
路人甲
路人甲
  • 注册日期2006-06-05
  • 发帖数15
  • QQ
  • 铜币158枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2007-04-06 23:27
<P>有没有用C#实现的啊!</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部