- 1、本文档共27页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
MO中常用的操作方法全
MO中常用的操作方法(1)
1.地图放大
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
? ??Set Map1.Extent = Map1.TrackRectangle
End Sub
2.地图移动
以下是右键移动、左键放大的代码
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
? If Button = vbLeftButton Then
??? ??? Set Map1.Extent = Map1.TrackRectangle
? ElseIf Button = vbRightButton Then
??? ??? Map1.Pan
? End If
End Sub
3.地图缩小
以下是右键缩小、左键放大的代码
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
??? Dim r As MapObjects2.Rectangle
??? If Button = vbLeftButton Then
??????? Set Map1.Extent = Map1.TrackRectangle
??? ElseIf Button = vbRightButton Then
??????? Set r = Map1.Extent
??????? r.ScaleRectangle 1.5
??????? Map1.Extent = r
??? End If
End Sub
4.恢复原始大小
Private Sub Command1_Click()
??? Set Map1.Extent = Map1.FullExtent
End Sub
5.定位到具体对象
Sub UpdateMap()
? Dim newExt As Object
? strExp = CONTINENT = + listContinents.Text +
? Set recs = Map1.Layers(0).Searchexpression_r(strExp)
?
? If recs.EOF Then
??? Set newExt = Map1.FullExtent? set a default extent
? Else
??? Set shp = recs(Shape).Value
??? Set newExt = shp.Extent
??? Dim i
??? i = 0
??? Do While Not recs.EOF
????? Set shp = recs(Shape).Value
????? Set newExt = newExt.Union(shp.Extent) - this works
????? i = i + 1
????? recs.MoveNext
??? Loop
? End If
? If i 1 Then
??? Set newExt = newExt.Extent
? End If
? Form1.Map1.Extent = newExt
End Sub
5.加载图层
Private Sub Form_Load()
? ??? 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
End Sub
6.卸载图层
Map1.Layers.Remove 0?? ?清除Map1的第0层图层。
Map1.Layers.Clear?? ???????
文档评论(0)