1060 lines
29 KiB
C++
1060 lines
29 KiB
C++
#include "stdafx.h"
|
|
#include "ParkingSpaceDlg.h"
|
|
#define UIFRAME_API __declspec( dllimport )
|
|
#include "DataLoadAndSave.h"
|
|
|
|
Acad::ErrorStatus CreateTextStyle(AcDbObjectId& resultId,
|
|
const CString csTsName,
|
|
const CString szFlNm,
|
|
const CString szBigFlNm,
|
|
double dTextWidth,
|
|
double dTextHeighot,
|
|
double xScale,
|
|
AcDbDatabase* pDB);
|
|
extern CString GetSerialNumForNext();
|
|
static bool g_bFirstExecute = true;//当前文件使用,第一次启动软件
|
|
static CString g_sLayerNoParkNum = _T("A001");//图中没有车位编号时,记录最后的车位起始值 wkl 2016/11.10
|
|
namespace
|
|
{
|
|
extern Acad::ErrorStatus TgCreateTextStyle(/*[in]*/const TCHAR* sName, /*[in]*/const TCHAR* engName, /*[in]*/const TCHAR* chiName, /*[out]*/ AcDbObjectId& id);
|
|
#define TARCH20_SYMBOL_KEY_ROADGRADE_CSTRING _T("ParkingSpace_CString") //注册表项
|
|
#define TARCH20_SYMBOL_KEY_PARKINGSPACEHEIGH_CSTRING _T("ParkingSpaceHeigh_CString") //注册表项,存储候选高度值
|
|
#define TARCH20_SYMBOL_KEY_PARKINGSPACEWIDTH_CSTRING _T("ParkingSpaceWidth_CString") //注册表项,存储候选宽度值
|
|
#define TARCH20_SYMBOL_TERMNAME _T("AllControlWndData\\SymbolWndData") //键
|
|
#define DIVSTRING _T("^@^") //分割符号
|
|
//获取指定图层上所有实体ID
|
|
AcDbObjectIdArray GetAllEntityId(const TCHAR* layername)
|
|
{
|
|
AcDbObjectIdArray entIds;
|
|
bool bFilterlayer = false;
|
|
AcDbObjectId layerId;
|
|
//获取指定图层对象ID
|
|
if (layername != NULL)
|
|
{
|
|
AcDbLayerTable *pLayerTbl = NULL;
|
|
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pLayerTbl, AcDb::kForRead);
|
|
if (!pLayerTbl->has(layername))
|
|
{
|
|
pLayerTbl->close();
|
|
return entIds;
|
|
}
|
|
pLayerTbl->getAt(layername, layerId);
|
|
pLayerTbl->close();
|
|
bFilterlayer = true;
|
|
}
|
|
//获得块表
|
|
AcDbBlockTable *pBlkTbl = NULL;
|
|
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlkTbl, AcDb::kForRead);
|
|
//块表记录
|
|
AcDbBlockTableRecord *pBlkTblRcd = NULL;
|
|
pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForRead);
|
|
pBlkTbl->close();
|
|
//创建遍历器,依次访问模型空间中的每一个实体
|
|
AcDbBlockTableRecordIterator *it = NULL;
|
|
pBlkTblRcd->newIterator(it);
|
|
for (it->start(); !it->done(); it->step())
|
|
{
|
|
AcDbEntity *pEnt = NULL;
|
|
Acad::ErrorStatus es = it->getEntity(pEnt, AcDb::kForRead);
|
|
if (es == Acad::eOk)
|
|
{
|
|
if (bFilterlayer)//过滤图层
|
|
{
|
|
if (pEnt->layerId() == layerId)
|
|
{
|
|
entIds.append(pEnt->objectId());
|
|
}
|
|
}
|
|
pEnt->close();
|
|
}
|
|
}
|
|
delete it;
|
|
pBlkTblRcd->close();
|
|
return entIds;
|
|
}
|
|
CString GetFullPath(const TCHAR *szFileName)
|
|
{
|
|
CString szFullPath = g_sDwbPath;
|
|
if (_tcscmp(szFileName, _T("")) == 0)
|
|
{
|
|
szFullPath = szFullPath.Left(szFullPath.GetLength() - 5) + _T("\\sys\\");
|
|
}
|
|
else
|
|
{
|
|
szFullPath = szFullPath.Left(szFullPath.GetLength() - 5) + _T("\\sys\\") + szFileName;
|
|
|
|
// 用于动态添加文字样式文件时使用
|
|
CString csTmp = szFileName;
|
|
if (csTmp.Find(_T(".")) == -1)
|
|
{
|
|
szFullPath += _T(".tts");
|
|
}
|
|
}
|
|
return szFullPath;
|
|
}
|
|
CString format(int i)
|
|
{
|
|
CString str;
|
|
str.Format(_T("%d"), i);
|
|
return str;
|
|
}
|
|
CString format(bool bValue)
|
|
{
|
|
CString str;
|
|
str.Format(_T("%d"), (int)bValue);
|
|
return str;
|
|
}
|
|
CString format(double dValue)
|
|
{
|
|
CString str;
|
|
str.Format(_T("%f"),dValue);
|
|
return str;
|
|
}
|
|
CString MergeStr(const std::vector<CString>& subStr)
|
|
{
|
|
CString str = _T("");
|
|
CString strTemp = _T("");
|
|
std::vector<CString>::const_iterator iter = subStr.begin();
|
|
if (iter == subStr.end())
|
|
return str;
|
|
strTemp = *iter;
|
|
if (strTemp.IsEmpty()) strTemp = _T(" ");
|
|
str += strTemp;
|
|
++iter;
|
|
for (iter; iter != subStr.end(); ++iter)
|
|
{
|
|
strTemp = *iter;
|
|
if (strTemp.IsEmpty()) strTemp = _T(" ");
|
|
str += DIVSTRING + strTemp;
|
|
}
|
|
return str;
|
|
}
|
|
int SplitString(LPCTSTR pszOri, LPCTSTR pszSplit, std::vector<CString> &vec)
|
|
{
|
|
do
|
|
{
|
|
if (!pszOri) break;
|
|
vec.clear();
|
|
|
|
if (!pszSplit)
|
|
{
|
|
vec.push_back(pszOri);
|
|
return 1;
|
|
}
|
|
|
|
CString sOri(pszOri), sSplit(pszSplit), sRel(_T(""));
|
|
int nSplitLen(sSplit.GetLength()), nFindPos(0), nRel(0);
|
|
while ((nFindPos = sOri.Find(sSplit, 0)) != -1)
|
|
{
|
|
sRel = sOri.Mid(0, nFindPos);
|
|
vec.push_back(sRel);
|
|
sOri = sOri.Right(sOri.GetLength() - nFindPos - nSplitLen);
|
|
++nRel;
|
|
}
|
|
|
|
if (!sOri.IsEmpty())
|
|
{
|
|
vec.push_back(sOri);
|
|
++nRel;
|
|
}
|
|
|
|
return nRel;
|
|
} while (false);
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
CParkingSpaceDlg::CParkingSpaceDlg(CWnd* pParent):
|
|
CModelessDialog(CParkingSpaceDlg::IDD, pParent),m_iPic(1)
|
|
, m_iWidth(2400)
|
|
, m_iHeight(5300)
|
|
, m_strWidth(_T(""))
|
|
, m_strHeight(_T(""))
|
|
{
|
|
m_bAddTextStyle = FALSE;
|
|
m_strTextHigh = _T("");
|
|
m_iAngle = 90;
|
|
m_iRow = 0;
|
|
m_iStyle = 3;
|
|
m_iCheck = 0;
|
|
m_bCarNum = FALSE;
|
|
m_iLocation = eOutSide;
|
|
m_strStartNum = _T("A001");
|
|
m_iTextStyle = 0;
|
|
LayerInit();
|
|
|
|
//文字样式
|
|
GetDefalutTextStyleAndTextHigh(TRUE);
|
|
if (!m_bAddTextStyle)//没有_TCH_NUMBER 样式,添加 一个
|
|
{
|
|
AddTextStyle();
|
|
}
|
|
if (m_strTextStyle.IsEmpty() && m_strTextHigh.IsEmpty())
|
|
{
|
|
GetDefalutTextStyleAndTextHigh();
|
|
}
|
|
if (!isHasTextStyle())
|
|
{
|
|
AcDbObjectId id;
|
|
AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();
|
|
CreateTextStyle(id,_T("_TCH_NUMBER"),_T("SIMPLEX"),_T("GBCBIG"), 0.6, 0.85, 1.0,pDB);
|
|
}
|
|
|
|
LoadRegeditSaveData();
|
|
|
|
}
|
|
|
|
CParkingSpaceDlg::~CParkingSpaceDlg()
|
|
{
|
|
SaveWidthAndHeigh();
|
|
SaveToRegeditData();
|
|
}
|
|
|
|
void CParkingSpaceDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CString sTitle = _T("");
|
|
|
|
sTitle = _T("");
|
|
GetDlgItem(IDC_CMB_ANGLE)->GetWindowText(sTitle);
|
|
if (!sTitle.IsEmpty())
|
|
{
|
|
DDX_Text(pDX, IDC_CMB_ANGLE, m_iAngle);
|
|
}
|
|
|
|
DDX_CBIndex(pDX, IDC_CMB_ROWNUM, m_iRow);
|
|
DDX_CBIndex(pDX, IDC_CMB_STYLE, m_iStyle);
|
|
DDX_Check(pDX, IDC_CHK_MARKER, m_iCheck);
|
|
DDX_CBString(pDX, IDC_CMB_PARKTEXTHEIGH, m_strTextHigh);
|
|
DDX_Text(pDX, IDC_EDT_PARKNUM, m_strStartNum);
|
|
DDX_Radio(pDX, IDC_RAD_PARKOUTSIDE, m_iLocation);
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_CMB_PARKTEXTSTYLE, m_comboStyleName);
|
|
DDX_CBString(pDX, IDC_CAR_WIDTH, m_strWidth);
|
|
DDX_CBString(pDX, IDC_CAR_HEIGHT, m_strHeight);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CParkingSpaceDlg, CModelessDialog)
|
|
ON_BN_CLICKED(IDC_BTN_SWAP, OnBnClickedBtnSwap)
|
|
ON_CBN_EDITCHANGE(IDC_CMB_ANGLE, OnCbnEditchangeCmbAngle)
|
|
ON_WM_CLOSE()
|
|
ON_WM_PAINT()
|
|
ON_CBN_SETFOCUS(IDC_CMB_ANGLE, OnCbnSetfocusCmbAngle)
|
|
ON_EN_SETFOCUS(IDC_CAR_WIDTH, OnEnSetfocusCarWidth)
|
|
ON_EN_SETFOCUS(IDC_CAR_HEIGHT, OnEnSetfocusCarHeight)
|
|
ON_EN_CHANGE(IDC_CAR_WIDTH, OnEnChangeCarWidth)
|
|
ON_EN_CHANGE(IDC_CAR_HEIGHT, OnEnChangeCarHeight)
|
|
ON_BN_CLICKED(IDC_BTN_PARKHEIGH, OnBnClickedBtnParkheigh)
|
|
ON_EN_KILLFOCUS(IDC_EDT_PARKNUM, OnEnKillfocusEdtParknum)
|
|
ON_BN_CLICKED(IDC_CHK_PARKCARNUMBER, OnBnClickedChkParkcarnumber)
|
|
ON_BN_CLICKED(IDC_CHK_MARKER, OnBnClickedChkMarker)
|
|
|
|
ON_CBN_SELCHANGE(IDC_CMB_PARKTEXTSTYLE, OnCbnSelchangeCmbParktextstyle)
|
|
ON_CBN_KILLFOCUS(IDC_CMB_PARKTEXTHEIGH, OnCbnKillfocusCmbParktextheigh)
|
|
ON_CBN_KILLFOCUS(IDC_CAR_WIDTH, OnCbnKillfocusCarWidth)
|
|
ON_CBN_KILLFOCUS(IDC_CAR_HEIGHT, OnCbnKillfocusCarHeight)
|
|
END_MESSAGE_MAP()
|
|
|
|
//交换
|
|
void CParkingSpaceDlg::OnBnClickedBtnSwap()
|
|
{
|
|
CString sWidth;
|
|
CString sHeight;
|
|
int nIndex = -1;
|
|
int iIn = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetCurSel();
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetLBText(iIn, sWidth);
|
|
iIn = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetCurSel();
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetLBText(iIn, sHeight);
|
|
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->FindStringExact(-1, sWidth)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->AddString(sWidth);
|
|
if (((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetCount() > 10)
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->DeleteString(1);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->SetCurSel(nIndex);
|
|
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->FindStringExact(-1, sHeight)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->AddString(sHeight);
|
|
if (((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetCount() > 10)
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->DeleteString(1);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->SetCurSel(nIndex);
|
|
OnCbnKillfocusCarHeight();
|
|
OnCbnKillfocusCarWidth();
|
|
}
|
|
|
|
//对话框初始化
|
|
BOOL CParkingSpaceDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
eUNIT unit = DocGetMeterUnitDraw() ? eMeter : eMillimetre;
|
|
CString sCaption(_T(""));
|
|
sCaption.Format(_T("车位布置(单位:%s)"), unit == eMeter ? _T("M") : _T("mm"));
|
|
SetWindowText(sCaption);
|
|
|
|
CString sText(_T(""));
|
|
sText.Format(_T("%d"),m_iAngle);
|
|
((CComboBox*)(GetDlgItem(IDC_CMB_ANGLE)))->SetWindowText(sText);
|
|
((CComboBox*)(GetDlgItem(IDC_CMB_ROWNUM)))->SetCurSel(m_iRow);
|
|
((CComboBox*)(GetDlgItem(IDC_CMB_STYLE)))->SetCurSel(m_iStyle);
|
|
|
|
if(m_iLocation == eOutSide)
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKOUTSIDE)))->SetCheck(1);
|
|
else if (m_iLocation == eMid)
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKOUTSIDE)))->SetCheck(1);
|
|
else if (m_iLocation == eInSide)
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKOUTSIDE)))->SetCheck(1);
|
|
|
|
if (m_strStartNum.IsEmpty())
|
|
((CButton*)(GetDlgItem(IDC_EDT_PARKNUM)))->SetWindowTextW(_T("A001"));
|
|
((CButton*)(GetDlgItem(IDC_EDT_PARKNUM)))->SetWindowTextW(m_strStartNum);
|
|
|
|
|
|
int nRet = ((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTHEIGH))->FindStringExact(0, m_strTextHigh);
|
|
if (nRet < 0) // 当前图纸没有此文字高度
|
|
{
|
|
((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTHEIGH))->InsertString(0, m_strTextHigh);
|
|
((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTHEIGH))->SetCurSel(0);
|
|
UpdateData(FALSE);
|
|
}
|
|
else
|
|
((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTHEIGH))->SetCurSel(nRet);
|
|
|
|
|
|
((CButton*)(GetDlgItem(IDC_CHK_PARKCARNUMBER)))->SetCheck(m_bCarNum);
|
|
OnBnClickedChkParkcarnumber();
|
|
LoadTextStyle();
|
|
m_iTextStyle = m_comboStyleName.FindStringExact(-1, m_strTextStyle);//modify tyj 20160922:查找字符串,将包含改为匹配。解决列表框中显示字体错误的问题
|
|
if (m_iTextStyle < 0)
|
|
{
|
|
m_strTextStyle = _T("");
|
|
GetDefalutTextStyleAndTextHigh();
|
|
m_iTextStyle = m_comboStyleName.FindStringExact(-1, m_strTextStyle);//modify tyj 20160922
|
|
}
|
|
((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTSTYLE))->SetCurSel(m_iTextStyle);
|
|
CString strSerial = GetSerialNumForNext();
|
|
if (strSerial.GetLength() > 0)
|
|
{
|
|
UpdataSerialNum(strSerial);
|
|
}
|
|
|
|
|
|
ReadWidthAndHeigh();
|
|
LoadWidthAndHeigh();
|
|
if (0 == strSerial.GetLength()) //图中没有车位编号时,按上次运行记忆值初始化 wkl
|
|
{
|
|
UpdataSerialNum(g_sLayerNoParkNum);
|
|
}
|
|
UpdateData(FALSE);
|
|
return TRUE;
|
|
}
|
|
|
|
void CParkingSpaceDlg::LoadWidthAndHeigh()
|
|
{
|
|
for (int i = 0; i < m_vecStrWidth.size(); ++i)
|
|
{
|
|
CString str(m_vecStrWidth.at(i));
|
|
//判断单位
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
int iCurWidth = _ttoi(str);
|
|
double dCurWidth = iCurWidth / 1000.0;
|
|
str.Format(_T("%g"), dCurWidth);
|
|
}
|
|
int nIndex(0);
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->FindStringExact(-1, str)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->InsertString(0, str);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->SetCurSel(nIndex);
|
|
}
|
|
|
|
for (int i = 0; i < m_vecStrHeight.size(); ++i)
|
|
{
|
|
CString str(m_vecStrHeight.at(i));
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
int iCurHeight = _ttoi(str);
|
|
double dCurHeight = iCurHeight / 1000.0;
|
|
str.Format(_T("%g"), dCurHeight);
|
|
}
|
|
int nIndex(0);
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->FindStringExact(-1, str)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->InsertString(0, str);
|
|
}
|
|
int nIndex(0);
|
|
CString strCurWidth(_T(""));
|
|
if (DocGetMeterUnitDraw())
|
|
strCurWidth.Format(_T("%g"), m_iWidth / 1000.0);
|
|
else
|
|
strCurWidth.Format(_T("%d"), m_iWidth);
|
|
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->FindStringExact(-1, strCurWidth)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->InsertString(0, strCurWidth);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->SetCurSel(nIndex);
|
|
|
|
CString strCurHeight(_T(""));
|
|
if (DocGetMeterUnitDraw())
|
|
strCurHeight.Format(_T("%g"), m_iHeight / 1000.0);
|
|
else
|
|
strCurHeight.Format(_T("%d"), m_iHeight);
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->FindStringExact(-1, strCurHeight)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->InsertString(0, strCurHeight);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->SetCurSel(nIndex);
|
|
UpdateData(TRUE);
|
|
}
|
|
|
|
void CParkingSpaceDlg::ReadWidthAndHeigh()
|
|
{
|
|
CString strTmp(_T(""));
|
|
std::vector<CString> strWndData;
|
|
strWndData.clear();
|
|
|
|
DataLoadAndSave::readRecordDataCString(TARCH20_SYMBOL_KEY_PARKINGSPACEWIDTH_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
if (strTmp.IsEmpty())
|
|
goto NEXT;
|
|
SplitString(strTmp, DIVSTRING, strWndData);
|
|
for (int j = 0; j < strWndData.size(); j++)
|
|
{
|
|
m_vecStrWidth.push_back(strWndData[j]);
|
|
}
|
|
NEXT:
|
|
strWndData.clear();
|
|
DataLoadAndSave::readRecordDataCString(TARCH20_SYMBOL_KEY_PARKINGSPACEHEIGH_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
if (strTmp.IsEmpty())
|
|
return;
|
|
SplitString(strTmp, DIVSTRING, strWndData);
|
|
for (int j = 0; j < strWndData.size(); j++)
|
|
{
|
|
m_vecStrHeight.push_back(strWndData[j]);
|
|
}
|
|
}
|
|
|
|
void CParkingSpaceDlg::SaveWidthAndHeigh()
|
|
{
|
|
CString strTmp = MergeStr(m_vecStrHeight);//组合字符串
|
|
DataLoadAndSave::writeRecordDataCString(TARCH20_SYMBOL_KEY_PARKINGSPACEHEIGH_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
strTmp = MergeStr(m_vecStrWidth);//组合字符串
|
|
DataLoadAndSave::writeRecordDataCString(TARCH20_SYMBOL_KEY_PARKINGSPACEWIDTH_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this);
|
|
|
|
ShowPic(m_iPic);
|
|
}
|
|
|
|
void CParkingSpaceDlg::ShowPic(int index)
|
|
{
|
|
UpdateData();
|
|
CString sDrawing = _T("");
|
|
int iAngle = GetAngle();
|
|
if (iAngle == 90)
|
|
{
|
|
if (index == 1)
|
|
{
|
|
sDrawing = _T("PARKINGWIDTH0");
|
|
|
|
}
|
|
else if (index == 2)
|
|
{
|
|
sDrawing = _T("PARKINGANGLE0");
|
|
}
|
|
else if (index == 3)
|
|
{
|
|
|
|
sDrawing = _T("PARKINGDEPTHH0");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (index == 1)
|
|
{
|
|
sDrawing = _T("PARKINGWIDTH1");
|
|
}
|
|
else if (index == 2)
|
|
{
|
|
sDrawing = _T("PARKINGANGLE1");
|
|
}
|
|
else if (index == 3)
|
|
{
|
|
sDrawing = _T("PARKINGDEPTHH1");
|
|
}
|
|
}
|
|
|
|
CWnd *pShowPic = GetDlgItem(IDC_STATIC_PARKPIC);
|
|
|
|
CDC *pDC = pShowPic->GetDC();
|
|
CRect rect;
|
|
pShowPic->GetClientRect(&rect);
|
|
m_ShowPicDC.InitDC(pDC,rect,GetAcadBackColor());
|
|
CString sName;
|
|
sName.Format(_T("tarch(%s)"),sDrawing);
|
|
XString sFile;
|
|
sFile << sName;
|
|
m_ShowPicDC.PaintSlide(sFile);
|
|
|
|
m_ShowPicDC.SetDC(NULL);
|
|
pShowPic->ReleaseDC(pDC);
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnCbnEditchangeCmbAngle()
|
|
{
|
|
CString sTitle;
|
|
GetDlgItem(IDC_CMB_ANGLE)->GetWindowText(sTitle);
|
|
if (!sTitle.IsEmpty())
|
|
{
|
|
CString sTem;
|
|
sTem.Format(_T("%d"),_ttoi(sTitle));
|
|
if (sTem != sTitle || sTem == _T("0"))
|
|
{
|
|
AfxMessageBox(_T("请输入大于0的数值!"));
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
}
|
|
|
|
double CParkingSpaceDlg::GetWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
return m_iWidth / 1000.0;
|
|
}
|
|
return m_iWidth;
|
|
}
|
|
|
|
double CParkingSpaceDlg::GetHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
return m_iHeight / 1000.0;
|
|
}
|
|
return m_iHeight;
|
|
}
|
|
|
|
int CParkingSpaceDlg::GetAngle()
|
|
{
|
|
return m_iAngle;
|
|
}
|
|
|
|
int CParkingSpaceDlg::GetRowFlag()
|
|
{
|
|
return m_iRow;
|
|
}
|
|
|
|
int CParkingSpaceDlg::GetStyle()
|
|
{
|
|
return m_iStyle;
|
|
}
|
|
|
|
bool CParkingSpaceDlg::IsCheck()
|
|
{
|
|
bool bRe = false;
|
|
if (m_iCheck == 1)
|
|
{
|
|
bRe = true;
|
|
}
|
|
return bRe;
|
|
}
|
|
|
|
void CParkingSpaceDlg::UpdateEx()
|
|
{
|
|
UpdateData();
|
|
}
|
|
|
|
|
|
void CParkingSpaceDlg::OnClose()
|
|
{
|
|
PostCommand(_T(" "));
|
|
CModelessDialog::OnClose();
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnCbnSetfocusCmbAngle()
|
|
{
|
|
m_iPic = 2;
|
|
Invalidate();
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnEnSetfocusCarWidth()
|
|
{
|
|
m_iPic = 1;
|
|
Invalidate();
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnEnSetfocusCarHeight()
|
|
{
|
|
m_iPic = 3;
|
|
Invalidate();
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnEnChangeCarWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnEnChangeCarHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
}
|
|
|
|
//字高
|
|
void CParkingSpaceDlg::OnBnClickedBtnParkheigh()
|
|
{
|
|
UpdateData(TRUE);
|
|
double nHeight = _tstof(m_strTextHigh)*DocGetPScale();
|
|
|
|
BeginEditorCommand();
|
|
if (GetDist(_T("\n字高"), nHeight, RSG_NOZERO | RSG_NONEG) == RTNORM) {
|
|
nHeight /= DocGetPScale();
|
|
m_strTextHigh.Format(_T("%.1f"), nHeight);
|
|
}
|
|
CompleteEditorCommand();
|
|
UpdateData(FALSE);
|
|
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
|
|
//车位编号
|
|
void CParkingSpaceDlg::OnBnClickedChkParkcarnumber()
|
|
{
|
|
if (((CButton*)(GetDlgItem(IDC_CHK_PARKCARNUMBER)))->GetCheck())
|
|
{
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKLOC)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKOUTSIDE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKINSIDE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKMID)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKSTARTNUM)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_EDT_PARKNUM)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKTEXTSTYLE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTSTYLE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_BTN_PARKHEIGH)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTHEIGH)))->EnableWindow(TRUE);
|
|
m_bCarNum = TRUE;
|
|
}
|
|
else
|
|
{
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKLOC)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKOUTSIDE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKINSIDE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_RAD_PARKMID)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKSTARTNUM)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_EDT_PARKNUM)))->EnableWindow(FALSE);
|
|
if (!((CButton*)(GetDlgItem(IDC_CHK_MARKER)))->GetCheck())
|
|
{
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKTEXTSTYLE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTSTYLE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_BTN_PARKHEIGH)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTHEIGH)))->EnableWindow(FALSE);
|
|
}
|
|
m_bCarNum = FALSE;
|
|
}
|
|
}
|
|
|
|
//标车位数
|
|
void CParkingSpaceDlg::OnBnClickedChkMarker()
|
|
{
|
|
if (((CButton*)(GetDlgItem(IDC_CHK_MARKER)))->GetCheck())
|
|
{
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKTEXTSTYLE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTSTYLE)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_BTN_PARKHEIGH)))->EnableWindow(TRUE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTHEIGH)))->EnableWindow(TRUE);
|
|
m_iCheck = 1;
|
|
}
|
|
else if (!((CButton*)(GetDlgItem(IDC_CHK_PARKCARNUMBER)))->GetCheck())
|
|
{
|
|
((CButton*)(GetDlgItem(IDC_STC_PARKTEXTSTYLE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTSTYLE)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_BTN_PARKHEIGH)))->EnableWindow(FALSE);
|
|
((CButton*)(GetDlgItem(IDC_CMB_PARKTEXTHEIGH)))->EnableWindow(FALSE);
|
|
m_iCheck = 0;
|
|
}
|
|
}
|
|
void CParkingSpaceDlg::OnEnKillfocusEdtParknum()
|
|
{
|
|
CString strTmp = m_strStartNum;//起始编号
|
|
UpdateData(TRUE);
|
|
int iCount = m_strStartNum.GetLength();
|
|
int iIndex(0);
|
|
for (int i = 0; i < iCount; i++)
|
|
{
|
|
if (0 == isdigit(m_strStartNum.GetAt(i)))
|
|
{
|
|
iIndex++;
|
|
}
|
|
}
|
|
if (iIndex == iCount)
|
|
{
|
|
MessageBox(_T("请输入包含数字的编号!"));
|
|
m_strStartNum = strTmp;
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
g_sLayerNoParkNum = GetStartNum();//记忆起始编号
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CParkingSpaceDlg::AddTextStyle()
|
|
{
|
|
CString csSysPath = g_sDwbPath;
|
|
csSysPath = csSysPath.Left(csSysPath.GetLength() - 5) + _T("\\sys\\");
|
|
csSysPath += _T("TextStyleDef.DAT");
|
|
CStdioFile file;
|
|
file.Open(csSysPath, CFile::modeReadWrite);
|
|
file.SeekToEnd();
|
|
file.WriteString(_T("\n停车位 _TCH_NUMBER 否 GBCBIG SIMPLEX 1.0 0.6 0.85 10 7 停车位"));
|
|
file.Close();
|
|
}
|
|
|
|
BOOL CParkingSpaceDlg::isHasTextStyle()
|
|
{
|
|
XSymbolList lstStyle(_T("STYLE"));//控件初始化
|
|
int iCount(0);
|
|
for (int m = 0; m < lstStyle.Length(); m++)
|
|
{
|
|
if (!wcscmp(lstStyle[m], _T("_TCH_NUMBER")))
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void CParkingSpaceDlg::LayerInit()
|
|
{/*
|
|
if (!IsLayerExistInDb(LAY_PKNG_SING))
|
|
{
|
|
AcDbObjectId idLayer = InitLayer(LAY_PKNG_SING);
|
|
AcDbLayerTableRecord *pLayerTblRcd = NULL;
|
|
if (acdbOpenObject(pLayerTblRcd, idLayer, AcDb::kForWrite) == Acad::eOk)
|
|
{
|
|
pLayerTblRcd->setName(L"PKNG-SIGN");
|
|
AcCmColor color;
|
|
color.setColorIndex(7);
|
|
pLayerTblRcd->setColor(color);
|
|
pLayerTblRcd->setDescription(L"停车位编号");
|
|
pLayerTblRcd->close();
|
|
}
|
|
}*/
|
|
}
|
|
|
|
void CParkingSpaceDlg::GetDefalutTextStyleAndTextHigh(BOOL bJudge)
|
|
{
|
|
//判断TextStyleDef.DAT文件路径是否存在
|
|
CString szTextStyleDefFile(_T(""));
|
|
szTextStyleDefFile = GetFullPath(_T("TextStyleDef.DAT"));
|
|
if (_taccess(szTextStyleDefFile, 0) == -1)
|
|
return;
|
|
|
|
//读取文件内容
|
|
CStdioFile file;
|
|
if (!file.Open(szTextStyleDefFile, CFile::modeRead))
|
|
{
|
|
AfxMessageBox(CString(_T("打开文件 \"")) + szTextStyleDefFile + _T("\" 失败"));
|
|
return;
|
|
}
|
|
|
|
CString sReadString(_T(""));
|
|
while (file.ReadString(sReadString))
|
|
{
|
|
TCHAR sKey[256] = _T(""); // 关键字
|
|
TCHAR sName[256] = _T(""); // 样式名称
|
|
TCHAR sChinese[265] = _T(""); // 中文字体
|
|
TCHAR sEnglish[256] = _T(""); // 西文字体
|
|
TCHAR sWindows[256] = _T(""); // Windows字体
|
|
float dHeigh(0.0), // 字高
|
|
dChineseScale(0.0), // 中文宽高比
|
|
dHeighScale(0.0), // 高度比例
|
|
dWideScale(0.0); // 宽度比例
|
|
//int nColor = 0; // 颜色
|
|
TCHAR sNote[256] = _T(""); // 备注
|
|
|
|
// 读出数据
|
|
_stscanf(sReadString, _T("%s%s%s%s%s%f%f%f%f%s"), sKey, sName, sWindows, sChinese, sEnglish,
|
|
&dChineseScale, &dHeighScale, &dWideScale, &dHeigh, sNote);
|
|
if (_tcscmp(sKey, _T("停车位")) == 0)
|
|
{
|
|
if (bJudge)
|
|
{
|
|
m_bAddTextStyle = TRUE;
|
|
break;
|
|
}
|
|
|
|
if (m_strTextHigh.IsEmpty())
|
|
m_strTextHigh.Format(_T("%.1f"), dHeigh);
|
|
if (m_strTextStyle.IsEmpty())
|
|
m_strTextStyle = sName;
|
|
break;
|
|
}
|
|
}
|
|
file.Close();
|
|
}
|
|
|
|
void CParkingSpaceDlg::LoadRegeditSaveData()
|
|
{
|
|
CString strTmp;
|
|
DataLoadAndSave::readRecordDataCString(TARCH20_SYMBOL_KEY_ROADGRADE_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
if (strTmp.IsEmpty())
|
|
return;
|
|
|
|
std::vector<CString> strWndData;
|
|
SplitString(strTmp, DIVSTRING, strWndData);
|
|
|
|
if (strWndData.size() <11)
|
|
{
|
|
return;
|
|
}
|
|
m_strTextStyle = strWndData[0];
|
|
m_strTextHigh = strWndData[1];
|
|
m_iAngle = _ttoi(strWndData[2]); //3
|
|
m_iStyle = _ttoi(strWndData[3]);
|
|
m_iRow = _ttoi(strWndData[4]);
|
|
m_bCarNum = _ttoi(strWndData[5]); //6
|
|
m_iCheck = _ttoi(strWndData[6]);
|
|
m_iHeight = _ttoi(strWndData[7]);
|
|
m_iWidth = _ttoi(strWndData[8]); //9
|
|
m_iLocation = _ttoi(strWndData[9]);
|
|
m_iTextStyle = _ttoi(strWndData[10]);
|
|
if (g_bFirstExecute)
|
|
{
|
|
m_strTextStyle = _T("");
|
|
m_strTextHigh = _T("");
|
|
GetDefalutTextStyleAndTextHigh(FALSE);
|
|
g_bFirstExecute = false;
|
|
}
|
|
}
|
|
|
|
void CParkingSpaceDlg::SaveToRegeditData()
|
|
{
|
|
std::vector<CString> strWndData;
|
|
strWndData.clear();
|
|
strWndData.push_back(m_strTextStyle);
|
|
strWndData.push_back(m_strTextHigh);
|
|
strWndData.push_back(format(m_iAngle)); // 3
|
|
strWndData.push_back(format(m_iStyle));
|
|
strWndData.push_back(format(m_iRow));
|
|
strWndData.push_back(format(m_bCarNum)); // 6
|
|
strWndData.push_back(format(m_iCheck));
|
|
strWndData.push_back(format(m_iHeight));
|
|
strWndData.push_back(format(m_iWidth)); //9
|
|
strWndData.push_back(format(m_iLocation));
|
|
strWndData.push_back(format(m_iTextStyle));
|
|
CString strTmp = MergeStr(strWndData);//组合字符串
|
|
DataLoadAndSave::writeRecordDataCString(TARCH20_SYMBOL_KEY_ROADGRADE_CSTRING, strTmp, TARCH20_SYMBOL_TERMNAME);
|
|
}
|
|
|
|
BOOL CParkingSpaceDlg::LoadTextStyle()
|
|
{
|
|
XSymbolList lstStyle(_T("STYLE"));
|
|
for (int m=0; m < lstStyle.Length(); m++)
|
|
m_comboStyleName.AddString(lstStyle[m]);
|
|
return TRUE;
|
|
|
|
AcDbDatabase *pCurDwg = acdbCurDwg();
|
|
AcDbTextStyleTable* pTT = NULL;
|
|
VERIFY(pCurDwg->getSymbolTable(pTT, AcDb::kForRead) == Acad::eOk);
|
|
|
|
AcDbTextStyleTableIterator* pIter = NULL;
|
|
VERIFY(pTT->newIterator(pIter) == Acad::eOk);
|
|
pTT->close();
|
|
|
|
for (pIter->start(); !pIter->done(); pIter->step())
|
|
{
|
|
AcDbTextStyleTableRecord* pTTR;
|
|
if (pIter->getRecord(pTTR, AcDb::kForRead) != Acad::eOk)
|
|
continue;
|
|
|
|
const TCHAR* pName = NULL;
|
|
if (pTTR->getName(pName) == Acad::eOk && pName != NULL)
|
|
{
|
|
if (m_lstStyle.Index(pName) < 0) // 如果没有重复
|
|
m_lstStyle.Append(tstrnew(pName)); // 读字体风格
|
|
}
|
|
pTTR->close();
|
|
}
|
|
delete pIter;
|
|
|
|
// add by xly on 110106 如果使用新创建的文字样式,图纸切换时产生bug
|
|
// 标记文字样式中,是否有当前样式
|
|
bool bIsHas(false);
|
|
for (int m = 0; m < m_lstStyle.Length(); m++)
|
|
{
|
|
m_comboStyleName.AddString(m_lstStyle[m]);
|
|
|
|
// 标记文字样式中有当前样式
|
|
if (m_lstStyle[m] == m_strTextStyle)
|
|
{
|
|
bIsHas = true;
|
|
}
|
|
}
|
|
|
|
// 没有当前样式,设置默认样式Stantard
|
|
if (!bIsHas)
|
|
{
|
|
/* TCHAR sStyle[256] = _T("");
|
|
xg_getvar(_T("TEXTSTYLE"), sStyle);
|
|
m_strTextStyle = sStyle;*/
|
|
GetDefalutTextStyleAndTextHigh();
|
|
}
|
|
//UpdateData(false);
|
|
|
|
|
|
// add by xly on 110429 文字样式不存在
|
|
if (m_strTextStyle.IsEmpty())
|
|
{
|
|
/*TCHAR sStyle[256] = _T("");
|
|
xg_getvar(_T("TEXTSTYLE"), sStyle);
|
|
m_strTextStyle = sStyle;*/
|
|
GetDefalutTextStyleAndTextHigh();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
//停车位 _TCH_NUMBER 否 GBCBIG SIMPLEX 1.0 0.6 0.85 10 7 停车位
|
|
//// 关键字 //样式名称// 中文字体// 西文字体// Windows字体// 字高 // 中文宽高比// 高度比例// 宽度比例// 颜色// 备注
|
|
Acad::ErrorStatus CreateTextStyle(AcDbObjectId& resultId,
|
|
const CString csTsName,
|
|
const CString szFlNm,
|
|
const CString szBigFlNm,
|
|
double dTextWidth,
|
|
double dTextHeight,
|
|
double xScale,
|
|
AcDbDatabase* pDB)
|
|
{
|
|
//AcDbObjectId id;
|
|
//TgCreateTextStyle(_T("_TCH_NUMBER"),_T(""),_T(""),id);
|
|
//AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();
|
|
AcDbTextStyleTable *pTsTbl;
|
|
Acad::ErrorStatus es = pDB->getSymbolTable(pTsTbl, AcDb::kForWrite);
|
|
if (es != Acad::eOk)
|
|
{
|
|
return es;
|
|
}
|
|
es = pTsTbl->getAt(csTsName, resultId);
|
|
if (es == Acad::eOk)
|
|
{
|
|
pTsTbl->close();
|
|
return es;
|
|
}
|
|
AcDbTextStyleTableRecord *pTstRcd = new AcDbTextStyleTableRecord;
|
|
pTstRcd->setName(csTsName);
|
|
pTstRcd->setFileName(szFlNm);//字体文件名字符串
|
|
pTstRcd->setBigFontFileName(szBigFlNm);//大字体文件名字字符串
|
|
resbuf *pXData=ads_buildlist(1001, TCHXD, 1040,
|
|
dTextHeight, 1040, dTextWidth, NULL);
|
|
pTstRcd->setXData(pXData);
|
|
pTstRcd->setXScale(xScale); //宽度系数
|
|
es = pTsTbl->add(resultId, pTstRcd);
|
|
pTstRcd->close();
|
|
pTsTbl->close();
|
|
|
|
return es;
|
|
}
|
|
|
|
|
|
|
|
void CParkingSpaceDlg::UpdataSerialNum(CString &strSerialNunm)
|
|
{
|
|
m_strStartNum = strSerialNunm;
|
|
((CButton*)(GetDlgItem(IDC_EDT_PARKNUM)))->SetWindowTextW(m_strStartNum);
|
|
}
|
|
|
|
|
|
|
|
|
|
void CParkingSpaceDlg::OnCbnSelchangeCmbParktextstyle()
|
|
{
|
|
m_iTextStyle = ((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTSTYLE))->GetCurSel();
|
|
((CComboBox*)GetDlgItem(IDC_CMB_PARKTEXTSTYLE))->GetWindowText(m_strTextStyle);
|
|
}
|
|
|
|
|
|
void CParkingSpaceDlg::OnCbnKillfocusCmbParktextheigh()
|
|
{
|
|
CString strTmp = m_strTextHigh;
|
|
UpdateData(TRUE);
|
|
int iIndex(0);
|
|
int iCount = m_strTextHigh.GetLength();
|
|
for (int i = 0; i < iCount; i++)
|
|
{
|
|
if ((m_strTextHigh[i] >= '0' && m_strTextHigh[i] <= '9') || m_strTextHigh[i] == '.')
|
|
{
|
|
iIndex++;
|
|
}
|
|
}
|
|
if (iIndex != iCount)
|
|
{
|
|
MessageBox(_T("请输入数字!"));
|
|
m_strTextHigh = strTmp;
|
|
return;
|
|
}
|
|
double dTemp = _ttof(m_strTextHigh);
|
|
if (dTemp < 0)
|
|
{
|
|
MessageBox(_T(">0的数字"));
|
|
m_strTextHigh = strTmp;
|
|
return;
|
|
}
|
|
m_strTextHigh.Format(L"%.1f", dTemp);
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
void CParkingSpaceDlg::OnCbnKillfocusCarWidth()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (DocGetMeterUnitDraw())
|
|
m_iWidth = _ttof(m_strWidth) * 1000;
|
|
else
|
|
m_iWidth = _ttoi(m_strWidth);
|
|
|
|
int nIndex(0);
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->FindStringExact(-1, m_strWidth)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->InsertString(0, m_strWidth);
|
|
if (((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetCount() > 10)
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->DeleteString(10);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->SetCurSel(nIndex);
|
|
|
|
UpdateData(FALSE);
|
|
m_vecStrWidth.clear();
|
|
for (int i = 0; i <((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetCount(); ++i)
|
|
{
|
|
CString strCurWidth(_T(""));
|
|
((CComboBox*)GetDlgItem(IDC_CAR_WIDTH))->GetLBText(i, strCurWidth);
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
int iWidth = _ttof(strCurWidth) * 1000;
|
|
strCurWidth.Format(_T("%d"), iWidth);
|
|
}
|
|
m_vecStrWidth.push_back(strCurWidth);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void CParkingSpaceDlg::OnCbnKillfocusCarHeight()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (DocGetMeterUnitDraw())
|
|
m_iHeight = _ttof(m_strHeight) * 1000;
|
|
else
|
|
m_iHeight = _ttoi(m_strHeight);
|
|
int nIndex(0);
|
|
if ((nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->FindStringExact(-1, m_strHeight)) == LB_ERR)
|
|
nIndex = ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->InsertString(0, m_strHeight);
|
|
if (((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetCount() > 10)
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->DeleteString(10);
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->SetCurSel(nIndex);
|
|
|
|
UpdateData(FALSE);
|
|
m_vecStrHeight.clear();
|
|
for (int i = 0; i < ((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetCount(); ++i)
|
|
{
|
|
CString strCurHeight(_T(""));
|
|
((CComboBox*)GetDlgItem(IDC_CAR_HEIGHT))->GetLBText(i, strCurHeight);
|
|
if (DocGetMeterUnitDraw())
|
|
{
|
|
int iHeight = _ttof(strCurHeight) * 1000;
|
|
strCurHeight.Format(_T("%d"), iHeight);
|
|
}
|
|
m_vecStrHeight.push_back(strCurHeight);
|
|
}
|
|
|
|
}
|