ArcGIS Engine标准培训教程第三课 制图控件应用开发

上传人:洪易 文档编号:49198146 上传时间:2018-07-25 格式:PPT 页数:39 大小:1.25MB
返回 下载 相关 举报
ArcGIS Engine标准培训教程第三课 制图控件应用开发_第1页
第1页 / 共39页
ArcGIS Engine标准培训教程第三课 制图控件应用开发_第2页
第2页 / 共39页
ArcGIS Engine标准培训教程第三课 制图控件应用开发_第3页
第3页 / 共39页
ArcGIS Engine标准培训教程第三课 制图控件应用开发_第4页
第4页 / 共39页
ArcGIS Engine标准培训教程第三课 制图控件应用开发_第5页
第5页 / 共39页
点击查看更多>>
资源描述

《ArcGIS Engine标准培训教程第三课 制图控件应用开发》由会员分享,可在线阅读,更多相关《ArcGIS Engine标准培训教程第三课 制图控件应用开发(39页珍藏版)》请在金锄头文库上搜索。

1、Copyright 2004 ESRI. All rights reserved.Developing Applications with ArcGIS Engine制图控件应用开发Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.课 3 概述uArcGIS Engine 控件u控件框架u制图控件和对象u框架控件u命令和工具u管理地图文档2Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All righ

2、ts reserved.ArcGIS Engine 控件u制图控件: MapControl 和 PageLayoutControlu框架控件: TOCControl 和 ToolbarControluReader Control: ReaderControlu所有控件都是通过Carto来访问 ArcObjects3Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.开始使用控件u控件为开发者提供了一个开发的框架u封装了 ArcObjects 的功能u使用property pages

3、易于快速入门u设置伙伴控件u访问数据u加载命令和工具4Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.MapControl控件uMapControl u封装Map coclassu绘制单Data Frameu用来分析和浏览u暴露鼠标和绘制事件u装载地图文档和其它文件u设置当前工具u库uMapControl.ocx5Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.

4、PageLayoutControl控件uPageLayoutControl u封装PageLayout coclassu绘制地图元素u创建版面视图 u打印u设置当前工具u加载地图文档u库uPageLayoutControl.ocx6Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.制图控件: 数据访问uIMapControl3/IPageLayoutControl2uCheckMxFileuLoadMxFileuReadMxMapsPrivate Sub Form1_Load(B

5、yVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Load map documentDim fileName As String fileName = “C:studentdaaedataworld.mxd“ If AxMapControl1.CheckMxFile(fileName) Then AxMapControl1.LoadMxFile(fileName,“)End IfSpecify which dataframe to display in map Dim maps As I

6、Array maps = AxMapControl1.ReadMxMaps(fileName,“) Dim map As IMap Dim i as Integer For i = 0 to maps.Count - 1 map = maps.Element(i) If map.Name = “Layers“ Then AxMapControl1.Map = map End If Next End Sub7Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.制图控件: 事件uIMa

7、pControlEvents/IPageLayoutControlEventswOnAfterDraw, OnBeforeScreenDraw, OnAfterScreenDraw, OnExtentUpdated, OnMouseDown/Up/Move, OnKeyDown/Up, OnOleDrop, OnViewRefreshed, OnMap/PageReplacedPrivate Sub AxMapControl1_OnMouseDown() Handles AxMapControl1.OnMouseDown Rotate if right mouse button is clic

8、ked pPoint = New Point pPoint.PutCoords(e.mapX, e.mapY) m_pPoint.X = m_pMapControl.Extent.XMin + (m_pMapControl.Extent.Width / 2) m_pPoint.Y = m_pMapControl.Extent.YMin + (m_pMapControl.Extent.Height / 2) m_pMapControl.ActiveView.ScreenDisplay.RotateStart(pPoint , m_pPoint) End Sub Private Sub AxMap

9、Control1_OnMouseMove() Handles AxMapControl1.OnMouseMove pPoint = New PointpPoint.PutCoords(e.mapX, e.mapY) Set current mouse location coordinates m_pMapControl.ActiveView.ScreenDisplay.RotateMoveTo(pPoint )m_pMapControl.ActiveView.ScreenDisplay.RotateTimer () Draw rotated display End Sub Private Su

10、b AxMapControl1_OnMouseUp() Handles AxMapControl1.OnMouseUp Dim dRotationAngle As Double Get rotation angle dRotationAngle = m_pMapControl.ActiveView.ScreenDisplay.RotateStop m_pMapControl.Rotation = dRotationAngle Rotate the MapControls displaym_pMapControl.Refresh(ESRI.ArcGIS.Carto.esriViewDrawPha

11、se.esriViewGeography ) End Sub8Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.其它成员uIMapControl3/IPageLayoutControl2uDocumentFilename, Object, KeyIntercept, SuppressResizeDrawing, CustomPropertyPrivate Const WM_ENTERSIZEMOVE As Integer = &H231 For resizingPrivate C

12、onst WM_EXITSIZEMOVE As Integer = &H232 For resizingPrivate m_mapControl As IMapControl3Private Sub Form1_Load() Handles MyBase.LoadSuppress drawing while resizingm_mapControl = AxMapControl1.Objectsetstyle(ControlStyles.EnableNotifyMessage, True)End SubProtected Overrides Sub OnNotifyMessage(ByVal

13、m As System.Windows.Forms.Message)If (m.Msg = WM_ENTERSIZEMOVE) ThenAxMapControl1.SuppressResizeDrawing(True, 0)ElseIf (m.Msg = WM_EXITSIZEMOVE) ThenAxMapControl1.SuppressResizeDrawing(False, 0)End IfEnd Sub9Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.MapContro

14、l 对象u通过Map你可以访问所有的对象uLayersuRenderersuSymbolsuFeatureClassesuWorkspaces10Developing Applications with ArcGIS EngineCopyright 2004 ESRI. All rights reserved.使用map和layers属性u提供直接访问Map和Layer对象的方法属性uIMapControl3uAddLayerFromFile, AddShapeFile, AddLayer, DeleteLayer, MoveLayerTo, Layer, MapPrivate Sub For

15、m1_Load() Handles MyBase.Load Dim filePath As String = “C:Program FilesArcGISBinTemplateDataWorld“ AxMapControl1.AddShapeFile(filePath, “cntry00.shp“) Add the country shapefile AxMapControl1.AddShapeFile(filePath, “city.shp“) Add the city shapefile Add layer at index 1 AxMapControl1.AddLayerFromFile

16、(“C:studentdaaedataglobedataWorld Image.lyr“, 1) End Sub Private Sub SwitchLayerOrder(ByVal lyrIndex1 As Integer, ByVal lyrIndex2 As Integer) AxMapControl1.MoveLayerTo(lyrIndex1, lyrIndex2) If lyrIndex1 esriTOCControlItem.esriTOCControlItemLayer Thene.canEdit = False End If End SubPrivate Sub AxTOCControl_OnEndLabelEdit() Handles AxTOCControl1.OnEndLabelEdit If Trim(e.newLabel) = “ Thene.canEdit = False End If

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 教育/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号