欢迎来到天天文库
浏览记录
ID:10758118
大小:129.50 KB
页数:12页
时间:2018-07-08
《实验指导书(display)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1Display1.1如何实现在ArcMap中放大缩小地图用户点击按钮后,可以在地图上进行点击或者拖放矩形框来放大缩小地图l要点因为考虑到用户可以单击放大缩小,也可以拖放矩形框来放大缩小,所以不可以直接使用IRubberBand接口,而是采用INewEnvelopeFeedback接口l程序说明主要通过InewEnvelopeFeedback.StartPoint和MoveTo方法来绘制矩形框,然后赋值给IActiveView.Extend属性,达到地图的放大缩小l代码Privatem_pFeedbackEnvAsINewEnvelopeFeedbackPrivatem_pPo
2、intAsIPointPrivatem_bIsMouseDownAsBooleanPrivatem_pActiveViewAsIActiveViewPrivateSubUIToolControl1_MouseDown(ByValbuttonAsLong,ByValshiftAsLong,ByValxAsLong,_ByValyAsLong)DimpMxDocumentAsIMxDocumentOnErrorGoToErrorHandler:'LeftButtonCheckIfbutton<>1ThenExitSubIfm_pActiveViewIsNothingThenSetp
3、MxDocument=ThisDocumentSetm_pActiveView=pMxDocument.ActivatedViewEndIf'得到起始点Setm_pPoint=m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x,y)m_bIsMouseDown=TrueExitSubErrorHandler:MsgBoxErr.DescriptionEndSubPrivateSubUIToolControl1_MouseMove(ByValbuttonAsLong,ByValshiftAsLong,ByV
4、alxAsLong,_ByValyAsLong)OnErrorGoToErrorHandler:IfNotm_bIsMouseDownThenExitSubIfm_pFeedbackEnvIsNothingThenSetm_pFeedbackEnv=NewNewEnvelopeFeedbackSetm_pFeedbackEnv.Display=m_pActiveView.ScreenDisplaym_pFeedbackEnv.Startm_pPointEndIfSetm_pPoint=m_pActiveView.ScreenDisplay.DisplayTransformati
5、on.ToMapPoint(x,y)'DrawEnvelopem_pFeedbackEnv.MoveTom_pPointExitSubErrorHandler:MsgBoxErr.DescriptionEndSubPrivateSubUIToolControl1_MouseUp(ByValbuttonAsLong,ByValshiftAsLong,ByValxAsLong,_ByValyAsLong)DimpEnvAsIEnvelopeOnErrorGoToErrorHandler:'LeftButtonCheckIfbutton<>1ThenExitSubIf(m_pFeed
6、backEnvIsNothing)Then'UserOnlyClickMapwithleftbuttonSetpEnv=m_pActiveView.Extent'如果是缩小的话,将这里的两个0.5都改成1.5pEnv.Expand0.5,0.5,TrueElse'UserDrawaEnvelopeSetpEnv=m_pFeedbackEnv.StopEndIfm_pActiveView.Extent=pEnvm_bIsMouseDown=FalseSetm_pPoint=NothingSetm_pFeedbackEnv=Nothingm_pActiveView.RefreshE
7、xitSubErrorHandler:MsgBoxErr.DescriptionEndSub1.2如何实现在ArcMap中移动地图用户点击按钮后,可以拖动地图显示l要点采用IActiveView.ScreenDisplay.PanStart和PanStop方法使地图移动。l程序说明通过IActiveView.ScreenDisplay的PanStart和PanStop方法在ITool的MouseDown,MouseUp和MouseMove事件的响应实现移动效果,将移动结果得到IEnvelop
此文档下载收益归作者所有