计算机地图制图上机实习报告二.doc
文本预览下载声明
计算机地图制图上机实习报告二
学生姓名: 张俊山
学生学号: 0809100122
所在班级: 10级地理信息系统
实习时间: 2012-10-11
实习地点: 城环机房
实现放大缩小功能
实验目的:实验内容:选择菜单工程—部件microsoft windows common controls 6.0或microsoft windows common controls 5.0,这样就可以在左边的工具箱中找到ToolBar, ImageList。然后,把ToolBar, ImageList拖放到Form中就可以Map1.MousePointer = moZoomIn
Map1.MousePointer = moPan
Map1.MousePointer = moZoomOut
Map1.MousePointer = moDefault
加载固定文件夹下的shp文件
Dim dc As New DataConnection
Dim layer As MapLayer
dc.Database = App.Path
If Not dc.Connect Then
MsgBox 在指定的文件夹下没找到图层数据文件!
End
End If
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset(States)
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset(Rivers)
Map1.Layers.Add layer
Map1.Refresh
以对话框形式加shp图层
导入CommonDialog 组件,这一组件在对象库Microsoft Common Dialog Control 6.0 中。添加Map控件,Conmon Dialog 控件,并将其名称改为cDlg1,添加一个按钮。
在Frm上增加一个标注增加图层的按钮,并增加的Private Sub Commandl_Click()
‘打开对话框的方式添加图层
CommonDialog1.CancelError = True
CommonDialog1.DialogTitle = 选择地图文件
Dim oConnect As New DataConnection
Dim oDataset As GeoDataset
Dim sName As String
Dim oLayer As MapObjects2.MapLayer
CommonDialog1.Filter = ESRI Shapefiles (*.shp)|*.shp
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) = 0 Then Exit Sub
oConnect.Database = CurDir
If Not oConnect.Connect Then Exit Sub
sName = Left(CommonDialog1.FileTitle, Len(CommonDialog1.FileTitle) - 4)
Set oDataset = oConnect.FindGeoDataset(sName)
If oDataset Is Nothing Then Exit Sub
Set oLayer = New MapLayer
oLayer.GeoDataset = oDataset
Map1.Layers.Add oLayer
Map2.Layers.Add oLayer
legend1.setMapSource Map1
legend1.LoadLegend True
Map1.Refresh
End Sub
实验心得:
Bridge, service levels and even end on the intersection of rongzhou bridge f. 3.1-5 network saturation and intersection service level (3) the operation of the bridge over the River connecting downtown
显示全部