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

777 lines
20 KiB
C++

// FeedAccessoryDlg.cpp : implementation file
//
#include "stdafx.h"
#include <DbEquipment.h>
#include <PipeWireMonitor.h>
#include "FeedAccessoryDlg.h"
#include "InsBlockDlg.h"
#include "SelectBlkDlg.h"
#include "SanitaryDangDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFeedAccessoryDlg dialog
XPoint GetAngPoint(XPoint ptstart, double nAngle)
{
double nEle = ptstart.z;
ptstart.z =0;
XPoint ptRet, ptend;
int itype = -1;
double dAng(0);
nAngle = Wcs2Ucs(nAngle);
double ntmp2 = Radian2Angle(nAngle);
while(1){
struct resbuf pointbuf;
int iRet = ads_grread(5, &itype, &pointbuf);//得到动态点pointbuf
ads_point_set(pointbuf.resval.rpoint, ptend);//ptend动态点,也就是引出支线的结束点
ptend.z = 0;
double dOAng = ads_angle(ptstart, ptend) - nAngle;
double dDis = ads_distance(ptstart, ptend);
dDis = fabs(dDis * cos(dOAng));
//指出标注的引出方向
if(dOAng < -0.001)
dOAng += 2*PI;
else if(dOAng > (PI*2 + 0.001))
dOAng -= PI*2;
double ntmp = Radian2Angle(dOAng);
if(dOAng<=PI && dOAng>PI/2){
dAng = nAngle + PI;
}
else if(dOAng>=0 && dOAng<PI/2){
dAng = nAngle;
}
else if(dOAng<=PI*2 && dOAng>PI/2*3){
dAng = nAngle;
}
else if(dOAng>=PI && dOAng<PI/2*3){
dAng = nAngle + PI;
}
ads_redraw(NULL, 1);
if(itype == 5){
ads_polar(ptstart, dAng, dDis, ptend);
ads_grdraw(ptstart, ptend, -1, 0);
ptRet = ptend;
ptRet.z = nEle;
}
else
break;
}
if(itype != 3)
return XPoint();
return ptRet;
}
void InsFeedAccessory()
{
CString csDwb = g_csDwbPath + _T("TwtSys");
XString xsTmp1, xsTmp2, xsTmp3, xsTmp4, xsTmp5, xsTmp6, xsTmp7, xsTmp8;
if(LoadDwbBlock(csDwb, _T("00000320"), xsTmp1) != RTNORM)//水龙头
return;
if(LoadDwbBlock(csDwb, _T("00000225"), xsTmp2) != RTNORM)//给水点
return;
if(LoadDwbBlock(csDwb, _T("00000172"), xsTmp3) != RTNORM)//淋浴头
return;
if(LoadDwbBlock(csDwb, _T("00000210"), xsTmp4) != RTNORM)//混水龙头
return;
if(LoadDwbBlock(csDwb, _T("00000488"), xsTmp5) != RTNORM)//浮球阀
return;
if(LoadDwbBlock(csDwb, _T("00000519"), xsTmp8) != RTNORM)//给水圆 zxl 2012.04.13 add
return;
// if(LoadDwbBlock(csDwb, _T("00000002"), xsTmp5) != RTNORM)//给水点
// return;
int nOsMode=0;
xg_getvar(_T("OSMODE"), &nOsMode);
nOsMode &= ~0x4000;
nOsMode |= OS_INT|OS_NEA;
XPushVar<int> vOsMode(_T("OSMODE"), nOsMode);
CFeedAccessoryDlg dlg(acedGetAcadFrame());
{
CTemporaryResourceOverride vTemp;
dlg.Create(IDD_ACCESSORY_FEED, acedGetAcadFrame());
dlg.ShowWindow(SW_SHOW);
acedGetAcadDwgView()->SetFocus();
}
XPoint ptIns, ptInsEq;
InitLayer(LAY_EQ_FEED);
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), 8, GetLayerNames(_T("管")), NULL);
g_nInsBlkRotate = 0;
double nScale = 1;
while(1){
dlg.UpdateData();
if(dlg.m_iType == 0)
g_csInsBlkName = (const TCHAR*)xsTmp1;
else if(dlg.m_iType == 1)
g_csInsBlkName = (const TCHAR*)xsTmp2;
else if(dlg.m_iType == 2)
g_csInsBlkName = (const TCHAR*)xsTmp3;
else if(dlg.m_iType == 3)
g_csInsBlkName = (const TCHAR*)xsTmp4;
else if(dlg.m_iType == 4)
g_csInsBlkName = (const TCHAR*)xsTmp5;
else if (dlg.m_iType == 5)//zxl 2012.04.13 add
{
g_csInsBlkName = (const TCHAR*)xsTmp8;
nScale = g_nFeedCircleScale;
}
TBlockEdJig jig(g_csInsBlkName, ptIns, nScale);
jig.SetPrompt(_T("\n请指定附件在管线上的插入点[旋转90度(A)/放大(E)/缩小(D)]<退出>:"));
jig.SetKeyword(_T("A E D R"));
int nKeyIndex = 0;
int nRetCode = jig.DoIt(&nKeyIndex);
if(nRetCode == RTNORM){
dlg.UpdateData();
ptIns = jig.GetPickPoint();
ptInsEq = ptIns;
AcDbObjectId recordId = GetBlockIdFromString(g_csInsBlkName);
PickSet ss(SS_FREE);
XPoint ptUcs = Wcs2Ucs(ptIns);
GetPointPickSet(ptUcs, ss, rbMaskPipe, 20);
if(ss.Length() == 0){
GetPointPickSet(ptUcs, ss, rbMaskPipe, 50);
}
double nAng = g_nInsBlkRotate;
Entity ent1;
XCurveSegment seg;
TDbPipe *pNewPipe3;
if(ss.Length() == 1){ //管件插入在管线上
Entity entPipe = ss[0L];
OPENOBJ_BEGIN(entPipe, AcDb::kForRead, TDbPipe, pPipe);
pNewPipe3 = (TDbPipe *)pPipe->clone();
XCurveSegment seg1(pPipe->StartPoint(), pPipe->EndPoint(), 0);
seg = seg1;
seg.ProjectToMe(ptIns, ptIns);
ptInsEq = ptIns;
nAng = ads_angle(seg.GetEndPoint(), seg.GetStartPoint());
XPoint ptPickPipe;
OPENOBJ_END();
}
else{
adsout << _T("\n给水附件没有插在支管上");
continue;
}
dlg.UpdateData();
if((ptIns == seg.EndPoint() || ptIns == seg.StartPoint())){//接在管末端
CString csBlkName;
// if(dlg.m_iType == 0)
// csBlkName = (const TCHAR*)xsTmp1;
// else if(dlg.m_iType == 3)
// csBlkName = (const TCHAR*)xsTmp4;
recordId = GetBlockIdFromString(g_csInsBlkName);
if(ptIns == seg.EndPoint())
nAng = ads_angle(seg.GetStartPoint(), seg.GetEndPoint()) + PI/2;
else if(ptIns == seg.StartPoint())
nAng = ads_angle(seg.GetEndPoint(), seg.GetStartPoint()) + PI/2;
TDbEquipment *pEquip = new TDbEquipment;
pEquip->SetBlock2d(recordId);
pEquip->SetLocation(ptInsEq);
pEquip->SetHidePipe(FALSE);
pEquip->SetAngle(nAng);
pEquip->SetSpare(dlg.m_dQ);
pEquip->SetScale(nScale);
pEquip->SetDang(dlg.m_nDang);
pEquip->SetSysBlock((const TCHAR*)dlg.m_csSysBlk);
pEquip->setLayer(LAY_EQ_FEED);
pEquip->setColor(AcCmColor()); //随层
AddToCurrentSpace(pEquip, Adesk::kTrue);
continue;
}
double nAngCross(0);
XPoint ptend, ptPipe;
int itype = -1;
ads_prompt(_T("\n请选择插入方向<确定>"));
while(1){
struct resbuf pointbuf;
int iRet = ads_grread(5, &itype, &pointbuf);
ads_point_set(pointbuf.resval.rpoint, ptend);
ptend = Ucs2Wcs(ptend);
if(itype != 5 && itype != 3 && itype != 11)
break;
dlg.UpdateData(TRUE);
AcGeVector3d vectBase(seg.EndPoint().x - seg.StartPoint().x, seg.EndPoint().y - seg.StartPoint().y, 0);
AcGeVector3d vectTmp(ptend.x - ptIns.x, ptend.y - ptIns.y, 0);
double dAng2 = vectBase.angleTo(vectTmp, AcGeVector3d::kZAxis);
if(dAng2 < PI)
ads_polar(ptIns, nAng - PI/2, dlg.m_nDist, ptPipe);
else{
ads_polar(ptIns, nAng + PI/2, dlg.m_nDist, ptPipe);
}
ads_redraw(NULL, 1);
//zxl 2012.08.10 add
double dElev = 0.0;
AcGePoint3d ptOldPipe = ptPipe;
AcGePoint3d ptOldIns = ptIns;
if (dlg.GetElevType(dElev) == 0)// 随支管
{
dElev = ptPipe.z;
}
else// 指定标高
{
ptPipe.z = dElev;
}
if(itype == 3 || itype == 11){
if(dlg.m_nDist > 10){
TDbPipe *pPipe = (TDbPipe *)pNewPipe3->clone();
if (dlg.m_nDimNewPipe == 1 && pPipe->IsDrawLabel())
{
pPipe->EnableDrawLabel(FALSE);
pNewPipe3->EnableDrawLabel(FALSE);
}
if(!g_bStandPipeArc)//传统扣弯
{
pPipe->SetRadiusIn(-2);
}
else
{
pPipe->SetRadiusIn(0);
}
// 垂直连接
if (dlg.GetLinkType() == 1)
{
ptPipe.z = dElev;
ptIns.z = dElev;
if (ptIns.Distance(ptOldIns) > 0.001)
{
pPipe->SetPoints(ptOldIns, ptIns);
AddToCurrentSpace(pPipe, Adesk::kTrue);
}
pNewPipe3->SetPoints(ptIns, ptPipe);
}
else
{
if (ptPipe.Distance(ptOldPipe) > 0.001)
{
pPipe->SetPoints(ptPipe, ptOldPipe);
AddToCurrentSpace(pPipe, Adesk::kTrue);
}
pNewPipe3->SetPoints(ptIns, ptOldPipe);
}
AddToCurrentSpace(pNewPipe3, Adesk::kTrue);
}
else
delete pNewPipe3;
if(dAng2 > PI)
nAngCross = nAng + PI;
else
nAngCross = nAng;
break;
}
else{
XPoint ptTmpUcs1 = Wcs2Ucs(ptIns);
XPoint ptTmpUcs2 = Wcs2Ucs(ptPipe);
ads_grdraw(ptTmpUcs1, ptTmpUcs2, -1, 0);
}
}
TDbEquipment *pEquip = new TDbEquipment;
pEquip->SetBlock2d(recordId);
pEquip->SetLocation(ptPipe);
pEquip->SetHidePipe(FALSE);
pEquip->SetSpare(dlg.m_dQ);
pEquip->SetAngle(nAngCross);
if(_tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000005)")) == 0){//普通水龙头
if(g_bBlk3D){
if(LoadDwbBlock(csDwb, _T("00000364"), xsTmp6) != RTNORM)//3d水龙头
break;
pEquip->SetBlock3d(GetBlockIdFromString(xsTmp6));
}
}
else if(g_bBlk3D && _tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000352)")) == 0 ||_tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000014)")) == 0){//小便器自闭式冲洗阀
if(LoadDwbBlock(csDwb, _T("00000368"), xsTmp7) != RTNORM)//3d自闭式冲洗阀
break;
pEquip->SetBlock3d(GetBlockIdFromString(xsTmp7));
}
else if(g_bBlk3D && _tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000293)")) == 0){//大便器自闭式冲洗阀
if(LoadDwbBlock(csDwb, _T("00000369"), xsTmp7) != RTNORM)//3d自闭式冲洗阀
break;
pEquip->SetBlock3d(GetBlockIdFromString(xsTmp7));
}
pEquip->SetScale(nScale);
pEquip->SetDang(dlg.m_nDang);
pEquip->SetSysBlock((const TCHAR*)dlg.m_csSysBlk);
pEquip->setLayer(LAY_EQ_FEED);
pEquip->setColor(AcCmColor()); //随层
AddToCurrentSpace(pEquip, Adesk::kTrue);
ads_redraw(NULL, 1);
TPipePerDocData *pData = GetCurPipeDocData();
pData->ApplyUpdates();
}
else if(nRetCode == RTKWORD){
if(nKeyIndex == 0)
g_nInsBlkRotate += PI/2;
else if(nKeyIndex == 1)
nScale += 1;
else if(nKeyIndex == 2 && jig.m_nSacle > 1)
nScale -= 1;
continue;
}
else
break;
}
g_nInsBlkRotate = 0;
dlg.DestroyWindow();
}
int CFeedAccessoryDlg::m_iType = 0;
int CFeedAccessoryDlg::m_iElevType = 0;
int CFeedAccessoryDlg::m_iLinkType = 0;
double CFeedAccessoryDlg::m_dElev = 0.0;
IMPLEMENT_DYNAMIC(CFeedAccessoryDlg, CModelessDialog)
double CFeedAccessoryDlg::m_nDist = 200;
int CFeedAccessoryDlg::m_nDimNewPipe = 0;
CFeedAccessoryDlg::CFeedAccessoryDlg(CWnd* pParent /*=NULL*/)
: CModelessDialog(CFeedAccessoryDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFeedAccessoryDlg)
m_nDang = 0.5;
m_dQ = 0.1;
//}}AFX_DATA_INIT
m_csSysBlk1 = _T("TWTSYS(00000005)");
m_csSysBlk2 = _T("TWTSYS(00000297)");
m_csSysBlk3 = _T("TWTSYS(00000017)");
m_csSysBlk4 = _T("TWTSYS(00000200)");
m_csSysBlk5 = _T("TWTSYS(00000492)");
m_csSysBlk6 = _T("TWTSYS(00000005)");//zxl 2012.04.13 add
m_bKeepFocus = TRUE;
}
void CFeedAccessoryDlg::DoDataExchange(CDataExchange* pDX)
{
CModelessDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFeedAccessoryDlg)
DDX_Text(pDX, IDC_EDIT_DANG, m_nDang);
DDX_Text(pDX, IDC_EDIT_Q, m_dQ);
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iType);
DDX_Radio(pDX, IDC_RADIO_WITHPIPE, m_iElevType);
DDX_Text(pDX, IDC_EDIT_LEN2, m_nDist);
DDX_Text(pDX, IDC_EDIT_ELEV, m_dElev);
//}}AFX_DATA_MAP
DDX_Radio(pDX, IDC_RADIO_DIM, m_nDimNewPipe);
}
BEGIN_MESSAGE_MAP(CFeedAccessoryDlg, CModelessDialog)
//{{AFX_MSG_MAP(CFeedAccessoryDlg)
ON_MESSAGE(WM_ACAD_KEEPFOCUS,onAcadKeepFocus)
ON_WM_PAINT()
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
ON_BN_CLICKED(IDC_RADIO_TYPE3, OnRadioType3)
ON_BN_CLICKED(IDC_RADIO_TYPE4, OnRadioType4)
ON_BN_CLICKED(IDC_PREVIEW2, OnPreview2)
ON_BN_CLICKED(IDC_BUTTON_DANG, OnButtonDang)
ON_EN_SETFOCUS(IDC_EDIT_LEN2, OnSetfocusEditLen2)
ON_EN_KILLFOCUS(IDC_EDIT_LEN2, OnKillfocusEditLen2)
ON_BN_CLICKED(IDC_RADIO_TYPE5, OnRadioType5)
ON_BN_CLICKED(IDC_RADIO_TYPE6, OnRadioType6)
ON_BN_CLICKED(IDC_RADIO_WITHPIPE, OnRadioWithPipe)
ON_BN_CLICKED(IDC_RADIO_ELEV, OnRadioElev)
ON_BN_CLICKED(IDC_STATIC_PIC1, OnStaticPic1)
ON_BN_CLICKED(IDC_STATIC_PIC2, OnStaticPic2)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_RADIO_DIM, &CFeedAccessoryDlg::OnBnClickedRadioDim)
ON_BN_CLICKED(IDC_RADIO_NODIM, &CFeedAccessoryDlg::OnBnClickedRadioNodim)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFeedAccessoryDlg message handlers
BOOL CFeedAccessoryDlg::OnInitDialog()
{
CModelessDialog::OnInitDialog();
OpenSlide();
CheckElveType();
ChangePicBK();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFeedAccessoryDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
OpenSlide();
}
void CFeedAccessoryDlg::OnClose()
{
CModelessDialog::OnClose();
acedPostCommand(_T("\33\33"));
}
LONG_PTR CFeedAccessoryDlg::onAcadKeepFocus(UINT_PTR, LONG_PTR)
{
return m_bKeepFocus;
}
void CFeedAccessoryDlg::OpenSlide()
{
UpdateData(TRUE);
CWnd *pImageBox1 = GetDlgItem(IDC_PREVIEW1);
CWnd *pImageBox2 = GetDlgItem(IDC_PREVIEW2);
//zxl 2012.08.10 add
CWnd *pPic1 = GetDlgItem(IDC_STATIC_PIC1);
CWnd *pPic2 = GetDlgItem(IDC_STATIC_PIC2);
if (pPic1 != NULL)
{
DrawSlide(_T("TWT(SPLJ)"), pPic1);
}
if (pPic2 != NULL)
{
DrawSlide(_T("TWT(CZLJ)"),pPic2);
}
CString csSldName, csSldName2;
if(m_iType == 0){
csSldName = _T("TWTSYS(00000320)");
csSldName2 = m_csSysBlk1;
}
else if(m_iType == 1){
if(g_bIsFeedPoint)
csSldName = _T("TWTSYS(00000002)");
else
csSldName = _T("TWTSYS(00000225)");
csSldName2 = m_csSysBlk2;
}
else if(m_iType == 2){
csSldName = _T("TWTSYS(00000172)");
csSldName2 = m_csSysBlk3;
}
else if(m_iType == 3){
csSldName = _T("TWTSYS(00000210)");
csSldName2 = m_csSysBlk4;
}
else if(m_iType == 4){
csSldName = _T("TWTSYS(00000488)");
csSldName2 = m_csSysBlk5;
}
else if (m_iType == 5)//zxl 2012.04.13 add
{
csSldName = _T("TWTSYS(00000519)");
csSldName2 = m_csSysBlk6;
}
m_csSysBlk = csSldName2;
DrawSlide((const TCHAR*)csSldName, pImageBox1);
DrawSlide((const TCHAR*)csSldName2, pImageBox2);
ChangePicBK();
}
void CFeedAccessoryDlg::OnRadioType1()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnRadioType2()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnRadioType3()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnRadioType4()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnRadioType5()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnRadioType6()
{
OpenSlide();
UpdateData(FALSE);
PostCommand(_T("R "), false);
}
void CFeedAccessoryDlg::OnPreview2()
{
UpdateData();
CTemporaryResourceOverride vTemp;
CSelectBlkDlg dlg;
dlg.m_staticSlide.m_iRowNum = 4;
dlg.m_staticSlide.m_iColNum = 4;
dlg.m_csTkName = _T("TWTSYS");
if(m_iType == 2)
dlg.m_csType = _T("淋浴头\\90度");
else
dlg.m_csType = _T("给水点\\90度");
CWnd *pWnd = GetDlgItem(IDC_PREVIEW2);
CRect rect;
if(m_iType == 0)
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk1;
else if(m_iType == 1)
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk2;
else if(m_iType == 2)
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk3;
else if(m_iType == 3)
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk4;
else if (m_iType == 4)
{
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk5;
}
else if (m_iType == 5)//zxl 2012.04.13 add
{
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk6;
}
pWnd->GetWindowRect(&rect);
dlg.m_ptBase = rect.TopLeft();
if(dlg.DoModal() == IDOK){
CString csRet = dlg.m_staticSlide.m_csCurRecord;
XString xsTKName, xsRocord;
SplitSlbName(csRet, xsTKName, xsRocord);
csRet.Format(_T("%s(%s)"), dlg.m_csTkName, xsRocord);
if(m_iType == 0)
m_csSysBlk1 = csRet;
else if(m_iType == 1)
m_csSysBlk2 = csRet;
else if(m_iType == 2)
m_csSysBlk3 = csRet;
else if(m_iType == 3)
m_csSysBlk4 = csRet;
else if (m_iType == 4)
{
m_csSysBlk5 = csRet;
}
else if (m_iType == 5)//zxl 2012.04.13 add
{
m_csSysBlk6 = csRet;
}
OpenSlide();
}
}
void CFeedAccessoryDlg::OnButtonDang()
{
CTemporaryResourceOverride vTemp;
CSanitaryDangDlg dlg;
if(dlg.DoModal() == IDOK && dlg.m_nRet > 0){
m_nDang = dlg.m_nRet;
m_dQ = dlg.m_nRet2;
UpdateData(FALSE);
}
}
//void CFeedAccessoryDlg::OnFeedFree()
//{
// UpdateData(TRUE);
// CWnd *pWnd = GetDlgItem(IDC_EDIT_LEN2);
// if(m_iFree == 0)
// pWnd->EnableWindow(FALSE);
// else
// pWnd->EnableWindow(TRUE);
// PostCommand(_T("R "), false);
//}
//
//void CFeedAccessoryDlg::OnFeedFixup()
//{
// UpdateData(TRUE);
// CWnd *pWnd = GetDlgItem(IDC_EDIT_LEN2);
// if(m_iFree == 0)
// pWnd->EnableWindow(FALSE);
// else
// pWnd->EnableWindow(TRUE);
// PostCommand(_T("R "), false);
void CFeedAccessoryDlg::OnSetfocusEditLen2()
{
// m_bKeepFocus = TRUE;
}
void CFeedAccessoryDlg::OnKillfocusEditLen2()
{
// m_bKeepFocus = FALSE;
// acedGetAcadDwgView()->SetFocus();
}
void CFeedAccessoryDlg::CheckElveType()
{
UpdateData(TRUE);
CWnd *pWnd = GetDlgItem(IDC_EDIT_ELEV);
CWnd *pPic1 = GetDlgItem(IDC_STATIC_PIC1);
CWnd *pPic2 = GetDlgItem(IDC_STATIC_PIC2);
if (pWnd == NULL || pPic1 == NULL || pPic2 == NULL)
{
return;
}
if (m_iElevType == 0)
{
pWnd->EnableWindow(false);
SetPicShowType(IDC_STATIC_PIC1, _T("TWT(SPLJ)"), false);
SetPicShowType(IDC_STATIC_PIC2, _T("TWT(CZLJ)"), false);
pPic1->EnableWindow(false);
pPic2->EnableWindow(false);
}
else
{
pWnd->EnableWindow(true);
pPic1->EnableWindow(true);
pPic2->EnableWindow(true);
ChangePicBK();
}
}
void CFeedAccessoryDlg::OnRadioWithPipe()
{
CheckElveType();
acedGetAcadDwgView()->SetFocus();
}
void CFeedAccessoryDlg::OnRadioElev()
{
CheckElveType();
acedGetAcadDwgView()->SetFocus();
}
void CFeedAccessoryDlg::OnStaticPic1()
{
m_iLinkType = 0;
ChangePicBK();
}
void CFeedAccessoryDlg::OnStaticPic2()
{
m_iLinkType = 1;
ChangePicBK();
}
void CFeedAccessoryDlg::SetPicShowType(int nID, const CString &strPicName, BOOL bIsSel)
{
CWnd* pImageBox = GetDlgItem(nID);
if (pImageBox != NULL)
{
CDC* pDC = pImageBox->GetDC();
CRect rc;
pImageBox->GetClientRect(&rc);
CImageDC* pImageDC = new CImageDC;
if (bIsSel)
{
pImageDC->InitDC(pDC, rc, RGB(255, 255, 255));
}
else
{
pImageDC->InitDC(pDC, rc, GetAcadBackColor());
}
pImageDC->PaintSlide(strPicName);
pImageDC->SetDC(pDC);
pImageBox->ReleaseDC(pDC);
delete pImageDC;
pImageDC = NULL;
}
}
void CFeedAccessoryDlg::ChangePicBK()
{
if (m_iElevType == 0)
{
SetPicShowType(IDC_STATIC_PIC1, _T("TWT(SPLJ)"), false);
SetPicShowType(IDC_STATIC_PIC2, _T("TWT(CZLJ)"), false);
}
else
{
if (m_iLinkType == 0)
{
SetPicShowType(IDC_STATIC_PIC1, _T("TWT(SPLJ)"), true);
SetPicShowType(IDC_STATIC_PIC2, _T("TWT(CZLJ)"), false);
}
else
{
SetPicShowType(IDC_STATIC_PIC1, _T("TWT(SPLJ)"), false);
SetPicShowType(IDC_STATIC_PIC2, _T("TWT(CZLJ)"), true);
}
}
}
int CFeedAccessoryDlg::GetLinkType()
{
return m_iLinkType;
}
int CFeedAccessoryDlg::GetElevType(double &dElev)
{
dElev = DocGetCurMeterUnitDraw() ? m_dElev : m_dElev * 1000;
return m_iElevType;
}
void CFeedAccessoryDlg::OnBnClickedRadioDim()
{
acedGetAcadDwgView()->SetFocus();
}
void CFeedAccessoryDlg::OnBnClickedRadioNodim()
{
acedGetAcadDwgView()->SetFocus();
}