• Unable to obtain requested locks during BeginAccess


       1:    Case "toolMuline"
       2:                      Select Case e.ToolStatus
       3:                          Case MapInfo.Tools.ToolStatus.Start
       4:                              '========================= 创建临时图层
       5:                              Dim tblTemp As Table = MapInfo.Engine.Session.Current.Catalog.GetTable("lyrmuline")
       6:                              If Not tblTemp Is Nothing Then
       7:                                  CloseLayer("lyrmuline")
       8:                                  CloseLayer("labelmuline")
       9:                              End If
      10:                              Dim pt As DPoint = e.MapCoordinate
      11:                              Dim lyrfilter As IMapLayerFilter = MapLayerFilterFactory.FilterForTools(MapControl1.Map, MapLayerFilterFactory.FilterByLayerType(LayerType.Normal), MapLayerFilterFactory.FilterVisibleLayers(True), "MapInfo.Tools.MapToolsDefault.SelectLayers", Nothing)
      12:                              Dim tableEnum As ITableEnumerator = MapControl1.Map.Layers.GetTableEnumerator(lyrfilter)
      13:                              If lyrfilter Is Nothing Then Return
      14:                              Dim mrfc As MultiResultSetFeatureCollection = Nothing
      15:                              Dim si As SearchInfo = Nothing
      16:                              Try
      17:                                  Dim dist As Distance = MapInfo.Mapping.SearchInfoFactory.ScreenToMapDistance(Me.MapControl1.Map, 5)
      18:                                  si = MapInfo.Data.SearchInfoFactory.SearchNearest(pt, MapControl1.Map.GetDisplayCoordSys(), dist)
      19:                                  CType(si.SearchResultProcessor, ClosestSearchResultProcessor).DistanceUnit = dist.Unit
      20:                                  CType(si.SearchResultProcessor, ClosestSearchResultProcessor).MaxDistance = dist.Value
      21:                                  CType(si.SearchResultProcessor, ClosestSearchResultProcessor).Options = ClosestSearchOptions.StopAtFirstMatch
      22:                                  si.QueryDefinition.Columns = Nothing
      23:                                  mrfc = Session.Current.Catalog.Search(tableEnum, si)
      24:                              Catch ex As Exception
      25:                                  MsgBox("查询过程出现错误!")
      26:                                  mrfc = Nothing
      27:                                  tableEnum = Nothing
      28:                                  lyrfilter = Nothing
      29:                                  'dist = Nothing
      30:                                  tblTemp = Nothing
      31:                              End Try
      32:                              If mrfc Is Nothing Then Return
      33:                              If mrfc.Count > 0 Then
      34:                                  Dim resEnum = mrfc.GetEnumerator()
      35:                                  While (resEnum.MoveNext)
      36:                                      Dim irfc As IResultSetFeatureCollection = CType(resEnum.Current, IResultSetFeatureCollection)
      37:                                      Dim ftrEnum As IFeatureEnumerator = irfc.GetFeatureEnumerator()
      38:                                      While ftrEnum.MoveNext
      39:                                          Dim ftr As Feature = CType(ftrEnum.Current, Feature)
      40:                                          If ftr.Table.Alias.IndexOf(key.Substring(0, 5)) > -1 Then
      41:                                              Dim cn As String = ftr(ftr.Columns(0).ToString).ToString
      42:   
      43:                                              PubFun.ConstPar.map = Me.MapControl1.Map
      44:   
      45:                                              Dim tbinfo As TableInfoMemTable = New TableInfoMemTable("lyrmuline")
      46:                                              tbinfo.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(Me.MapControl1.Map.GetDisplayCoordSys()))
      47:                                              tbinfo.Columns.Add(ColumnFactory.CreateStyleColumn())
      48:                                              tbinfo.Columns.Add(ColumnFactory.CreateStringColumn("Name", 20))
      49:                                              tblTemp = MapInfo.Engine.Session.Current.Catalog.CreateTable(tbinfo)
      50:                                              Dim lyr As FeatureLayer = New FeatureLayer(tblTemp)
      51:                                              MapControl1.Map.Layers.Insert(0, lyr)
      52:   
      53:                                              '====标注图层===============
      54:                                              Dim activeLabel As String = "labelmuline"
      55:                                              Dim activeMapTable As Table = MapInfo.Engine.Session.Current.Catalog.GetTable("lyrmuline")
      56:                                              Dim lblyr As MapInfo.Mapping.LabelLayer = New MapInfo.Mapping.LabelLayer(activeLabel, activeLabel)
      57:   
      58:                                              Dim lblsource As MapInfo.Mapping.LabelSource = New MapInfo.Mapping.LabelSource(activeMapTable)
      59:                                              lblsource.DefaultLabelProperties.Style.Font.Name = "楷书"
      60:                                              lblsource.DefaultLabelProperties.Style.Font.Size = 12
      61:                                              lblsource.DefaultLabelProperties.Layout.Alignment = MapInfo.Text.Alignment.TopCenter
      62:                                              lblsource.DefaultLabelProperties.Layout.Offset = 2
      63:                                              lblsource.DefaultLabelProperties.Style.Font.ForeColor = Color.Red
      64:                                              lblsource.DefaultLabelProperties.Style.Font.BackColor = Color.Transparent
      65:                                              lblsource.DefaultLabelProperties.Style.Font.Shadow = True
      66:                                              lblsource.DefaultLabelProperties.Caption = "Name"
      67:                                              lblyr.Sources.Append(lblsource)
      68:                                              MapControl1.Map.Layers.Add(lblyr)
      69:                                              '==========================================
      70:                                              PubFun.ConMap.CreateMultine("lyrmuline", ftr.Geometry.Centroid.x, ftr.Geometry.Centroid.y, ftr("LAC_CI").ToString, ftr("N1_LAC_CI").ToString, ftr("N2_LAC_CI").ToString, ftr("N3_LAC_CI").ToString, ftr("N4_LAC_CI").ToString, ftr("N5_LAC_CI").ToString, ftr("N6_LAC_CI").ToString, ftr("RxLev").ToString, ftr("N1_RxLev").ToString, ftr("N2_RxLev").ToString, ftr("N3_RxLev").ToString, ftr("N4_RxLev").ToString, ftr("N5_RxLev").ToString, ftr("N6_RxLev").ToString)
      71:                                          End If
      72:                                          irfc.Close()
      73:                                          mrfc.Clear()
      74:                                          ftrEnum = Nothing
      75:                                          resEnum = Nothing
      76:                                          irfc = Nothing
      77:                                          mrfc = Nothing
      78:                                          tableEnum = Nothing
      79:                                          lyrfilter = Nothing
      80:                                          si = Nothing
      81:                                          tblTemp = Nothing
      82:                                      End While
      83:                                  End While
      84:                              Else
      85:                                  mrfc = Nothing
      86:                                  tableEnum = Nothing
      87:                                  lyrfilter = Nothing
      88:                                  'dist = Nothing
      89:                                  tblTemp = Nothing
      90:                                  si = Nothing
      91:   
      92:                              End If
      93:                              MapControl1.Refresh()
      94:                              Exit Select
      95:                      End Select
      96:   
      97:                      Exit Select
  • 相关阅读:
    pycharm使用
    python上手之环境搭建
    LDA浅析转
    矩阵按列按行归一化到L2范数的原理和最精简Matlab代码(转)
    (转)Low-Mid-High
    菲波纳数列的特性
    劝狼赋
    asp.net mvc Controller 模式下的 aop
    android for vs (三)visual studio android 发布为 apk
    android for vs (二)visual studio android 开发实例
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978830.html
Copyright © 2020-2023  润新知