Files
envi-code/SourceCode/Code2026/tg_shs/shs_public/LayerManBar.cpp
T
2026-09-28 15:28:50 +08:00

1079 lines
35 KiB
C++

// LayerManBar.cpp: implementation of the CLayerManBar class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
//#include <arxtools.h>
//#include <DbObject.h>
//#include <dbwall.h>
#include <actrans.h>
#include "tapi.h"
#include "LayerManBar.h"
#include "Resource.h"
extern XStringList g_lstCloseLay;
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define IDI_LAYERBAR 1115
#define IDC_LAYERBAR_LIST 1116
#define IDC_LAYERBAR_OPEN 1117
#define IDC_LAYERBAR_CLOSE 1118
#define IDC_LAYERBAR_DEL 1119
#define IDC_LAYERBAR_OPENALL 1120
#define IDC_LAYERBAR_LUCKTEL 1121
#define IDC_LAYERBAR_ILL 1122
#define IDC_LAYERBAR_POW 1123
#define IDC_LAYERBAR_FIR 1124
#define IDC_LAYERBAR_WEA 1125
#define IDC_LAYERBAR_LUCKTCH 1126
#define IDC_LAYERBAR_TEL 1127
#define IDC_LAYERBAR_TCHLAY 1128
#define IDC_LAYERBAR_TELLAY 1129
#define IDC_LAYERBAR_DEFINE 1130
#define IDC_LAYERBAR_OPEN2 1131
#define IDC_LAYERBAR_LOCK 1132
#define IDC_LAYERBAR_LOCK2 1133
#define IDC_LAYERBAR_UNLOCK 1134
CLayerManBar* g_pLayerBar = NULL;
extern TARCH_IMPEXP int g_nProductId;
void LayerTools()
{
CAcModuleResourceOverride exm;
CMDIFrameWnd *pAcadFrame = acedGetAcadFrame();
if(g_pLayerBar){
if(::IsWindow(g_pLayerBar->m_hWnd)) {
if(!g_pLayerBar->IsWindowVisible()) {
acedGetAcadFrame()->ShowControlBar(g_pLayerBar, TRUE, TRUE);
CWnd *pView=acedGetAcadDwgView();
if(pView)
pView->SetFocus();
}
else
{
acedGetAcadFrame()->ShowControlBar(g_pLayerBar, FALSE, TRUE);
acedGetAcadFrame()->RecalcLayout();
}
return;
}
delete g_pLayerBar;
g_pLayerBar=NULL;
}
g_pLayerBar = new CLayerManBar;
CRect rect(0, 0, 81, 100);
int nDockSide=AFX_IDW_DOCKBAR_LEFT;
int nBarStyle=WS_CHILD|WS_VISIBLE| CBRS_FLYBY;
g_pLayerBar->Create(pAcadFrame,
_T("上华图层管理"), IDI_LAYERBAR, nBarStyle ,
rect);
g_pLayerBar->Initial();
g_pLayerBar->RestoreControlBar();
g_pLayerBar->EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
pAcadFrame->DockControlBar(g_pLayerBar, nDockSide);
pAcadFrame->ShowControlBar(g_pLayerBar, TRUE, TRUE);
pAcadFrame->RecalcLayout();
}
void DestroyLayerManBar()
{
if(g_pLayerBar){
if(::IsWindow(g_pLayerBar->m_hWnd))
g_pLayerBar->DestroyWindow();
delete g_pLayerBar;
g_pLayerBar=NULL;
}
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CLayerManBar, CAcUiDockControlBar)
CLayerManBar::CLayerManBar()
{
m_sizeDlg.cx = 91;
m_sizeDlg.cy = 100;
m_bIsTchOn = TRUE;
m_bIsTelOn = TRUE;
m_bIsTchLucked = FALSE;
m_bIsTelLucked = FALSE;
}
CLayerManBar::~CLayerManBar()
{
}
BEGIN_MESSAGE_MAP(CLayerManBar, CAcUiDockControlBar)
//{{AFX_MSG_MAP(CAcUiDockControlBar)
ON_WM_WINDOWPOSCHANGED()
ON_BN_CLICKED(IDC_LAYERBAR_TCHLAY, OnButTchLay)
ON_BN_CLICKED(IDC_LAYERBAR_TELLAY, OnButTelLay)
ON_BN_CLICKED(IDC_LAYERBAR_DEFINE, OnButDefine)
ON_BN_CLICKED(IDC_LAYERBAR_OPEN, OnButOpen)
// ON_BN_CLICKED(IDC_LAYERBAR_TEL, OnButTel)
ON_BN_CLICKED(IDC_LAYERBAR_LUCKTEL, OnButLuckTel)
ON_BN_CLICKED(IDC_LAYERBAR_OPENALL, OnButOpenAll)
ON_BN_CLICKED(IDC_LAYERBAR_CLOSE, OnButClose)
ON_BN_CLICKED(IDC_LAYERBAR_LUCKTCH, OnButLuckTch)
ON_BN_CLICKED(IDC_LAYERBAR_DEL, OnButDel)
ON_BN_CLICKED(IDC_LAYERBAR_OPEN2, OnButOpen2)
ON_BN_CLICKED(IDC_LAYERBAR_UNLOCK, OnButUnLock)
ON_BN_CLICKED(IDC_LAYERBAR_LOCK, OnButLock)
ON_BN_CLICKED(IDC_LAYERBAR_LOCK2, OnButLock2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CLayerManBar::Initial()
{
CAcModuleResourceOverride vTemp;
m_butTgLay.Create(_T("显示建筑层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,20,90,40), this, IDC_LAYERBAR_TCHLAY);
CString csShowTel = _T("显示电气层");
if(g_nProductId==16)
csShowTel = _T("显示电气层");
else if(g_nProductId==14)
csShowTel = _T("显示给排水");
m_butTelLay.Create(csShowTel, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,40,90,60), this, IDC_LAYERBAR_TELLAY);
m_butDefine.Create(_T("定义图层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,60,90,80), this, IDC_LAYERBAR_DEFINE);
m_butLuckTch.Create(_T("锁定建筑层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,80,90,100), this, IDC_LAYERBAR_LUCKTCH);
if(g_nProductId==16)
csShowTel = _T("锁定电气层");
else if(g_nProductId==14)
csShowTel = _T("锁定给排水");
m_butLuckTel.Create(csShowTel, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,100,90,120), this, IDC_LAYERBAR_LUCKTEL);
m_butOpen.Create(_T("只开选择层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,140,90,160), this, IDC_LAYERBAR_OPEN);
m_butClose.Create(_T("关闭选择层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,160,90,180), this, IDC_LAYERBAR_CLOSE);
m_butDel.Create(_T("删除选择层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,180,90,200), this, IDC_LAYERBAR_DEL);
m_butOpen2.Create(_T("打开关闭层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,200,90,220), this, IDC_LAYERBAR_OPEN2);
m_butLock.Create(_T("锁定选择层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,220,90,240), this, IDC_LAYERBAR_LOCK);
m_butLock2.Create(_T("锁非选择层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,240,90,260), this, IDC_LAYERBAR_LOCK2);
m_butUnLock.Create(_T("解锁图层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,260,90,280), this, IDC_LAYERBAR_UNLOCK);
m_butOpenAll.Create(_T("打开全部层"), WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
CRect(0,280,90,300), this, IDC_LAYERBAR_OPENALL);
HBITMAP hBitmap31 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_KXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butOpen.SetIcon(hBitmap31, NULL, 16, 15);
HBITMAP hBitmap32 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_GXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butClose.SetIcon(hBitmap32, NULL, 16, 15);
HBITMAP hBitmap33 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_SCXC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butDel.SetIcon(hBitmap33, NULL, 16, 15);
HBITMAP hBitmap34 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_DKTC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butOpen2.SetIcon(hBitmap34, NULL, 16, 15);
HBITMAP hBitmap35 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_SXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLock.SetIcon(hBitmap35, NULL, 16, 15);
HBITMAP hBitmap36 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_SFXC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLock2.SetIcon(hBitmap36, NULL, 16, 15);
HBITMAP hBitmap37 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_JXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butUnLock.SetIcon(hBitmap37, NULL, 16, 15);
HBITMAP hBitmap1 = (HBITMAP)::LoadImage(g_hTchDll, _T("ID_LIGHT_ON"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTgLay.SetIcon(hBitmap1, NULL, 16, 15);
HBITMAP hBitmap2 = (HBITMAP)::LoadImage(g_hTchDll, _T("ID_LIGHT_ON"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTelLay.SetIcon(hBitmap2, NULL, 16, 15);
HBITMAP hBitmap3 = (HBITMAP)::LoadImage(g_hTchDll, _T("ICON_16_PICKENT"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butDefine.SetIcon(hBitmap3, NULL, 16, 15);
HBITMAP hBitmap4 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_JXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLuckTel.SetIcon(hBitmap4, NULL, 16, 15);
HBITMAP hBitmap5 = (HBITMAP)::LoadImage(g_hTchDll, _T("TWT_16_JXZC"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLuckTch.SetIcon(hBitmap5, NULL, 16, 15);
HBITMAP hBitmap6 = (HBITMAP)::LoadImage(g_hTchDll, _T("ID_LIGHT_ALLON"), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butOpenAll.SetIcon(hBitmap6, NULL, 16, 15);
}
// 调整窗口大小
void CLayerManBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
{
CAcUiDockControlBar::OnWindowPosChanged(lpwndpos);
if((lpwndpos->flags & SWP_HIDEWINDOW) || (lpwndpos->flags & SWP_SHOWWINDOW))
return;
CSize sizeOld = m_sizeDlg;
m_sizeDlg.cx = lpwndpos->cx;
m_sizeDlg.cy = lpwndpos->cy;
long nIncY = m_sizeDlg.cy - sizeOld.cy;
long nIncX = m_sizeDlg.cx - sizeOld.cx;
}
//定义图层
void CLayerManBar::OnButDefine()
{
acDocManager->sendStringToExecute(curDoc(), _T("defineLayer "), true, false, false);
}
//建筑图层(显示)
void CLayerManBar::OnButTchLay()
{
CAcModuleResourceOverride vTemp;
m_bIsTchOn = !m_bIsTchOn;
CString csTmp = _T("ID_LIGHT_ON");
if(!m_bIsTchOn)
csTmp = _T("ID_LIGHT_OFF");
HBITMAP hBitmap=(HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTgLay.SetIcon(hBitmap, NULL, 16, 15);
XStringList lst;
lst.Append(tstrnew(LAY_AXIS));
lst.Append(tstrnew(LAY_BALCONY));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_COLU));
lst.Append(tstrnew(LAY_WIN));
lst.Append(tstrnew(LAY_DIMAX));
lst.Append(tstrnew(LAY_GROUND));
lst.Append(tstrnew(LAY_WALL));
lst.Append(tstrnew(LAY_WALL_DIVIDER));
lst.Append(tstrnew(LAY_WALL_FILL));
lst.Append(tstrnew(LAY_WALL_BRICK));
lst.Append(tstrnew(LAY_WALL_ROCKET));
lst.Append(tstrnew(LAY_WALL_CONCRETE));
lst.Append(tstrnew(LAY_WALL_PARAPET));
lst.Append(tstrnew(LAY_COLU_BRICK));
lst.Append(tstrnew(LAY_COLU_ROCKET));
lst.Append(tstrnew(LAY_COLU_CONCRETE));
lst.Append(tstrnew(LAY_COLU_STEEL));
lst.Append(tstrnew(LAY_SURFACE));
lst.Append(tstrnew(LAY_ROOF));
lst.Append(tstrnew(LAY_STAIR));
lst.Append(tstrnew(LAY_SANIWARE));
lst.Append(tstrnew(LAY_RAIL));
lst.Append(tstrnew(LAY_HANDRAIL));
lst.Append(tstrnew(LAY_SPACE));
lst.Append(tstrnew(LAY_VIEW));
lst.Append(tstrnew(LAY_AXIS_TEXT));
lst.Append(tstrnew(_T("PUB_DIM"))); //建筑的文字和标注
lst.Append(tstrnew(_T("PUB_TEXT")));
lst.Append(tstrnew(LAY_VIEWPORT));
lst.Append(tstrnew(LAY_HATCH));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_OPENING_DIM));
lst.Append(tstrnew(LAY_S_LINE));
lst.Append(tstrnew(LAY_S_WIN));
lst.Append(tstrnew(LAY_S_BLOCK));
lst.Append(tstrnew(LAY_S_STAIR));
lst.Append(tstrnew(LAY_E_FLOOR));
lst.Append(tstrnew(LAY_E_LINE));
lst.Append(tstrnew(LAY_E_WIN));
lst.Append(tstrnew(LAY_E_COMP));
lst.Append(tstrnew(LAY_E_STAIR));
lst.Append(tstrnew(_T("TCH_保留")));
lst.Append(tstrnew(_T("PUB_WALL")));
XString xsDbfFile;
if(!FindFile(_T("userlayer.dbf"), xsDbfFile)) {
MessageBox(_T("对不起,没有发现userlayer.dbf文件!"));
return;
}
CodeBase db;
XDbfTable *pTable = db.Open(xsDbfFile);
if(!pTable) {
CString csTmp;
csTmp.Format(_T("%s文件只读或损坏!"), xsDbfFile);
AfxMessageBox(csTmp);
// AfxMessageBox(_T("TK文件只读或损坏!"));
return;
}
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext()){
int id(0);
CString sName, sComment;
GET_FIELD(pTable, _T("product"), id);
GET_FIELD(pTable, _T("name"), sName);
if(id == 1){
lst.Append(tstrnew(sName));
}
}
ShowLayer(lst, m_bIsTchOn);
}
//电气层(显示)
void CLayerManBar::OnButTelLay()
{
CAcModuleResourceOverride vTemp;
m_bIsTelOn = !m_bIsTelOn;
CString csTmp = _T("ID_LIGHT_ON");
if(!m_bIsTelOn)
csTmp = _T("ID_LIGHT_OFF");
HBITMAP hBitmap0 = (HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTelLay.SetIcon(hBitmap0, NULL, 16, 15);
XStringList lst;
if(g_nProductId==16){
lst.Append(tstrnew(LAY_EQUIP_ILLUME));
lst.Append(tstrnew(LAY_EQUIP_POWER));
lst.Append(tstrnew(LAY_EQUIP_FIRE));
lst.Append(tstrnew(LAY_EQUIP_WEAK));
lst.Append(tstrnew(LAY_EQUIP_CUPBOARD));
lst.Append(tstrnew(LAY_TEL_ELEMENT));
lst.Append(tstrnew(LAY_TEL_DOT));
lst.Append(tstrnew(LAY_TEL_LWIRE));
lst.Append(tstrnew(LAY_TEL_SHTLN));
lst.Append(tstrnew(LAY_WIRE_ILLUME));
lst.Append(tstrnew(LAY_WIRE_POWER));
lst.Append(tstrnew(LAY_WIRE_FIRE));
lst.Append(tstrnew(LAY_WIRE_WEAK));
lst.Append(tstrnew(LAY_WIRE_SYSTEM));
lst.Append(tstrnew(LAY_WIRE_BUS));
lst.Append(tstrnew(LAY_WIRE_GROUND));
lst.Append(tstrnew(LAY_WIRE_THUNDER));
lst.Append(tstrnew(LAY_DIM_ILLUME));
lst.Append(tstrnew(LAY_DIM_POWER));
lst.Append(tstrnew(LAY_DIM_FIRE));
lst.Append(tstrnew(LAY_DIM_WEAK));
lst.Append(tstrnew(LAY_DIM_SYSTEM));
lst.Append(tstrnew(LAY_DIM_CUPBOARD));
lst.Append(tstrnew(LAY_TEL_THUNDER));
lst.Append(tstrnew(LAY_TEL_DIM_TEXT));
lst.Append(tstrnew(LAY_DIM));
lst.Append(tstrnew(LAY_TEXT));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_TEL_GRID));
lst.Append(tstrnew(LAY_TEL_SOCK));
lst.Append(tstrnew(LAY_TEL_SOCK_DOTE));
lst.Append(tstrnew(LAY_TEL_TERM));
lst.Append(tstrnew(LAY_WIRE_EMERG));
lst.Append(tstrnew(LAY_WIRE_USER1));
lst.Append(tstrnew(LAY_WIRE_USER2));
}
else if(g_nProductId==14){
lst.Append(tstrnew(LAY_PIPE_FEED));
lst.Append(tstrnew(LAY_PIPE_FEED2));
lst.Append(tstrnew(LAY_PIPE_FEED3));
lst.Append(tstrnew(LAY_PIPE_HEADFEED));
lst.Append(tstrnew(LAY_PIPE_HEADFEED2));
lst.Append(tstrnew(LAY_PIPE_HEADFEED3));
lst.Append(tstrnew(LAY_PIPE_HEADBACK));
lst.Append(tstrnew(LAY_PIPE_HEADBACK2));
lst.Append(tstrnew(LAY_PIPE_HEADBACK3));
lst.Append(tstrnew(LAY_PIPE_DIRT));
lst.Append(tstrnew(LAY_PIPE_USELESS));
lst.Append(tstrnew(LAY_PIPE_RAIN));
lst.Append(tstrnew(LAY_PIPE_USED));
lst.Append(tstrnew(LAY_PIPE_USED2));
lst.Append(tstrnew(LAY_PIPE_USED3));
lst.Append(tstrnew(LAY_PIPE_FIRE));
lst.Append(tstrnew(LAY_PIPE_FIRE2));
lst.Append(tstrnew(LAY_PIPE_FIRE3));
lst.Append(tstrnew(LAY_PIPE_SPRINKLE));
lst.Append(tstrnew(LAY_PIPE_SPRINKLE2));
lst.Append(tstrnew(LAY_PIPE_SPRINKLE3));
lst.Append(tstrnew(LAY_PIPE_COAGULATE));
lst.Append(tstrnew(LAY_PIPE_DRINK));
lst.Append(tstrnew(LAY_PIPE_PRESSDIRT));
lst.Append(tstrnew(LAY_PIPE_PRESSUSELESS));
lst.Append(tstrnew(LAY_PIPE_PRESSRAIN));
lst.Append(tstrnew(LAY_PIPE_OTHER));
lst.Append(tstrnew(LAY_PIPE_DOUBLE));
lst.Append(tstrnew(LAY_PIPE_DIM));
lst.Append(tstrnew(LAY_PIPE_USER1));
lst.Append(tstrnew(LAY_PIPE_USER2));
lst.Append(tstrnew(LAY_PIPE_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_PIPE_USER4));
lst.Append(tstrnew(LAY_PIPE_USER5));
lst.Append(tstrnew(LAY_PIPE_USER6));
lst.Append(tstrnew(LAY_PIPE_USER7));
lst.Append(tstrnew(LAY_PIPE_USER8));
lst.Append(tstrnew(LAY_VPIPE_USER1));
lst.Append(tstrnew(LAY_VPIPE_USER2));
lst.Append(tstrnew(LAY_VPIPE_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_VPIPE_USER4));
lst.Append(tstrnew(LAY_VPIPE_USER5));
lst.Append(tstrnew(LAY_VPIPE_USER6));
lst.Append(tstrnew(LAY_VPIPE_USER7));
lst.Append(tstrnew(LAY_VPIPE_USER8));
lst.Append(tstrnew(LAY_VPIPE_FEED));
lst.Append(tstrnew(LAY_VPIPE_FEED2));
lst.Append(tstrnew(LAY_VPIPE_FEED3));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED2));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED3));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK2));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK3));
lst.Append(tstrnew(LAY_VPIPE_DIRT));
lst.Append(tstrnew(LAY_VPIPE_USELESS));
lst.Append(tstrnew(LAY_VPIPE_RAIN));
lst.Append(tstrnew(LAY_VPIPE_USED));
lst.Append(tstrnew(LAY_VPIPE_USED2));
lst.Append(tstrnew(LAY_VPIPE_USED3));
lst.Append(tstrnew(LAY_VPIPE_FIRE));
lst.Append(tstrnew(LAY_VPIPE_FIRE2));
lst.Append(tstrnew(LAY_VPIPE_FIRE3));
lst.Append(tstrnew(LAY_VPIPE_SPRINKLE));
lst.Append(tstrnew(LAY_VPIPE_SPRINKLE2));
lst.Append(tstrnew(LAY_VPIPE_SPRINKLE3));
lst.Append(tstrnew(LAY_VPIPE_COAGULATE));
lst.Append(tstrnew(LAY_VPIPE_DRINK));
lst.Append(tstrnew(LAY_VPIPE_PRESSDIRT));
lst.Append(tstrnew(LAY_VPIPE_PRESSUSELESS));
lst.Append(tstrnew(LAY_VPIPE_PRESSRAIN));
lst.Append(tstrnew(LAY_VPIPE_OTHER));
lst.Append(tstrnew(LAY_VALVE_FEED));
lst.Append(tstrnew(LAY_VALVE_HEADFEED));
lst.Append(tstrnew(LAY_VALVE_HEADBACK));
lst.Append(tstrnew(LAY_VALVE_DIRT));
lst.Append(tstrnew(LAY_VALVE_USELESS));
lst.Append(tstrnew(LAY_VALVE_RAIN));
lst.Append(tstrnew(LAY_VALVE_USED));
lst.Append(tstrnew(LAY_VALVE_FIRE));
lst.Append(tstrnew(LAY_VALVE_SPRINKLE));
lst.Append(tstrnew(LAY_VALVE_COAGULATE));
lst.Append(tstrnew(LAY_VALVE_DRINK));
lst.Append(tstrnew(LAY_VALVE_PRESSDIRT));
lst.Append(tstrnew(LAY_VALVE_PRESSUSELESS));
lst.Append(tstrnew(LAY_VALVE_PRESSRAIN));
lst.Append(tstrnew(LAY_VALVE_OTHER));
lst.Append(tstrnew(LAY_VALVE_USER1));
lst.Append(tstrnew(LAY_VALVE_USER2));
lst.Append(tstrnew(LAY_VALVE_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_VALVE_USER4));
lst.Append(tstrnew(LAY_VALVE_USER5));
lst.Append(tstrnew(LAY_VALVE_USER6));
lst.Append(tstrnew(LAY_VALVE_USER7));
lst.Append(tstrnew(LAY_VALVE_USER8));
lst.Append(tstrnew(LAY_DIM_FEED));
lst.Append(tstrnew(LAY_DIM_HEADFEED));
lst.Append(tstrnew(LAY_DIM_HEADBACK));
lst.Append(tstrnew(LAY_DIM_DIRT));
lst.Append(tstrnew(LAY_DIM_USELESS));
lst.Append(tstrnew(LAY_DIM_RAIN));
lst.Append(tstrnew(LAY_DIM_USED));
lst.Append(tstrnew(LAY_DIM_HYDRANT));
lst.Append(tstrnew(LAY_DIM_SPRINKLE));
lst.Append(tstrnew(LAY_DIM_COAGULATE));
lst.Append(tstrnew(LAY_DIM_DRINK));
lst.Append(tstrnew(LAY_DIM_PRESSDIRT));
lst.Append(tstrnew(LAY_DIM_PRESSUSELESS));
lst.Append(tstrnew(LAY_DIM_PRESSRAIN));
lst.Append(tstrnew(LAY_DIM_OTHER));
lst.Append(tstrnew(LAY_DIM_USER1));
lst.Append(tstrnew(LAY_DIM_USER2));
lst.Append(tstrnew(LAY_DIM_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_DIM_USER4));
lst.Append(tstrnew(LAY_DIM_USER5));
lst.Append(tstrnew(LAY_DIM_USER6));
lst.Append(tstrnew(LAY_DIM_USER7));
lst.Append(tstrnew(LAY_DIM_USER8));
lst.Append(tstrnew(LAY_TEXT_FEED));
lst.Append(tstrnew(LAY_TEXT_HEADFEED));
lst.Append(tstrnew(LAY_TEXT_HEADBACK));
lst.Append(tstrnew(LAY_TEXT_DIRT));
lst.Append(tstrnew(LAY_TEXT_USELESS));
lst.Append(tstrnew(LAY_TEXT_RAIN));
lst.Append(tstrnew(LAY_TEXT_USED));
lst.Append(tstrnew(LAY_TEXT_FIRE));
lst.Append(tstrnew(LAY_TEXT_SPRINKLE));
lst.Append(tstrnew(LAY_TEXT_COAGULATE));
lst.Append(tstrnew(LAY_TEXT_DRINK));
lst.Append(tstrnew(LAY_TEXT_PRESSDIRT));
lst.Append(tstrnew(LAY_TEXT_PRESSUSELESS));
lst.Append(tstrnew(LAY_TEXT_PRESSRAIN));
lst.Append(tstrnew(LAY_TEXT_OTHER));
lst.Append(tstrnew(LAY_TEXT_USER1));
lst.Append(tstrnew(LAY_TEXT_USER2));
lst.Append(tstrnew(LAY_TEXT_USER3)); // cet 2012.4.12 add
lst.Append(tstrnew(LAY_TEXT_USER4));
lst.Append(tstrnew(LAY_TEXT_USER5));
lst.Append(tstrnew(LAY_TEXT_USER6));
lst.Append(tstrnew(LAY_TEXT_USER7));
lst.Append(tstrnew(LAY_TEXT_USER8));
lst.Append(tstrnew(LAY_EQ_FEED));
lst.Append(tstrnew(LAY_EQ_HEADFEED));
lst.Append(tstrnew(LAY_EQ_HEADBACK));
lst.Append(tstrnew(LAY_EQ_DIRT));
lst.Append(tstrnew(LAY_EQ_USELESS));
lst.Append(tstrnew(LAY_EQ_RAIN));
lst.Append(tstrnew(LAY_EQ_USED));
lst.Append(tstrnew(LAY_EQ_FIRE));
lst.Append(tstrnew(LAY_EQ_SPRINKLE));
lst.Append(tstrnew(LAY_EQ_COAGULATE));
lst.Append(tstrnew(LAY_EQ_DRINK));
lst.Append(tstrnew(LAY_EQ_PRESSDIRT));
lst.Append(tstrnew(LAY_EQ_PRESSUSELESS));
lst.Append(tstrnew(LAY_EQ_PRESSRAIN));
lst.Append(tstrnew(LAY_EQ_OTHER));
lst.Append(tstrnew(LAY_EQ_USER1));
lst.Append(tstrnew(LAY_EQ_USER2));
lst.Append(tstrnew(LAY_EQ_USER3)); // cet 2012.4.12 add
lst.Append(tstrnew(LAY_EQ_USER4));
lst.Append(tstrnew(LAY_EQ_USER5));
lst.Append(tstrnew(LAY_EQ_USER6));
lst.Append(tstrnew(LAY_EQ_USER7));
lst.Append(tstrnew(LAY_EQ_USER8));
lst.Append(tstrnew(LAY_TEXT));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_EQUIP_PIPE));
lst.Append(tstrnew(LAY_EQUIP_GULLY));
lst.Append(tstrnew(LAY_EQUIP_VALVE));
lst.Append(tstrnew(LAY_EQUIP_LEAK));
lst.Append(tstrnew(LAY_EQUIP_SPRINKLE));
lst.Append(tstrnew(LAY_EQUIP_HYDRANT));
lst.Append(tstrnew(LAY_TWT_WATERTANK));
lst.Append(tstrnew(LAY_TWT_PUMP));
lst.Append(tstrnew(LAY_TWT_OUT));
lst.Append(tstrnew(LAY_TWT_GULLY));
lst.Append(tstrnew(LAY_TWT_SECTION));
lst.Append(tstrnew(LAY_TWT_FLANGE));
lst.Append(tstrnew(LAY_CALC_TEXT));
lst.Append(tstrnew(LAY_PIPE_DIM));
lst.Append(tstrnew(LAY_TWT_TREE));
lst.Append(tstrnew(LAY_TWT_ROAD));
lst.Append(tstrnew(LAY_TWT_DOTE));
lst.Append(tstrnew(LAY_TWT_DASH));
lst.Append(tstrnew(LAY_WELL_RAIN));
lst.Append(tstrnew(LAY_WELL_USELESS));
lst.Append(tstrnew(LAY_WELL_DIRT));
lst.Append(tstrnew(LAY_WELL_FEED));
lst.Append(tstrnew(LAY_WELL_FIRE));
lst.Append(tstrnew(LAY_WELL_OTHER));
lst.Append(tstrnew(LAY_WELL_TEXT));
lst.Append(tstrnew(LAY_TWT_GRID));
lst.Append(tstrnew(LAY_WELL_USED));
lst.Append(tstrnew(LAY_VPIPE_DIM));
lst.Append(tstrnew(LAY_DIM));
lst.Append(tstrnew(LAY_ELEV_DIM));
lst.Append(tstrnew(LAY_INDEX_DIM));
lst.Append(tstrnew(LAY_LEADER_DIM));
lst.Append(tstrnew(LAY_COORD_DIM));
lst.Append(tstrnew(LAY_OTHER_DIM));
lst.Append(tstrnew(LAY_SHEET));
lst.Append(tstrnew(_T("TWT")));
}
XString xsDbfFile;
if(!FindFile(_T("userlayer.dbf"), xsDbfFile)) {
MessageBox(_T("对不起,没有发现userlayer.dbf文件!"));
return;
}
CodeBase db;
XDbfTable *pTable = db.Open(xsDbfFile);
if(!pTable) {
CString csTmp;
csTmp.Format(_T("%s文件只读或损坏!"), xsDbfFile);
AfxMessageBox(csTmp);
// AfxMessageBox(_T("TK文件只读或损坏!"));
return;
}
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext()){
int id(0);
CString sName;
GET_FIELD(pTable, _T("product"), id);
GET_FIELD(pTable, _T("name"), sName);
if(id == g_nProductId){
lst.Append(tstrnew(sName));
}
}
ShowLayer(lst, m_bIsTelOn);
}
void CLayerManBar::OnButOpen2()
{
acDocManager->sendStringToExecute(curDoc(), _T("OpenLayer "), true, false, false);
}
void CLayerManBar::OnButUnLock()
{
acDocManager->sendStringToExecute(curDoc(), _T("UNLOCKSELLAYER "), true, false, false);
}
void CLayerManBar::OnButLock()
{
acDocManager->sendStringToExecute(curDoc(), _T("LOCKSELLAYER "), true, false, false);
}
void CLayerManBar::OnButLock2()
{
acDocManager->sendStringToExecute(curDoc(), _T("sfxc "), true, false, false);
}
void CLayerManBar::OnButClose()
{
acDocManager->sendStringToExecute(curDoc(), _T("CloseSelLayer "), true, false, false);
}
void CLayerManBar::OnButDel()
{
acDocManager->sendStringToExecute(curDoc(), _T("EraseSelLayer "), true, false, false);
}
void CLayerManBar::OnButOpen()
{
acDocManager->sendStringToExecute(curDoc(), _T("OpenSelLayer "), true, false, false);
}
void CLayerManBar::OnButOpenAll()
{
g_lstCloseLay.Reset();
m_bIsTchOn = TRUE;
m_bIsTelOn = TRUE;
CString csTmp = _T("ID_LIGHT_ON");
HBITMAP hBitmap=(HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTgLay.SetIcon(hBitmap, NULL, 16, 15);
HBITMAP hBitmap0 = (HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butTelLay.SetIcon(hBitmap0, NULL, 16, 15);
acDocManager->sendStringToExecute(curDoc(), _T("OpenAllLayer "), true, false, false);
}
extern BOOL SetLayerLock(const TCHAR*szLayerName, BOOL bLock);
void CLayerManBar::LuckLayer(XStringList &lstShow, BOOL bLock)
{
XSymbolList lstLayer(_T("LAYER"));
lstLayer.QuickSort(_tcscmp);
int len = lstLayer.Length();
for(int i=0; i<len ; i++){
CString csLayer = (const TCHAR *)lstLayer[i];
csLayer.MakeLower();
BOOL flag = FALSE;
for(int j=0;j<lstShow.Length();j++){
CString csShow = (const TCHAR *)lstShow[j];
csShow.MakeLower();
if(_tcsicmp(csLayer, csShow) == 0){
flag = TRUE;
break;
}
if(csShow.Find(_T("*")) > -1){ //通配符
int idx = csShow.Find(_T("*"));
if(csShow.Find(_T("*"), idx+1) > 0) //不支持多*
continue;
CString csLeft, csRight;
csLeft = csShow.Left(idx);
csRight = csShow.Right(csShow.GetLength() - idx - 1);
//把通配符左右2边的字符串都取出来, 如果该图层含有其内容的,都算匹配
if(csLeft != _T("")){
int idx = csLayer.Find(csLeft);
if(idx == 0){ //在开头
flag = TRUE;
break;
}
}
if(csRight != _T("")){
if(csLayer.Find(csRight) > -1){
int idx = csLayer.Find(csRight);
idx += csRight.GetLength();
if(idx == csLayer.GetLength()){ //在结尾
flag = TRUE;
break;
}
}
}
}
}
if(flag){
AcDbDatabase *dwg=acdbCurDwg();
AcAxDocLock docLock(dwg);
SetLayerLock((const TCHAR *)csLayer, bLock);
}
}
actrTransactionManager->flushGraphics(); //acad 刷新
acedUpdateDisplay(); //解决光标不在VIEW上无法刷新的问题 2008-7-31 sr 王勇光的方法
}
void CLayerManBar::ShowLayer(XStringList &lstShow, BOOL _topen)
{
XSymbolList lstLayer(_T("LAYER"));
lstLayer.QuickSort(_tcscmp);
int len = lstLayer.Length();
for(int i=0; i<len ; i++){
CString csLayer = (const TCHAR *)lstLayer[i];
BOOL flag = FALSE;
for(int j=0;j<lstShow.Length();j++){
CString csShow = (const TCHAR *)lstShow[j];
if(_tcsicmp(csLayer, csShow) == 0){
flag = TRUE;
break;
}
if(csShow.Find(_T("*")) > -1){ //通配符
int idx = csShow.Find(_T("*"));
if(csShow.Find(_T("*"), idx+1) > 0) //不支持多*
continue;
CString csLeft, csRight;
csLeft = csShow.Left(idx);
csRight = csShow.Right(csShow.GetLength() - idx - 1);
//把通配符左右2边的字符串都取出来, 如果该图层含有其内容的,都算匹配
if(csLeft != _T("")){
int idx = csLayer.Find(csLeft);
if(idx == 0){ //在开头
flag = TRUE;
break;
}
}
if(csRight != _T("")){
if(csLayer.Find(csRight) > -1){
int idx = csLayer.Find(csRight);
idx += csRight.GetLength();
if(idx == csLayer.GetLength()){ //在结尾
flag = TRUE;
break;
}
}
}
}
}
if(flag){
AcDbDatabase *dwg=acdbCurDwg();
AcAxDocLock docLock(dwg);
SetLayerOnOff((const TCHAR *)csLayer, _topen);
}
}
actrTransactionManager->flushGraphics(); //acad 刷新
acedUpdateDisplay(); //解决光标不在VIEW上无法刷新的问题 2008-7-31 sr 王勇光的方法
// CWnd *pView = acedGetAcadDwgView();
// if(pView){
// pView->SetFocus();
// CRect rect;
// CPoint pt;
// pView->GetWindowRect(rect);
// pt = rect.CenterPoint();
// SetCursorPos(pt.x, pt.y );
// }
}
void CLayerManBar::OnButLuckTel()
{
CAcModuleResourceOverride vTemp;
m_bIsTelLucked = !m_bIsTelLucked;
CString csTmp = _T("TWT_16_SXZC");
if(!m_bIsTelLucked)
csTmp = _T("TWT_16_JXZC");
HBITMAP hBitmap0 = (HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLuckTel.SetIcon(hBitmap0, NULL, 16, 15);
XStringList lst;
if(g_nProductId==16){
lst.Append(tstrnew(LAY_EQUIP_ILLUME));
lst.Append(tstrnew(LAY_EQUIP_POWER));
lst.Append(tstrnew(LAY_EQUIP_FIRE));
lst.Append(tstrnew(LAY_EQUIP_WEAK));
lst.Append(tstrnew(LAY_EQUIP_CUPBOARD));
lst.Append(tstrnew(LAY_TEL_ELEMENT));
lst.Append(tstrnew(LAY_TEL_DOT));
lst.Append(tstrnew(LAY_TEL_LWIRE));
lst.Append(tstrnew(LAY_TEL_SHTLN));
lst.Append(tstrnew(LAY_WIRE_ILLUME));
lst.Append(tstrnew(LAY_WIRE_POWER));
lst.Append(tstrnew(LAY_WIRE_FIRE));
lst.Append(tstrnew(LAY_WIRE_WEAK));
lst.Append(tstrnew(LAY_WIRE_SYSTEM));
lst.Append(tstrnew(LAY_WIRE_BUS));
lst.Append(tstrnew(LAY_WIRE_GROUND));
lst.Append(tstrnew(LAY_WIRE_THUNDER));
lst.Append(tstrnew(LAY_DIM_ILLUME));
lst.Append(tstrnew(LAY_DIM_POWER));
lst.Append(tstrnew(LAY_DIM_FIRE));
lst.Append(tstrnew(LAY_DIM_WEAK));
lst.Append(tstrnew(LAY_DIM_SYSTEM));
lst.Append(tstrnew(LAY_DIM_CUPBOARD));
lst.Append(tstrnew(LAY_TEL_THUNDER));
lst.Append(tstrnew(LAY_TEL_DIM_TEXT));
lst.Append(tstrnew(LAY_DIM));
lst.Append(tstrnew(LAY_TEXT));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_TEL_GRID));
lst.Append(tstrnew(LAY_TEL_SOCK));
lst.Append(tstrnew(LAY_TEL_SOCK_DOTE));
lst.Append(tstrnew(LAY_TEL_TERM));
lst.Append(tstrnew(LAY_WIRE_EMERG));
lst.Append(tstrnew(LAY_WIRE_USER1));
lst.Append(tstrnew(LAY_WIRE_USER2));
}
else if(g_nProductId==14){
lst.Append(tstrnew(LAY_PIPE_FEED));
lst.Append(tstrnew(LAY_PIPE_FEED2));
lst.Append(tstrnew(LAY_PIPE_FEED3));
lst.Append(tstrnew(LAY_PIPE_HEADFEED));
lst.Append(tstrnew(LAY_PIPE_HEADFEED2));
lst.Append(tstrnew(LAY_PIPE_HEADFEED3));
lst.Append(tstrnew(LAY_PIPE_HEADBACK));
lst.Append(tstrnew(LAY_PIPE_HEADBACK2));
lst.Append(tstrnew(LAY_PIPE_HEADBACK3));
lst.Append(tstrnew(LAY_PIPE_DIRT));
lst.Append(tstrnew(LAY_PIPE_USELESS));
lst.Append(tstrnew(LAY_PIPE_RAIN));
lst.Append(tstrnew(LAY_PIPE_USED));
lst.Append(tstrnew(LAY_PIPE_FIRE));
lst.Append(tstrnew(LAY_PIPE_FIRE2));
lst.Append(tstrnew(LAY_PIPE_FIRE3));
lst.Append(tstrnew(LAY_PIPE_SPRINKLE));
lst.Append(tstrnew(LAY_PIPE_COAGULATE));
lst.Append(tstrnew(LAY_PIPE_DRINK));
lst.Append(tstrnew(LAY_PIPE_PRESSDIRT));
lst.Append(tstrnew(LAY_PIPE_PRESSUSELESS));
lst.Append(tstrnew(LAY_PIPE_PRESSRAIN));
lst.Append(tstrnew(LAY_PIPE_OTHER));
lst.Append(tstrnew(LAY_PIPE_DOUBLE));
lst.Append(tstrnew(LAY_PIPE_DIM));
lst.Append(tstrnew(LAY_PIPE_USER1));
lst.Append(tstrnew(LAY_PIPE_USER2));
lst.Append(tstrnew(LAY_PIPE_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_PIPE_USER4));
lst.Append(tstrnew(LAY_PIPE_USER5));
lst.Append(tstrnew(LAY_PIPE_USER6));
lst.Append(tstrnew(LAY_PIPE_USER7));
lst.Append(tstrnew(LAY_PIPE_USER8));
lst.Append(tstrnew(LAY_VPIPE_USER1));
lst.Append(tstrnew(LAY_VPIPE_USER2));
lst.Append(tstrnew(LAY_VPIPE_USER3)); // cet 2012.4.12 add user3-user8
lst.Append(tstrnew(LAY_VPIPE_USER4));
lst.Append(tstrnew(LAY_VPIPE_USER5));
lst.Append(tstrnew(LAY_VPIPE_USER6));
lst.Append(tstrnew(LAY_VPIPE_USER7));
lst.Append(tstrnew(LAY_VPIPE_USER8));
lst.Append(tstrnew(LAY_VPIPE_FEED));
lst.Append(tstrnew(LAY_VPIPE_FEED2));
lst.Append(tstrnew(LAY_VPIPE_FEED3));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED2));
lst.Append(tstrnew(LAY_VPIPE_HEADFEED3));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK2));
lst.Append(tstrnew(LAY_VPIPE_HEADBACK3));
lst.Append(tstrnew(LAY_VPIPE_DIRT));
lst.Append(tstrnew(LAY_VPIPE_USELESS));
lst.Append(tstrnew(LAY_VPIPE_RAIN));
lst.Append(tstrnew(LAY_VPIPE_USED));
lst.Append(tstrnew(LAY_VPIPE_FIRE));
lst.Append(tstrnew(LAY_VPIPE_FIRE2));
lst.Append(tstrnew(LAY_VPIPE_FIRE3));
lst.Append(tstrnew(LAY_VPIPE_SPRINKLE));
lst.Append(tstrnew(LAY_VPIPE_COAGULATE));
lst.Append(tstrnew(LAY_VPIPE_DRINK));
lst.Append(tstrnew(LAY_VPIPE_PRESSDIRT));
lst.Append(tstrnew(LAY_VPIPE_PRESSUSELESS));
lst.Append(tstrnew(LAY_VPIPE_PRESSRAIN));
lst.Append(tstrnew(LAY_VPIPE_OTHER));
lst.Append(tstrnew(LAY_TEXT));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_EQUIP_PIPE));
lst.Append(tstrnew(LAY_EQUIP_VALVE));
lst.Append(tstrnew(LAY_EQUIP_SPRINKLE));
lst.Append(tstrnew(LAY_EQUIP_HYDRANT));
lst.Append(tstrnew(LAY_TWT_WATERTANK));
lst.Append(tstrnew(LAY_TWT_PUMP));
lst.Append(tstrnew(LAY_TWT_OUT));
lst.Append(tstrnew(LAY_TWT_GULLY));
lst.Append(tstrnew(LAY_TWT_SECTION));
lst.Append(tstrnew(LAY_TWT_FLANGE));
lst.Append(tstrnew(LAY_CALC_TEXT));
lst.Append(tstrnew(LAY_PIPE_DIM));
lst.Append(tstrnew(LAY_TWT_TREE));
lst.Append(tstrnew(LAY_TWT_ROAD));
lst.Append(tstrnew(LAY_TWT_DOTE));
lst.Append(tstrnew(LAY_TWT_DASH));
lst.Append(tstrnew(LAY_WELL_RAIN));
lst.Append(tstrnew(LAY_WELL_DIRT));
lst.Append(tstrnew(LAY_WELL_FEED));
lst.Append(tstrnew(LAY_WELL_FIRE));
lst.Append(tstrnew(LAY_WELL_OTHER));
lst.Append(tstrnew(LAY_WELL_TEXT));
lst.Append(tstrnew(LAY_TWT_GRID));
lst.Append(tstrnew(LAY_WELL_USED));
lst.Append(tstrnew(LAY_VPIPE_DIM));
lst.Append(tstrnew(LAY_DIM));
lst.Append(tstrnew(LAY_ELEV_DIM));
lst.Append(tstrnew(LAY_INDEX_DIM));
lst.Append(tstrnew(LAY_LEADER_DIM));
lst.Append(tstrnew(LAY_COORD_DIM));
lst.Append(tstrnew(LAY_OTHER_DIM));
lst.Append(tstrnew(LAY_SHEET));
lst.Append(tstrnew(_T("TWT")));
}
XString xsDbfFile;
if(!FindFile(_T("userlayer.dbf"), xsDbfFile)) {
MessageBox(_T("对不起,没有发现userlayer.dbf文件!"));
return;
}
CodeBase db;
XDbfTable *pTable = db.Open(xsDbfFile);
if(!pTable) {
CString csTmp;
csTmp.Format(_T("%s文件只读或损坏!"), xsDbfFile);
AfxMessageBox(csTmp);
// AfxMessageBox(_T("TK文件只读或损坏!"));
return;
}
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext()){
int id(0);
CString sName;
GET_FIELD(pTable, _T("product"), id);
GET_FIELD(pTable, _T("name"), sName);
if(id == g_nProductId){
lst.Append(tstrnew(sName));
}
}
LuckLayer(lst, m_bIsTelLucked);
}
void CLayerManBar::OnButLuckTch()
{
CAcModuleResourceOverride vTemp;
m_bIsTchLucked = !m_bIsTchLucked;
CString csTmp = _T("TWT_16_SXZC");
if(!m_bIsTchLucked)
csTmp = _T("TWT_16_JXZC");
HBITMAP hBitmap=(HBITMAP)::LoadImage(g_hTchDll, csTmp, IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_DEFAULTCOLOR );
m_butLuckTch.SetIcon(hBitmap, NULL, 16, 15);
XStringList lst;
lst.Append(tstrnew(LAY_AXIS));
lst.Append(tstrnew(LAY_BALCONY));
lst.Append(tstrnew(LAY_BORDER));
lst.Append(tstrnew(LAY_COLU));
lst.Append(tstrnew(LAY_WIN));
lst.Append(tstrnew(LAY_DIMAX));
lst.Append(tstrnew(LAY_GROUND));
lst.Append(tstrnew(LAY_WALL));
lst.Append(tstrnew(LAY_SURFACE));
lst.Append(tstrnew(LAY_ROOF));
lst.Append(tstrnew(LAY_STAIR));
lst.Append(tstrnew(LAY_SANIWARE));
lst.Append(tstrnew(LAY_RAIL));
lst.Append(tstrnew(LAY_HANDRAIL));
lst.Append(tstrnew(LAY_SPACE));
lst.Append(tstrnew(LAY_VIEW));
lst.Append(tstrnew(LAY_AXIS_TEXT));
lst.Append(tstrnew(_T("PUB_DIM"))); //建筑的文字和标注
lst.Append(tstrnew(_T("PUB_TEXT")));
lst.Append(tstrnew(_T("PUB_TITLE")));
lst.Append(tstrnew(LAY_VIEWPORT));
lst.Append(tstrnew(LAY_HATCH));
lst.Append(tstrnew(LAY_OPENING_DIM));
lst.Append(tstrnew(LAY_S_LINE));
lst.Append(tstrnew(LAY_S_WIN));
lst.Append(tstrnew(LAY_S_BLOCK));
lst.Append(tstrnew(LAY_S_STAIR));
lst.Append(tstrnew(LAY_E_FLOOR));
lst.Append(tstrnew(LAY_E_LINE));
lst.Append(tstrnew(LAY_E_WIN));
lst.Append(tstrnew(LAY_E_COMP));
lst.Append(tstrnew(LAY_E_STAIR));
lst.Append(tstrnew(_T("TCH_保留")));
lst.Append(tstrnew(_T("PUB_WALL")));
XString xsDbfFile;
if(!FindFile(_T("userlayer.dbf"), xsDbfFile)) {
MessageBox(_T("对不起,没有发现userlayer.dbf文件!"));
return;
}
CodeBase db;
XDbfTable *pTable = db.Open(xsDbfFile);
if(!pTable) {
CString csTmp;
csTmp.Format(_T("%s文件只读或损坏!"), xsDbfFile);
AfxMessageBox(csTmp);
// AfxMessageBox(_T("TK文件只读或损坏!"));
return;
}
for(pTable->MoveFirst();!pTable->IsEOF();pTable->MoveNext()){
int id(0);
CString sName, sComment;
GET_FIELD(pTable, _T("product"), id);
GET_FIELD(pTable, _T("name"), sName);
if(id == 1){
lst.Append(tstrnew(sName));
}
}
LuckLayer(lst, m_bIsTchLucked);
}