| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876 |
- /**************************************************************************************************
- 版本所有(C), 2020-2022, 北京普达迪泰
- ***************************************************************************************************
- 文 件 名: StaticTask.cpp
- 功能描述: 静态测量任务
- 版 本 号: 1.00初版
- 作 者: HYF
- 生成日期; 2021-12-20
- 最近修改:
- 函数列表:
- 修改历史:
- 1.日 期 :2021-12-20
- 作 者 : HYF
- 修改内容 : 创建文件
- **************************************************************************************************/
- #include "pch.h"
- #include "Dms.h"
- #include "StaticTask.h"
- #include "DmsDoc.h"
- #include "TaskManager.h"
- #include "EquipDataManager.h"
- #include "EquipDataCircleManager.h"
- #include "EquipDataPlaneManager.h"
- #include "EquipDataLineManager.h"
- #include "EquipDataPointManager.h"
- #include "EquipDataCylinderManager.h"
- #include "CppSQLite3.h"
- #include "EnvelopeDlg.h"
- #include "GuideDlg.h"
- #include "StaticReport.h"
- #include "GridCtrl.h"
- #include "OSGView.h"
- #include "CameraConfigDlg.h"
- #include "MainFrm.h"
- #include "IDPMSManager.h"
- #include "StaticData.h"
- #include "IPNDlg.h"
- #include "DlgTest.h"
- #include "CameraInfo.h"
- // 定时器
- #define MEASURE_TIMER 1000
- // CStaticTask
- IMPLEMENT_DYNCREATE(CStaticTask, CFormView)
- CStaticTask::CStaticTask()
- : CFormView(IDD_VIEW_STATIC_TASK)
- , m_bIsAttached(FALSE)
- {
- m_BkBrush.CreateSolidBrush(RGB(247, 247, 247));
- m_pCamMenu = NULL;
- }
- CStaticTask::~CStaticTask()
- {
- if (m_pCamMenu != NULL)
- {
- delete m_pCamMenu;
- m_pCamMenu = NULL;
- }
- }
- void CStaticTask::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_STATIC_TASK_TITLE, m_Static_Title);
- DDX_Control(pDX, IDC_STATIC_POINT_TITLE, m_Static_PointTitle);
- DDX_Control(pDX, IDC_TREE_DATA, m_TreeCtrl);
- DDX_Control(pDX, IDC_GRIDCTRL_POINT, m_GridCtrl);
- DDX_Control(pDX, IDC_COMBO_CS, m_Combo_CS);
- DDX_Control(pDX, IDC_BTN_REPORT, m_Btn_Report);
- DDX_Control(pDX, IDC_BTN_COMPARE, m_Btn_Compare);
- DDX_Control(pDX, IDC_STATIC_EQUIP_TYPE_CODE, m_Static_EquipTypeCode);
- DDX_Control(pDX, IDC_STATIC_EQUIP_CODE, m_Static_EquipCode);
- DDX_Control(pDX, IDC_MBTN_STATIC_CAMERA, m_MBtn_Cam);
- DDX_Control(pDX, IDC_BTN_AUTO, m_Btn_Auto);
- DDX_Control(pDX, IDC_BTN_UPDATE, m_Btn_Update);
- }
- BEGIN_MESSAGE_MAP(CStaticTask, CFormView)
- ON_BN_CLICKED(IDC_BTN_CAMERA, &CStaticTask::OnBnClickedBtnCamera)
- ON_WM_CREATE()
- ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_DATA, &CStaticTask::OnTvnSelchangedTreeData)
- ON_NOTIFY(TVN_BEGINLABELEDIT, IDC_TREE_DATA, &CStaticTask::OnTvnBeginlabeleditTreeData)
- ON_NOTIFY(TVN_ENDLABELEDIT, IDC_TREE_DATA, &CStaticTask::OnTvnEndlabeleditTreeData)
- ON_BN_CLICKED(IDC_BTN_AUTO, &CStaticTask::OnBnClickedBtnAuto)
- ON_BN_CLICKED(IDC_BTN_COMPARE, &CStaticTask::OnBnClickedBtnCompare)
- ON_BN_CLICKED(IDC_BTN_GUIDE, &CStaticTask::OnBnClickedBtnGuide)
- ON_BN_CLICKED(IDC_BTN_REPORT, &CStaticTask::OnBnClickedBtnReport)
- ON_WM_DESTROY()
- ON_WM_SIZE()
- ON_WM_TIMER()
- ON_CBN_SELCHANGE(IDC_COMBO_CS, &CStaticTask::OnCbnSelchangeComboCS)
- ON_BN_CLICKED(IDC_BTN_FINISH, &CStaticTask::OnBnClickedBtnBack)
- ON_BN_CLICKED(IDC_BTN_MESH, &CStaticTask::OnBnClickedBtnIPN)
- ON_MESSAGE(WM_SUCCESS , OnMeasureSuccess )
- ON_MESSAGE(WM_FAILURE, OnMeasureFailure)
- ON_MESSAGE(WM_UPDATE_FAILURE, OnMeasureUpdateFailure)
- ON_MESSAGE(WM_UPDATE_SUCCESS, OnMeasureUpdateSuccess)
- ON_MESSAGE(WM_CAM_CONFIG_SUCCESS, OnCamConfigSuccess)
- ON_MESSAGE(WM_CAM_CONFIG_FAILURE, OnCamConfigFailure)
- ON_MESSAGE(WM_START_IDPMS, OnReStartIDPMS)
- ON_BN_CLICKED(BTN_AGV, &CStaticTask::OnBnClickedAgv)
- ON_BN_CLICKED(IDC_MBTN_STATIC_CAMERA, &CStaticTask::OnBnClickedMbtnStaticCamera)
- ON_BN_CLICKED(IDC_BTN_UPDATE, &CStaticTask::OnBnClickedBtnUpdate)
- END_MESSAGE_MAP()
- // CStaticTask 诊断
- #ifdef _DEBUG
- void CStaticTask::AssertValid() const
- {
- CFormView::AssertValid();
- }
- #ifndef _WIN32_WCE
- void CStaticTask::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif
- #endif //_DEBUG
- /**************************************************************************************************
- 函 数 名 :OnCreate
- 功能描述 :消息处理-WM_CREATE
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int CStaticTask::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFormView::OnCreate(lpCreateStruct) == -1)
- return -1;
- m_pDoc = (CDmsDoc *)GetDocument();
- ASSERT(m_pDoc != NULL);
- ASSERT(m_pDoc->IsKindOf(RUNTIME_CLASS(CDmsDoc)));
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnInitialUpdate
- 功能描述 :初始化UI展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // 任务标题
- m_Static_Title.SetFontSize(16);
- m_Static_Title.SetFontBold(TRUE);
- // 型号
- m_Static_EquipTypeCode.SetFontSize(15);
- m_Static_EquipTypeCode.SetFontBold(TRUE);
- m_Static_EquipTypeCode.SetTextColor(g_crInfoText);
- // 编号
- m_Static_EquipCode.SetFontSize(15);
- m_Static_EquipCode.SetTextColor(g_crInfoText);
- m_Static_EquipCode.SetFontBold(TRUE);
- // 从标系
- m_Combo_CS.ResetContent();
- m_Combo_CS.InsertString(0, _T("空间直角坐标系"));
- m_Combo_CS.InsertString(1, _T("球坐标系"));
- m_Combo_CS.InsertString(2, _T("柱坐标系"));
- m_Combo_CS.SetCurSel(0);
- // 相机标定菜单
- m_pCamMenu = new CMenu();
- m_pCamMenu->LoadMenu(IDM_CAM_STATIC);
- m_MBtn_Cam.m_hMenu = m_pCamMenu->GetSubMenu(0)->GetSafeHmenu();
- // 设置TreeCtrl风格
- DWORD dwStyles = GetWindowLong(m_TreeCtrl.m_hWnd, GWL_STYLE);//获取树控制原风格
- dwStyles |= TVS_EDITLABELS | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS;
- SetWindowLong(m_TreeCtrl.m_hWnd, GWL_STYLE, dwStyles);
- HICON hIcon[10];
- hIcon[0] = AfxGetApp()->LoadIcon(IDI_POINT_TYPE);
- hIcon[1] = AfxGetApp()->LoadIcon(IDI_POINT);
- hIcon[2] = AfxGetApp()->LoadIcon(IDI_PLANE_TYPE);
- hIcon[3] = AfxGetApp()->LoadIcon(IDI_PLANE);
- hIcon[4] = AfxGetApp()->LoadIcon(IDI_CIRCLE_TYPE);
- hIcon[5] = AfxGetApp()->LoadIcon(IDI_CIRCLE);
- hIcon[6] = AfxGetApp()->LoadIcon(IDI_LINE_TYPE);
- hIcon[7] = AfxGetApp()->LoadIcon(IDI_LINE);
- hIcon[8] = AfxGetApp()->LoadIcon(IDI_CYLINDER_TYPE);
- hIcon[9] = AfxGetApp()->LoadIcon(IDI_CYLINDER);
- m_imageList.Create(20, 20, ILC_COLOR32, 4, 4);
- m_imageList.SetBkColor(RGB(255, 255, 255));
- for (int i = 0; i < 10; i++)
- {
- m_imageList.Add(hIcon[i]);
- }
- m_TreeCtrl.SetImageList(&m_imageList, TVSIL_NORMAL);
- m_TreeCtrl.SetBkColor(RGB(255, 255, 255));
- m_Static_PointTitle.SetWindowText("");
- //
- m_GridCtrl.SetBkColor(RGB(0xFF, 0xFF, 0xFF));
- // 启动定时器
- SetTimer(MEASURE_TIMER, 500, NULL);
- }
- /**************************************************************************************************
- 函 数 名 :InitTreeCtrlData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreeCtrlData()
- {
- m_TreeCtrl.DeleteAllItems();
- // 初始化数据
- EquipDataManager *pManager = m_pDoc->GetEquipDataManager();
- ASSERT(pManager != NULL);
- DWORD dwItemId;
- CString szItemTitle;
- CString szItemCode;
- int iItemType;
- CppSQLite3Query q = pManager->Query(m_taskId);
- while (!q.eof()) {
- dwItemId = q.getIntField("item_id");
- iItemType = q.getIntField("item_type");
- szItemTitle = q.getStringField("item_title");
- szItemCode = q.getStringField("item_code");
- switch (iItemType)
- {
- case 1: // Point
- m_hPoints = m_TreeCtrl.InsertItem(_T("Points"), 0, 0);
- m_TreeCtrl.SetItemState(m_hPoints, TVIS_BOLD, TVIS_BOLD);
- m_TreeCtrl.SetItemData(m_hPoints, 0);
- InitTreePointData(dwItemId);
- break;
- case 2: // Plane
- m_hPlanes = m_TreeCtrl.InsertItem(_T("Planes"), 2, 2);
- m_TreeCtrl.SetItemState(m_hPlanes, TVIS_BOLD, TVIS_BOLD);
- m_TreeCtrl.SetItemData(m_hPlanes, 0);
- InitTreePlaneData(dwItemId);
- break;
- case 3: // Circle
- m_hCircles = m_TreeCtrl.InsertItem(_T("Circles"), 4, 4);
- m_TreeCtrl.SetItemState(m_hCircles, TVIS_BOLD, TVIS_BOLD);
- m_TreeCtrl.SetItemData(m_hCircles, 0);
- InitTreeCircleData(dwItemId);
- break;
- case 4: // Line
- m_hLines = m_TreeCtrl.InsertItem(_T("Lines"), 6, 6);
- m_TreeCtrl.SetItemState(m_hLines, TVIS_BOLD, TVIS_BOLD);
- m_TreeCtrl.SetItemData(m_hLines, 0);
- InitTreeLineData(dwItemId);
- break;
- case 5: // Cylinders
- m_hCylinders = m_TreeCtrl.InsertItem(_T("Cylinders"), 8, 8);
- m_TreeCtrl.SetItemState(m_hLines, TVIS_BOLD, TVIS_BOLD);
- m_TreeCtrl.SetItemData(m_hCylinders, 0);
- InitTreeCylinderData(dwItemId);
- break;
- }
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :InitFormData
- 功能描述 :初始化数值
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitFormData(DWORD taskId)
- {
- // 设备IDPMS附加状态为FALSE
- m_bIsAttached = FALSE;
- this->ResetFormData();
- this->m_taskId = taskId;
- // 初始化任务信息
- InitTaskInfo();
- // 初始化UI栏位显示状态
- ShowTaskFieldStatus();
- // 附加IDPMS窗口到UI
- AttachIDPMS();
- // 调整IDPMS显示布局
- RelayoutIDPMS();
- }
- /**************************************************************************************************
- 函 数 名 :InitTaskInfo
- 功能描述 :初始化任务信息
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTaskInfo()
- {
- // 初始化数据
- TaskManager *pTaskManager = m_pDoc->GetTaskManager();
- ASSERT(pTaskManager != NULL);
- CppSQLite3Query q = pTaskManager->Query(m_taskId);
- if (!q.eof()) {
- CString szTaskTitle = q.getStringField("task_title");
-
- m_Static_Title.SetWindowText(szTaskTitle);
- m_szEquipTypeCode = q.getStringField("equip_type_code");
- m_Static_EquipTypeCode.SetWindowText(m_szEquipTypeCode);
- m_szEquipCode = q.getStringField("equip_code");
- m_Static_EquipCode.SetWindowText(m_szEquipCode);
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :AttachIDPMS
- 功能描述 :附加IDPMS窗口到UI中
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::AttachIDPMS()
- {
- // 初始化
- if (g_hIDPMSHWnd)
- {
- ::SetParent(g_hIDPMSHWnd, GetDlgItem(IDC_IDPMS_RECT)->m_hWnd);
- LONG style=GetWindowLong(g_hIDPMSHWnd ,GWL_STYLE);// 14CF 0000
- style &=~WS_CAPTION;
- style &=~WS_THICKFRAME;
- style |=WS_VISIBLE;
- SetWindowLong(g_hIDPMSHWnd, GWL_STYLE, style);//eraze title of ms paint window.
- m_bIsAttached = TRUE;
- }
- }
- /**************************************************************************************************
- 函 数 名 :RelayoutIDPMS
- 功能描述 :调整IDPMS显示布局
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::RelayoutIDPMS()
- {
- CRect rect;
- GetDlgItem(IDC_IDPMS_RECT)->GetWindowRect(&rect);
- ScreenToClient(rect);
- CRect rectShow;
- rectShow.left = 0;
- rectShow.top = 0;
- rectShow.right = rect.right - rect.left;
- rectShow.bottom = rect.bottom - rect.top;
- ::MoveWindow(g_hIDPMSHWnd, rectShow.left, rectShow.top, rectShow.right, rectShow.bottom, true);
- ::UpdateWindow(g_hIDPMSHWnd);
- ::ShowWindow(g_hIDPMSHWnd, SW_SHOW);
- ::SwitchToThisWindow(g_hIDPMSHWnd, TRUE);
- }
- /**************************************************************************************************
- 函 数 名 :resetFormData
- 功能描述 :重置UI数值
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::ResetFormData()
- {
- m_hPlanes = NULL;
- m_hCircles = NULL;
- m_hLines = NULL;
- m_hPoints = NULL;
- m_hCylinders = NULL;
- m_taskId = NULL;
- m_szEquipCode = "";
- m_szEquipTypeCode = "";
- m_iShowType = 0;
- m_iTaskStatus = 0;
- m_iCS = 0;
- m_TreeCtrl.DeleteAllItems();
- m_GridCtrl.DeleteAllItems();
- // 从IDPMS获取数据
- IDPMSManager *pManager = IDPMSManager::GetManager();
- BOOL bRet = pManager->CloseIDPMSProject();
- if (!bRet) {
- LOG::D(_T("IDPMS 通讯异常"));
- }
- }
- /**************************************************************************************************
- 函 数 名 :ShowTaskFieldStatus
- 功能描述 :初始化UI栏位展示信息
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowTaskFieldStatus()
- {
- if (m_iTaskStatus == 0) { // 初始状态
- m_Btn_Auto.EnableWindow(TRUE);
- m_Btn_Report.ShowWindow(SW_HIDE);
- m_Btn_Compare.ShowWindow(SW_HIDE);
- m_Btn_Update.ShowWindow(SW_HIDE);
- }
- else if (m_iTaskStatus == 1) // 运行状态
- {
- m_Btn_Auto.EnableWindow(FALSE);
- m_Btn_Report.ShowWindow(SW_HIDE);
- m_Btn_Compare.ShowWindow(SW_HIDE);
- m_Btn_Update.EnableWindow(FALSE);
- }
- else if (m_iTaskStatus == 2) // 完成状态
- {
- m_Btn_Auto.EnableWindow(TRUE);
- m_Btn_Report.ShowWindow(SW_SHOW);
- m_Btn_Compare.ShowWindow(SW_SHOW);
- m_Btn_Update.ShowWindow(SW_SHOW);
- m_Btn_Update.EnableWindow(TRUE);
- m_Btn_Update.SetWindowText("更新数据");
- }
- }
- /**************************************************************************************************
- 函 数 名 :InitTreePlaneData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreePointData(DWORD iItemId)
- {
- if (!m_hPoints) return;
- // POINT数据访问入口
- EquipDataPointManager *pPointManager = m_pDoc->GetEquipDataPointManager();
- ASSERT(pPointManager != NULL);
- DWORD dwSubItemId;
- CString szPointTitle;
- CString szPointCode;
- HTREEITEM item;
- CppSQLite3Query q = pPointManager->Query(m_taskId, m_szEquipCode, iItemId);
- while (!q.eof()) {
- dwSubItemId = q.getIntField("subitem_id");
- szPointTitle = q.getStringField("point_title");
- szPointCode = q.getStringField("point_code");
- item = m_TreeCtrl.InsertItem(szPointTitle, 1, 1, m_hPoints, TVI_LAST);
- m_TreeCtrl.SetItemData(item, dwSubItemId);
- q.nextRow();
- }
- q.finalize();
- m_TreeCtrl.Expand(m_hPoints, TVE_EXPAND);
- }
- /**************************************************************************************************
- 函 数 名 :InitTreePlaneData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreePlaneData(DWORD iItemId)
- {
- if (!m_hPlanes) return;
- // Plane数据访问入口
- EquipDataPlaneManager *pPlaneManager = m_pDoc->GetEquipDataPlaneManager();
- ASSERT(pPlaneManager != NULL);
-
- DWORD dwSubItemId;
- CString szPlaneTitle;
- CString szPlaneCode;
- HTREEITEM item;
- CppSQLite3Query q = pPlaneManager->Query(m_taskId, m_szEquipCode, iItemId);
- while (!q.eof()) {
- dwSubItemId = q.getIntField("subitem_id");
- szPlaneTitle = q.getStringField("plane_title");
- szPlaneCode = q.getStringField("plane_code");
- item = m_TreeCtrl.InsertItem(szPlaneTitle, 3, 3, m_hPlanes, TVI_LAST);
- m_TreeCtrl.SetItemData(item, dwSubItemId);
- q.nextRow();
- }
- q.finalize();
- m_TreeCtrl.Expand(m_hPlanes, TVE_EXPAND);
- }
- /**************************************************************************************************
- 函 数 名 :InitTreePlaneData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreeCircleData(DWORD iItemId)
- {
- if (!m_hCircles) return;
- // Circle数据访问入口
- EquipDataCircleManager *pCircleManager = m_pDoc->GetEquipDataCircleManager();
- ASSERT(pCircleManager != NULL);
- DWORD dwSubItemId;
- CString szCircleTitle;
- CString szCircleCode;
- HTREEITEM item;
- CppSQLite3Query q = pCircleManager->Query(m_taskId, m_szEquipCode, iItemId);
- while (!q.eof()) {
- dwSubItemId = q.getIntField("subitem_id");
- szCircleTitle = q.getStringField("circle_title");
- szCircleCode = q.getStringField("circle_code");
- item = m_TreeCtrl.InsertItem(szCircleTitle, 5, 5, m_hCircles, TVI_LAST);
- m_TreeCtrl.SetItemData(item, dwSubItemId);
- q.nextRow();
- }
- q.finalize();
- m_TreeCtrl.Expand(m_hCircles, TVE_EXPAND);
- }
- /**************************************************************************************************
- 函 数 名 :InitTreePlaneData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreeLineData(DWORD iItemId)
- {
- if (!m_hLines) return;
- // LINE数据访问入口
- EquipDataLineManager *pLineManager = m_pDoc->GetEquipDataLineManager();
- ASSERT(pLineManager != NULL);
- DWORD dwSubItemId;
- CString szLineTitle;
- CString szLineCode;
- HTREEITEM item;
- CppSQLite3Query q = pLineManager->Query(m_taskId, m_szEquipCode, iItemId);
- while (!q.eof()) {
- dwSubItemId = q.getIntField("subitem_id");
- szLineTitle = q.getStringField("line_title");
- szLineCode = q.getStringField("line_code");
- item = m_TreeCtrl.InsertItem(szLineTitle, 7, 7, m_hLines, TVI_LAST);
- m_TreeCtrl.SetItemData(item, dwSubItemId);
- q.nextRow();
- }
- q.finalize();
- m_TreeCtrl.Expand(m_hLines, TVE_EXPAND);
- }
- /**************************************************************************************************
- 函 数 名 :InitTreePlaneData
- 功能描述 :初始化设备静态测量数据树状展示
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::InitTreeCylinderData(DWORD iItemId)
- {
- if (!m_hCylinders) return;
- // Circle数据访问入口
- EquipDataCylinderManager *pCylinderManager = m_pDoc->GetEquipDataCylinderManager();
- ASSERT(pCylinderManager != NULL);
- DWORD dwSubItemId;
- CString szCylinderTitle;
- CString szCylinderCode;
- HTREEITEM item;
- CppSQLite3Query q = pCylinderManager->Query(m_taskId, m_szEquipCode, iItemId);
- while (!q.eof()) {
- dwSubItemId = q.getIntField("subitem_id");
- szCylinderTitle = q.getStringField("cylinder_title");
- szCylinderCode = q.getStringField("cylinder_code");
- item = m_TreeCtrl.InsertItem(szCylinderTitle, 9, 9, m_hCylinders, TVI_LAST);
- m_TreeCtrl.SetItemData(item, dwSubItemId);
- q.nextRow();
- }
- q.finalize();
- m_TreeCtrl.Expand(m_hCylinders, TVE_EXPAND);
- }
- /**************************************************************************************************
- 函 数 名 :OnUpdate
- 功能描述 :数据变更,更新UI
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
- {
- }
- /**************************************************************************************************
- 函 数 名 :OnTvnSelchangedTreeData
- 功能描述 :事件处理-点云数据选择
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnTvnSelchangedTreeData(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
- HTREEITEM item = pNMTreeView->itemNew.hItem;
- CString str = m_TreeCtrl.GetItemText(item);
- DWORD dwId = (DWORD)m_TreeCtrl.GetItemData(item);
- if (dwId == 0) {
- *pResult = 1;
- return;
- }
- // 显示选中的数据
- ShowData(item);
- *pResult = 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnTvnBeginlabeleditTreeData
- 功能描述 :事件处理-开始编辑点云数据名称
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnTvnBeginlabeleditTreeData(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);
- HTREEITEM item = pTVDispInfo->item.hItem;
- DWORD dwId = (DWORD)m_TreeCtrl.GetItemData(item);
- if (dwId == 0) {
- *pResult = 1;
- return;
- }
- CEdit *pEdit = m_TreeCtrl.GetEditControl();
- ASSERT(pEdit);
- if (pEdit)
- {
- // 设置结点编辑文本长度不能多于31个字符
- pEdit->LimitText(31);
- }
- *pResult = 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnTvnEndlabeleditTreeData
- 功能描述 :事件处理-结束编辑点云数据名称
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnTvnEndlabeleditTreeData(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);
- HTREEITEM item = pTVDispInfo->item.hItem;
- CString strText;
- m_TreeCtrl.GetEditControl()->GetWindowText(strText);
-
- BOOL bRet = UpdateDataTitle(item, strText);
- if (!bRet)
- {
- MessageBox(_T("修改失败!"));
- *pResult = 1;
- return;
- }
-
- m_TreeCtrl.SetItemText(item, strText);//设置编辑后的文本为结点
- *pResult = 0;
- }
- /**************************************************************************************************
- 函 数 名 :UpdateDataTitle
- 功能描述 :事件处理-结束编辑点云数据名称
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL CStaticTask::UpdateDataTitle(HTREEITEM hItem, LPCTSTR szTitle)
- {
- HTREEITEM hParent = m_TreeCtrl.GetParentItem(hItem);
- DWORD dwSubitemId = (DWORD)m_TreeCtrl.GetItemData(hItem);
- if (hParent == m_hPoints)
- {
- // POINT数据访问入口
- EquipDataPointManager *pPointManager = m_pDoc->GetEquipDataPointManager();
- ASSERT(pPointManager != NULL);
- return pPointManager->UpdateTitle(m_taskId, m_szEquipCode, 1, dwSubitemId, szTitle);
- }
- else if (hParent == m_hPlanes)
- {
- // Plane数据访问入口
- EquipDataPlaneManager *pPlaneManager = m_pDoc->GetEquipDataPlaneManager();
- ASSERT(pPlaneManager != NULL);
- return pPlaneManager->UpdateTitle(m_taskId, m_szEquipCode, 2, dwSubitemId, szTitle);
- }
- else if (hParent == m_hCircles)
- {
- // Circle数据访问入口
- EquipDataCircleManager *pCircleManager = m_pDoc->GetEquipDataCircleManager();
- ASSERT(pCircleManager != NULL);
- return pCircleManager->UpdateTitle(m_taskId, m_szEquipCode, 3, dwSubitemId, szTitle);
- }
- else if (hParent == m_hLines)
- {
- // LINE数据访问入口
- EquipDataLineManager *pLineManager = m_pDoc->GetEquipDataLineManager();
- ASSERT(pLineManager != NULL);
- return pLineManager->UpdateTitle(m_taskId, m_szEquipCode, 4, dwSubitemId, szTitle);
- }
- else if (hParent == m_hCylinders)
- {
- // Cylinder数据访问入口
- EquipDataCylinderManager *pCylinderManager = m_pDoc->GetEquipDataCylinderManager();
- ASSERT(pCylinderManager != NULL);
- return pCylinderManager->UpdateTitle(m_taskId, m_szEquipCode, 5, dwSubitemId, szTitle);
- }
- return FALSE;
- }
- /**************************************************************************************************
- 函 数 名 :ShowData
- 功能描述 :显示数据
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowData(HTREEITEM hItem)
- {
- // 选中节点的标题
- CString szItemTitle = m_TreeCtrl.GetItemText(hItem);
- HTREEITEM hParent = m_TreeCtrl.GetParentItem(hItem);
- DWORD dwSubitemId = (DWORD)m_TreeCtrl.GetItemData(hItem);
- m_dwSubItemId = dwSubitemId;
- CString szTitle("");
- m_GridCtrl.DeleteAllItems();
- m_GridCtrl.SetEditable(FALSE);
- m_GridCtrl.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xFF));
- m_GridCtrl.SetAutoSizeStyle();
- m_GridCtrl.AutoSize(GVS_HEADER);
- m_GridCtrl.SetRowCount(10);
- if (hParent == m_hPoints)
- {
- szTitle.Format("点:%s", szItemTitle);
- m_Static_PointTitle.SetWindowText(szTitle);
- m_iShowType = 1;
- ShowPointData(m_iShowType, dwSubitemId);
- }
- else if (hParent == m_hPlanes)
- {
- szTitle.Format("平面:%s", szItemTitle);
- m_Static_PointTitle.SetWindowText(szTitle);
- m_iShowType = 2;
- ShowPlaneData(m_iShowType, dwSubitemId);
- }
- else if (hParent == m_hCircles)
- {
- szTitle.Format("圆:%s", szItemTitle);
- m_Static_PointTitle.SetWindowText(szTitle);
- m_iShowType = 3;
- ShowCircleData(m_iShowType, dwSubitemId);
- }
- else if (hParent == m_hLines)
- {
- szTitle.Format("直线:%s", szItemTitle);
- m_Static_PointTitle.SetWindowText(szTitle);
- m_iShowType = 4;
- ShowLineData(m_iShowType, dwSubitemId);
- }
- else if (hParent == m_hCylinders)
- {
- szTitle.Format("圆柱:%s", szItemTitle);
- m_Static_PointTitle.SetWindowText(szTitle);
- m_iShowType = 5;
- ShowCylinderData(m_iShowType, dwSubitemId);
- }
- }
- /**************************************************************************************************
- 函 数 名 :ShowPlaneData
- 功能描述 :显示数据-面
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowPlaneData(DWORD dwItemId, DWORD dwSubitemId)
- {
- TRY
- {
- m_GridCtrl.SetColumnCount(10);
- m_GridCtrl.SetFixedRowCount(1);
- m_GridCtrl.SetFixedColumnCount(1);
- m_GridCtrl.SetColumnWidth(0, 40);
- m_GridCtrl.SetColumnWidth(1, 120);
- m_GridCtrl.SetColumnWidth(2, 120);
- m_GridCtrl.SetColumnWidth(3, 100);
- m_GridCtrl.SetColumnWidth(4, 100);
- m_GridCtrl.SetColumnWidth(5, 100);
- m_GridCtrl.SetColumnWidth(6, 100);
- m_GridCtrl.SetColumnWidth(7, 100);
- m_GridCtrl.SetColumnWidth(8, 100);
- m_GridCtrl.SetColumnWidth(9, 120);
- }
- CATCH(CMemoryException, e)
- {
- e->ReportError();
- return;
- }
- END_CATCH
- // Get the font
- CFont* pFont = m_GridCtrl.GetFont();
- LOGFONT lf;
- pFont->GetLogFont(&lf);
- // Make it true-type
- memcpy(lf.lfFaceName, _T("Arial"), 6);
- // Set the fixed row defaults as this new font
- m_GridCtrl.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
- CString str;
- GV_ITEM ItemTitle;
- ItemTitle.mask = GVIF_TEXT | GVIF_FORMAT;
- ItemTitle.nBorder = GVIS_BDR_BOTTOM;
- ItemTitle.nFormat = DT_SINGLELINE | DT_VCENTER;
- ItemTitle.row = 0;
- ItemTitle.col = 0;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("序号"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 1;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("名称"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 2;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("编码"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("A"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 4;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("B"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 5;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("C"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("D"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 7;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("RMS"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 8;
- ItemTitle.nFormat = DT_RIGHT;
- str.Format(_T("平面度"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 9;
- ItemTitle.nFormat = DT_LEFT;
- str.Format(_T("说明"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- // Plane数据访问入口
- EquipDataPlaneManager *pPlaneManager = m_pDoc->GetEquipDataPlaneManager();
- ASSERT(pPlaneManager != NULL);
- GV_ITEM Item;
- Item.mask = GVIF_TEXT | GVIF_FORMAT;
- Item.nFormat = DT_SINGLELINE | DT_VCENTER;
- int iRow = 1;
- int iIndex = 0;
- CppSQLite3Query q = pPlaneManager->Query(m_taskId, m_szEquipCode, dwItemId, dwSubitemId);
- while (!q.eof()) {
- iIndex += 1;
- // 序号
- Item.row = iRow;
- Item.col = 0;
- Item.nFormat = DT_CENTER;
- str.Format("%d", iIndex);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
-
- // 名称
- Item.row = iRow;
- Item.col = 1;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("plane_title"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // CODE
- Item.row = iRow;
- Item.col = 2;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("plane_code"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // A
- Item.row = iRow;
- Item.col = 3;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_a"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // B
- Item.row = iRow;
- Item.col = 4;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_b"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // C
- Item.row = iRow;
- Item.col = 5;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_c"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // D
- Item.row = iRow;
- Item.col = 6;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_d"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // RMS
- Item.row = iRow;
- Item.col = 7;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_rms"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 平面度
- Item.row = iRow;
- Item.col = 8;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("plane_flatness"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // DESC
- Item.row = iRow;
- Item.col = 9;
- Item.nFormat = DT_LEFT;
- str.Format("%s", q.getStringField("plane_desc"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- iRow++;
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :ShowCircleData
- 功能描述 :显示数据-圆
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowCircleData(DWORD dwItemId, DWORD dwSubitemId)
- {
- TRY
- {
- m_GridCtrl.SetColumnCount(10);
- m_GridCtrl.SetFixedRowCount(2);
- m_GridCtrl.SetFixedColumnCount(1);
- m_GridCtrl.SetColumnWidth(0, 40);
- m_GridCtrl.SetColumnWidth(1, 120);
- m_GridCtrl.SetColumnWidth(2, 120);
- m_GridCtrl.SetColumnWidth(3, 100);
- m_GridCtrl.SetColumnWidth(4, 100);
- m_GridCtrl.SetColumnWidth(5, 100);
- m_GridCtrl.SetColumnWidth(6, 100);
- m_GridCtrl.SetColumnWidth(7, 100);
- m_GridCtrl.SetColumnWidth(8, 100);
- m_GridCtrl.SetColumnWidth(9, 120);
- }
- CATCH(CMemoryException, e)
- {
- e->ReportError();
- return;
- }
- END_CATCH
- // Get the font
- CFont* pFont = m_GridCtrl.GetFont();
- LOGFONT lf;
- pFont->GetLogFont(&lf);
- // Make it true-type
- memcpy(lf.lfFaceName, _T("Arial"), 6);
- // Set the fixed row defaults as this new font
- m_GridCtrl.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
- CString str;
- GV_ITEM ItemTitle;
- ItemTitle.mask = GVIF_TEXT | GVIF_FORMAT;
- ItemTitle.nBorder = GVIS_BDR_BOTTOM;
- ItemTitle.nFormat = DT_SINGLELINE | DT_VCENTER;
- ItemTitle.row = 0;
- ItemTitle.col = 0;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("序号");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 0, 1, 0);
- ItemTitle.row = 0;
- ItemTitle.col = 1;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("名称");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 1, 1, 1);
- ItemTitle.row = 0;
- ItemTitle.col = 2;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("编码");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 2, 1, 2);
- ItemTitle.row = 0;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("圆心");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 3, 0, 5);
- CString szX;
- CString szY;
- CString szZ;
- if (m_iCS == 0) {
- szX.Format("%s", "X");
- szY.Format("%s", "Y");
- szZ.Format("%s", "Z");
- }
- else if (m_iCS == 1)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "φ");
- }
- else if (m_iCS == 2)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "Z");
- }
- ItemTitle.row = 1;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 4;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 5;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("半径");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 6, 1, 6);
- ItemTitle.row = 0;
- ItemTitle.col = 7;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("RMS");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 7, 1, 7);
- ItemTitle.row = 0;
- ItemTitle.col = 8;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("圆度");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 8, 1, 8);
- ItemTitle.row = 0;
- ItemTitle.col = 9;
- ItemTitle.nFormat = DT_LEFT;
- ItemTitle.strText = _T("说明");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 9, 1, 9);
- // Circle数据访问入口
- EquipDataCircleManager *pCircleManager = m_pDoc->GetEquipDataCircleManager();
- ASSERT(pCircleManager != NULL);
- GV_ITEM Item;
- Item.mask = GVIF_TEXT | GVIF_FORMAT;
- Item.nFormat = DT_SINGLELINE | DT_VCENTER;
- int iRow = 2;
- int iIndex = 0;
- CppSQLite3Query q = pCircleManager->Query(m_taskId, m_szEquipCode,dwItemId, dwSubitemId);
- while (!q.eof()) {
- iIndex += 1;
- // 序号
- Item.row = iRow;
- Item.col = 0;
- Item.nFormat = DT_CENTER;
- str.Format("%d", iIndex);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 名称
- Item.row = iRow;
- Item.col = 1;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("circle_title"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // CODE
- Item.row = iRow;
- Item.col = 2;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("circle_code"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 圆心作坐标系切换
- DOUBLE x = q.getFloatField("circle_center_x");
- DOUBLE y = q.getFloatField("circle_center_y");
- DOUBLE z = q.getFloatField("circle_center_z");
- CoordCartesian ctsPoint;
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 圆心 - X
- Item.row = iRow;
- Item.col = 3;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 圆心 - Y
- Item.row = iRow;
- Item.col = 4;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 圆心 - Z
- Item.row = iRow;
- Item.col = 5;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 半径
- Item.row = iRow;
- Item.col = 6;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("circle_radius"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // RMS
- Item.row = iRow;
- Item.col = 7;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("circle_rms"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 圆度
- Item.row = iRow;
- Item.col = 8;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("circle_roundness"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // DESC
- Item.row = iRow;
- Item.col = 9;
- Item.nFormat = DT_LEFT;
- str.Format("%s", q.getStringField("circle_desc"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- iRow++;
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :ShowLineData
- 功能描述 :显示数据-直线
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowLineData(DWORD dwItemId, DWORD dwSubitemId)
- {
-
- TRY
- {
- m_GridCtrl.SetColumnCount(14);
- m_GridCtrl.SetFixedRowCount(2);
- m_GridCtrl.SetFixedColumnCount(1);
- m_GridCtrl.SetColumnWidth(0, 40);
- m_GridCtrl.SetColumnWidth(1, 100);
- m_GridCtrl.SetColumnWidth(2, 100);
- m_GridCtrl.SetColumnWidth(3, 70);
- m_GridCtrl.SetColumnWidth(4, 70);
- m_GridCtrl.SetColumnWidth(5, 70);
- m_GridCtrl.SetColumnWidth(6, 70);
- m_GridCtrl.SetColumnWidth(7, 70);
- m_GridCtrl.SetColumnWidth(8, 70);
- m_GridCtrl.SetColumnWidth(9, 70);
- m_GridCtrl.SetColumnWidth(10, 70);
- m_GridCtrl.SetColumnWidth(11, 70);
- m_GridCtrl.SetColumnWidth(12, 70);
- m_GridCtrl.SetColumnWidth(13, 100);
- }
- CATCH(CMemoryException, e)
- {
- e->ReportError();
- return;
- }
- END_CATCH
- // 坐标系参数名称
- CString szX;
- CString szY;
- CString szZ;
- if (m_iCS == 0) {
- szX.Format("%s", "X");
- szY.Format("%s", "Y");
- szZ.Format("%s", "Z");
- }
- else if (m_iCS == 1)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "φ");
- }
- else if (m_iCS == 2)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "Z");
- }
- // Get the font
- CFont* pFont = m_GridCtrl.GetFont();
- LOGFONT lf;
- pFont->GetLogFont(&lf);
- // Make it true-type
- memcpy(lf.lfFaceName, _T("Arial"), 6);
- // Set the fixed row defaults as this new font
- m_GridCtrl.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
- CString str;
- GV_ITEM ItemTitle;
- ItemTitle.mask = GVIF_TEXT | GVIF_FORMAT;
- ItemTitle.nBorder = GVIS_BDR_BOTTOM;
- ItemTitle.nFormat = DT_SINGLELINE | DT_VCENTER;
- ItemTitle.row = 0;
- ItemTitle.col = 0;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("序号"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 0, 1, 0);
- ItemTitle.row = 0;
- ItemTitle.col = 1;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("名称"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 1, 1, 1);
- ItemTitle.row = 0;
- ItemTitle.col = 2;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("编码"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 2, 1, 2);
- ItemTitle.row = 0;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("向量"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 3, 0, 5);
- ItemTitle.row = 1;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 4;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 5;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("起点");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 6, 0, 8);
- ItemTitle.row = 1;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 7;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 8;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 9;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("终点");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 9, 0, 11);
- ItemTitle.row = 1;
- ItemTitle.col = 9;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 10;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 11;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 12;
- ItemTitle.nFormat = DT_CENTER;
- str.Format(_T("长度"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 12, 1, 12);
- ItemTitle.row = 0;
- ItemTitle.col = 13;
- ItemTitle.nFormat = DT_LEFT;
- str.Format(_T("说明"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 13, 1, 13);
- // LINE数据访问入口
- EquipDataLineManager *pLineManager = m_pDoc->GetEquipDataLineManager();
- ASSERT(pLineManager != NULL);
- GV_ITEM Item;
- Item.mask = GVIF_TEXT | GVIF_FORMAT;
- Item.nFormat = DT_SINGLELINE | DT_VCENTER;
- int iRow = 2;
- int iIndex = 0;
- CppSQLite3Query q = pLineManager->Query(m_taskId, m_szEquipCode, dwItemId, dwSubitemId);
- while (!q.eof()) {
- iIndex += 1;
- // 序号
- Item.row = iRow;
- Item.col = 0;
- Item.nFormat = DT_CENTER;
- str.Format("%d", iIndex);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 名称
- Item.row = iRow;
- Item.col = 1;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("line_title"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // CODE
- Item.row = iRow;
- Item.col = 2;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("line_code"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /***********************************************************************************/
- // 向量进行坐标系切换
- DOUBLE x = q.getFloatField("line_vec_x");
- DOUBLE y = q.getFloatField("line_vec_y");
- DOUBLE z = q.getFloatField("line_vec_z");
- CoordCartesian ctsPoint;
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 向量 - X
- Item.row = iRow;
- Item.col = 3;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 向量 - Y
- Item.row = iRow;
- Item.col = 4;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 向量 - Z
- Item.row = iRow;
- Item.col = 5;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /***********************************************************************************/
- // 起点进行坐标系切换
- x = q.getFloatField("line_start_x");
- y = q.getFloatField("line_start_y");
- z = q.getFloatField("line_start_z");
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 起点 - X
- Item.row = iRow;
- Item.col = 6;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 起点 - Y
- Item.row = iRow;
- Item.col = 7;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 起点 - Z
- Item.row = iRow;
- Item.col = 8;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /********************************************************************************/
- // 终点进行坐标系切换
- x = q.getFloatField("line_end_x");
- y = q.getFloatField("line_end_y");
- z = q.getFloatField("line_end_z");
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 终点 - X
- Item.row = iRow;
- Item.col = 9;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点 - Y
- Item.row = iRow;
- Item.col = 10;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点 - Z
- Item.row = iRow;
- Item.col = 11;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /***********************************************************************************/
- // 长度
- Item.row = iRow;
- Item.col = 12;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("line_length"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 说明
- Item.row = iRow;
- Item.col = 13;
- Item.nFormat = DT_LEFT;
- str.Format("%s", q.getStringField("line_desc"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- iRow++;
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :ShowPointsData
- 功能描述 :显示数据-点
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowPointData(DWORD dwItemId, DWORD dwSubitemId)
- {
- TRY
- {
- m_GridCtrl.SetColumnCount(10);
- m_GridCtrl.SetFixedRowCount(2);
- m_GridCtrl.SetFixedColumnCount(1);
- m_GridCtrl.SetColumnWidth(0, 40);
- m_GridCtrl.SetColumnWidth(1, 100);
- m_GridCtrl.SetColumnWidth(2, 100);
- m_GridCtrl.SetColumnWidth(3, 80);
- m_GridCtrl.SetColumnWidth(4, 80);
- m_GridCtrl.SetColumnWidth(5, 80);
- m_GridCtrl.SetColumnWidth(6, 80);
- m_GridCtrl.SetColumnWidth(7, 80);
- m_GridCtrl.SetColumnWidth(8, 80);
- m_GridCtrl.SetColumnWidth(9, 100);
- }
- CATCH(CMemoryException, e)
- {
- e->ReportError();
- return;
- }
- END_CATCH
- // 坐标系参数名称
- CString szX;
- CString szY;
- CString szZ;
- if (m_iCS == 0) {
- szX.Format("%s", "X");
- szY.Format("%s", "Y");
- szZ.Format("%s", "Z");
- }
- else if (m_iCS == 1)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "φ");
- }
- else if (m_iCS == 2)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "Z");
- }
- // Get the font
- CFont* pFont = m_GridCtrl.GetFont();
- LOGFONT lf;
- pFont->GetLogFont(&lf);
- // Make it true-type
- memcpy(lf.lfFaceName, _T("Arial"), 6);
- // Set the fixed row defaults as this new font
- m_GridCtrl.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
- CString str;
- GV_ITEM ItemTitle;
- ItemTitle.mask = GVIF_TEXT | GVIF_FORMAT;
- ItemTitle.nBorder = GVIS_BDR_BOTTOM;
- ItemTitle.nFormat = DT_SINGLELINE | DT_VCENTER;
- ItemTitle.row = 0;
- ItemTitle.col = 0;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = _T("序号");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 0, 1, 0);
- ItemTitle.row = 0;
- ItemTitle.col = 1;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = _T("名称");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 1, 1, 1);
- ItemTitle.row = 0;
- ItemTitle.col = 2;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = _T("编码");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 2, 1, 2);
- ItemTitle.row = 0;
- ItemTitle.col = 3;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = _T("理论值");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 3, 0, 5);
- ItemTitle.row = 1;
- ItemTitle.col = 3;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 4;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 5;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 6;
- ItemTitle.nFormat |= DT_CENTER;
- str.Format(_T("实测值"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 6, 0, 8);
- ItemTitle.row = 1;
- ItemTitle.col = 6;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 7;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 8;
- ItemTitle.nFormat |= DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 9;
- ItemTitle.nFormat |= DT_LEFT;
- str.Format(_T("说明"));
- ItemTitle.strText = str;
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 9, 1, 9);
- // POINT数据访问入口
- EquipDataPointManager *pPointManager = m_pDoc->GetEquipDataPointManager();
- ASSERT(pPointManager != NULL);
- GV_ITEM Item;
- Item.mask = GVIF_TEXT | GVIF_FORMAT;
- Item.nFormat = DT_SINGLELINE | DT_VCENTER;
- int iRow = 2;
- int iIndex = 0;
- CppSQLite3Query q = pPointManager->Query(m_taskId, m_szEquipCode, dwItemId, dwSubitemId);
- while (!q.eof()) {
- iIndex += 1;
- // 序号
- Item.row = iRow;
- Item.col = 0;
- Item.nFormat |= DT_CENTER;
- str.Format("%d", iIndex);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 名称
- Item.row = iRow;
- Item.col = 1;
- Item.nFormat |= DT_CENTER;
- str.Format("%s", q.getStringField("point_title"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // CODE
- Item.row = iRow;
- Item.col = 2;
- Item.nFormat |= DT_CENTER;
- str.Format("%s", q.getStringField("point_code"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /***********************************************************************************/
- // 向量进行坐标系切换
- DOUBLE x = q.getFloatField("point_e_x");
- DOUBLE y = q.getFloatField("point_e_y");
- DOUBLE z = q.getFloatField("point_e_z");
- CoordCartesian ctsPoint;
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 理论 - X
- Item.row = iRow;
- Item.col = 3;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 理论 - Y
- Item.row = iRow;
- Item.col = 4;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 理论 - Z
- Item.row = iRow;
- Item.col = 5;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /**************************************************************************/
- // 终点进行坐标系切换
- x = q.getFloatField("point_a_x");
- y = q.getFloatField("point_a_y");
- z = q.getFloatField("point_a_z");
- ctsPoint.x = x;
- ctsPoint.y = y;
- ctsPoint.z = z;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint;
- CS::CartesianToSpherical(ctsPoint, cdsPoint);
- x = cdsPoint.r;
- y = cdsPoint.θ;
- z = cdsPoint.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint;
- CS::CartesianToCylindrical(ctsPoint, ccdPoint);
- x = ccdPoint.r;
- y = ccdPoint.θ;
- z = ccdPoint.z;
- }
- // 实测 - X
- Item.row = iRow;
- Item.col = 6;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", x);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 实测 - Y
- Item.row = iRow;
- Item.col = 7;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", y);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 实测 - Z
- Item.row = iRow;
- Item.col = 8;
- Item.nFormat |= DT_RIGHT;
- str.Format("%.3f", z);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- /*************************************************************************/
- // 说明
- Item.row = iRow;
- Item.col = 9;
- Item.nFormat |= DT_LEFT;
- str.Format("%s", q.getStringField("point_desc"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- iRow++;
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :ShowCylinderData
- 功能描述 :显示数据-圆柱
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::ShowCylinderData(DWORD dwItemId, DWORD dwSubitemId)
- {
- TRY
- {
- m_GridCtrl.SetColumnCount(12);
- m_GridCtrl.SetFixedRowCount(2);
- m_GridCtrl.SetFixedColumnCount(1);
- m_GridCtrl.SetColumnWidth(0, 40);
- m_GridCtrl.SetColumnWidth(1, 120);
- m_GridCtrl.SetColumnWidth(2, 120);
- m_GridCtrl.SetColumnWidth(3, 100);
- m_GridCtrl.SetColumnWidth(4, 100);
- m_GridCtrl.SetColumnWidth(5, 100);
- m_GridCtrl.SetColumnWidth(6, 100);
- m_GridCtrl.SetColumnWidth(7, 100);
- m_GridCtrl.SetColumnWidth(8, 120);
- m_GridCtrl.SetColumnWidth(9, 120);
- m_GridCtrl.SetColumnWidth(10, 120);
- m_GridCtrl.SetColumnWidth(11, 120);
- }
- CATCH(CMemoryException, e)
- {
- e->ReportError();
- return;
- }
- END_CATCH
- // Get the font
- CFont* pFont = m_GridCtrl.GetFont();
- LOGFONT lf;
- pFont->GetLogFont(&lf);
- // Make it true-type
- memcpy(lf.lfFaceName, _T("Arial"), 6);
- // Set the fixed row defaults as this new font
- m_GridCtrl.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
- CString str;
- GV_ITEM ItemTitle;
- ItemTitle.mask = GVIF_TEXT | GVIF_FORMAT;
- ItemTitle.nBorder = GVIS_BDR_BOTTOM;
- ItemTitle.nFormat = DT_SINGLELINE | DT_VCENTER;
- ItemTitle.row = 0;
- ItemTitle.col = 0;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("序号");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 0, 1, 0);
- ItemTitle.row = 0;
- ItemTitle.col = 1;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("名称");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 1, 1, 1);
- ItemTitle.row = 0;
- ItemTitle.col = 2;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("编码");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 2, 1, 2);
- ItemTitle.row = 0;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("终点1");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 3, 0, 5);
- CString szX;
- CString szY;
- CString szZ;
- if (m_iCS == 0) {
- szX.Format("%s", "X");
- szY.Format("%s", "Y");
- szZ.Format("%s", "Z");
- }
- else if (m_iCS == 1)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "φ");
- }
- else if (m_iCS == 2)
- {
- szX.Format("%s", "R");
- szY.Format("%s", "θ");
- szZ.Format("%s", "Z");
- }
- ItemTitle.row = 1;
- ItemTitle.col = 3;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 4;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 5;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("终点2");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 6, 0, 8);
- ItemTitle.row = 1;
- ItemTitle.col = 6;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szX;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 7;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szY;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 1;
- ItemTitle.col = 8;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = szZ;
- m_GridCtrl.SetItem(&ItemTitle);
- ItemTitle.row = 0;
- ItemTitle.col = 9;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("半径");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 9, 1, 9);
- ItemTitle.row = 0;
- ItemTitle.col = 10;
- ItemTitle.nFormat = DT_CENTER;
- ItemTitle.strText = _T("长度");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 10, 1, 10);
- ItemTitle.row = 0;
- ItemTitle.col = 11;
- ItemTitle.nFormat = DT_LEFT;
- ItemTitle.strText = _T("说明");
- m_GridCtrl.SetItem(&ItemTitle);
- m_GridCtrl.MergeCells(0, 11, 1, 11);
- // Circle数据访问入口
- EquipDataCylinderManager *pCylinderManager = m_pDoc->GetEquipDataCylinderManager();
- ASSERT(pCylinderManager != NULL);
- GV_ITEM Item;
- Item.mask = GVIF_TEXT | GVIF_FORMAT;
- Item.nFormat = DT_SINGLELINE | DT_VCENTER;
- int iRow = 2;
- int iIndex = 0;
- CppSQLite3Query q = pCylinderManager->Query(m_taskId, m_szEquipCode, dwItemId, dwSubitemId);
- while (!q.eof()) {
- iIndex += 1;
- // 序号
- Item.row = iRow;
- Item.col = 0;
- Item.nFormat = DT_CENTER;
- str.Format("%d", iIndex);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 名称
- Item.row = iRow;
- Item.col = 1;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("cylinder_title"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // CODE
- Item.row = iRow;
- Item.col = 2;
- Item.nFormat = DT_CENTER;
- str.Format("%s", q.getStringField("cylinder_code"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点1作坐标系切换
- DOUBLE x1 = q.getFloatField("point1_x");
- DOUBLE y1 = q.getFloatField("point1_y");
- DOUBLE z1 = q.getFloatField("point1_z");
- DOUBLE x2 = q.getFloatField("point2_x");
- DOUBLE y2 = q.getFloatField("point2_y");
- DOUBLE z2 = q.getFloatField("point2_z");
- CoordCartesian ctsPoint1, ctsPoint2;
- ctsPoint1.x = x1;
- ctsPoint1.y = y1;
- ctsPoint1.z = z1;
- ctsPoint2.x = x1;
- ctsPoint2.y = y1;
- ctsPoint2.z = z1;
- if (m_iCS == 1)
- {
- CoordSpherical cdsPoint1, cdsPoint2;
- CS::CartesianToSpherical(ctsPoint1, cdsPoint1);
- x1 = cdsPoint1.r;
- y1 = cdsPoint1.θ;
- z1 = cdsPoint1.φ;
- CS::CartesianToSpherical(ctsPoint2, cdsPoint2);
- x2 = cdsPoint2.r;
- y2 = cdsPoint2.θ;
- z2 = cdsPoint2.φ;
- }
- else if (m_iCS == 2)
- {
- CoordCylindrical ccdPoint1, ccdPoint2;
- CS::CartesianToCylindrical(ctsPoint1, ccdPoint1);
- x1 = ccdPoint1.r;
- y1 = ccdPoint1.θ;
- z1 = ccdPoint1.z;
- CS::CartesianToCylindrical(ctsPoint2, ccdPoint2);
- x2 = ccdPoint2.r;
- y2 = ccdPoint2.θ;
- z2 = ccdPoint2.z;
- }
- // 终点1 - X
- Item.row = iRow;
- Item.col = 3;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x1);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点1 - Y
- Item.row = iRow;
- Item.col = 4;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y1);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点1 - Z
- Item.row = iRow;
- Item.col = 5;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z1);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点2 - X
- Item.row = iRow;
- Item.col = 6;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", x2);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点2 - Y
- Item.row = iRow;
- Item.col = 7;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", y2);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 终点2 - Z
- Item.row = iRow;
- Item.col = 8;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", z2);
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // 半径
- Item.row = iRow;
- Item.col = 9;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("cylinder_radius"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // Length
- Item.row = iRow;
- Item.col = 10;
- Item.nFormat = DT_RIGHT;
- str.Format("%.3f", q.getFloatField("cylinder_length"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- // DESC
- Item.row = iRow;
- Item.col = 11;
- Item.nFormat = DT_LEFT;
- str.Format("%s", q.getStringField("cylinder_desc"));
- Item.strText = str;
- m_GridCtrl.SetItem(&Item);
- iRow++;
- q.nextRow();
- }
- q.finalize();
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnCamera
- 功能描述 :事件处理-相机标定
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnCamera()
- {
- CameraConfigDlg dlg(this, m_szEquipTypeCode, m_szEquipCode);
- if (dlg.DoModal() == IDOK) {
-
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnCompare
- 功能描述 :事件处理-包络比对
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnCompare()
- {
- EnvelopeDlg dlg(this, m_taskId);
- if (dlg.DoModal() == IDOK) {
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnGuide
- 功能描述 :事件处理-打开帮助引导对话框
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnGuide()
- {
- CString szPath = "";
- szPath.Append(Utils::GetLocalUrlDir());
- szPath.Append("/Guide/");
- if (m_szEquipTypeCode.IsEmpty())
- {
- return;
- }
- szPath.Append(m_szEquipTypeCode);
- szPath.Append("/index.html");
- BOOL bRet = Utils::IsFileExist(szPath);
- if (!bRet)
- {
- MessageBox("系统安装目录下没有准备引导帮助文档,请联系管理员!");
- return;
- }
- GuideDlg dlg(this, m_szEquipTypeCode);
- if (dlg.DoModal() == IDOK) {
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnReport
- 功能描述 :事件处理-生成报告
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnReport()
- {
- StaticReport dlg(this, m_taskId);
- if (dlg.DoModal() == IDOK) {
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnDestroy
- 功能描述 :事件处理-窗口销毁
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnDestroy()
- {
- KillTimer(MEASURE_TIMER);
- CFormView::OnDestroy();
- }
- /**************************************************************************************************
- 函 数 名 :OnSize
- 功能描述 :事件处理-WMSIZE
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnSize(UINT nType, int cx, int cy)
- {
- CFormView::OnSize(nType, cx, cy);
- if (m_bIsAttached)
- {
- RelayoutIDPMS();
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnCbnSelchangeComboCs
- 功能描述 :事件处理-坐标系切换
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnCbnSelchangeComboCS()
- {
- m_iCS = m_Combo_CS.GetCurSel();
- if (m_iShowType == 1)
- ShowPointData(m_iShowType, m_dwSubItemId);
- else if (m_iShowType == 2)
- ShowPlaneData(m_iShowType, m_dwSubItemId);
- else if (m_iShowType == 3)
- ShowCircleData(m_iShowType, m_dwSubItemId);
- else if (m_iShowType == 4)
- ShowLineData(m_iShowType, m_dwSubItemId);
- else
- ShowCylinderData(m_iShowType, m_dwSubItemId);
-
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnBack
- 功能描述 :事件处理-BACK
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnBack()
- {
- this->ResetFormData();
- CMainFrame *pMain = (CMainFrame*)AfxGetApp()->m_pMainWnd;
- ::PostMessage(pMain->m_hWnd, WM_BACK_TO_START, NULL, NULL);
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedBtnMesh
- 功能描述 :事件处理-网形优化
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnIPN()
- {
- IPNDlg dlg(this);
- if (dlg.DoModal()) {
- }
- }
- /**************************************************************************************************
- 函 数 名 :OnMeasureSuccess
- 功能描述 :测量成功-WM-SUCCESS自定义消息处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- LRESULT CStaticTask::OnMeasureSuccess(WPARAM wp, LPARAM lp)
- {
- DMSResponse *pMsg = (DMSResponse *)wp;
- if (pMsg != NULL)
- {
- CString szMsg(pMsg->szMsg);
- if (!szMsg.IsEmpty()) {
- MessageBox(szMsg);
- }
- Utils::DMS_FreeMsg(pMsg);
- }
- // 更新任务为完成状态
- TaskManager *pTaskManager = m_pDoc->GetTaskManager();
- ASSERT(pTaskManager != NULL);
- pTaskManager->UpdateStatus(m_taskId, 1); // 1表示完成状态;
- // 初始化设备静态数据
- InitTreeCtrlData();
- // Task -> Success Status
- m_iTaskStatus = 2;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
-
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnMeasureFailure
- 功能描述 :测量失败-WM-FAILURE自定义消息处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- LRESULT CStaticTask::OnMeasureFailure(WPARAM wp, LPARAM lp)
- {
- LOG::D("StaticTask:: OnMeasureFailure");
- DMSResponse *pMsg = (DMSResponse *)wp;
- if (pMsg != NULL)
- {
- CString szMsg(pMsg->szMsg);
- if (!szMsg.IsEmpty()) {
- MessageBox(szMsg);
- }
- Utils::DMS_FreeMsg(pMsg);
- }
- // 设置任务为初始状态
- m_iTaskStatus = 0;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnMeasureSuccess
- 功能描述 :测量成功-WM-SUCCESS自定义消息处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- LRESULT CStaticTask::OnMeasureUpdateSuccess(WPARAM wp, LPARAM lp)
- {
- DMSResponse *pMsg = (DMSResponse *)wp;
- if (pMsg != NULL)
- {
- CString szMsg(pMsg->szMsg);
- if (!szMsg.IsEmpty()) {
- MessageBox(szMsg);
- }
- Utils::DMS_FreeMsg(pMsg);
- }
- // 更新任务为完成状态
- TaskManager *pTaskManager = m_pDoc->GetTaskManager();
- ASSERT(pTaskManager != NULL);
- pTaskManager->UpdateStatus(m_taskId, 1); // 1表示完成状态;
- // 初始化设备静态数据
- InitTreeCtrlData();
- // Task -> Success Status
- m_iTaskStatus = 2;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnMeasureFailure
- 功能描述 :测量失败-WM-FAILURE自定义消息处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- LRESULT CStaticTask::OnMeasureUpdateFailure(WPARAM wp, LPARAM lp)
- {
- LOG::D("StaticTask:: OnMeasureUpdateFailure");
- DMSResponse *pMsg = (DMSResponse *)wp;
- if (pMsg != NULL)
- {
- CString szMsg(pMsg->szMsg);
- if (!szMsg.IsEmpty()) {
- MessageBox(szMsg);
- }
- Utils::DMS_FreeMsg(pMsg);
- }
- // 设置任务为初始状态
- m_iTaskStatus = 2;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedAgv
- 功能描述 :事件处理-AGV自动化测量
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::OnBnClickedAgv()
- {
- /*
- StaticData data(m_szEquipTypeCode, m_szEquipCode);
- data.LoadDataFromFile("D:\\BDA3D2.txt");
- data.PrintData();
- data.SaveToDB();
- data.Clear();
- */
- DlgTest dlg;
- dlg.DoModal();
- }
- /**************************************************************************************************
- 函 数 名 :OnTvnEndlabeleditTreeData
- 功能描述 :事件处理-自动测量
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnAuto()
- {
- CString szResult;
- // 从IDPMS获取数据
- IDPMSManager *pManager = IDPMSManager::GetManager();
- // 启动IDPMS多线程模式
- BOOL bRet = pManager->StartStaticProcThread(this, m_taskId, m_szEquipTypeCode, m_szEquipCode);
- if (!bRet)
- {
- MessageBox("从IDPMS获取数据失败!");
- return;
- }
- // 设置任务为运行状态
- m_iTaskStatus = 1;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- }
- /**************************************************************************************************
- 函 数 名 :OnTvnEndlabeleditTreeData
- 功能描述 :事件处理-自动测量
- 输入参数 :略
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void CStaticTask::OnBnClickedBtnUpdate()
- {
- CString szResult;
- // 从IDPMS获取数据
- IDPMSManager *pManager = IDPMSManager::GetManager();
- // 启动IDPMS多线程模式
- BOOL bRet = pManager->StartStaticDataProcThread(this, m_taskId, m_szEquipTypeCode, m_szEquipCode);
- if (!bRet)
- {
- MessageBox("更新失败!");
- return;
- }
- // 设置任务为运行状态
- m_iTaskStatus = 1;
-
- m_Btn_Update.SetWindowText("处理中...");
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- }
- /**************************************************************************************************
- 函 数 名 :OnBnClickedMbtnStaticCamera
- 功能描述 :相机标定菜单事件处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::OnBnClickedMbtnStaticCamera()
- {
- int iOpt = m_MBtn_Cam.m_nMenuResult;
- int iCam = 1;
- if (iOpt == IDM_CAM_1) iCam = 1;
- else iCam = 2;
- // 启动IDPMS多线程模式
- IDPMSManager *pManager = IDPMSManager::GetManager();
- BOOL bRet = pManager->SingleCameraConfigProcThread(this, iCam);
- return;
- }
- /**************************************************************************************************
- 函 数 名 :OnCamConfigSuccess
- 功能描述 :WM_CAM_COFNIG_SUCCESS相机标定成功处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- afx_msg LRESULT CStaticTask::OnCamConfigSuccess(WPARAM wp, LPARAM lp)
- {
- DMSResponse *pMsg = (DMSResponse *)wp;
- CString szMsg;
- if (pMsg != NULL)
- {
- szMsg.Format("%s", pMsg->szMsg);
- CameraInfo dlg(this, szMsg);
- dlg.DoModal();
- Utils::DMS_FreeMsg(pMsg);
- }
- else
- {
- szMsg.Format("%s", _T("执行成功!"));
- MessageBox(szMsg);
- }
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnCamConfigFailure
- 功能描述 :WM_CAM_COFNIG_FAILURE相机标定失败处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- afx_msg LRESULT CStaticTask::OnCamConfigFailure(WPARAM wp, LPARAM lp)
- {
- DMSResponse *pMsg = (DMSResponse *)wp;
- CString szMsg;
- if (pMsg != NULL)
- {
- szMsg.Format("%s", pMsg->szMsg);
- Utils::DMS_FreeMsg(pMsg);
- }
- else
- {
- szMsg.Format("%s", _T("执行失败!"));
-
- }
- MessageBox(szMsg);
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnRestartIDPMS
- 功能描述 :WM_RESTART_IDPMS处理
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- afx_msg LRESULT CStaticTask::OnReStartIDPMS(WPARAM wp, LPARAM lp)
- {
- LOG::D("StaticTask:: OnReStartIDPMS");
- // 从IDPMS获取数据
- IDPMSManager *pManager = IDPMSManager::GetManager();
- BOOL bRet = pManager->StartIDPMS2();
- if (bRet)
- {
- AttachIDPMS();
- RelayoutIDPMS();
- // 设置任务为运行状态
- m_iTaskStatus = 0;
- // 设置UI栏位状态
- ShowTaskFieldStatus();
- }
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OnTimer
- 功能描述 :定时器消息
- 输入参数 :略
- 输出参数 :略
- 返 回 值 :略
- **************************************************************************************************/
- void CStaticTask::OnTimer(UINT_PTR nIDEvent)
- {
- switch (nIDEvent) {
- case MEASURE_TIMER:
- ::InvalidateRect(g_hIDPMSHWnd, NULL, TRUE);
- ::UpdateWindow(g_hIDPMSHWnd);
- break;
- }
- CFormView::OnTimer(nIDEvent);
- }
|