按名称查找.txt

来自「mapxtrexe查看地图,查询图层,按名查找等」· 文本 代码 · 共 16 行

TXT
16
字号
Dim searchString As String = "Name='香港'"
        ' the following assumes that the table uscty_1k is already open.
        Dim fTroy As Feature = MapInfo.Engine.Session.Current.Catalog.SearchForFeature("Citys", MapInfo.Data.SearchInfoFactory.SearchWhere(searchString))
        Dim d As New MapInfo.geometry.Distance(10, DistanceUnit.Kilometer)

        Dim si As SearchInfo = MapInfo.Data.SearchInfoFactory.SearchWithinDistance(fTroy.Geometry, d, ContainsType.Geometry)
        Dim fc As IResultSetFeatureCollection = MapInfo.Engine.Session.Current.Catalog.Search("Citys", si)

Dim fn As IFeatureEnumerator = fc.GetFeatureEnumerator
        ListBox1.Items.Clear()
        While (fn.MoveNext())
            If (fn.Current.Geometry.GetType().ToString() = "MapInfo.Geometry.LegacyText") Then
                ListBox1.Items.Add(CType(fn.Current.Geometry, MapInfo.Geometry.LegacyText).Caption)
            End If
            ListBox1.Items.Add(fn.Current.Geometry.GetType().ToString)
        End While

⌨️ 快捷键说明

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