📄 form1.frm
字号:
VERSION 5.00
Object = "{370A8DDA-7915-42DC-B4A1-77662C82B046}#1.0#0"; "TOCControl.ocx"
Object = "{C552EA90-6FBB-11D5-A9C1-00104BB6FC1C}#1.0#0"; "MapControl.ocx"
Begin VB.Form frmMapControl
Caption = "Form1"
ClientHeight = 8145
ClientLeft = 60
ClientTop = 450
ClientWidth = 12465
LinkTopic = "Form1"
ScaleHeight = 8145
ScaleWidth = 12465
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command7
Caption = "Command7"
Height = 495
Left = 10440
TabIndex = 8
Top = 240
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "直方图"
Height = 255
Left = 8640
TabIndex = 7
Top = 240
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "条状图"
Height = 255
Left = 6720
TabIndex = 6
Top = 240
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "饼状图"
Height = 255
Left = 5040
TabIndex = 5
Top = 240
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "密度图"
Height = 255
Left = 3240
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "分类图"
Height = 255
Left = 1800
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "单值图"
Height = 255
Left = 360
TabIndex = 2
Top = 240
Width = 1095
End
Begin esriTOCControl.TOCControl ArcTOCControl
Height = 6855
Left = 120
OleObjectBlob = "Form1.frx":0000
TabIndex = 1
Top = 960
Width = 3135
End
Begin esriMapControl.MapControl arcMapControl
Height = 6855
Left = 3360
OleObjectBlob = "Form1.frx":0087
TabIndex = 0
Top = 960
Width = 8655
End
End
Attribute VB_Name = "frmMapControl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public m_enumThemeMapType As tagThemeMapType '当前要生成的专题图类型
Private m_pLineSymbol As ILineSymbol '线符号
Private m_pLinePolyline As IPolyline '直线测距的多段线
Private m_pTextSymbol As ITextSymbol '直线测距的文字符号
Private m_pStartPoint As IPoint '直线测距的起始点
Private m_pTextPoint As IPoint '直线测距文字的起始点
Private m_pAoInitialize As IAoInitialize
Private m_pDocument As IMapDocument
Public m_CurrentView As enumView
Public Enum enumView
viewMap = 1
viewMapLayout = 2
End Enum
'专题图类型
Public Enum tagThemeMapType
enumNoThemeMap = 0 '不绘制专题图
enumUniqueMap = 1 '单值图
enumClassMap = 2 '分类图
enumDotMap = 3 '点密度图
enumPieMap = 4 '饼状图
enumBarMap = 5 '条状图
enumStackMap = 6 '重叠图
End Enum
Private Sub Command1_Click()
DisplayUniqueRenderForm m_pMap
End Sub
'显示单值图对话框
Private Sub DisplayUniqueRenderForm(Optional pMap As IMap, Optional pLayer As ILayer)
If pMap Is Nothing And pLayer Is Nothing Then
MsgBox "请设置 pMap 或 pLayer参数。"
Exit Sub
End If
If Not pLayer Is Nothing Then
If pMap Is Nothing And (Not TypeOf pLayer Is IGeoFeatureLayer) Then
MsgBox "要进行单值渲染的图层类型必须为 GeoFeatureLayer 。"
Exit Sub
End If
If TypeOf pLayer Is IGeoFeatureLayer Then
frmThemeUnique.Layer = pLayer
frmThemeUnique.Show 1
Exit Sub
End If
End If
frmThemeUnique.Map = pMap
frmThemeUnique.Show 1
End Sub
'显示分类图对话框
Private Sub DisplayClassRenderForm(Optional pMap As IMap, Optional pLayer As ILayer)
If pMap Is Nothing And pLayer Is Nothing Then
MsgBox "请设置 pMap 或 pLayer参数。"
Exit Sub
End If
If Not pLayer Is Nothing Then
If pMap Is Nothing And (Not TypeOf pLayer Is IGeoFeatureLayer) Then
MsgBox "要进行分类渲染的图层类型必须为 GeoFeatureLayer 。"
Exit Sub
End If
If TypeOf pLayer Is IGeoFeatureLayer Then
frmThemeGraduate.Layer = pLayer
frmThemeGraduate.Show 1
Exit Sub
End If
End If
frmThemeGraduate.Map = pMap
frmThemeGraduate.Show 1
End Sub
'显示饼状图,条状图,直方图或点密度图对话框
Private Sub DisplayPieRenderForm(enumThemeMapType As tagThemeMapType, Optional pMap As IMap, Optional pLayer As ILayer)
If pMap Is Nothing And pLayer Is Nothing Then
MsgBox "请设置 pMap 或 pLayer参数。"
Exit Sub
End If
If (Not enumThemeMapType = enumBarMap) And (Not enumThemeMapType = enumPieMap) And _
(Not enumThemeMapType = enumStackMap) And (Not enumThemeMapType = enumDotMap) Then
MsgBox "参数错误。"
Exit Sub
End If
If Not pLayer Is Nothing Then
If pMap Is Nothing And (Not TypeOf pLayer Is IGeoFeatureLayer) Then
MsgBox "要进行单值渲染的图层类型必须为 GeoFeatureLayer 。"
Exit Sub
End If
If TypeOf pLayer Is IGeoFeatureLayer Then
frmThemePie.Layer = pLayer
frmThemePie.ThemeMapType = enumThemeMapType
frmThemePie.Show 1
Exit Sub
End If
End If
frmThemePie.Map = pMap
frmThemePie.ThemeMapType = enumThemeMapType
frmThemePie.Show 1
End Sub
Public Sub SetView(viewNew As enumView)
If viewNew = m_CurrentView Then Exit Sub
m_CurrentView = viewNew
DoEvents
End Sub
Private Sub Command2_Click()
DisplayClassRenderForm m_pMap
End Sub
Private Sub Command3_Click()
DisplayPieRenderForm enumDotMap, m_pMap
End Sub
Private Sub Command4_Click()
DisplayPieRenderForm enumPieMap, m_pMap
End Sub
Private Sub Command5_Click()
DisplayPieRenderForm enumBarMap, m_pMap
End Sub
Private Sub Command6_Click()
DisplayPieRenderForm enumStackMap, m_pMap
End Sub
Private Sub Form_Load()
'创建AO初始化对象
Set m_pAoInitialize = New AoInitialize
If m_pAoInitialize Is Nothing Then
MsgBox "程序初始化失败. 这个程序不能运行!"
Unload frmMDIMain
Exit Sub
End If
'判断产品是否有效的
If m_pAoInitialize.IsProductCodeAvailable(esriLicenseProductCodeEngine) = esriLicenseAvailable Then
If m_pAoInitialize.Initialize(esriLicenseProductCodeEngineGeoDB) <> esriLicenseCheckedOut Then
MsgBox "这个程序初始化失败. 这个程序不能运行!"
Unload frmMDIMain
Exit Sub
End If
Else
MsgBox "这是一个无效的 ArcGIS Engine 产品. 这个程序不能运行!"
Unload frmMDIMain
Exit Sub
End If
Set m_pMap = frmMapControl.arcMapControl.Map
frmMapControl.SetView viewMap
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -