| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205 |
- /**************************************************************************************************
- 版本所有(C), 2020-2022, 北京普达迪泰
- ***************************************************************************************************
- 文 件 名: StaticData.h
- 功能描述: Static Task任务报告数据
- 版 本 号: 1.00初版
- 作 者: HYF
- 生成日期; 2021-12-20
- 最近修改:
- 函数列表:
- 修改历史:
- 1.日 期 :2021-12-20
- 作 者 : HYF
- 修改内容 : 创建文件
- **************************************************************************************************/
- #include "pch.h"
- #include <afx.h>
- #include <afxtempl.h>
- #include "StaticData.h"
- #include "EquipDataManager.h"
- #include "DictManager.h"
- #include "EquipDataPointManager.h"
- #include "EquipDataCircleManager.h"
- #include "EquipDataPlaneManager.h"
- #include "EquipDataLineManager.h"
- #include "EquipDataCylinderManager.h"
- #include "EquipDataAngleManager.h"
- #include "EquipDataPointRelatedManager.h"
- #include "EquipData.h"
- #include "EquipDataPlane.h"
- #include "EquipDataCircle.h"
- #include "EquipDataLine.h"
- #include "EquipDataPoint.h"
- #include "EquipDataCylinder.h"
- #include "EquipDataAngle.h"
- #include "EquipDataPointRelated.h"
- #include "Utils.h"
- // StaticData
- StaticData::StaticData(DWORD iTaskId, LPCTSTR szEquipTypeCode, LPCTSTR szEquipCode)
- : m_iTaskId(iTaskId)
- , m_szEquipTypeCode(szEquipTypeCode)
- , m_szEquipCode(szEquipCode)
- {
- m_pDictManager = new DictManager();
- }
- StaticData::~StaticData()
- {
- if (NULL != m_pDictManager) {
- delete m_pDictManager;
- m_pDictManager = NULL;
- }
- }
- /**************************************************************************************************
- 函 数 名 :LoadDataFromFile
- 功能描述 :从IDPMS报告加载数据
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::LoadDataFromFile(LPCTSTR szFile)
- {
- CStdioFile file;
- CFileException e;
- CString szErr;
- CString szFilePath;
- DWORD pos=0;
-
- if (!file.Open(szFile, CFile::typeText|CFile::modeRead))
- {
- LOG::E(_T("静态数据文件打不开"));
- return FALSE;
- }
- int iType = 1;
- int iItemId = 0;
- int iSubItemId = 0;
- BOOL bRet = TRUE;
- CString szLine;
- while (TRUE) {
- if (!file.ReadString(szLine)) break;
- if ((szLine.Find(_T("点名称")) >= 0) && (iType == 1))
- {
- AddEquipItemData(iType);
- bRet = this->ParsePoint(&file);
- if (!bRet) break;
- }
- else if (szLine.Find(_T("点残差")) >= 0)
- {
- bRet = this->ParsePointRelated(&file, iType);
- if (!bRet) break;
- }
- else if (szLine.Find(_T("平面:")) >= 0)
- {
- iType = 2;
- AddEquipItemData(iType);
- bRet = this->ParsePlane(&file, szLine);
- if (!bRet) break;
- }
- else if (szLine.Find(_T("Circle:")) >= 0)
- {
- iType = 3;
- AddEquipItemData(iType);
- bRet = this->ParseCircle(&file, szLine);
- if (!bRet) break;
- }
- else if (szLine.Find(_T("直线:")) >= 0)
- {
- iType = 4;
- AddEquipItemData(iType);
- bRet = this->ParseLine(&file, szLine);
- if (!bRet) break;
- }
- else if (szLine.Find(_T("圆柱:")) >= 0)
- {
- iType = 5;
- AddEquipItemData(iType);
- bRet = this->ParseCylinder(&file, szLine);
- if (!bRet) break;
- }
-
- }
-
- // 关闭文件
- file.Close();
- return bRet;
- }
- /**************************************************************************************************
- 函 数 名 :ParsePoint
- 功能描述 :解析Point行
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParsePoint(CStdioFile *pFile)
- {
- EquipDataPoint *pPoint = NULL;
- CStringArray szArray;
- CString szLine;
- DWORD iSubItemId = 0;
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) return TRUE;
- int iNum = Utils::StrSplit(szLine, ' ', szArray);
- if (iNum < 2) continue;
- CString szPointTitle(szArray.GetAt(0));
- CString szPointCode(szArray.GetAt(0));
- CString szPointAX = szArray.GetAt(1);
- CString szPointAY = szArray.GetAt(2);
- CString szPointAZ = szArray.GetAt(3);
- CString szPointTotal = szArray.GetAt(7);
- DOUBLE pointAX = atof(szPointAX.GetBuffer());
- DOUBLE pointAY = atof(szPointAY.GetBuffer());
- DOUBLE pointAZ = atof(szPointAZ.GetBuffer());
- DOUBLE pointTotal = atof(szPointTotal.GetBuffer());
-
- // SubItemId
- iSubItemId = (DWORD)m_PointList.GetCount() + 1;
- // 新增
- pPoint = new EquipDataPoint();
- pPoint->SetTaskId(m_iTaskId);
- pPoint->SetEquipCode(m_szEquipCode);
- pPoint->SetItemId(1);
- pPoint->SetSubItemId(iSubItemId);
- pPoint->SetPointTitle(m_pDictManager->GetDictItemTitle(szPointCode, szPointCode));
- pPoint->SetPointCode(szPointCode);
- pPoint->SetPointAX(pointAX);
- pPoint->SetPointAY(pointAY);
- pPoint->SetPointAZ(pointAZ);
- pPoint->SetPointTotal(pointTotal);
- m_PointList.AddTail(pPoint);
- }
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :ParsePlane
- 功能描述 :解析Plane行
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParsePlane(CStdioFile *pFile, CString& szTitleLine)
- {
- CStringArray szTitleArray;
- int iNum = Utils::StrSplit(szTitleLine, ' ', szTitleArray);
- CString szPlaneCode(szTitleArray.GetAt(1));
- CStringArray szArray;
- DWORD iSubItemId = (DWORD)m_PlaneList.GetCount()+1;
- CString szLine;
- EquipDataPlane* pPlane = new EquipDataPlane();
-
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) break;
- iNum = Utils::StrSplit(szLine, ' ', szArray);
- if (iNum < 2) continue;
- CString szParam = szArray.GetAt(0);
- if (szParam.CompareNoCase("A:") == 0)
- {
- CString szA = szArray.GetAt(1);
- DOUBLE fA = atof(szA.GetBuffer());
- pPlane->SetPlaneA(fA);
- }
- else if (szParam.CompareNoCase("B:") == 0)
- {
- CString szB = szArray.GetAt(1);
- DOUBLE fB = atof(szB.GetBuffer());
- pPlane->SetPlaneB(fB);
- }
- else if (szParam.CompareNoCase("C:") == 0)
- {
- CString szC = szArray.GetAt(1);
- DOUBLE fC = atof(szC.GetBuffer());
- pPlane->SetPlaneC(fC);
- }
- else if (szParam.CompareNoCase("D:") == 0)
- {
- CString szD = szArray.GetAt(1);
- DOUBLE fD = atof(szD.GetBuffer());
- pPlane->SetPlaneD(fD);
- }
- else if (szParam.CompareNoCase("RMS:") == 0)
- {
- CString szRMS = szArray.GetAt(1);
- DOUBLE fRMS = atof(szRMS.GetBuffer());
- pPlane->SetPlaneRMS(fRMS);
- }
- }
- pPlane->SetTaskId(m_iTaskId);
- pPlane->SetEquipCode(m_szEquipCode);
- pPlane->SetPlaneTitle(m_pDictManager->GetDictItemTitle(szPlaneCode, szPlaneCode));
- pPlane->SetPlaneCode(szPlaneCode);
- pPlane->SetItemId(2);
- pPlane->SetSubItemId(iSubItemId);
- m_PlaneList.AddTail(pPlane);
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :ParseCircle
- 功能描述 :解析Circle行
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParseCircle(CStdioFile *pFile, CString& szTitleLine )
- {
- CStringArray szTitleArray;
- int iNum = Utils::StrSplit(szTitleLine, ' ', szTitleArray);
- CString szCircleCode(szTitleArray.GetAt(1));
- CStringArray szArray;
- CString szLine;
- DWORD iSubItemId = (DWORD)m_CircleList.GetCount()+1;
- EquipDataCircle *pCircle = new EquipDataCircle();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) break;
- iNum = Utils::StrSplit(szLine, ' ', szArray);
- if (iNum < 2) continue;
- CString szParam = szArray.GetAt(0);
- if (szParam.CompareNoCase("中心点:") == 0) {
- CString szCCX = szArray.GetAt(1);
- CString szCCY = szArray.GetAt(2);
- CString szCCZ = szArray.GetAt(3);
- DOUBLE fCCX = atof(szCCX.GetBuffer());
- DOUBLE fCCY = atof(szCCY.GetBuffer());
- DOUBLE fCCZ = atof(szCCZ.GetBuffer());
- pCircle->SetCircleCenterX(fCCX);
- pCircle->SetCircleCenterY(fCCY);
- pCircle->SetCircleCenterZ(fCCZ);
- }
- else if(szParam.CompareNoCase("半径:") == 0)
- {
- CString szRadius = szArray.GetAt(1);
- DOUBLE fRadius = atof(szRadius);
- pCircle->SetCircleRadius(fRadius);
- }
- else if(szParam.CompareNoCase("总RMS:") == 0)
- {
- CString szRMS = szArray.GetAt(1);
- DOUBLE fRMS = atof(szRMS);
- pCircle->SetCircleRMS(fRMS);
- }
- }
- pCircle->SetTaskId(m_iTaskId);
- pCircle->SetEquipCode(m_szEquipCode);
- pCircle->SetCircleTitle(m_pDictManager->GetDictItemTitle(szCircleCode, szCircleCode));
- pCircle->SetCircleCode(szCircleCode);
- pCircle->SetItemId(3);
- pCircle->SetSubItemId(iSubItemId);
- m_CircleList.AddTail(pCircle);
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :ParseLine
- 功能描述 :解析Line行
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParseLine(CStdioFile *pFile, CString& szTitleLine )
- {
- CStringArray szTitleArray;
- int iNum = Utils::StrSplit(szTitleLine, ' ', szTitleArray);
- CString szLineCode(szTitleArray.GetAt(1));
-
- CStringArray szArray;
- CString szLine;
- DWORD iSubItemId = (DWORD)m_LineList.GetCount()+1;
- EquipDataLine *pLine = new EquipDataLine();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) break;
- iNum = Utils::StrSplit(szLine, ' ', szArray);
- if (iNum < 2) continue;
- CString szParam = szArray.GetAt(0);
- if (szParam.CompareNoCase("方向向量:") == 0) {
- CString szVecX = szArray.GetAt(1);
- CString szVecY = szArray.GetAt(2);
- CString szVecZ = szArray.GetAt(3);
- DOUBLE fVecX = atof(szVecX.GetBuffer());
- DOUBLE fVecY = atof(szVecY.GetBuffer());
- DOUBLE fVecZ = atof(szVecZ.GetBuffer());
- pLine->SetLineVectorX(fVecX);
- pLine->SetLineVectorY(fVecY);
- pLine->SetLineVectorZ(fVecZ);
- }
- else if (szParam.CompareNoCase("终点1:") == 0) {
- CString szStartX = szArray.GetAt(1);
- CString szStartY = szArray.GetAt(2);
- CString szStartZ = szArray.GetAt(3);
- DOUBLE fStartX = atof(szStartX.GetBuffer());
- DOUBLE fStartY = atof(szStartY.GetBuffer());
- DOUBLE fStartZ = atof(szStartZ.GetBuffer());
- pLine->SetLineStartX(fStartX);
- pLine->SetLineStartY(fStartY);
- pLine->SetLineStartZ(fStartZ);
- }
- else if (szParam.CompareNoCase("终点2:") == 0) {
- CString szEndX = szArray.GetAt(1);
- CString szEndY = szArray.GetAt(2);
- CString szEndZ = szArray.GetAt(3);
- DOUBLE fEndX = atof(szEndX.GetBuffer());
- DOUBLE fEndY = atof(szEndY.GetBuffer());
- DOUBLE fEndZ = atof(szEndZ.GetBuffer());
- pLine->SetLineEndX(fEndX);
- pLine->SetLineEndY(fEndY);
- pLine->SetLineEndZ(fEndZ);
- }
- else if(szParam.CompareNoCase("长度:") == 0)
- {
- CString szLength = szArray.GetAt(1);
- DOUBLE fLength = atof(szLength);
- pLine->SetLineLength(fLength);
- }
- }
- pLine->SetTaskId(m_iTaskId);
- pLine->SetEquipCode(m_szEquipCode);
- pLine->SetLineTitle(m_pDictManager->GetDictItemTitle(szLineCode, szLineCode));
- pLine->SetLineCode(szLineCode);
- pLine->SetItemId(4);
- pLine->SetSubItemId(iSubItemId);
- m_LineList.AddTail(pLine);
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :ParseCylinder
- 功能描述 :解析Cylinder行
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParseCylinder(CStdioFile *pFile, CString& szTitleLine)
- {
- CStringArray szTitleArray;
- int iNum = Utils::StrSplit(szTitleLine, ' ', szTitleArray);
- CString szCylinderCode(szTitleArray.GetAt(1));
- CStringArray szArray;
- CString szLine;
- DWORD iSubItemId = (DWORD)m_CylinderList.GetCount()+1;
- EquipDataCylinder *pCylinder = new EquipDataCylinder();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) break;
- iNum = Utils::StrSplit(szLine, ' ', szArray);
- CString szParam = szArray.GetAt(0);
- if (szParam.CompareNoCase("终点1:") == 0) {
- CString szP1X = szArray.GetAt(1);
- CString szP1Y = szArray.GetAt(2);
- CString szP1Z = szArray.GetAt(3);
- DOUBLE fP1X = atof(szP1X.GetBuffer());
- DOUBLE fP1Y = atof(szP1Y.GetBuffer());
- DOUBLE fP1Z = atof(szP1Z.GetBuffer());
- pCylinder->SetPoint1X(fP1X);
- pCylinder->SetPoint1Y(fP1Y);
- pCylinder->SetPoint1Z(fP1Z);
- }
- else if (szParam.CompareNoCase("终点2:") == 0) {
- CString szP2X = szArray.GetAt(1);
- CString szP2Y = szArray.GetAt(2);
- CString szP2Z = szArray.GetAt(3);
- DOUBLE fP2X = atof(szP2X.GetBuffer());
- DOUBLE fP2Y = atof(szP2Y.GetBuffer());
- DOUBLE fP2Z = atof(szP2Z.GetBuffer());
- pCylinder->SetPoint2X(fP2X);
- pCylinder->SetPoint2Y(fP2Y);
- pCylinder->SetPoint2Z(fP2Z);
- }
- else if(szParam.CompareNoCase("半径:") == 0)
- {
- CString szRadius = szArray.GetAt(1);
- DOUBLE fRadius = atof(szRadius);
- pCylinder->SetCylinderRadius(fRadius);
- }
- else if(szParam.CompareNoCase("长度:") == 0)
- {
- CString szLength = szArray.GetAt(1);
- DOUBLE fLength = atof(szLength.GetBuffer());
- pCylinder->SetCylinderLength(fLength);
- }
- }
- pCylinder->SetTaskId(m_iTaskId);
- pCylinder->SetEquipCode(m_szEquipCode);
- pCylinder->SetCylinderTitle(m_pDictManager->GetDictItemTitle(szCylinderCode, szCylinderCode));
- pCylinder->SetCylinderCode(szCylinderCode);
- pCylinder->SetItemId(5);
- pCylinder->SetSubItemId(iSubItemId);
- m_CylinderList.AddTail(pCylinder);
- return TRUE;
- }
- void StaticData::AddAngle(EquipDataAngle *pNewAngle)
- {
- DWORD iSubItemId = (DWORD)m_AngleList.GetCount();
- pNewAngle->SetSubItemId(iSubItemId+1);
- m_AngleList.AddTail(pNewAngle);
- }
- /**************************************************************************************************
- 函 数 名 :ParsePointRelated
- 功能描述 :解析点残差
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::ParsePointRelated(CStdioFile *pFile, int iType)
- {
- switch (iType) {
- case 2:
- this->ParsePlanePointRelated(pFile);
- break;
- case 3:
- this->ParseCirclePointRelated(pFile);
- break;
- case 4:
- this->ParseLinePointRelated(pFile);
- break;
- case 5:
- this->ParseCylinderPointRelated(pFile);
- break;
- }
- return TRUE;
- }
- // Plane Points related Parser
- BOOL StaticData::ParsePlanePointRelated(CStdioFile *pFile) {
- EquipDataPointRelated *pPointRelated = NULL;
- CStringArray szArray;
- CString szLine;
- int iItemId = 2;
- int iSubItemId;
- iSubItemId = (int)m_PlaneList.GetCount();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) return TRUE;
- int iNum = Utils::StrSplit(szLine, ' ', szArray);
- CString szPointCode(szArray.GetAt(0));
- if ((iNum < 2) || (szPointCode.Compare("点名称") == 0)) continue;
- CString szPointTitle(szArray.GetAt(0));
- CString szPointAX = szArray.GetAt(1);
- CString szPointAY = szArray.GetAt(2);
- CString szPointAZ = szArray.GetAt(3);
- CString szDX = szArray.GetAt(4);
- CString szDY = szArray.GetAt(5);
- CString szDZ = szArray.GetAt(6);
- CString szTotal = szArray.GetAt(7);
- CString szOffset = szArray.GetAt(8);
- DOUBLE fPointAX = atof(szPointAX.GetBuffer());
- DOUBLE fPointAY = atof(szPointAY.GetBuffer());
- DOUBLE fPointAZ = atof(szPointAZ.GetBuffer());
- DOUBLE fDX = atof(szDX.GetBuffer());
- DOUBLE fDY = atof(szDY.GetBuffer());
- DOUBLE fDZ = atof(szDZ.GetBuffer());
- DOUBLE fTotal = atof(szTotal.GetBuffer());
- DOUBLE fOffset = atof(szOffset.GetBuffer());
- // 1.查询点数据是否存在,如果不存在则保存
- EquipDataPoint *pPoint = this->SearchPointByCode(szPointCode);
- DWORD iPointSubItemId;
- if (!pPoint)
- {
- iPointSubItemId = (DWORD)m_PointList.GetCount() + 1;
- EquipDataPoint *pPoint = new EquipDataPoint();
- pPoint->SetItemId(1);
- pPoint->SetTaskId(m_iTaskId);
- pPoint->SetEquipCode(m_szEquipCode);
- pPoint->SetSubItemId(iPointSubItemId);
- pPoint->SetPointTitle(m_pDictManager->GetDictItemTitle(szPointCode, szPointCode));
- pPoint->SetPointCode(szPointCode);
- pPoint->SetPointAX(fPointAX);
- pPoint->SetPointAY(fPointAY);
- pPoint->SetPointAZ(fPointAZ);
- m_PointList.AddTail(pPoint);
- }
- else
- {
- iPointSubItemId = pPoint->GetSubItemId();
- }
- // 2.新增点列差到列表中
- pPointRelated = new EquipDataPointRelated();
- pPointRelated->SetTaskId(m_iTaskId);
- pPointRelated->SetEquipCode(m_szEquipCode);
- pPointRelated->SetItemId(iItemId);
- pPointRelated->SetSubItemId(iSubItemId);
- pPointRelated->SetItemType(2);
- pPointRelated->SetPointSubItemId(iPointSubItemId);
- pPointRelated->SetDX(fDX);
- pPointRelated->SetDY(fDY);
- pPointRelated->SetDZ(fDZ);
- pPointRelated->SetTotal(fTotal);
- pPointRelated->SetOffset(fOffset);
- m_PointRelatedList.AddTail(pPointRelated);
- }
- return TRUE;
- }
- // Circle Points related Parser
- BOOL StaticData::ParseCirclePointRelated(CStdioFile *pFile) {
- EquipDataPointRelated *pPointRelated = NULL;
- CStringArray szArray;
- CString szLine;
- int iItemId = 3;
- int iSubItemId;
- iSubItemId = (int)m_CircleList.GetCount();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) return TRUE;
- int iNum = Utils::StrSplit(szLine, ' ', szArray);
- CString szPointCode(szArray.GetAt(0));
- if ((iNum < 2) || (szPointCode.Compare("点名称") == 0)) continue;
- CString szPointTitle(szArray.GetAt(0));
- CString szPointAX = szArray.GetAt(1);
- CString szPointAY = szArray.GetAt(2);
- CString szPointAZ = szArray.GetAt(3);
- CString szDX = szArray.GetAt(4);
- CString szDY = szArray.GetAt(5);
- CString szDZ = szArray.GetAt(6);
- CString szOnPlane = szArray.GetAt(7);
- CString szOutPlane = szArray.GetAt(8);
- CString szTotal = szArray.GetAt(9);
- CString szOffset = szArray.GetAt(10);
- DOUBLE fPointAX = atof(szPointAX.GetBuffer());
- DOUBLE fPointAY = atof(szPointAY.GetBuffer());
- DOUBLE fPointAZ = atof(szPointAZ.GetBuffer());
- DOUBLE fDX = atof(szDX.GetBuffer());
- DOUBLE fDY = atof(szDY.GetBuffer());
- DOUBLE fDZ = atof(szDZ.GetBuffer());
- DOUBLE fOnPlane = atof(szOnPlane.GetBuffer());
- DOUBLE fOutPlane = atof(szOutPlane.GetBuffer());
- DOUBLE fTotal = atof(szTotal.GetBuffer());
- DOUBLE fOffset = atof(szOffset.GetBuffer());
- // 1.查询点数据是否存在,如果不存在则保存
- EquipDataPoint *pPoint = this->SearchPointByCode(szPointCode);
- DWORD iPointSubItemId;
- if (!pPoint)
- {
- iPointSubItemId = (DWORD)m_PointList.GetCount() + 1;
- EquipDataPoint *pPoint = new EquipDataPoint();
- pPoint->SetTaskId(m_iTaskId);
- pPoint->SetItemId(1);
- pPoint->SetEquipCode(m_szEquipCode);
- pPoint->SetSubItemId(iPointSubItemId);
- pPoint->SetPointTitle(szPointTitle);
- pPoint->SetPointCode(szPointCode);
- pPoint->SetPointAX(fPointAX);
- pPoint->SetPointAY(fPointAY);
- pPoint->SetPointAZ(fPointAZ);
- m_PointList.AddTail(pPoint);
- }
- else
- {
- iPointSubItemId = pPoint->GetSubItemId();
- }
- // 2.新增点列差到列表中
- pPointRelated = new EquipDataPointRelated();
- pPointRelated->SetTaskId(m_iTaskId);
- pPointRelated->SetEquipCode(m_szEquipCode);
- pPointRelated->SetItemId(iItemId);
- pPointRelated->SetSubItemId(iSubItemId);
- pPointRelated->SetItemType(3);
- pPointRelated->SetPointSubItemId(iPointSubItemId);
- pPointRelated->SetDX(fDX);
- pPointRelated->SetDY(fDY);
- pPointRelated->SetDZ(fDZ);
- pPointRelated->SetOnPlane(fOnPlane);
- pPointRelated->SetOutPlane(fOutPlane);
- pPointRelated->SetTotal(fTotal);
- pPointRelated->SetOffset(fOffset);
- m_PointRelatedList.AddTail(pPointRelated);
- }
- return TRUE;
- }
- // Line Points related Parser
- BOOL StaticData::ParseLinePointRelated(CStdioFile *pFile) {
- EquipDataPointRelated *pPointRelated = NULL;
- CStringArray szArray;
- CString szLine;
- int iItemId = 4;
- int iSubItemId;
- iSubItemId = (int)m_LineList.GetCount();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) return TRUE;
- int iNum = Utils::StrSplit(szLine, ' ', szArray);
- CString szPointCode(szArray.GetAt(0));
- if ((iNum < 2) || (szPointCode.Compare("点名称") == 0)) continue;
- CString szPointTitle(szArray.GetAt(0));
- CString szPointAX = szArray.GetAt(1);
- CString szPointAY = szArray.GetAt(2);
- CString szPointAZ = szArray.GetAt(3);
- CString szDX = szArray.GetAt(4);
- CString szDY = szArray.GetAt(5);
- CString szDZ = szArray.GetAt(6);
- CString szTotal = szArray.GetAt(7);
- CString szOffset = szArray.GetAt(8);
- DOUBLE fPointAX = atof(szPointAX.GetBuffer());
- DOUBLE fPointAY = atof(szPointAY.GetBuffer());
- DOUBLE fPointAZ = atof(szPointAZ.GetBuffer());
- DOUBLE fDX = atof(szDX.GetBuffer());
- DOUBLE fDY = atof(szDY.GetBuffer());
- DOUBLE fDZ = atof(szDZ.GetBuffer());
- DOUBLE fTotal = atof(szTotal.GetBuffer());
- DOUBLE fOffset = atof(szOffset.GetBuffer());
- // 1.查询点数据是否存在,如果不存在则保存
- EquipDataPoint *pPoint = this->SearchPointByCode(szPointCode);
- DWORD iPointSubItemId;
- if (!pPoint)
- {
- iPointSubItemId = (DWORD)m_PointList.GetCount() + 1;
- EquipDataPoint *pPoint = new EquipDataPoint();
- pPoint->SetTaskId(m_iTaskId);
- pPoint->SetItemId(1);
- pPoint->SetEquipCode(m_szEquipCode);
- pPoint->SetSubItemId(iPointSubItemId);
- pPoint->SetPointTitle(szPointTitle);
- pPoint->SetPointCode(szPointCode);
- pPoint->SetPointAX(fPointAX);
- pPoint->SetPointAY(fPointAY);
- pPoint->SetPointAZ(fPointAZ);
- m_PointList.AddTail(pPoint);
- }
- else
- {
- iPointSubItemId = pPoint->GetSubItemId();
- }
- // 2.新增点列差到列表中
- pPointRelated = new EquipDataPointRelated();
- pPointRelated->SetTaskId(m_iTaskId);
- pPointRelated->SetEquipCode(m_szEquipCode);
- pPointRelated->SetItemId(iItemId);
- pPointRelated->SetSubItemId(iSubItemId);
- pPointRelated->SetItemType(4);
- pPointRelated->SetPointSubItemId(iPointSubItemId);
- pPointRelated->SetDX(fDX);
- pPointRelated->SetDY(fDY);
- pPointRelated->SetDZ(fDZ);
- pPointRelated->SetTotal(fTotal);
- pPointRelated->SetOffset(fOffset);
- m_PointRelatedList.AddTail(pPointRelated);
- }
- return TRUE;
- }
- // Cylinder Points related Parser
- BOOL StaticData::ParseCylinderPointRelated(CStdioFile *pFile) {
- EquipDataPointRelated *pPointRelated = NULL;
- CStringArray szArray;
- CString szLine;
- int iItemId = 5;
- int iSubItemId;
- iSubItemId = (int)m_CylinderList.GetCount();
- while (pFile->ReadString(szLine)) {
- if (szLine.IsEmpty()) return TRUE;
- int iNum = Utils::StrSplit(szLine, ' ', szArray);
- CString szPointCode(szArray.GetAt(0));
- if ((iNum < 2) || (szPointCode.Compare("点名称") == 0)) continue;
- CString szPointTitle(szArray.GetAt(0));
- CString szPointAX = szArray.GetAt(1);
- CString szPointAY = szArray.GetAt(2);
- CString szPointAZ = szArray.GetAt(3);
- CString szDX = szArray.GetAt(4);
- CString szDY = szArray.GetAt(5);
- CString szDZ = szArray.GetAt(6);
- CString szTotal = szArray.GetAt(7);
- CString szOffset = szArray.GetAt(8);
- DOUBLE fPointAX = atof(szPointAX.GetBuffer());
- DOUBLE fPointAY = atof(szPointAY.GetBuffer());
- DOUBLE fPointAZ = atof(szPointAZ.GetBuffer());
- DOUBLE fDX = atof(szDX.GetBuffer());
- DOUBLE fDY = atof(szDY.GetBuffer());
- DOUBLE fDZ = atof(szDZ.GetBuffer());
- DOUBLE fTotal = atof(szTotal.GetBuffer());
- DOUBLE fOffset = atof(szOffset.GetBuffer());
- // 1.查询点数据是否存在,如果不存在则保存
- EquipDataPoint *pPoint = this->SearchPointByCode(szPointCode);
- DWORD iPointSubItemId;
- if (!pPoint)
- {
- iPointSubItemId = (DWORD)m_PointList.GetCount() + 1;
- EquipDataPoint *pPoint = new EquipDataPoint();
- pPoint->SetTaskId(m_iTaskId);
- pPoint->SetItemId(1);
- pPoint->SetEquipCode(m_szEquipCode);
- pPoint->SetSubItemId(iPointSubItemId);
- pPoint->SetPointTitle(szPointTitle);
- pPoint->SetPointCode(szPointCode);
- pPoint->SetPointAX(fPointAX);
- pPoint->SetPointAY(fPointAY);
- pPoint->SetPointAZ(fPointAZ);
- m_PointList.AddTail(pPoint);
- }
- else
- {
- iPointSubItemId = pPoint->GetSubItemId();
- }
- // 2.新增点列差到列表中
- pPointRelated = new EquipDataPointRelated();
- pPointRelated->SetTaskId(m_iTaskId);
- pPointRelated->SetEquipCode(m_szEquipCode);
- pPointRelated->SetItemId(iItemId);
- pPointRelated->SetSubItemId(iSubItemId);
- pPointRelated->SetItemType(5);
- pPointRelated->SetPointSubItemId(iPointSubItemId);
- pPointRelated->SetDX(fDX);
- pPointRelated->SetDY(fDY);
- pPointRelated->SetDZ(fDZ);
- pPointRelated->SetTotal(fTotal);
- pPointRelated->SetOffset(fOffset);
- m_PointRelatedList.AddTail(pPointRelated);
- }
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :SearchPointByCode
- 功能描述 :基于编号查询
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- EquipDataPoint* StaticData::SearchPointByCode(LPCTSTR szCode)
- {
- POSITION pos;
- EquipDataPoint *pPoint = NULL;
- pos = m_PointList.GetHeadPosition();
- while (pos != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos);
- if (pPoint != NULL)
- {
- CString szPointCode = pPoint->GetPointCode();
- if (szPointCode.Compare(szCode) == 0)
- {
- return pPoint;
- }
- }
- }
- return NULL;
- }
- /**************************************************************************************************
- 函 数 名 :SearchPointByCode
- 功能描述 :基于编号查询
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::IsEquipDataExist(int iType)
- {
- POSITION pos;
- EquipData *pData = NULL;
- BOOL bRet = TRUE;
- pos = m_DataList.GetHeadPosition();
- while (pos != NULL)
- {
- pData = (EquipData *)m_DataList.GetNext(pos);
- if (pData != NULL)
- {
- if ( pData->GetItemType() == iType)
- {
- return TRUE;
- }
- }
- }
- return FALSE;
- }
- /**************************************************************************************************
- 函 数 名 :AddEquipItemData
- 功能描述 :添加数据项到结构中
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::AddEquipItemData(int iType)
- {
- EquipData *pEquipData = NULL;
- if (IsEquipDataExist(iType)) return;
- pEquipData = new EquipData();
- pEquipData->SetTaskId(m_iTaskId);
- pEquipData->SetEquipCode(m_szEquipCode);
- pEquipData->SetItemType(iType);
- pEquipData->SetItemId(iType);
- if (iType == 1)
- {
- pEquipData->SetItemCode("Point");
- pEquipData->SetItemTitle("Point");
- pEquipData->SetItemDesc("Point");
- }
- else if (iType == 2) {
- pEquipData->SetItemCode("Plane");
- pEquipData->SetItemTitle("Plane");
- pEquipData->SetItemDesc("Plane");
- }
- else if (iType == 3)
- {
- pEquipData->SetItemCode("Circle");
- pEquipData->SetItemTitle("Circle");
- pEquipData->SetItemDesc("Circle");
- }
- else if (iType == 4)
- {
- pEquipData->SetItemCode("Line");
- pEquipData->SetItemTitle("Line");
- pEquipData->SetItemDesc("Line");
- }
- else if (iType == 5)
- {
- pEquipData->SetItemCode("Cylinder");
- pEquipData->SetItemTitle("Cylinder");
- pEquipData->SetItemDesc("Cylinder");
- }
- m_DataList.AddTail((EquipData *)pEquipData);
- }
- /**************************************************************************************************
- 函 数 名 :AddEquipSubItemData
- 功能描述 :添加子项数据到结构中
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::AddEquipSubItemData(int iType, void *pData)
- {
- if (iType == 1)
- {
- m_PointList.AddTail((EquipDataPoint *)pData);
- }
- else if (iType == 2)
- {
- m_PlaneList.AddTail((EquipDataPlane *)pData);
- }
- else if (iType == 3)
- {
- m_CircleList.AddTail((EquipDataCircle *)pData);
- }
- else if (iType == 4)
- {
- m_LineList.AddTail((EquipDataLine *)pData);
- }
- else if (iType == 5)
- {
- m_CylinderList.AddTail((EquipDataCylinder *)pData);
- }
- else if (iType == 6) // 点残差数据
- {
-
- }
- }
- /**************************************************************************************************
- 函 数 名 :Clear
- 功能描述 :清空数据
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::Clear()
- {
- while (!m_DataList.IsEmpty())
- {
- delete m_DataList.RemoveHead();
- }
- while (!m_PointList.IsEmpty())
- {
- delete m_PointList.RemoveHead();
- }
- while (!m_PlaneList.IsEmpty())
- {
- delete m_PlaneList.RemoveHead();
- }
- while (!m_CircleList.IsEmpty())
- {
- delete m_CircleList.RemoveHead();
- }
- while (!m_LineList.IsEmpty())
- {
- delete m_LineList.RemoveHead();
- }
- while (!m_CylinderList.IsEmpty())
- {
- delete m_CylinderList.RemoveHead();
- }
- while (!m_AngleList.IsEmpty())
- {
- delete m_AngleList.RemoveHead();
- }
- while (!m_PointRelatedList.IsEmpty())
- {
- delete m_PointRelatedList.RemoveHead();
- }
- }
- /**************************************************************************************************
- 函 数 名 :CalcPointFlatness
- 功能描述 :计算平面度
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::CalcPointFlatness()
- {
- EquipDataPlane *pPlane = NULL;
- POSITION pos1;
- pos1 = m_PlaneList.GetHeadPosition();
- while (pos1 != NULL)
- {
- pPlane = (EquipDataPlane *)m_PlaneList.GetNext(pos1);
- if (pPlane != NULL)
- {
- DWORD itemId1 = pPlane->GetItemId();
- DWORD subItemId1 = pPlane->GetSubItemId();
- EquipDataPointRelated *pPointRelated = NULL;
- DOUBLE fMax = 0.0;
- DOUBLE fMin = 0.0;
- // 1.获取结点
- POSITION pos2;
- pos2 = m_PointRelatedList.GetHeadPosition();
- while (pos2 != NULL)
- {
- pPointRelated = (EquipDataPointRelated *)m_PointRelatedList.GetNext(pos2);
- if (pPointRelated != NULL)
- {
- DWORD itemId2 = pPointRelated->GetItemId();
- DWORD subItemId2 = pPointRelated->GetSubItemId();
- DWORD pointId1 = pPointRelated->GetPointSubItemId();
- DWORD itemType = pPointRelated->GetItemType();
- if ((itemType == 2)&&(itemId1 == itemId2) && (subItemId1 == subItemId2))
- {
- DOUBLE fTotal = pPointRelated->GetTotal();
- if (fTotal > fMax) fMax = fTotal;
- if (fTotal < fMin) fMin = fTotal;
- }
- }
- }
- // 平面度 = 点总计最大值 - 点总计最小值
- pPlane->SetPlaneFlatness(fMax - fMin);
- }
- }
- return;
- }
- /**************************************************************************************************
- 函 数 名 :CalcPointFlatness
- 功能描述 :计算圆度
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::CalcCircleRoundness()
- {
- EquipDataCircle *pCircle = NULL;
- POSITION pos1;
- pos1 = m_CircleList.GetHeadPosition();
- while (pos1 != NULL)
- {
- pCircle = (EquipDataCircle *)m_CircleList.GetNext(pos1);
- if (pCircle != NULL)
- {
- DWORD itemId1 = pCircle->GetItemId();
- DWORD subItemId1 = pCircle->GetSubItemId();
- EquipDataPointRelated *pPointRelated = NULL;
- DOUBLE fMax = 0.0;
- DOUBLE fMin = 0.0;
- // 1.获取结点
- POSITION pos2;
- pos2 = m_PointRelatedList.GetHeadPosition();
- while (pos2 != NULL)
- {
- pPointRelated = (EquipDataPointRelated *)m_PointRelatedList.GetNext(pos2);
- if (pPointRelated != NULL)
- {
- DWORD itemId2 = pPointRelated->GetItemId();
- DWORD subItemId2 = pPointRelated->GetSubItemId();
- DWORD pointId1 = pPointRelated->GetPointSubItemId();
- DWORD iItemType = pPointRelated->GetItemType();
- if ((iItemType == 3 )&&(itemId1 == itemId2) && (subItemId1 == subItemId2))
- {
- DOUBLE fOnPlane = pPointRelated->GetOnPlane();
- if (fOnPlane > fMax) fMax = fOnPlane;
- if (fOnPlane < fMin) fMin = fOnPlane;
- }
- }
- }
- // 圆度 = 点总计最大值 - 点总计最小值
- pCircle->SetCircleRoundness(fMax - fMin);
- }
- }
- return;
- }
- /**************************************************************************************************
- 函 数 名 :GetAngleParam
- 功能描述 :新增推力线偏角
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::GenerateAngle()
- {
- CString szCylinderCode = AppConfig::GetString("Static", "Cylinder");
- CString szPointCode = AppConfig::GetString("Static", "Point1");
- //this->HandleAngle("cl1", "CODE489");
- this->HandleAngle(szCylinderCode, szPointCode);
- }
- /**************************************************************************************************
- 函 数 名 :GetAngleParam
- 功能描述 :新增推力线偏角
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::GenerateAngleText()
- {
- int i = 1;
- CString Cylinder;
- CString Point;
- while (i < 5) {
- Cylinder.Format("Cylinder%d", i);
- Point.Format("Point%d", i);
- CString szCylinderCode = AppConfig::GetString("Static", Cylinder);
- CString szPointCode = AppConfig::GetString("Static", Point);
- this->HandleAngle(szCylinderCode, szPointCode);
- i++;
- }
- }
- /**************************************************************************************************
- 函 数 名 :GenerateDoublePoint
- 功能描述 :新增两点式推力线偏角
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::GenerateDoublePoint()
- {
- int i = 1;
- CString StartPoint;
- CString EndPoint;
- while (i < 5) {
- StartPoint.Format("SPoint%d", i);
- EndPoint.Format("EPoint%d", i);
- CString szPointCodeStart = AppConfig::GetString("Static", StartPoint);
- CString szPointCodeEnd = AppConfig::GetString("Static", EndPoint);
- this->HandleAngleDoublePoint(szPointCodeStart, szPointCodeEnd);
- i++;
- }
-
- }
- /**************************************************************************************************
- 函 数 名 :GetAngleParam
- 功能描述 :新增推力线偏角
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::HandleAngle(LPCTSTR szTargetCylinderCode, LPCTSTR szTargetPointCode)
- {
- DOUBLE x1 = 0.0;
- DOUBLE y1 = 0.0;
- DOUBLE z1 = 0.0;
- DOUBLE x2 = 0.0;
- DOUBLE y2 = 0.0;
- DOUBLE z2 = 0.0;
- CString m_linecode;
- CString m_pointcode;
- bool bExist = false;
- // 1. Cylinder
- POSITION pos1;
- EquipDataCylinder *pCylinder = NULL;
- pos1 = m_CylinderList.GetHeadPosition();
- while (pos1 != NULL)
- {
- pCylinder = (EquipDataCylinder *)m_CylinderList.GetNext(pos1);
- if (pCylinder == NULL) break;
- CString szCylinderCode = pCylinder->GetCylinderCode();
- if (szCylinderCode.Compare(szTargetCylinderCode) == 0)
- {
- DOUBLE point1x = pCylinder->GetPoint1X();
- DOUBLE point1y = pCylinder->GetPoint1Y();
- DOUBLE point1z = pCylinder->GetPoint1Z();
- DOUBLE point2x = pCylinder->GetPoint2X();
- DOUBLE point2y = pCylinder->GetPoint2Y();
- DOUBLE point2z = pCylinder->GetPoint2Z();
- x1 = (point1x + point2x) / 2;
- y1 = (point1y + point2y) / 2;
- z1 = (point1z + point2z) / 2;
- bExist = true;
- break;
- }
- }
- if (!bExist) return;
- // 2.Point
- POSITION pos2;
- EquipDataPoint *pPoint = NULL;
- pos2 = m_PointList.GetHeadPosition();
- while (pos2 != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos2);
- if (pPoint == NULL) break;
- CString szPointCode = pPoint->GetPointCode();
- if (szPointCode.Compare(szTargetPointCode) == 0)
- {
- x2 = pPoint->GetPointAX();
- y2 = pPoint->GetPointAY();
- z2 = pPoint->GetPointAZ();
- break;
- }
- }
- m_linecode.Format("%s & %s", szTargetCylinderCode, szTargetPointCode);
- m_pointcode.Format("%sO", szTargetCylinderCode);
- //3.
- DWORD iTaskId = pPoint->GetTaskId();
- CString szEquipCode = pPoint->GetEquipCode();
- DWORD iPointSubItemId = m_PointList.GetCount()+1;
- DWORD iCylinderSubItemId = pCylinder->GetSubItemId();
- EquipDataPoint *pCyCenter = new EquipDataPoint();
- pCyCenter->SetTaskId(iTaskId);
- pCyCenter->SetEquipCode(szEquipCode);
- pCyCenter->SetItemId(1);
- pCyCenter->SetSubItemId(iPointSubItemId);
- pCyCenter->SetPointCode(m_pointcode);
- pCyCenter->SetPointTitle(m_pointcode);
- pCyCenter->SetPointAX(x1);
- pCyCenter->SetPointAY(y1);
- pCyCenter->SetPointAZ(z1);
- pCyCenter->SetPointEX(0.0);
- pCyCenter->SetPointEY(0.0);
- pCyCenter->SetPointEZ(0.0);
- pCyCenter->SetPointDesc("");
- m_PointList.AddTail(pCyCenter);
- //4.
- EquipDataPointRelated* pCyRelated = new EquipDataPointRelated();
- pCyRelated->SetTaskId(iTaskId);
- pCyRelated->SetEquipCode(szEquipCode);
- pCyRelated->SetItemId(5);
- pCyRelated->SetItemType(5);
- pCyRelated->SetSubItemId(iCylinderSubItemId);
- pCyRelated->SetPointSubItemId(iPointSubItemId);
- pCyRelated->SetDX(0.0);
- pCyRelated->SetDY(0.0);
- pCyRelated->SetDZ(0.0);
- pCyRelated->SetTotal(0.0);
- pCyRelated->SetOffset(0.0);
- pCyRelated->SetOnPlane(0.0);
- pCyRelated->SetOutPlane(0.0);
- m_PointRelatedList.AddTail(pCyRelated);
- if (x1 != 0 && x2 != 0)
- {
- this->CalcAngle(m_linecode,x1, y1, z1, x2, y2, z2);
- }
- return;
- }
- /**************************************************************************************************
- 函 数 名 :GetAngleParam
- 功能描述 :新增推力线偏角两点式
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::HandleAngleDoublePoint(LPCTSTR szPointCodeStart, LPCTSTR szPointCodeEnd)
- {
- DOUBLE x1 = 0.0;
- DOUBLE y1 = 0.0;
- DOUBLE z1 = 0.0;
- DOUBLE x2 = 0.0;
- DOUBLE y2 = 0.0;
- DOUBLE z2 = 0.0;
- CString count;
- // 1. PointStart
- POSITION pos1;
- EquipDataPoint *pPoint = NULL;
- pos1 = m_PointList.GetHeadPosition();
- while (pos1 != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos1);
- if (pPoint == NULL) break;
- CString szPointCode = pPoint->GetPointCode();
- if (szPointCode.Compare(szPointCodeStart) == 0)
- {
- x1 = pPoint->GetPointAX();
- y1 = pPoint->GetPointAY();
- z1 = pPoint->GetPointAZ();
- }
- }
- // 2.PointEnd
- POSITION pos2;
- EquipDataPoint *pPoint1 = NULL;
- pos2 = m_PointList.GetHeadPosition();
- while (pos2 != NULL)
- {
- pPoint1 = (EquipDataPoint *)m_PointList.GetNext(pos2);
- if (pPoint1 == NULL) break;
- CString szPointCode = pPoint1->GetPointCode();
- if (szPointCode.Compare(szPointCodeEnd) == 0)
- {
- x2 = pPoint1->GetPointAX();
- y2 = pPoint1->GetPointAY();
- z2 = pPoint1->GetPointAZ();
- }
- }
- count.Format("%s And %s", szPointCodeStart, szPointCodeEnd);
- if (x1 != 0 && x2 != 0)
- {
- this->CalcAngle(count,x1, y1, z1, x2, y2, z2);
- }
- return;
- }
- /**************************************************************************************************
- 函 数 名 :CalcAngle
- 功能描述 :计算推力线偏角
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::CalcAngle(DOUBLE x1, DOUBLE y1, DOUBLE z1, DOUBLE x2, DOUBLE y2, DOUBLE z2)
- {
- // 1.获取坐标值
- DOUBLE fX1 = x1;
- DOUBLE fY1 = y1;
- DOUBLE fZ1 = z1;
- DOUBLE fX2 = x2;
- DOUBLE fY2 = y2;
- DOUBLE fZ2 = z2;
- // 2.计算偏角数据
- DOUBLE v1 = (fX2 - fX1)*(fX2 - fX1);
- DOUBLE v2 = (fY2 - fY1)*(fY2 - fY1);
- DOUBLE v3 = (fZ2 - fZ1)*(fZ2 - fZ1);
- DOUBLE fLength = sqrt(v1 + v2 + v3);
- DOUBLE ax = acos((fX2 - fX1) / fLength) * 180 / PI;
- DOUBLE ay = acos((fY2 - fY1) / fLength) * 180 / PI;
- DOUBLE az = acos((fZ2 - fZ1) / fLength) * 180 / PI;
- // 3. 存储数据
- EquipDataAngle *pAngle = new EquipDataAngle();
- pAngle->SetEquipCode(m_szEquipCode);
- pAngle->SetItemId(6); //
- pAngle->SetLineTitle("AS1AE1");
- pAngle->SetLineCode("AS1AE1");
- pAngle->SetLineStartX(fX1);
- pAngle->SetLineStartY(fY1);
- pAngle->SetLineStartZ(fZ1);
- pAngle->SetLineEndX(fX2);
- pAngle->SetLineEndY(fY2);
- pAngle->SetLineEndZ(fZ2);
- pAngle->SetAngleAX(ax);
- pAngle->SetAngleAY(ay);
- pAngle->SetAngleAZ(az);
- this->AddAngle(pAngle);
- return;
- }
- /**************************************************************************************************
- 函 数 名 :CalcAngle
- 功能描述 :计算推力线偏角有推力线名
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::CalcAngle(CString count,DOUBLE x1, DOUBLE y1, DOUBLE z1, DOUBLE x2, DOUBLE y2, DOUBLE z2)
- {
- //0.获取推力线编号
- CString fcount = count;
- // 1.获取坐标值
- DOUBLE fX1 = x1;
- DOUBLE fY1 = y1;
- DOUBLE fZ1 = z1;
- DOUBLE fX2 = x2;
- DOUBLE fY2 = y2;
- DOUBLE fZ2 = z2;
- // 2.计算偏角数据
- DOUBLE v1 = (fX2 - fX1)*(fX2 - fX1);
- DOUBLE v2 = (fY2 - fY1)*(fY2 - fY1);
- DOUBLE v3 = (fZ2 - fZ1)*(fZ2 - fZ1);
- DOUBLE fLength = sqrt(v1 + v2 + v3);
- DOUBLE ax = acos((fX2 - fX1) / fLength) * 180 / PI;
- DOUBLE ay = acos((fY2 - fY1) / fLength) * 180 / PI;
- DOUBLE az = acos((fZ2 - fZ1) / fLength) * 180 / PI;
- // 3. 存储数据
- EquipDataAngle *pAngle = new EquipDataAngle();
- pAngle->SetTaskId(m_iTaskId);
- pAngle->SetEquipCode(m_szEquipCode);
- pAngle->SetItemId(6); //
- pAngle->SetLineTitle(fcount);
- pAngle->SetLineCode(fcount);
- pAngle->SetLineStartX(fX1);
- pAngle->SetLineStartY(fY1);
- pAngle->SetLineStartZ(fZ1);
- pAngle->SetLineEndX(fX2);
- pAngle->SetLineEndY(fY2);
- pAngle->SetLineEndZ(fZ2);
- pAngle->SetAngleAX(ax);
- pAngle->SetAngleAY(ay);
- pAngle->SetAngleAZ(az);
- this->AddAngle(pAngle);
- return;
- }
- /**************************************************************************************************
- 函 数 名 :SaveToDB
- 功能描述 :批量存储到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::SaveToDB()
- {
- // 计算Plane平面度
- this->CalcPointFlatness();
- // Calc Circle Roundness
- this->CalcCircleRoundness();
- // 生成偏角数据
- this->GenerateAngleText();
- this->GenerateDoublePoint();
- // 保存到数据库中
- int iRet = 0;
- iRet += SaveEquipDataToDB();
- iRet += SavePointToDB();
- iRet += SavePlaneToDB();
- iRet += SaveCircleToDB();
- iRet += SaveLineToDB();
- iRet += SaveCylinderToDB();
- iRet += SaveAngleToDB();
- iRet += SavePointRelatedToDB();
- if (iRet > 0) return FALSE;
-
- return TRUE;
- }
- /**************************************************************************************************
- 函 数 名 :Validate
- 功能描述 :数据完整性验证
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- BOOL StaticData::Validate(CString &szMsg) {
- CString rules = AppConfig::GetString(_T("Data-Integrity"), this->m_szEquipTypeCode);
- CStringArray arrRules;
- Utils::StrSplit(rules, ",", arrRules);
-
- int icount = (int)arrRules.GetCount();
- EquipDataPoint *pPoint = NULL;
- BOOL bRet = TRUE;
-
- for (int i = 0; i < icount; i++) {
- pPoint = this->SearchPointByCode(arrRules[i]);
- if (pPoint == NULL) {
- if (bRet) {
- szMsg.Append(_T("关键点未测得:"));
- bRet = FALSE;
- }
- szMsg.Append(arrRules[i]);
- szMsg.Append("/");
- }
- }
- if (!szMsg.IsEmpty())
- {
- szMsg.TrimRight('/');
- }
-
- return bRet;
- }
- /**************************************************************************************************
- 函 数 名 :SaveEquipDataToDB
- 功能描述 :存储Equip数据类别到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SaveEquipDataToDB()
- {
- POSITION pos;
- EquipData *pData = NULL;
- CString szLine;
- EquipDataManager *pManager = new EquipDataManager();
- pManager->Delete(m_iTaskId);
- pos = m_DataList.GetHeadPosition();
- while (pos != NULL)
- {
- pData = (EquipData *)m_DataList.GetNext(pos);
- if (pData != NULL)
- {
- pManager->Add(*pData);
- }
- }
-
- delete pManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SavePointToDB
- 功能描述 :存储Line到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SavePointToDB()
- {
- POSITION pos;
- EquipDataPoint *pPoint = NULL;
- EquipDataPointManager *pPointManager = new EquipDataPointManager();
- pPointManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_PointList.GetHeadPosition();
- while (pos != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos);
- if (pPoint != NULL)
- {
- bRet = pPointManager->Add(*pPoint);
- if (bRet != TRUE)
- {
- AfxMessageBox("Point数据存储失败!");
- break;
- }
- }
- }
- delete pPointManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SavePlaneToDB
- 功能描述 :存储Plane到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SavePlaneToDB()
- {
- POSITION pos;
- EquipDataPlane *pPlane = NULL;
- EquipDataPlaneManager *pPlaneManager = new EquipDataPlaneManager();
- pPlaneManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_PlaneList.GetHeadPosition();
- while (pos != NULL)
- {
- pPlane = (EquipDataPlane *)m_PlaneList.GetNext(pos);
- if (pPlane != NULL)
- {
- bRet = pPlaneManager->Add(*pPlane);
- if (bRet != TRUE)
- {
- AfxMessageBox("Plane数据存储失败!");
- break;
- }
- }
- }
- delete pPlaneManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SaveCircleToDB
- 功能描述 :存储Circle到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SaveCircleToDB()
- {
- POSITION pos;
- EquipDataCircle *pCircle = NULL;
- EquipDataCircleManager *pCircleManager = new EquipDataCircleManager();
- pCircleManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_CircleList.GetHeadPosition();
- while (pos != NULL)
- {
- pCircle = (EquipDataCircle *)m_CircleList.GetNext(pos);
- if (pCircle != NULL)
- {
- bRet = pCircleManager->Add(*pCircle);
- if (bRet != TRUE)
- {
- AfxMessageBox("Circle数据存储失败!");
- break;
- }
- }
- }
- delete pCircleManager;
-
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SaveLineToDB
- 功能描述 :存储Line到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SaveLineToDB()
- {
- POSITION pos;
- EquipDataLine *pLine = NULL;
- EquipDataLineManager *pLineManager = new EquipDataLineManager();
- pLineManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_LineList.GetHeadPosition();
- while (pos != NULL)
- {
- pLine = (EquipDataLine *)m_LineList.GetNext(pos);
- if (pLine != NULL)
- {
- bRet = pLineManager->Add(*pLine);
- if (bRet != TRUE)
- {
- AfxMessageBox("Line数据存储失败!");
- break;
- }
- }
- }
- delete pLineManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SavePointToDB
- 功能描述 :存储Line到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SaveCylinderToDB()
- {
- POSITION pos;
- EquipDataCylinder *pCylinder = NULL;
- EquipDataCylinderManager *pCylinderManager = new EquipDataCylinderManager();
- pCylinderManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_CylinderList.GetHeadPosition();
- while (pos != NULL)
- {
- pCylinder = (EquipDataCylinder *)m_CylinderList.GetNext(pos);
- if (pCylinder != NULL)
- {
- bRet = pCylinderManager->Add(*pCylinder);
- if (bRet != TRUE)
- {
- AfxMessageBox("Line数据存储失败!");
- break;
- }
- }
- }
- delete pCylinderManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SaveAngleToDB
- 功能描述 :存储Angle到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SaveAngleToDB()
- {
- POSITION pos;
- EquipDataAngle *pAngle = NULL;
- EquipDataAngleManager *pAngleManager = new EquipDataAngleManager();
- pAngleManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_AngleList.GetHeadPosition();
- while (pos != NULL)
- {
- pAngle = (EquipDataAngle *)m_AngleList.GetNext(pos);
- if (pAngle != NULL)
- {
- bRet = pAngleManager->Add(*pAngle);
- if (bRet != TRUE)
- {
- AfxMessageBox("Angle数据存储失败!");
- break;
- }
- }
- }
- delete pAngleManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :SavePointToDB
- 功能描述 :存储Line到数据库
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::SavePointRelatedToDB()
- {
- POSITION pos;
- EquipDataPointRelated *pPointRelated = NULL;
- EquipDataPointRelatedManager *pPointRelatedManager = new EquipDataPointRelatedManager();
- pPointRelatedManager->Delete(m_iTaskId);
- BOOL bRet = TRUE;
- pos = m_PointRelatedList.GetHeadPosition();
- while (pos != NULL)
- {
- pPointRelated = (EquipDataPointRelated *)m_PointRelatedList.GetNext(pos);
- if (pPointRelated != NULL)
- {
- bRet = pPointRelatedManager->Add(*pPointRelated);
- if (bRet != TRUE)
- {
- AfxMessageBox("Line数据存储失败!");
- break;
- }
- }
- }
- delete pPointRelatedManager;
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OutputConfig
- 功能描述 :输出配置文件
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::OutputConfig()
- {
- CString szFile1 = AppConfig::GetString("Output", "File1");
- CString szPoints1 = AppConfig::GetString("Output", "File1_Points");
- if (!szFile1.IsEmpty()) {
- this->OutputDataToFile(szFile1, szPoints1);
- }
-
- CString szFile2 = AppConfig::GetString("Output", "File2");
- CString szPoints2 = AppConfig::GetString("Output", "File2_Points");
- if (!szFile2.IsEmpty()) {
- this->OutputDataToFile(szFile2, szPoints2);
- }
- CString szFile3 = AppConfig::GetString("Output", "File3");
- CString szPoints3 = AppConfig::GetString("Output", "File3_Points");
- if (!szFile3.IsEmpty()) {
- this->OutputDataToFile(szFile3, szPoints3);
- }
- CString szFile4 = AppConfig::GetString("Output", "File4");
- CString szPoints4 = AppConfig::GetString("Output", "File4_Points");
- if (!szFile4.IsEmpty()) {
- this->OutputDataToFile(szFile4, szPoints4);
- }
- CString szFile5 = AppConfig::GetString("Output", "File5");
- CString szPoints5 = AppConfig::GetString("Output", "File5_Points");
- if (!szFile5.IsEmpty()) {
- this->OutputDataToFile(szFile5, szPoints5);
- }
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :OutputDataToFile
- 功能描述 :输出点数据到文件
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- int StaticData::OutputDataToFile(const CString &szFile, const CString &strPoints)
- {
- CStdioFile file;
- if (!file.Open(szFile, CFile::typeText | CFile::modeCreate | CFile::modeReadWrite))
- {
- LOG::E(_T("文件失败"));
- return 1;
- }
- CStringArray szArray;
- Utils::StrSplit(strPoints, ",", szArray);
- POSITION pos;
- EquipDataPoint *pPoint = NULL;
- CString szLine;
-
- pos = m_PointList.GetHeadPosition();
- while (pos != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos);
- if (pPoint != NULL)
- {
- CString szPoint = pPoint->GetPointCode();
- for (int i = 0; i < szArray.GetSize(); i++)
- {
- CString szPointTarget = szArray.GetAt(i);
- if (!szPointTarget.IsEmpty())
- {
- if (szPointTarget.CompareNoCase(szPoint)==0)
- {
- szLine.Format("%20s %.3f %.3f %.3f\n"
- , pPoint->GetPointTitle()
- , pPoint->GetPointAX()
- , pPoint->GetPointAY()
- , pPoint->GetPointAZ());
- file.WriteString(szLine);
- }
- }
- }
-
- }
- }
- file.Close();
- return 0;
- }
- /**************************************************************************************************
- 函 数 名 :PrintData
- 功能描述 :调试打印
- 输入参数 :无
- 输出参数 :无
- 返 回 值 :void
- **************************************************************************************************/
- void StaticData::PrintData()
- {
- CStdioFile file;
- CString szFile("D:\\data.txt");
- if (!file.Open(szFile, CFile::typeText|CFile::modeCreate|CFile::modeReadWrite))
- {
- LOG::E(_T("打开文件失败"));
- return ;
- }
-
- this->PrintEquipData(&file);
- this->PrintPoint(&file);
- this->PrintPlane(&file);
- this->PrintCircle(&file);
- this->PrintLine(&file);
- this->PrintCylinder(&file);
- this->PrintAngle(&file);
- this->PrintPointRelated(&file);
- file.Close();
- }
- // 打印输出Equip Data
- void StaticData::PrintEquipData(CStdioFile *pFile)
- {
- POSITION pos;
- EquipData *pData = NULL;
- CString szLine;
- szLine.Format("-------------------------------------------------------------------------------\n");
- pFile->WriteString(szLine);
- szLine.Format(" equipCode itemId itemCode itemTitle itemType\n");
- pFile->WriteString(szLine);
- pos = m_DataList.GetHeadPosition();
- while (pos != NULL)
- {
- pData = (EquipData *)m_DataList.GetNext(pos);
- if (pData != NULL)
- {
- szLine.Format(" %20s %d %s %s %d\n"
- ,pData->GetEquipCode()
- ,pData->GetItemId()
- ,pData->GetItemCode()
- ,pData->GetItemTitle()
- ,pData->GetItemType());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出点数据
- void StaticData::PrintPoint(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataPoint *pPoint = NULL;
- CString szLine;
- szLine.Format("------------------------------------------------------------------------------------\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId pointTitle pointAX pointAY pointAZ pointTotal\n");
- pFile->WriteString(szLine);
- pos = m_PointList.GetHeadPosition();
- while (pos != NULL)
- {
- pPoint = (EquipDataPoint *)m_PointList.GetNext(pos);
- if (pPoint != NULL)
- {
- szLine.Format(" %20s %d %d %s %.3f %.3f %.3f %.3f\n"
- ,pPoint->GetEquipCode()
- ,pPoint->GetItemId()
- ,pPoint->GetSubItemId()
- ,pPoint->GetPointTitle()
- ,pPoint->GetPointAX()
- ,pPoint->GetPointAY()
- ,pPoint->GetPointAZ()
- ,pPoint->GetPointTotal());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出平面数据
- void StaticData::PrintPlane(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataPlane *pPlane = NULL;
- CString szLine;
- szLine.Format("------------------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("%20s %20s %20s %20s %20s \r\n", "equipCode", "itemId", "subitemId" , "planeCode", "A", "B", "C", "D", "RMS");
- pFile->WriteString(szLine);
- pos = m_PlaneList.GetHeadPosition();
- while (pos != NULL)
- {
- pPlane = (EquipDataPlane *)m_PlaneList.GetNext(pos);
- if (pPlane != NULL)
- {
- szLine.Format("%20s %20d %20d %20s %20.3f %20.3f %20.3f %20.3f %20.3f %20.3f\r\n"
- ,pPlane->GetEquipCode()
- ,pPlane->GetItemId()
- ,pPlane->GetSubItemId()
- ,pPlane->GetPlaneCode()
- ,pPlane->GetPlaneA()
- ,pPlane->GetPlaneB()
- ,pPlane->GetPlaneC()
- ,pPlane->GetPlaneD()
- ,pPlane->GetPlaneRMS()
- ,pPlane->GetPlaneFlatness());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出圆数据
- void StaticData::PrintCircle(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataCircle *pCircle = NULL;
- CString szLine;
- szLine.Format("------------------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId CircelCode C-X C-Y C-Z Raidus RMS \r\n");
- pFile->WriteString(szLine);
- pos = m_CircleList.GetHeadPosition();
- while (pos != NULL)
- {
- pCircle = (EquipDataCircle *)m_CircleList.GetNext(pos);
- if (pCircle != NULL)
- {
- szLine.Format("%20s %d %d %s (%.3f %.3f %.3f) %.3f %.3f \r\n"
- ,pCircle->GetEquipCode()
- ,pCircle->GetItemId()
- ,pCircle->GetSubItemId()
- ,pCircle->GetCircleCode()
- ,pCircle->GetCircleCenterX()
- ,pCircle->GetCircleCenterY()
- ,pCircle->GetCircleCenterZ()
- ,pCircle->GetCircleRadius()
- ,pCircle->GetCircleRMS());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出直线数据
- void StaticData::PrintLine(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataLine *pLine = NULL;
- CString szLine;
- szLine.Format("---------------------------------------------------------------------------------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId lineCode Vec-X Vec-Y Vec-Z Start-X Start-Y Start-Z End-X End-Y End-Z Length \r\n");
- pFile->WriteString(szLine);
- pos = m_LineList.GetHeadPosition();
- while (pos != NULL)
- {
- pLine = (EquipDataLine *)m_LineList.GetNext(pos);
- if (pLine != NULL)
- {
- szLine.Format("%20s %d %d %s (%.3f %.3f %.3f)(%.3f %.3f %.3f) (%.3f %.3f %.3f) %.3f \r\n"
- ,pLine->GetEquipCode()
- ,pLine->GetItemId()
- ,pLine->GetSubItemId()
- ,pLine->GetLineCode()
- ,pLine->GetLineVectorX()
- ,pLine->GetLineVectorY()
- ,pLine->GetLineVectorZ()
- ,pLine->GetLineStartX()
- ,pLine->GetLineStartY()
- ,pLine->GetLineStartZ()
- ,pLine->GetLineEndX()
- ,pLine->GetLineEndY()
- ,pLine->GetLineEndZ()
- ,pLine->GetLineLength());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出圆柱数据
- void StaticData::PrintCylinder(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataCylinder *pCylinder = NULL;
- CString szLine;
- szLine.Format("------------------------------------------------------------------------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId CylinderCode P1-X P1-Y P1-Z P2-X P2-Y P2-Z Radius Length \r\n");
- pFile->WriteString(szLine);
- pos = m_CylinderList.GetHeadPosition();
- while (pos != NULL)
- {
- pCylinder = (EquipDataCylinder *)m_CylinderList.GetNext(pos);
- if (pCylinder != NULL)
- {
- szLine.Format("%20s %d %d %s (%.3f %.3f %.3f) (%.3f %.3f %.3f) %.3f %.3f \r\n"
- ,pCylinder->GetEquipCode()
- ,pCylinder->GetItemId()
- ,pCylinder->GetSubItemId()
- ,pCylinder->GetCylinderCode()
- ,pCylinder->GetPoint1X()
- ,pCylinder->GetPoint1Y()
- ,pCylinder->GetPoint1Z()
- ,pCylinder->GetPoint2X()
- ,pCylinder->GetPoint2Y()
- ,pCylinder->GetPoint2Z()
- ,pCylinder->GetCylinderRadius()
- ,pCylinder->GetCylinderLength());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印输出圆柱数据
- void StaticData::PrintAngle(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataAngle *pAngle = NULL;
- CString szLine;
- szLine.Format("------------------------------------------------------------------------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId CylinderCode P1-X P1-Y P1-Z P2-X P2-Y P2-Z Radius Length \r\n");
- pFile->WriteString(szLine);
- pos = m_AngleList.GetHeadPosition();
- while (pos != NULL)
- {
- pAngle = (EquipDataAngle *)m_AngleList.GetNext(pos);
- if (pAngle != NULL)
- {
- szLine.Format("%20s %d %d %s %s (%.3f %.3f %.3f) (%.3f %.3f %.3f) \r\n"
- , pAngle->GetEquipCode()
- , pAngle->GetItemId()
- , pAngle->GetSubItemId()
- , pAngle->GetLineCode()
- , pAngle->GetLineTitle()
- , pAngle->GetAngleAX()
- , pAngle->GetAngleAY()
- , pAngle->GetAngleAZ()
- , pAngle->GetAngleEX()
- , pAngle->GetAngleEY()
- , pAngle->GetAngleEZ());
- pFile->WriteString(szLine);
- }
- }
- }
- // 打印点残差数据
- void StaticData::PrintPointRelated(CStdioFile *pFile)
- {
- POSITION pos;
- EquipDataPointRelated *pPointRelated = NULL;
- CString szLine;
- szLine.Format("---------------------------------------------------------------------------\r\n");
- pFile->WriteString(szLine);
- szLine.Format("equipCode itemId subitemId itemType PointSubItemId \r\n");
- pFile->WriteString(szLine);
- pos = m_PointRelatedList.GetHeadPosition();
- while (pos != NULL)
- {
- pPointRelated = (EquipDataPointRelated *)m_PointRelatedList.GetNext(pos);
- if (pPointRelated != NULL)
- {
- szLine.Format("%20s %d %d %d %d\n"
- ,pPointRelated->GetEquipCode()
- ,pPointRelated->GetItemId()
- ,pPointRelated->GetSubItemId()
- ,pPointRelated->GetItemType()
- ,pPointRelated->GetPointSubItemId());
- pFile->WriteString(szLine);
- }
- }
- }
|