OTSSampleClr.cpp 16 KB

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