274 lines
5.5 KiB
C++
274 lines
5.5 KiB
C++
#include "stdafx.h"
|
|
#include "WellDimEditDlg.h"
|
|
#include "DbWellDim.h"
|
|
#include "PipeDownDimEditDlg.h"
|
|
#include "TImageDrawDC.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
//***************************************************************************************************
|
|
// 编辑井标注
|
|
//***************************************************************************************************
|
|
|
|
int EditWellDim(AcDbObjectId id)
|
|
{
|
|
if (id.isNull())
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
//获取井标注当前样式
|
|
CDbWellDim *pWellDim = NULL;
|
|
int nCurWellDimType = 0;
|
|
acdbOpenObject(pWellDim, id, AcDb::kForRead);
|
|
if (pWellDim != NULL)
|
|
{
|
|
nCurWellDimType = pWellDim->GetDrawMode();
|
|
pWellDim->close();
|
|
}
|
|
|
|
// cet 2010.2.25 del
|
|
// //当标注为管底标注时,不进行处理
|
|
// if (nCurWellDimType == 1 || nCurWellDimType == 5)
|
|
// {
|
|
// return 1;
|
|
// }
|
|
//
|
|
// //获取选择后井标注样式
|
|
// CTemporaryResourceOverride vTemp;
|
|
// CWellDimEditDlg dlg;
|
|
// dlg.SetWellDimType(nCurWellDimType);
|
|
// if (dlg.DoModal() == IDOK)
|
|
// {
|
|
// nCurWellDimType = dlg.GetSelWellDimType();
|
|
// }
|
|
|
|
// cet 2010.2.25 add 增加对管底标注样式修改
|
|
// if (nCurWellDimType == 1 || nCurWellDimType == 5) //管底标注 cet 2011.3.16 modify 增加新样式7
|
|
if (nCurWellDimType == 1 || nCurWellDimType == 5 //管底标注
|
|
|| nCurWellDimType == 7 || nCurWellDimType == 8) // cet 2011.6.16 modify 增加新样式8
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CPipeDownDimEditDlg dlg;
|
|
dlg.SetDimType(nCurWellDimType);
|
|
if (dlg.DoModal() == IDOK)
|
|
{
|
|
nCurWellDimType = dlg.GetDimType();
|
|
}
|
|
}
|
|
else //井底标注
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CWellDimEditDlg dlg;
|
|
dlg.SetWellDimType(nCurWellDimType);
|
|
if (dlg.DoModal() == IDOK)
|
|
{
|
|
nCurWellDimType = dlg.GetSelWellDimType();
|
|
}
|
|
}
|
|
|
|
//设置井标注样式
|
|
acdbOpenObject(pWellDim, id, AcDb::kForWrite);
|
|
if (pWellDim != NULL)
|
|
{
|
|
pWellDim->SetDrawMode(nCurWellDimType);
|
|
pWellDim->close();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
CWellDimEditDlg::CWellDimEditDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CWellDimEditDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CWellDimEditDlg)
|
|
//}}AFX_DATA_INIT
|
|
m_nLastSel = eNone;
|
|
}
|
|
|
|
|
|
void CWellDimEditDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CWellDimEditDlg)
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CWellDimEditDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CWellDimEditDlg)
|
|
ON_BN_CLICKED(IDC_STC_TYPE0, OnStcType0)
|
|
ON_BN_CLICKED(IDC_STC_TYPE2, OnStcType2)
|
|
ON_BN_CLICKED(IDC_STC_TYPE3, OnStcType3)
|
|
ON_BN_CLICKED(IDC_STC_TYPE4, OnStcType4)
|
|
ON_WM_PAINT()
|
|
ON_BN_CLICKED(IDC_STC_TYPE6, OnStcType6)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
void CWellDimEditDlg::ShowAllPics()
|
|
{
|
|
SetShowPic(IDC_STC_TYPE0, _T("TWT(WELLDIM1)"));
|
|
SetShowPic(IDC_STC_TYPE2, _T("TWT(WELLDIM5)"));
|
|
SetShowPic(IDC_STC_TYPE3, _T("TWT(WELLDIM3)"));
|
|
SetShowPic(IDC_STC_TYPE4, _T("TWT(WELLDIM4)"));
|
|
SetShowPic(IDC_STC_TYPE6, _T("TWT(WELLDIM7)")); // cet 2010.5.14 add
|
|
ChangePicBK(m_nLastSel,TRUE);
|
|
}
|
|
|
|
void CWellDimEditDlg::SetShowPic(int nID, const CString &strPicName)
|
|
{
|
|
if (!strPicName.IsEmpty())
|
|
{
|
|
CWnd* pWnd = NULL;
|
|
pWnd = GetDlgItem(nID);
|
|
if (pWnd != NULL)
|
|
{
|
|
GlobalFunc::DrawSlide(strPicName, pWnd);
|
|
}
|
|
}
|
|
}
|
|
void CWellDimEditDlg::ChangePicBK(int nCurSel, BOOL bIsSel)
|
|
{
|
|
if (nCurSel < 0 || nCurSel > 6)
|
|
{
|
|
return;
|
|
}
|
|
switch(nCurSel)
|
|
{
|
|
case 0:
|
|
{
|
|
SetPicShowType(IDC_STC_TYPE0, _T("TWT(WELLDIM1)"), bIsSel);
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
SetPicShowType(IDC_STC_TYPE2, _T("TWT(WELLDIM5)"), bIsSel);
|
|
break;
|
|
}
|
|
case 3:
|
|
{
|
|
SetPicShowType(IDC_STC_TYPE3, _T("TWT(WELLDIM3)"), bIsSel);
|
|
break;
|
|
}
|
|
case 4:
|
|
{
|
|
SetPicShowType(IDC_STC_TYPE4, _T("TWT(WELLDIM4)"), bIsSel);
|
|
break;
|
|
}
|
|
case 6:
|
|
{
|
|
SetPicShowType(IDC_STC_TYPE6, _T("TWT(WELLDIM7)"), bIsSel); // cet 2010.5.14 add
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void CWellDimEditDlg::SetPicShowType(int nID, const CString &strPicName, BOOL bIsSel)
|
|
{
|
|
CWnd* pImageBox = GetDlgItem(nID);
|
|
if (pImageBox != NULL)
|
|
{
|
|
CDC* pDC = pImageBox->GetDC();
|
|
CRect rc;
|
|
pImageBox->GetClientRect(&rc);
|
|
TImageDrawDC* pImageDC = new TImageDrawDC;
|
|
|
|
if (bIsSel)
|
|
{
|
|
pImageDC->InitDC(pDC, rc, RGB(255, 255, 255));
|
|
}
|
|
else
|
|
{
|
|
pImageDC->InitDC(pDC, rc, GlobalFunc::GetAcadBackColor());
|
|
}
|
|
|
|
pImageDC->PaintSlide(strPicName);
|
|
pImageDC->SetDC(pDC);
|
|
pImageBox->ReleaseDC(pDC);
|
|
|
|
// cet 2010.5.13 add
|
|
delete pImageDC;
|
|
pImageDC = NULL;
|
|
}
|
|
|
|
}
|
|
|
|
int CWellDimEditDlg::GetSelWellDimType()
|
|
{
|
|
return m_nLastSel;
|
|
}
|
|
|
|
void CWellDimEditDlg::OnStcType0()
|
|
{
|
|
if (m_nLastSel != eType0)
|
|
{
|
|
ChangePicBK(m_nLastSel, FALSE);
|
|
m_nLastSel = eType0;
|
|
}
|
|
ChangePicBK(m_nLastSel, TRUE);
|
|
|
|
}
|
|
|
|
void CWellDimEditDlg::OnStcType2()
|
|
{
|
|
if (m_nLastSel != eType2)
|
|
{
|
|
ChangePicBK(m_nLastSel, FALSE);
|
|
m_nLastSel = eType2;
|
|
}
|
|
ChangePicBK(m_nLastSel, TRUE);
|
|
}
|
|
|
|
void CWellDimEditDlg::OnStcType3()
|
|
{
|
|
if (m_nLastSel != eType3)
|
|
{
|
|
ChangePicBK(m_nLastSel, FALSE);
|
|
m_nLastSel = eType3;
|
|
}
|
|
ChangePicBK(m_nLastSel, TRUE);
|
|
}
|
|
|
|
void CWellDimEditDlg::OnStcType4()
|
|
{
|
|
if (m_nLastSel != eType4)
|
|
{
|
|
ChangePicBK(m_nLastSel, FALSE);
|
|
m_nLastSel = eType4;
|
|
}
|
|
ChangePicBK(m_nLastSel, TRUE);
|
|
}
|
|
|
|
BOOL CWellDimEditDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
return TRUE;
|
|
}
|
|
|
|
void CWellDimEditDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this);
|
|
ShowAllPics();
|
|
}
|
|
|
|
void CWellDimEditDlg::SetWellDimType(int nType)
|
|
{
|
|
m_nLastSel = nType;
|
|
}
|
|
|
|
void CWellDimEditDlg::OnStcType6()
|
|
{
|
|
if (m_nLastSel != eType6)
|
|
{
|
|
ChangePicBK(m_nLastSel, FALSE);
|
|
m_nLastSel = eType6;
|
|
}
|
|
ChangePicBK(m_nLastSel, TRUE);
|
|
}
|