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

📄 covermenu.mb

📁 mapinfo二次开发,是不可多得的好东西
💻 MB
字号:
Include "menu.def"
Include "icons.def"
include "mapbasic.def"
Declare Sub CoverMenu
sub CoverMenu
    dim datapath as string     '* 定义程序中数据的路径
    dim i as integer
    dim bflag as logical
    bflag = true
    onerror goto  error_trap
    datapath = ApplicationDirectory$()+"\data\"

    do case int(CommandInfo(CMD_INFO_MENUITEM))    '根据不同的id打开不同的图层'
    case 2000
        If NumWindows() = 0 Then
            open table datapath &"BaseMap.TAB" as 底图 Interactive
            Map From 底图
            set map window frontwindow() zoom entire
            Set window Frontwindow() max          
        End If        
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)          '此函数作用返回地图窗口的坐标和距离信息'
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "底图" then '返回地图窗口中图层的信息'
		      bflag = false
            end if
        next
        if bflag then
            open table datapath & "BaseMap.TAB" as 底图 Interactive
            Map From 底图
            set map window frontwindow() zoom entire
            Set window Frontwindow() max
        end if
        bflag = true 
    Case 2001 
        If NumWindows() = 0 Then
            open table datapath & "B11.tab" as 现状面 Interactive
            Map From 现状面
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	
		'*循环的目的在于判断图层是否已经添加到底图窗口中了
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "现状面" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "B11.tab" as 现状面 Interactive
           Add map auto layer 现状面
        end if 
        set map layer 现状面 editable
        bflag = true    '*recover the value
    Case 2002
        If NumWindows() = 0 Then
            open table datapath & "B12.tab" as 现状线 Interactive
            Map From 现状线
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "现状线" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "B12.tab" as 现状线 Interactive
           Add map auto layer 现状线
        end if
        set map layer 现状线 editable
        bflag = true
    Case 2003
         If NumWindows() = 0 Then
            open table datapath & "D10.tab" as 注记 Interactive
            Map From 注记
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	

        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "注记" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "D10.tab" as 注记 Interactive
           Add map auto layer 注记
        end if
        set map layer 注记 editable
        bflag = true
    Case 2011
         If NumWindows() = 0 Then
            open table datapath & "C11.tab" as 权属面 Interactive
            Map From 权属面
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "权属面" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "C11.tab" as 权属面 Interactive
           Add map auto layer 权属面
        end if
        set map layer 权属面 editable
        bflag = true
    Case 2012
        If NumWindows() = 0 Then
            open table datapath & "C12.tab" as 权属线 Interactive
            Map From 权属线
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "权属线" then
		      bflag = false
            end if
        next

        if bflag then
           Open Table datapath & "C12.tab" as 权属线 Interactive
           Add map auto layer 权属线
        end if
        set map layer 权属线 editable
        bflag = true
    'Case 2013
       ' for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            'if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "权属拐点" then
		      'bflag = false
           ' end if
       ' next
        'if bflag then
           'Open Table datapath & "C13.tab" as 权属拐点 Interactive
           'Add map auto layer 权属拐点
        'end if
        'set map layer 权属拐点 editable
        'bflag = true
    Case 2083
        If NumWindows() = 0 Then
            open table datapath & "A21.tab" as 等高线 Interactive
            Map From 等高线
            set map window frontwindow() zoom entire
            Set window Frontwindow() max  
         End If      	
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "等高线" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "A21.tab" as 等高线 Interactive
           Add map auto layer 等高线
        end if
        set map layer 等高线 editable
        bflag = true
    Case 2022
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "高程点" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "A22.tab" as 高程点 Interactive
             Add map auto layer 高程点
        end if
        set map layer 高程点 editable
        bflag = true
    Case 3031
        If NumWindows() = 0 Then
            open table datapath & "D21.tab" as 规划图 Interactive
            Map From 规划图
            set map window frontwindow() zoom entire
 Set window Frontwindow() max  
         End If      	
        for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "规划图" then
		      bflag = false
            end if
        next
        if bflag then
           Open Table datapath & "D21.tab" as 规划图 Interactive
           Add map auto layer 规划图
        end if
        set map layer 规划图 editable
        bflag = true
    'Case 2032
        'for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            'if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "整饰图线层" then
		      'bflag = false
           ' end if
        'next
        'if bflag then
           'Open Table datapath & "D22.tab" as 整饰图线层 Interactive
           'Add map auto layer 整饰图线层
        'end if
        'set map layer 整饰图线层 editable
        'bflag = true
    'Case 3033
        'for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            'if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "整饰图其它线层" then
		     ' bflag = false
           ' end if
        'next
        'if bflag then
           'Open Table datapath & "D23.tab" as 整饰图其它线层 Interactive
           'Add map auto layer 整饰图其它线层
       ' end if
        'set map layer 整饰图其它线层 editable
        'bflag = true
    'Case 2034
       ' for i = 0 to MapperInfo(Frontwindow(),MAPPER_INFO_LAYERS)
            'if LayerInfo(Frontwindow(),i,LAYER_INFO_NAME)  = "整饰图点层" then
		      'bflag = false
            'end if
       ' next
        'if bflag then
           'Open Table datapath & "D24.tab" as 整饰图点层 Interactive
          ' Add map auto layer 整饰图点层
        'end if
        'set map layer 整饰图点层 editable
       ' bflag = true

   end case
done:
  exit sub
error_trap:
  note error$()
  resume done
 end sub

⌨️ 快捷键说明

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