⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thematics.vb

📁 用VB.NET开发的GeoMedia一个实例
💻 VB
📖 第 1 页 / 共 2 页
字号:
Public Class FrmThematics
    Inherits System.Windows.Forms.Form
    Dim objColors As PView.ColorSchemes
    Dim clsNum As Integer
    Dim objMapView As AxMapviewLib.AxGMMapView


#Region " Windows 窗体设计器生成的代码 "

    Public Sub New(ByRef GMMapview As AxMapviewLib.AxGMMapView)
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化
        objMapView = GMMapview
    End Sub

    '窗体重写处置以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents btnOkay As System.Windows.Forms.Button
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents cblFeature As System.Windows.Forms.ComboBox
    Friend WithEvents cblAttribute As System.Windows.Forms.ComboBox
    Friend WithEvents cboColorSchemes As System.Windows.Forms.ComboBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents rbValue As System.Windows.Forms.RadioButton
    Friend WithEvents rbRange As System.Windows.Forms.RadioButton
    Friend WithEvents tbRangeNum As System.Windows.Forms.NumericUpDown
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.cboColorSchemes = New System.Windows.Forms.ComboBox()
        Me.btnOkay = New System.Windows.Forms.Button()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.cblAttribute = New System.Windows.Forms.ComboBox()
        Me.cblFeature = New System.Windows.Forms.ComboBox()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.tbRangeNum = New System.Windows.Forms.NumericUpDown()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.rbValue = New System.Windows.Forms.RadioButton()
        Me.rbRange = New System.Windows.Forms.RadioButton()
        Me.GroupBox1.SuspendLayout()
        CType(Me.tbRangeNum, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(16, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 16)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "特征:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(16, 72)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(64, 24)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "属性:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(16, 224)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(112, 24)
        Me.Label4.TabIndex = 4
        Me.Label4.Text = "配色方案:"
        '
        'cboColorSchemes
        '
        Me.cboColorSchemes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboColorSchemes.Enabled = False
        Me.cboColorSchemes.Location = New System.Drawing.Point(16, 240)
        Me.cboColorSchemes.Name = "cboColorSchemes"
        Me.cboColorSchemes.Size = New System.Drawing.Size(224, 20)
        Me.cboColorSchemes.TabIndex = 4
        '
        'btnOkay
        '
        Me.btnOkay.Enabled = False
        Me.btnOkay.Location = New System.Drawing.Point(96, 280)
        Me.btnOkay.Name = "btnOkay"
        Me.btnOkay.Size = New System.Drawing.Size(64, 24)
        Me.btnOkay.TabIndex = 5
        Me.btnOkay.Text = "确定"
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(176, 280)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(64, 24)
        Me.btnCancel.TabIndex = 6
        Me.btnCancel.Text = "取消"
        '
        'cblAttribute
        '
        Me.cblAttribute.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cblAttribute.Enabled = False
        Me.cblAttribute.ItemHeight = 12
        Me.cblAttribute.Location = New System.Drawing.Point(16, 88)
        Me.cblAttribute.Name = "cblAttribute"
        Me.cblAttribute.Size = New System.Drawing.Size(224, 20)
        Me.cblAttribute.TabIndex = 2
        '
        'cblFeature
        '
        Me.cblFeature.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cblFeature.Enabled = False
        Me.cblFeature.ItemHeight = 12
        Me.cblFeature.Location = New System.Drawing.Point(16, 32)
        Me.cblFeature.Name = "cblFeature"
        Me.cblFeature.Size = New System.Drawing.Size(224, 20)
        Me.cblFeature.TabIndex = 1
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.tbRangeNum, Me.Label3, Me.rbValue, Me.rbRange})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 128)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(224, 80)
        Me.GroupBox1.TabIndex = 3
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "配色依据:"
        '
        'tbRangeNum
        '
        Me.tbRangeNum.Location = New System.Drawing.Point(160, 48)
        Me.tbRangeNum.Name = "tbRangeNum"
        Me.tbRangeNum.Size = New System.Drawing.Size(48, 21)
        Me.tbRangeNum.TabIndex = 3
        Me.tbRangeNum.Value = New Decimal(New Integer() {4, 0, 0, 0})
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(96, 56)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 10
        Me.Label3.Text = "分级数量:"
        '
        'rbValue
        '
        Me.rbValue.Enabled = False
        Me.rbValue.Location = New System.Drawing.Point(16, 24)
        Me.rbValue.Name = "rbValue"
        Me.rbValue.Size = New System.Drawing.Size(80, 24)
        Me.rbValue.TabIndex = 1
        Me.rbValue.Text = "唯一值"
        '
        'rbRange
        '
        Me.rbRange.Checked = True
        Me.rbRange.Enabled = False
        Me.rbRange.Location = New System.Drawing.Point(16, 48)
        Me.rbRange.Name = "rbRange"
        Me.rbRange.Size = New System.Drawing.Size(80, 24)
        Me.rbRange.TabIndex = 2
        Me.rbRange.TabStop = True
        Me.rbRange.Text = "范围"
        '
        'FrmThematics
        '
        Me.AcceptButton = Me.btnOkay
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(258, 319)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1, Me.btnOkay, Me.cboColorSchemes, Me.Label4, Me.cblAttribute, Me.Label2, Me.Label1, Me.btnCancel, Me.cblFeature})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "FrmThematics"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "1"
        Me.GroupBox1.ResumeLayout(False)
        CType(Me.tbRangeNum, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub FrmThematics_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.InitForm()

    End Sub

    Private Sub InitForm()
        '----------------------------------------------------------------------------------------------------------
        ' 调用公共类里的得到Feature的方法( Common.GeometryOP.GetFeatureNameList),加入到Feature列表中,供用户选择
        ' Intergraph Shenzhen 2005.1
        '----------------------------------------------------------------------------------------------------------
        On Error GoTo ErrorHandler

        Dim alFeatureName As ArrayList
        Dim i As Integer

        Me.cblFeature.Items.Clear()

        alFeatureName = Common.GeometryOP.GetFeatureNameList()
        For i = 0 To alFeatureName.Count - 1
            If alFeatureName.Item(i) <> "" Then Me.cblFeature.Items.Add(alFeatureName.Item(i))
        Next

        '设定初始的Feature名称
        cblFeature.Text = alFeatureName.Item(0)
        cblFeature.Enabled = True

        Exit Sub
ErrorHandler:
        MsgBox(Err.Description, MSGBOX_ERROR, "Select Feature")
    End Sub

    Private Sub cblFeature_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cblFeature.SelectedIndexChanged
        '----------------------------------------------------------------------------------------------------------
        ' 根据选择的Feature,检索出属性列表,加入到属性列表中,供用户选择
        ' Intergraph Shenzhen 2005.1
        '----------------------------------------------------------------------------------------------------------

        On Error GoTo ErrorHandler

        Dim objMDSrvc As New GMService.MetadataService()

        'Populate attribute list with field names of currently selected table.
        objMDSrvc.Connection = gobjConnection
        objMDSrvc.TableName = cblFeature.Text

        Dim vFields As Object

        cblAttribute.Enabled = True
        rbRange.Checked = True
        tbRangeNum.Enabled = True

        objMDSrvc.GetFields(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256, vFields) 'gmmfBoolean + gmmfByte + gmmfInteger + gmmfLong + gmmfCurrency + gmmfSingle + gmmfDouble + gmmfDate + gmmfText

        Me.cblAttribute.Items.Clear()
        btnOkay.Enabled = False

        Dim i As Long
        For i = 0 To UBound(vFields)
            If vFields(i) <> "" And LCase(vFields(i)) <> "geometry_sk" Then cblAttribute.Items.Add(vFields(i))
        Next
        '设定当前Feature的初始属性值
        cblAttribute.Text = vFields(0)


        Exit Sub
ErrorHandler:
        MsgBox(Err.Number & " - " & Err.Source & Chr(13) & _
            Err.Description, vbOKOnly + vbExclamation)

    End Sub

    Private Sub cblAttribute_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cblAttribute.SelectedIndexChanged
        rbValue.Enabled = True
        rbRange.Enabled = True
        tbRangeNum.Enabled = True


        SetColorSchemes()

        cboColorSchemes.Enabled = True

    End Sub

    Private Sub SetColorSchemes()
        '----------------------------------------------------------------------------------------------------------
        ' 根据选择的配色依据和分色数量生成四种固定的配色方案,加入到列表中,供选择
        ' Intergraph Shenzhen 2005.1
        '----------------------------------------------------------------------------------------------------------
        On Error GoTo ErrHander
        ' Populate the color scheme combobox
        Dim objColor As PView.ColorScheme

        '.net下好象需要为每个objColor都单独定义一个对象,否则在添加到objColors时,报对象已经存在在集合中的错误。
        Dim objColor1 As PView.ColorScheme
        Dim objColor2 As PView.ColorScheme
        Dim objColor3 As PView.ColorScheme

           Dim iColor As Integer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -