OTSSampleClr.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. #include "stdafx.h"
  2. #include "OTSSampleClr.h"
  3. #include <COTSUtilityDllFunExport.h>
  4. namespace OTSCLRINTERFACE {
  5. //using namespace Newtonsoft::Json ::Linq;
  6. COTSSampleClr::COTSSampleClr()
  7. {
  8. theSample = new COTSSamplePtr(new COTSSample());
  9. }
  10. COTSSampleClr::COTSSampleClr(COTSSamplePtr pSample) // copy constructor
  11. {
  12. ASSERT(pSample);
  13. //theSample= new COTSSamplePtr(new COTSSample(pSample.get()));
  14. theSample = new COTSSamplePtr(pSample);
  15. //*theSample = pSample;
  16. }
  17. COTSSampleClr::~COTSSampleClr()
  18. {
  19. if (theSample != nullptr)
  20. {
  21. delete theSample;
  22. theSample = nullptr;
  23. }
  24. }
  25. COTSSampleClr::!COTSSampleClr()
  26. {
  27. if (theSample != nullptr)
  28. {
  29. delete theSample;
  30. theSample = nullptr;
  31. }
  32. }
  33. //JObject^ COTSSampleClr:: GetJSONProperty()
  34. //{
  35. //
  36. // JObject^ SMeasureInfo= gcnew JObject();
  37. // //the propItem list will change according to the value which is selected in the property grid.
  38. // //So we have to call setpropItemGrps function every time when we want to update the property grid display.
  39. // theSample->get()->SetPropItemGrps();
  40. // //获得 样品属性值
  41. // auto PropItemGrpsList = theSample->get()->GetPropItemGrps();
  42. //
  43. //
  44. // int iItemGrpCount = PropItemGrpsList.size();
  45. // if (0 == iItemGrpCount)
  46. // {
  47. // return SMeasureInfo;
  48. // }
  49. // SMeasureInfo->Add("bSwitch", theSample->get()->GetSwitch());
  50. // SMeasureInfo->Add("ParamLock", theSample->get()->GetParamLock());
  51. // JObject^ SMeasurePara = gcnew JObject();
  52. // //获取样品的测量区域信息
  53. // //获取样品名称
  54. //
  55. // CString sSName = theSample->get()->GetName();
  56. // SMeasurePara->Add("sNewSampleName", gcnew String(theSample->get()->GetName()));
  57. // // 获取测量区域形状
  58. // auto area = theSample->get()->GetMsrArea();
  59. // SMeasurePara->Add("iShape", (int)area->GetShape());
  60. // //获取样品孔名称
  61. // SMeasurePara->Add("sHoleName" ,gcnew String(theSample->get()->GetSampleHoleName()));
  62. // //样品测量区域
  63. // JObject^ rectangleObject = gcnew JObject();
  64. // auto rec = area->GetDomainRect();
  65. // rectangleObject->Add("x", rec.left);
  66. // rectangleObject->Add("y", rec.top );
  67. // rectangleObject->Add("width", rec.Width());
  68. // rectangleObject->Add("height", rec.Height());
  69. // SMeasurePara->Add("MeasureRect", rectangleObject);
  70. // SMeasureInfo->Add("SMeasurePara", SMeasurePara);
  71. // JObject^ TSampleParam = gcnew JObject();
  72. // TSampleParam->Add("sWorkSampleName", gcnew String(theSample->get()->GetName()));
  73. // TSampleParam->Add("bSwitch", theSample->get()->GetSwitch());
  74. // SMeasureInfo->Add("TSampleParam", TSampleParam);
  75. // JArray^ groupArray = gcnew JArray();
  76. // for (int i = 0; i < iItemGrpCount; i++)
  77. // {
  78. // JObject^ groupObject = gcnew JObject();
  79. // //获取GROUP ID和Grid的显示组的标题名
  80. // groupObject->Add ("GroupId" ,(int)PropItemGrpsList[i]->GetGroupId());
  81. // groupObject->Add ("Title", gcnew String( PropItemGrpsList[i]->GetName()));
  82. // //获取样品属性ID和值
  83. // std::vector <CPropItemPtr> PropItemList = PropItemGrpsList[i]->GetItemsList();
  84. //
  85. // int iItemCount = PropItemList.size();
  86. // JArray^ itemArray = gcnew JArray();
  87. // for (int k = 0; k < iItemCount; k++)
  88. // {
  89. // JObject^ SData = gcnew JObject();
  90. // SData->Add("SampleId" ,(int)PropItemList[k]->GetSmplItemId());
  91. // SData->Add("CaptionName", gcnew String( PropItemList[k]->GetName()));
  92. // SData->Add("IsReadOnly" , PropItemList[k]->IsReadOnly());
  93. // SData->Add("SampleValType", (int)PropItemList[k]->GetTypeId());
  94. // SData->Add("DescriptionInfo",gcnew String(PropItemList[k]->GetDescription()));
  95. //
  96. // String^ val = gcnew String(theSample->get()->GetItemValueStr(PropItemList[k]->GetSmplItemId()));
  97. // SData->Add("valStr", val);
  98. // std::vector<CString> comboDownList;
  99. // if (PropItemList[k]->GetTypeId() == OTS_ITEM_TYPES::COMBO)
  100. // {
  101. // comboDownList = theSample->get()->GetItemComboDownList(PropItemList[k]->GetSmplItemId());
  102. // }
  103. //
  104. // JArray^ jarr = gcnew JArray();
  105. // if (comboDownList.size() > 0)
  106. // {
  107. // for (int i=0; i < (int)comboDownList.size(); i++)
  108. // {
  109. // jarr->Add(gcnew String(comboDownList[i]));
  110. // }
  111. // }
  112. // SData->Add("comboDownList", jarr);
  113. // itemArray->Add(SData);
  114. // }
  115. // groupObject->Add("SData", itemArray);
  116. // groupArray->Add(groupObject);
  117. //
  118. // }
  119. // SMeasureInfo->Add("ItemGrp", groupArray);
  120. // return SMeasureInfo;
  121. //}
  122. COTSSamplePtr COTSSampleClr::GetSamplePtr()
  123. {
  124. return *theSample;
  125. }
  126. // has measure results test
  127. bool COTSSampleClr::HasMeasureResult()
  128. {
  129. COTSSamplePtr pSample = GetSamplePtr();
  130. if (pSample == nullptr)
  131. {
  132. LogErrorTrace(__FILE__, __LINE__, _T("HasMeasureResult: invalide pointer."));
  133. return false;
  134. }
  135. return pSample->HasMeasureResult();
  136. }
  137. // property item groups list
  138. /*bool COTSSampleClr::SetPropItemGrps()
  139. {
  140. COTSSamplePtr pSample = GetSamplePtr();
  141. if (pSample == nullptr)
  142. {
  143. LogErrorTrace(__FILE__, __LINE__, _T("SetPropItemGrps: invalide pointer."));
  144. return FALSE;
  145. }
  146. pSample->SetPropItemGrps();
  147. return TRUE;
  148. }*/
  149. /*CPropItemGrpClr^ COTSSampleClr::GetPropItemGrpByIndex(int a_nIndex)
  150. {
  151. COTSSamplePtr pSample = GetSamplePtr();
  152. if (pSample == nullptr)
  153. {
  154. LogErrorTrace(__FILE__, __LINE__, _T("SetPropItemGrps: invalide pointer."));
  155. return nullptr;
  156. }
  157. CPropItemGrpPtr pPropItemGrp = pSample->GetPropItemGrpByIndex(a_nIndex);
  158. if (pPropItemGrp == nullptr)
  159. {
  160. LogErrorTrace(__FILE__, __LINE__, _T("SetPropItemGrps: invalide pointer."));
  161. return nullptr;
  162. }
  163. CPropItemGrpClr^ pPropItemGrpClr = gcnew CPropItemGrpClr(pPropItemGrp);
  164. return pPropItemGrpClr;
  165. }*/
  166. /*CPropItemGrpClr^ COTSSampleClr::GetPropItemGrpById(int a_nId)
  167. {
  168. COTSSamplePtr pSample = GetSamplePtr();
  169. if (pSample == nullptr)
  170. {
  171. LogErrorTrace(__FILE__, __LINE__, _T("GetPropItemGrpById: invalide pointer."));
  172. return nullptr;
  173. }
  174. CPropItemGrpPtr pPropItemGrp = pSample->GetPropItemGrpById((OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)a_nId);
  175. if (pPropItemGrp == nullptr)
  176. {
  177. LogErrorTrace(__FILE__, __LINE__, _T("GetPropItemGrpById: invalide pointer."));
  178. return nullptr;
  179. }
  180. CPropItemGrpClr^ pPropItemGrpClr = gcnew CPropItemGrpClr(pPropItemGrp);
  181. return pPropItemGrpClr;
  182. }*/
  183. /*CPropItemGrpClr^ COTSSampleClr::UpdatePropItemGrp(int a_nId)
  184. {
  185. COTSSamplePtr pSample = GetSamplePtr();
  186. if (pSample == nullptr)
  187. {
  188. LogErrorTrace(__FILE__, __LINE__, _T("UpdatePropItemGrp: invalide pointer."));
  189. return nullptr;
  190. }
  191. CPropItemGrpPtr pPropItemGrp = pSample->UpdatePropItemGrp((OTS_SAMPLE_PROP_GRID_ITEM_GROUPS)a_nId);
  192. if (pPropItemGrp == nullptr)
  193. {
  194. LogErrorTrace(__FILE__, __LINE__, _T("UpdatePropItemGrp: invalide pointer."));
  195. return nullptr;
  196. }
  197. CPropItemGrpClr^ pPropItemGrpClr = gcnew CPropItemGrpClr(pPropItemGrp);
  198. return pPropItemGrpClr;
  199. }*/
  200. /*CPropItemClr^ COTSSampleClr::GetPropItemById(int a_nId)
  201. {
  202. COTSSamplePtr pSample = GetSamplePtr();
  203. if (pSample == nullptr)
  204. {
  205. LogErrorTrace(__FILE__, __LINE__, _T("GetPropItemById: invalide pointer."));
  206. return nullptr;
  207. }
  208. CPropItemPtr pPropItem = pSample->GetPropItemById((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId);
  209. if (pPropItem == nullptr)
  210. {
  211. LogErrorTrace(__FILE__, __LINE__, _T("GetPropItemById: invalide pointer."));
  212. return nullptr;
  213. }
  214. CPropItemClr^ pPropItemClr = gcnew CPropItemClr(pPropItem);
  215. return pPropItemClr;
  216. }*/
  217. // BOOL data (1)
  218. /*bool COTSSampleClr::GetPropBOOLData(int a_nId, bool% a_bValue)
  219. {
  220. bool bRet;
  221. BOOL bResult;
  222. COTSSamplePtr pSample = GetSamplePtr();
  223. if (pSample == nullptr)
  224. {
  225. LogErrorTrace(__FILE__, __LINE__, _T("GetPropBOOLData: invalide pointer."));
  226. return false;
  227. }
  228. bRet = pSample->GetPropBOOLData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  229. a_bValue = bResult;
  230. return bRet;
  231. }*/
  232. /*bool COTSSampleClr::SetPropBOOLData(int a_nId, bool a_bValue)
  233. {
  234. bool bResult = FALSE;
  235. COTSSamplePtr pSample = GetSamplePtr();
  236. if (pSample == nullptr)
  237. {
  238. LogErrorTrace(__FILE__, __LINE__, _T("SetPropBOOLData: invalide pointer."));
  239. return false;
  240. }
  241. BOOL bValue = a_bValue;
  242. bResult = pSample->SetPropBOOLData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bValue);
  243. return bResult;
  244. }*/
  245. // int data (16)
  246. /*bool COTSSampleClr::GetPropIntData(int a_nId, int% a_nValue)
  247. {
  248. bool bRet;
  249. int bResult;
  250. COTSSamplePtr pSample = GetSamplePtr();
  251. if (pSample == nullptr)
  252. {
  253. LogErrorTrace(__FILE__, __LINE__, _T("GetPropIntData: invalide pointer."));
  254. return false;
  255. }
  256. bRet = pSample->GetPropIntData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  257. a_nValue = bResult;
  258. return bRet;
  259. }*/
  260. /*bool COTSSampleClr::SetPropIntData(int a_nId, int a_nValue)
  261. {
  262. bool bRet = FALSE;
  263. COTSSamplePtr pSample = GetSamplePtr();
  264. if (pSample == nullptr)
  265. {
  266. LogErrorTrace(__FILE__, __LINE__, _T("SetPropIntData: invalide pointer."));
  267. return false;
  268. }
  269. bRet = pSample->SetPropIntData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, a_nValue);
  270. return bRet;
  271. }*/
  272. // double data (4)
  273. /*bool COTSSampleClr::GetPropDoubleData(int a_nId, double% a_dValue)
  274. {
  275. bool bRet;
  276. double bResult;
  277. COTSSamplePtr pSample = GetSamplePtr();
  278. if (pSample == nullptr)
  279. {
  280. LogErrorTrace(__FILE__, __LINE__, _T("GetPropDoubleData: invalide pointer."));
  281. return false;
  282. }
  283. bRet = pSample->GetPropDoubleData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  284. a_dValue = bResult;
  285. return bRet;
  286. }*/
  287. /*bool COTSSampleClr::SetPropDoubleData(int a_nId, double a_dValue)
  288. {
  289. bool bRet = FALSE;
  290. COTSSamplePtr pSample = GetSamplePtr();
  291. if (pSample == nullptr)
  292. {
  293. LogErrorTrace(__FILE__, __LINE__, _T("SetPropDoubleData: invalide pointer."));
  294. return false;
  295. }
  296. bRet = pSample->SetPropDoubleData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, a_dValue);
  297. return bRet;
  298. }*/
  299. // string data (7)
  300. /*bool COTSSampleClr::GetPropStringData(int a_nId, String^% a_strValue)
  301. {
  302. bool bRet;
  303. CString bResult;
  304. COTSSamplePtr pSample = GetSamplePtr();
  305. if (pSample == nullptr)
  306. {
  307. LogErrorTrace(__FILE__, __LINE__, _T("GetPropStringData: invalide pointer."));
  308. return false;
  309. }
  310. bRet = pSample->GetPropStringData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  311. a_strValue = gcnew String(bResult);
  312. return bRet;
  313. }*/
  314. /*bool COTSSampleClr::SetPropStringData(int a_nId, String^ a_strValue)
  315. {
  316. bool bRet = false;
  317. if (a_strValue == nullptr)
  318. {
  319. LogErrorTrace(__FILE__, __LINE__, _T("SetPropStringData: invalide pointer."));
  320. return false;
  321. }
  322. COTSSamplePtr pSample = GetSamplePtr();
  323. if (pSample == nullptr)
  324. {
  325. LogErrorTrace(__FILE__, __LINE__, _T("SetPropStringData: invalide pointer."));
  326. return false;
  327. }
  328. CString str = a_strValue;
  329. bRet = pSample->SetPropStringData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, str);
  330. return bRet;
  331. }*/
  332. // combo data (7)
  333. //bool COTSSampleClr::GetPropComboData(int a_nId, int% a_nValue)
  334. //{
  335. // bool bRet;
  336. // int bResult;
  337. // COTSSamplePtr pSample = GetSamplePtr();
  338. // if (pSample == nullptr)
  339. // {
  340. // LogErrorTrace(__FILE__, __LINE__, _T("GetPropComboData: invalide pointer."));
  341. // return false;
  342. // }
  343. // bRet = pSample->GetPropComboData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  344. // a_nValue = bResult;
  345. // return bRet;
  346. //}
  347. //bool COTSSampleClr::SetPropComboData(int a_nId, int a_nValue)
  348. //{
  349. // bool bRet = false;
  350. // COTSSamplePtr pSample = GetSamplePtr();
  351. // if (pSample == nullptr)
  352. // {
  353. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropComboData: invalide pointer."));
  354. // return false;
  355. // }
  356. // bRet = pSample->SetPropComboData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, a_nValue);
  357. // return bRet;
  358. //}
  359. //bool COTSSampleClr::GetPropComboStrings(int a_nId, CStringListClr^% a_listComboStrings)
  360. //{
  361. // bool bRet;
  362. // COTSSamplePtr pSample = GetSamplePtr();
  363. // if (pSample == nullptr)
  364. // {
  365. // LogErrorTrace(__FILE__, __LINE__, _T("GetPropComboStrings: invalide pointer."));
  366. // return false;
  367. // }
  368. // std::vector<CString> bResult;
  369. // bRet = pSample->GetPropComboStrings((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  370. // for (auto pString : bResult)
  371. // {
  372. // String^ str = gcnew String(pString);
  373. // a_listComboStrings->Add(str);
  374. // }
  375. // return bRet;
  376. //}
  377. //// time data (2)
  378. //bool COTSSampleClr::GetPropTimeData(int a_nId, DateTime^% a_oValue)
  379. //{
  380. // bool bRet;
  381. // COleDateTime bResult;
  382. // COTSSamplePtr pSample = GetSamplePtr();
  383. // if (pSample == nullptr)
  384. // {
  385. // LogErrorTrace(__FILE__, __LINE__, _T("GetPropTimeData: invalide pointer."));
  386. // return false;
  387. // }
  388. // bRet = pSample->GetPropTimeData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  389. // a_oValue = gcnew DateTime(bResult.GetYear(), bResult.GetMonth(), bResult.GetDay(), bResult.GetHour(), bResult.GetMinute(), bResult.GetSecond());
  390. // return bRet;
  391. //}
  392. //bool COTSSampleClr::SetPropTimeData(int a_nId, DateTime^ a_oValue)
  393. //{
  394. // bool bRet;
  395. // COTSSamplePtr pSample = GetSamplePtr();
  396. // if (pSample == nullptr)
  397. // {
  398. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeData: invalide pointer."));
  399. // return false;
  400. // }
  401. // ASSERT(a_oValue);
  402. // if (!a_oValue)
  403. // {
  404. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeData: invalide pointer."));
  405. // return false;
  406. // }
  407. // COleDateTime oVaule(a_oValue->Year, a_oValue->Month, a_oValue->Day, a_oValue->Hour, a_oValue->Minute, a_oValue->Second);
  408. //
  409. // bRet = pSample->SetPropTimeData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, oVaule);
  410. // return bRet;
  411. //}
  412. //// time span data (1)
  413. //bool COTSSampleClr::GetPropTimeSpanData(int a_nId, TimeSpan^% a_oValue)
  414. //{
  415. // bool bRet;
  416. // COleDateTimeSpan bResult;
  417. // COTSSamplePtr pSample = GetSamplePtr();
  418. // if (pSample == nullptr)
  419. // {
  420. // LogErrorTrace(__FILE__, __LINE__, _T("GetPropTimeSpanData: invalide pointer."));
  421. // return false;
  422. // }
  423. // bRet = pSample->GetPropTimeSpanData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  424. // #pragma warning(disable : 4244)
  425. // a_oValue = gcnew TimeSpan(bResult.GetTotalDays(), bResult.GetTotalHours(), bResult.GetTotalMinutes(), bResult.GetTotalSeconds());
  426. // #pragma warning(default : 4244)
  427. // return bRet;
  428. //}
  429. //bool COTSSampleClr::SetPropTimeSpanData(int a_nId, TimeSpan^ a_oValue)
  430. //{
  431. // bool bRet = false;
  432. // COTSSamplePtr pSample = GetSamplePtr();
  433. // if (pSample == nullptr)
  434. // {
  435. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeSpanData: invalide pointer."));
  436. // return false;
  437. // }
  438. // ASSERT(a_oValue);
  439. // if(!a_oValue)
  440. // {
  441. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeSpanData: invalide pointer."));
  442. // return false;
  443. // }
  444. // COleDateTimeSpan oVaule(a_oValue->Days, a_oValue->Hours, a_oValue->Minutes, a_oValue->Seconds);
  445. //
  446. // bRet = pSample->SetPropTimeSpanData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, oVaule);
  447. // return bRet;
  448. //}
  449. //// file list data (2)
  450. //bool COTSSampleClr::GetPropFileListData(int a_nId, String^% a_strFileName)
  451. //{
  452. // bool bRet;
  453. // CString bResult;
  454. // COTSSamplePtr pSample = GetSamplePtr();
  455. // if (pSample == nullptr)
  456. // {
  457. // LogErrorTrace(__FILE__, __LINE__, _T("GetPropTimeSpanData: invalide pointer."));
  458. // return false;
  459. // }
  460. // bRet = pSample->GetPropFileListData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  461. // a_strFileName = gcnew String(bResult);
  462. // return bRet;
  463. //}
  464. //bool COTSSampleClr::SetPropFileListData(int a_nId, String^ a_strFileName)
  465. //{
  466. // bool bRet = false;
  467. // COTSSamplePtr pSample = GetSamplePtr();
  468. // if (pSample == nullptr)
  469. // {
  470. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeSpanData: invalide pointer."));
  471. // return false;
  472. // }
  473. // ASSERT(a_strFileName);
  474. // if(!a_strFileName)
  475. // {
  476. // LogErrorTrace(__FILE__, __LINE__, _T("SetPropTimeSpanData: invalide pointer."));
  477. // return false;
  478. // }
  479. // CString str = a_strFileName;
  480. // bRet = pSample->SetPropFileListData((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, str);
  481. // return bRet;
  482. //}
  483. //// get related property item
  484. //bool COTSSampleClr::GetRelatedPropItem(int a_nId, int% a_nRelatedPropId)
  485. //{
  486. // bool bRet;
  487. // OTS_SAMPLE_PROP_GRID_ITEMS bResult;
  488. // COTSSamplePtr pSample = GetSamplePtr();
  489. // if (pSample == nullptr)
  490. // {
  491. // LogErrorTrace(__FILE__, __LINE__, _T("GetRelatedPropItem: invalide pointer."));
  492. // return false;
  493. // }
  494. // bRet = pSample->GetRelatedPropItem((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  495. // a_nRelatedPropId = (int)bResult;
  496. // return bRet;
  497. //}
  498. //// get related property item group
  499. //bool COTSSampleClr::GetRelatedPropItemGrp(int a_nId, int% a_nRelatedPropGrpId)
  500. //{
  501. // bool bRet;
  502. // OTS_SAMPLE_PROP_GRID_ITEM_GROUPS bResult;
  503. // COTSSamplePtr pSample = GetSamplePtr();
  504. // if (pSample == nullptr)
  505. // {
  506. // LogErrorTrace(__FILE__, __LINE__, _T("GetRelatedPropItem: invalide pointer."));
  507. // return false;
  508. // }
  509. // bRet = pSample->GetRelatedPropItemGrp((OTS_SAMPLE_PROP_GRID_ITEMS)a_nId, bResult);
  510. // a_nRelatedPropGrpId = (int)bResult;
  511. //
  512. // return bRet;
  513. //}
  514. bool COTSSampleClr::GetBSESize(int% a_nWidth, int% a_nHeight)
  515. {
  516. COTSSamplePtr pSample = GetSamplePtr();
  517. if (pSample == nullptr)
  518. {
  519. LogErrorTrace(__FILE__, __LINE__, _T("GetBSESize: invalide pointer."));
  520. return false;
  521. }
  522. int nWidth = 0;
  523. int nHeight = 0;
  524. bool bRet = pSample->GetBSESize(nWidth, nHeight);
  525. a_nWidth = nWidth;
  526. a_nHeight = nHeight;
  527. return bRet;
  528. }
  529. }