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

📄 frmlocationsallocate.frm

📁 都是基于VB所做的程序集合,值得大家作为实践的参考资料.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLocationsAllocate 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "选址分区"
   ClientHeight    =   2970
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4335
   Icon            =   "frmLocationsAllocate.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2970
   ScaleWidth      =   4335
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.CheckBox chkbFromCenter 
      Caption         =   "从中心点开始分配"
      Height          =   255
      Left            =   120
      TabIndex        =   10
      Top             =   2160
      Width           =   3015
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   375
      Left            =   3240
      TabIndex        =   9
      Top             =   2475
      Width           =   855
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "分析"
      Height          =   375
      Left            =   2160
      TabIndex        =   8
      Top             =   2475
      Width           =   855
   End
   Begin VB.TextBox txtCenterNodesTableName 
      Height          =   315
      Left            =   2040
      TabIndex        =   7
      Text            =   "LocationAllocate_CenterNodesTable"
      Top             =   1680
      Width           =   2055
   End
   Begin VB.TextBox txtAllocateResultTableName 
      Height          =   315
      Left            =   2040
      TabIndex        =   5
      Text            =   "LocationAllocate_ResultTable"
      Top             =   1200
      Width           =   2055
   End
   Begin VB.ComboBox cmbLocationAllocateMode 
      Height          =   315
      Left            =   2040
      TabIndex        =   3
      Text            =   "Mininum Distance"
      Top             =   720
      Width           =   2055
   End
   Begin VB.TextBox txtLocationsCount 
      Height          =   315
      Left            =   2040
      TabIndex        =   1
      Text            =   "10"
      Top             =   240
      Width           =   2055
   End
   Begin VB.Label Label5 
      Caption         =   "节点统计数据集"
      Height          =   375
      Left            =   120
      TabIndex        =   6
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label4 
      Caption         =   "结果统计数据集"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   1200
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "最优化方式"
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   720
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "查找位置个数"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   1575
   End
End
Attribute VB_Name = "frmLocationsAllocate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
    Me.Hide
End Sub

Private Sub cmdOK_Click()
    Dim bResult As Boolean
    Dim nLocationAllocateMode As seLocationAllocateType
    Dim bFromCenter As Boolean
    Dim strAllocateResultTableName As String
    Dim strCenterNodesTableName As String
    Dim nLocationsCount As Long
    
    Select Case cmbLocationAllocateMode.Text
        Case "Mininum Distance"
            nLocationAllocateMode = scaLATMinDistance
        Case "Maximum Cover"
            nLocationAllocateMode = scaLATMaxCover
        Case "Mininum Distance Power"
            nLocationAllocateMode = scaLATMinDistPower
        Case "Mininum Attend"
            nLocationAllocateMode = scaLATMaxAttend
    End Select
    bFromCenter = IIf(chkbFromCenter.Value = 1, True, False)
    strAllocateResultTableName = txtAllocateResultTableName.Text
    strCenterNodesTableName = txtCenterNodesTableName.Text
    nLocationsCount = CLng(txtLocationsCount.Text)
    
    bResult = frmMain.SuperAnalyst1.NetworkAnalyst.LocationsAllocate(nLocationAllocateMode, nLocationsCount, bFromCenter, strAllocateResultTableName, strCenterNodesTableName)
    If bResult Then
        MsgBox "分析成功"
        frmMain.SuperWkspManager1.Refresh
    Else
        MsgBox "分析失败"
    End If
End Sub

Private Sub Form_Load()
    cmbLocationAllocateMode.AddItem "Mininum Distance"
    cmbLocationAllocateMode.AddItem "Maximum Cover"
    cmbLocationAllocateMode.AddItem "Mininum Distance Power"
    cmbLocationAllocateMode.AddItem "Mininum Attend"
    Dim i As Integer
    
    Dim objDatasource As soDataSource
    
    Set objDatasource = frmMain.SuperWorkspace1.Datasources(frmMain.SuperMap1.Layers(1).Dataset.DataSourceAlias)
    For i = 1 To 10
        If objDatasource.IsAvailableDatasetName(txtAllocateResultTableName.Text) Then
            Exit For
        Else
            txtAllocateResultTableName.Text = txtAllocateResultTableName.Text & i
        End If
    Next
        
    For i = 1 To 10
        If objDatasource.IsAvailableDatasetName(txtCenterNodesTableName.Text) Then
            Exit For
        Else
            If InStrRev(txtCenterNodesTableName.Text, "_") <> 0 Then
                Exit For
            Else
                txtCenterNodesTableName.Text = txtCenterNodesTableName.Text & i
            End If
        End If
    Next
   
    
    Set objDatasource = Nothing
End Sub

⌨️ 快捷键说明

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