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

📄 form1.frm

📁 介绍VB下MAPX实现的二次搜索查询
💻 FRM
字号:
VERSION 5.00
Object = "{E760686B-BC9E-4802-9ECF-175FDF4062CE}#5.0#0"; "MAPX50.DLL"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6870
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9720
   LinkTopic       =   "Form1"
   ScaleHeight     =   6870
   ScaleWidth      =   9720
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Caption         =   "条件"
      Height          =   2175
      Left            =   7800
      TabIndex        =   2
      Top             =   1320
      Width           =   1695
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   240
         TabIndex        =   5
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   ">"
         Height          =   255
         Left            =   480
         TabIndex        =   4
         Top             =   960
         Width           =   255
      End
      Begin VB.Label Label1 
         Caption         =   "pop_1990"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   600
         Width           =   975
      End
   End
   Begin VB.ListBox List1 
      Height          =   2400
      Left            =   7560
      TabIndex        =   1
      Top             =   4080
      Width           =   2055
   End
   Begin VB.CommandButton Command1 
      Caption         =   "半径查询"
      Height          =   375
      Left            =   7920
      TabIndex        =   0
      Top             =   720
      Width           =   1215
   End
   Begin MapXLib.Map Map1 
      Height          =   6735
      Left            =   0
      TabIndex        =   6
      Top             =   0
      Width           =   7455
      _Version        =   500012
      _ExtentX        =   13150
      _ExtentY        =   11880
      _StockProps     =   1
      MapCatalog.GeoDictionary=   "GeoDictionary"
      GeoSet          =   "Empty GeosetName {9A9AC2F4-8375-44d1-BCEB-476AE986F190}"
      DefaultStyle.TextFontBackColor=   16777215
      DefaultStyle.SupportsBitmapSymbols=   -1  'True
      DefaultStyle.SymbolChar=   55
      DefaultStyle.SymbolFontBackColor=   16777215
      BeginProperty DefaultStyle.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty DefaultStyle.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Map Symbols"
         Size            =   14.25
         Charset         =   2
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      DefaultStyle.LineStyle=   1
      DefaultStyle.LineWidth=   1
      DefaultStyle.RegionColor=   16777215
      DefaultStyle.LinePattern=   2
      DefaultStyle.RegionBackColor=   16777215
      DefaultStyle.RegionBorderStyle=   1
      DefaultStyle.RegionBorderWidth=   1
      Title.Visible   =   0   'False
      Title.Text      =   "Empty Title {01A9504B-CE13-4415-A5A0-51D8C2F15204}"
      Title.Style.TextFontBackColor=   16777215
      Title.Style.TextFontOpaque=   -1  'True
      Title.Style.SymbolChar=   0
      BeginProperty Title.Style.TextFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   23.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Title.Style.SymbolFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   23.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Title.X         =   2484
      Title.Y         =   449
      Map.NumericCoordSys.ProjectionInfo=   "Form1.frx":0000
      Map.DisplayCoordSys.ProjectionInfo=   "Form1.frx":0130
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const SEARCH_DISTANCE_TOOL As Integer = 101

Private Sub Command1_Click()
  Map1.CurrentTool = 101
End Sub



Private Sub Form_Load()
  Map1.Layers.Add App.Path + "\Data\States.tab"
  Map1.CreateCustomTool SEARCH_DISTANCE_TOOL, miToolTypeCircle, miRadiusSelectCursor  '自定义半径查询工具
  Map1.MapUnit = miUnitMeter
End Sub
Private Sub Map1_ToolUsed(ByVal ToolNum As Integer, ByVal X1 As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 As Double, ByVal Distance As Double, ByVal Shift As Boolean, ByVal Ctrl As Boolean, EnableDefault As Boolean)
 Dim P As New MapXLib.Point
 Dim Fs As MapXLib.Features
 Dim lInfo As MapXLib.LayerInfo
 Dim lStr As String
 Dim Lay As MapXLib.Layer
 Dim I As Integer
 Dim Mydata As Dataset
 Dim MydataLayer As Layer
 Dim Pop_1990 As Double
 Dim Sql As String
 Dim F As Feature
 List1.Clear
 Select Case ToolNum
   Case SEARCH_DISTANCE_TOOL '半径查询
     For I = 1 To Map1.Layers.Count
       If Map1.Layers.Item(I).Name = "temp" Then
         Map1.Layers.Remove I
         Exit For
       End If
    Next
    P.Set X1, Y1
    Set Lay = Map1.Layers.Item(1)
    Set Fs = Lay.SearchWithinDistance(P, Distance, miUnitMeter, miSearchTypeCentroidWithin)
    Set lInfo = New LayerInfo
    lInfo.Type = 6 ' layer type is miLayerInfoTypeTemp
    lInfo.AddParameter "name", "temp"
    lInfo.AddParameter "features", Fs
    Map1.Layers.Add lInfo
    Set Lay = Map1.Layers("temp")
    Map1.Layers.Item(1).AutoLabel = True
    Set lInfo = Nothing
    Set Mydata = Map1.Datasets.Add(miDataSetLayer, Lay)
    Pop_1990 = Val(Text1.Text)
    Sql = "Pop_1990>" + Str(Pop_1990)
    Set Fs = Lay.Search(Sql)
      For Each F In Fs
        List1.AddItem F.Name
      Next
   End Select
End Sub

⌨️ 快捷键说明

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