📄 海大gis.frm
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{C7FC2F7C-0688-11D5-B2F8-000102D87123}#1.0#0"; "MO21Legend.ocx"
Begin VB.Form Form08
Caption = "海大校园查询系统"
ClientHeight = 7800
ClientLeft = 60
ClientTop = 345
ClientWidth = 10560
Icon = "海大Gis.frx":0000
LinkTopic = "Form1"
ScaleHeight = 7800
ScaleWidth = 10560
StartUpPosition = 2 '屏幕中心
WindowState = 2 'Maximized
Begin MapObjects2.Map Map2
Height = 2535
Left = 11280
TabIndex = 8
Top = 7560
Width = 2655
_Version = 131072
_ExtentX = 4683
_ExtentY = 4471
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "海大Gis.frx":0442
End
Begin VB.CommandButton Command2
Caption = "查询"
Height = 495
Left = 0
TabIndex = 6
Top = 7440
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 0
TabIndex = 5
Text = "1"
Top = 6840
Width = 1095
End
Begin MO21legend.legend legend1
Height = 4815
Left = 120
TabIndex = 4
Top = 600
Width = 1095
_ExtentX = 1931
_ExtentY = 8493
BackColor = -2147483644
ForeColor = -2147483630
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 120
TabIndex = 3
Top = 6120
Width = 975
End
Begin VB.CommandButton Command3
Caption = "帮助"
Height = 375
Left = 120
TabIndex = 2
Top = 5640
Width = 975
End
Begin MSComctlLib.ImageList ImageList1
Left = 9240
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 20
ImageHeight = 20
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "海大Gis.frx":045C
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "海大Gis.frx":056E
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "海大Gis.frx":0680
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "海大Gis.frx":0792
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 1
Top = 0
Width = 10560
_ExtentX = 18627
_ExtentY = 847
ButtonWidth = 714
ButtonHeight = 688
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 9
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "放大"
ImageIndex = 1
Style = 2
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "缩小"
ImageIndex = 2
Style = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "移动"
ImageIndex = 3
Style = 2
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.ToolTipText = "还原"
ImageIndex = 4
Style = 2
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
OLEDropMode = 1
End
Begin MapObjects2.Map Map1
Height = 9495
Left = 1320
TabIndex = 0
Top = 600
Width = 12615
_Version = 131072
_ExtentX = 22251
_ExtentY = 16748
_StockProps = 225
BackColor = 16777215
BorderStyle = 1
Contents = "海大Gis.frx":08A4
End
Begin VB.Label Label1
Caption = "Label1"
Height = 8055
Left = 14160
TabIndex = 7
Top = 720
Width = 975
End
End
Attribute VB_Name = "Form08"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Sbl As Boolean
Dim recSelection As MapObjects2.Recordset
Dim g_symSelection As MapObjects2.Symbol
Dim dc As New DataConnection
Dim layer As MapLayer
Dim r As MapObjects2.Rectangle
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
Map1.Refresh
End Sub
Private Sub Command3_Click()
Dim Bs As String
Bs = "选择工具栏,可以实现放大、缩小、移动和还原的功能。" & vbCrLf & _
"点击左边的图例控制面板,可以打开和关闭图层。" & vbCrLf & vbCrLf & " Xue Wei,2003/5/3"
MsgBox Bs, , "墨西哥地图浏览系统帮助"
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Toolbar1.Buttons(1).Value = 1 Then
Set Map1.Extent = Map1.TrackRectangle
ElseIf Toolbar1.Buttons(3).Value = 1 Then
Map1.Pan
ElseIf Toolbar1.Buttons(2).Value = 1 Then
Set r = Map1.Extent
r.ScaleRectangle 1.5
Map1.Extent = r
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If Toolbar1.Buttons(1).Value = 1 Then
Map1.MousePointer = moZoomIn
ElseIf Toolbar1.Buttons(3).Value = 1 Then
Map1.MousePointer = moPan
ElseIf Toolbar1.Buttons(2).Value = 1 Then
Map1.MousePointer = moZoomOut
ElseIf Toolbar1.Buttons(4).Value = 1 Then
Set Map1.Extent = Map1.FullExtent
Map1.MousePointer = moDefault
End If
End Sub
Private Sub legend1_AfterSetLayerVisible(index As Integer, isVisible As Boolean)
Map1.Refresh
End Sub
Private Sub LayerSet()
Dim Sline As Object
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("bgcorlor")
layer.Symbol.Color = RGB(135, 177, 93)
layer.Symbol.SymbolType = moLineSymbol
layer.Symbol.Size = 1
layer.Symbol.OutlineColor = moBrown
layer.Name = "草地"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("tree")
layer.Symbol.Color = RGB(35, 150, 60)
layer.Symbol.Size = 4
layer.Symbol.Style = 0
layer.Name = "树"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("other")
layer.Symbol.Color = RGB(199, 181, 177)
layer.Symbol.Size = 3
layer.Symbol.Style = 0
layer.Name = "地板"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("build")
layer.Symbol.Color = RGB(209, 178, 160)
layer.Name = "建筑物"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("road2")
layer.Symbol.Color = moBlack
layer.Symbol.Size = 1
layer.Symbol.Style = 0
layer.Name = "小径"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("road3")
layer.Symbol.Color = RGB(197, 200, 217)
layer.Symbol.Size = 1
layer.Symbol.Style = 0
layer.Name = "校道1"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("p")
layer.Symbol.Color = RGB(142, 155, 165)
layer.Symbol.Size = 1
layer.Symbol.Style = 0
layer.Name = "停车场"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("sport")
layer.Symbol.Color = moDarkGreen
layer.Symbol.Size = 2
layer.Name = "体育"
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("build")
layer.Name = "建筑物名称"
layer.Symbol.Size = 0
layer.Symbol.Color = RGB(209, 178, 160)
Set layer.Renderer = New LabelRenderer
layer.Renderer.Field = "Name" '指定要显示的字段
'layer.Renderer.Symbol(0).Font.Name = "幼圆"
'layer.Renderer.Symbol(0).Font.Bold = False '缺省为True
layer.Renderer.Symbol(0).Color = moBlack
layer.Renderer.Symbol(0).Font.Size = 9
layer.Renderer.AllowDuplicates = True
Map1.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("lake")
layer.Symbol.Color = RGB(90, 150, 240)
layer.Symbol.Size = 3
layer.Symbol.Style = 0
layer.Name = "湖"
Map1.Layers.Add layer
'在指示图上加载图层
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("bgcorlor")
layer.Symbol.Color = RGB(135, 177, 93)
layer.Symbol.SymbolType = moLineSymbol
layer.Symbol.Size = 1
layer.Symbol.OutlineColor = moBrown
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("tree")
layer.Symbol.Color = RGB(35, 150, 60)
layer.Symbol.Size = 4
layer.Symbol.Style = 0
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("other")
layer.Symbol.Color = RGB(199, 181, 177)
layer.Symbol.Size = 3
layer.Symbol.Style = 0
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("build")
layer.Symbol.Color = RGB(209, 178, 160)
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("road2")
layer.Symbol.Color = moBlack
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("road3")
layer.Symbol.Color = RGB(197, 200, 217)
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("p")
layer.Symbol.Color = RGB(142, 155, 165)
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("sport")
layer.Symbol.Color = moDarkGreen
Map2.Layers.Add layer
Set layer = New MapLayer
Set layer.GeoDataset = dc.FindGeoDataset("lake")
layer.Symbol.Color = RGB(90, 150, 240)
Map2.Layers.Add layer
End Sub
Private Sub Form_Load()
Dim strExpression As String
dc.Database = App.Path + "\" + "haida"
If Not dc.Connect Then
MsgBox "在指定的文件夹下没找到图层数据文件!"
End
End If
Label1.Caption = "查询是通过每栋楼等层数进行查询,宿舍楼为7层,有些建筑不知道的是0"
LayerSet
legend1.setMapSource Map1
legend1.LoadLegend True
'设置显示模式
Set g_symSelection = New MapObjects2.Symbol
g_symSelection.SymbolType = Map1.Layers(0).Symbol.SymbolType
g_symSelection.Color = moRed
Map1.Refresh
Map2.Refresh
End Sub
Private Sub Map1_AfterLayerDraw(ByVal index As Integer, ByVal canceled As Boolean, ByVal hDC As stdole.OLE_HANDLE)
Dim Name As String
Dim shp As MapObjects2.Polygon
Dim strExpression As String
Name = Text1.Text
'查找;
strExpression = "Ceng = " & Name
Set recSelection = Map1.Layers(1).SearchExpression(strExpression)
Sbl = True
If Sbl Then
If Not recSelection.EOF Then
Map1.DrawShape recSelection, g_symSelection
End If
Set recSelection = Nothing
End If
If index = 1 Then
Map2.TrackingLayer.Refresh True
End If
End Sub
Private Sub Map2_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
Dim sym As New Symbol
sym.OutlineColor = moRed
sym.Size = 2
sym.Style = moTransparentFill
Map2.DrawShape Map1.Extent, sym
End Sub
Private Sub Map2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim kuang As New MapObjects2.Rectangle
Dim pt As New MapObjects2.Point
Set kuang = Map2.TrackRectangle
Set Map1.Extent = kuang
Set pt = Map2.ToMapPoint(X, Y)
Map1.CenterAt pt.X, pt.Y
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -