📄 frmmain.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{03ED3B1E-ED1B-4A2E-8FE3-D8D1A673F5D4}#5.2#0"; "SuperMap.ocx"
Begin VB.Form FrmMain
BorderStyle = 3 'Fixed Dialog
Caption = "对象操作示范"
ClientHeight = 7215
ClientLeft = 45
ClientTop = 330
ClientWidth = 10515
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 7215
ScaleWidth = 10515
StartUpPosition = 2 'CenterScreen
Begin SuperMapLib.SuperMap SuperMap1
Height = 6675
Left = 2325
TabIndex = 23
Top = 525
Width = 8130
_Version = 327682
_ExtentX = 14340
_ExtentY = 11774
_StockProps = 160
Appearance = 1
End
Begin SuperMapLib.SuperWorkspace SuperWorkspace1
Left = 3900
Top = 1800
_Version = 327682
_ExtentX = 847
_ExtentY = 847
_StockProps = 0
End
Begin VB.CommandButton btnOpenDatase
Caption = "显示数据集"
Enabled = 0 'False
Height = 435
Left = 7875
TabIndex = 21
Top = 15
Width = 1290
End
Begin VB.CommandButton btnDeleteDt
Caption = "删除数据集"
Enabled = 0 'False
Height = 435
Left = 6585
TabIndex = 20
Top = 15
Width = 1290
End
Begin VB.Frame Frame1
Caption = "对象操作"
Height = 3390
Left = 45
TabIndex = 8
Top = 3810
Width = 2220
Begin VB.CommandButton btnSplitObjects
Caption = "分解复杂对象"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 19
Top = 2955
Width = 2040
End
Begin VB.CommandButton btnLineJoint
Caption = "线连接"
Enabled = 0 'False
Height = 375
Left = 1110
TabIndex = 18
Top = 1035
Width = 1020
End
Begin VB.CommandButton btnObjCopy
Caption = "复制"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 17
Top = 285
Width = 1020
End
Begin VB.CommandButton btnObjXOR
Caption = "异或"
Enabled = 0 'False
Height = 375
Left = 1110
TabIndex = 16
Top = 660
Width = 1020
End
Begin VB.CommandButton btnSelectionToDt
Caption = "保存为数据集"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 15
Top = 2580
Width = 2040
End
Begin VB.CommandButton btnObjDelete
Caption = "删除"
Enabled = 0 'False
Height = 375
Left = 1110
TabIndex = 14
Top = 285
Width = 1020
End
Begin VB.CommandButton btnRegionToLine
Caption = "面转换为线"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 13
Top = 2205
Width = 2040
End
Begin VB.CommandButton btnLineToRegion
Caption = "线转换为面"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 12
Top = 1830
Width = 2040
End
Begin VB.CommandButton btnObjIntersect
Caption = "相交"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 11
Top = 1035
Width = 1020
End
Begin VB.CommandButton btnObjUnion
Caption = "合并"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 10
Top = 660
Width = 1020
End
Begin VB.CommandButton btnCreateBuffer
Caption = "生成缓冲区"
Enabled = 0 'False
Height = 375
Left = 90
TabIndex = 9
Top = 1455
Width = 2040
End
End
Begin MSComctlLib.TreeView tvwData
Height = 2985
Left = 45
TabIndex = 7
Top = 780
Width = 2220
_ExtentX = 3916
_ExtentY = 5265
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Style = 7
ImageList = "ImgTreeView"
Appearance = 1
End
Begin VB.CommandButton btnViewEntire
Caption = "全幅显示"
Height = 435
Left = 5415
TabIndex = 6
Top = 15
Width = 1170
End
Begin VB.CommandButton btnZoomFree
Caption = "自由缩放"
Height = 435
Left = 4245
TabIndex = 5
Top = 15
Width = 1170
End
Begin VB.CommandButton btnZoomOut
Caption = "缩小"
Height = 435
Left = 3195
TabIndex = 4
Top = 15
Width = 1050
End
Begin VB.CommandButton btnZoomIn
Caption = "放大"
Height = 435
Left = 2145
TabIndex = 3
Top = 15
Width = 1050
End
Begin VB.CommandButton btnPan
Caption = "漫游"
Height = 435
Left = 1095
TabIndex = 2
Top = 15
Width = 1050
End
Begin VB.CommandButton btnSelect
Caption = "选择"
Height = 435
Left = 45
TabIndex = 1
Top = 15
Width = 1050
End
Begin VB.CommandButton btnExit
Caption = "退出"
Height = 435
Left = 9165
TabIndex = 0
Top = 15
Width = 1290
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2640
Top = 750
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.ImageList ImgTreeView
Left = 1800
Top = 60
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 17
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":058A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":069C
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":07AE
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":08C0
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":09CC
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0AE0
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0BF2
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0D04
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0E0E
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1162
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1274
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1386
Key = ""
EndProperty
BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1498
Key = ""
EndProperty
BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":15AA
Key = ""
EndProperty
BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":16BC
Key = ""
EndProperty
BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":17C6
Key = ""
EndProperty
BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":18D8
Key = ""
EndProperty
EndProperty
End
Begin VB.Label Label1
Caption = "数据列表:"
Height = 240
Left = 90
TabIndex = 22
Top = 510
Width = 1005
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'================================SuperMap Objects示范工程说明=================================
'
'功能简介:示范SuperMap中对对象的各种操作,如相交、相并、异或、复制、缓冲区分析、线对象的连接、
' 线面对象的互转、用代码删除对象、复杂对象的分解、把选择的对象(集合)保存为数据集
'所用控件:SuperMap控件和SuperWorkspace控件
'所用数据:\..\Data\World\World.sdb和World.sdd文件
'操作说明:
' 1、单击"显示数据集",可以把左侧目录树中的选中的数据集显示在地图窗口中
' 2、单击"删除数据集",可以删除左侧目录树中的选中的数据集
' 3、"对象操作"中的一组按钮,要先显示一个数据集,并选中一个或多个对象才能用。使用时,
' 按提示操作即可。
'
'===============================SuperMap Objects示范工程说明结束===============================
Option Explicit
Private Sub btnLineJoint_Click() '线连接
Dim objSelection As soSelection
Dim objRecordset As soRecordset
Dim objGeoLine1 As soGeoLine
Dim objGeoLine2 As soGeoLine
Dim objStyle As New soStyle
If FrmMain.SuperMap1.selection.Count <> 2 Then
MsgBox "线连接只是在两条线之间"
Else
Set objSelection = FrmMain.SuperMap1.selection
Set objRecordset = objSelection.ToRecordset(True)
objRecordset.MoveFirst
Set objGeoLine1 = objRecordset.GetGeometry '得到第一条线
objRecordset.MoveNext
Set objGeoLine2 = objRecordset.GetGeometry '得到第二条线
If objGeoLine1.Joint(objGeoLine2) Then
objStyle.PenColor = vbBlue
FrmMain.SuperMap1.TrackingLayer.ClearEvents
FrmMain.SuperMap1.TrackingLayer.AddEvent objGeoLine1, objStyle, "" '在SuperMap中显示出来
FrmMain.SuperMap1.TrackingLayer.Refresh
MsgBox "连接成功!"
Else
MsgBox "连接失败!"
End If
End If
Set objSelection = Nothing
Set objRecordset = Nothing
Set objGeoLine1 = Nothing
Set objGeoLine2 = Nothing
Set objStyle = Nothing
End Sub
Private Sub btnOpenDatase_Click()
'显示数据集
Dim objDS As soDataSource
Dim objDt As soDataset
If tvwData.SelectedItem.Index = 1 Then Exit Sub
Set objDS = SuperWorkspace1.Datasources(1)
If objDS Is Nothing Then Exit Sub
Set objDt = objDS.Datasets(tvwData.SelectedItem.Text)
If objDt Is Nothing Then
MsgBox "错误!", vbInformation
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -