没有合适的资源?快使用搜索试试~ 我知道了~
DotSpatial_Tutorial_4.docx
4星 · 超过85%的资源 需积分: 6 7 下载量 81 浏览量
2013-08-08
10:59:45
上传
评论
收藏 942KB DOCX 举报
温馨提示
试读
36页
DotSpatial_Tutorial_4.docx
资源推荐
资源详情
资源评论
Introduction to Programming with DotSpatial
Shape File, Attribute Table Operations
and Printing map in DotSpatial
Tutorial (4)
Purpose of this tutorial: Become familiar with the following operations in DotSpatial:
1. Shape file related operations.
1.1) Creating the following types of shape files: Point, Polyline, Polygon
1.2) Add an attribute to the above shape files.
1.3) Save the shape files with user defined attributes.
2. Attribute table related operations.
2.1) View an attribute table of a shape file.
2.2) Add a new column into an attribute table.
2.3) Remove a column from an attribute table.
2.4) Update an attribute column in the shapefile.
2.3) Export an attribute to table to MS Excel worksheet.
3. Printing a map in DotSpatial.
3.1) Implement a print operation.
3.2) Set a print document properties. (North Arrow, Legend, Scale bar, Title)
This tutorial has 5 important steps.
Step 1: Download the DotSpatial class library
Step 2: Add the DotSpatial reference and change the compile option.
Step 3: Add the DotSpatial Controls into the Visual Studio Toolbox.
Step 4: Design the GUI. (GUI - Graphical User Interface)
Step 5: Write the code for implementing the map operations.
Teva ~ Veluppillai Page 1
Introduction to Programming with DotSpatial
Step 1 : Download the DotSpatial class library
This step is as same as the Tutorial #1 step 1.
Step 2: Add the DotSpatial reference and change the compile option.
2.1) Add the required DotSpatial reference in the visual studio development environment.
Create a new VB or C# application and right click over the project on the solution explorer. On the
context menu select the add reference and add the following reference from the DotSpatial folder.
DotSpatial.Data.Forms.dll, DotSpatial.Symbology.dll, DotSpatial.Controls.dll, DotSpatial.Projections.dll,
DotSpatial.Data.dll, DotSpatial.Topology.dll
Fig. 1 Required references.
Teva ~ Veluppillai Page 2
Introduction to Programming with DotSpatial
Fig. 2 Required references on Visual Studio Development Environment.
2.2) Change the compile option from .Net FrameWork 4 Client Profile to .Net FrameWork 4
This step is as same as the Tutorial # 1 step 2.2.
Step 3: Add the DotSpatial Controls into the Visual Studio Toolbox.
This step is as same as the Tutorial # 1 step 3.
Step 4 : Design the GUI. (Graphical User Interface)
Design the GUI as follows:
Teva ~ Veluppillai Page 3
Introduction to Programming with DotSpatial
Fig.3. Final GUI
Interface design considerations.
1. Add four panel controls. Panel control's properties should be as follows:
Propertie
s
Panel1 Panel2 Panel3 Panel4
Name pnlOperations pnlLegend pnlMap pnlAttribute
Dock Top Left Fill Bottom
Note: Set the border style of the panels to Fixed Single (Optional)
2. Add a menu strip control on the pnlOperations. Menu should be contains the following menu items.
2.1) Main menu item: File, Shapefile Operations, Map Options, and Attribute Table Operations
2.2) Sub menu items:
Under File menu item create 3 sub menu items as follows: Load, Clear, Exit
Those implementations can be found in ‘Tutorial 2’.
Under the Shapefile Operations create the following sub menu items : Point , Polyline, Polygon
Teva ~ Veluppillai Page 4
Introduction to Programming with DotSpatial
Under the Point sub menu item create the following Sub menu items: Create Point Shapefile, Save Point
Shapefile.
Under the Polyline sub menu item create the following Sub menu items: Create Polyline Shapefile, Save
Polyline Shapefile.
Under the Polygon sub menu item create the following Sub menu items: Create Polygon Shapefile, Save
Polygon Shapefile.
Under the Map Options menu item create the following sub menu items: Default, Information,
Measurement, Zoom In, Zoom Out, Zoom to Extent, Pan, and Print Map
Under the Attribute Table Operations menu item create the following sub menu items: View Attribute
table, Add a column in the attribute table, Save the colum in ShapeFile, Delete a column in the attribute
table, Update attribute table in Shapefile, Export Attribute table to Excel.
Fig. 4. Menu Items
3. Add the Map and legend controls on the form.
3.1 ) Add the map control on the pnlMap control and add legend control on the pnlLegend.
Map and Legend control are located on the Toolbox under DotSpatial controls.
Set the map properties as follows: Dock = Fill, Legend = Legend1
Set the legend properties as follows: Dock = Fill
4. Add a DataGridView on the pnlAttribute.
Set its properties as follows: Name : dgvAttributeTable , Dock = Fill
Step 5: Write the code for implementing the map operations.
5.1 ) Import the following namespaces:
VB
Teva ~ Veluppillai Page 5
剩余35页未读,继续阅读
资源评论
- gis_ymgao2014-02-08有合集的,不建议在这边下
hxwhsw
- 粉丝: 3
- 资源: 51
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功