|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "MarkAreaMgr.h"
|
|
|
|
|
#include "CStringFuc.h"
|
|
|
|
|
#include "GlobalDrawMgr.h"
|
|
|
|
|
#include "FileMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "ObjComponentMgr.h"
|
|
|
|
|
#include "WorkFileLable.h"
|
|
|
|
|
#include "WorkFileMgr.h"
|
|
|
|
|
#include "Layer.h"
|
|
|
|
|
#include "WorkDataMgr.h"
|
|
|
|
|
#include "CommonFlowMgr.h"
|
|
|
|
|
|
|
|
|
|
#define FILE_PATH _T("\\Parameter\\MarkArea\\MarkArea.par")
|
|
|
|
|
#define FIXED_FILE_PATH _T("\\Parameter\\MarkArea\\FixedMarkArea.par")//<2F>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ֻ<>ܶ<EFBFBD>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CMarkAreaMgr *gMarkAreaMgr = new CMarkAreaMgr;
|
|
|
|
|
CMarkAreaMgr::CMarkAreaMgr(void)
|
|
|
|
|
{
|
|
|
|
|
m_CurSelIdx = -1;//<2F><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
m_bDraw = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_bDrawIdx = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾarea <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
}
|
|
|
|
|
CMarkAreaMgr::~CMarkAreaMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::OnAppInitialize()
|
|
|
|
|
{
|
|
|
|
|
SaveOrLoad(false);//<2F><>ȡ<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::Draw(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
if(!m_bDraw)
|
|
|
|
|
return;
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(m_CurSelIdx==i)
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec[i].Draw(pDC,true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec[i].Draw(pDC,false);
|
|
|
|
|
}
|
|
|
|
|
if(m_bDrawIdx)
|
|
|
|
|
{
|
|
|
|
|
//<2F>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%d"),i+1);
|
|
|
|
|
gDraw->DrawTxt(pDC,str,m_AreaVec[i].GetBasePt());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>area ,һ<><D2BB>ֻ<EFBFBD><D6BB>ѡһ<D1A1><D2BB>
|
|
|
|
|
void CMarkAreaMgr::SelAreaByPt(Dbxy pt)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(m_AreaVec[i].IsPtInArea(pt))
|
|
|
|
|
{
|
|
|
|
|
SetCurSelIdx(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ѡ<><D1A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>area
|
|
|
|
|
void CMarkAreaMgr::SelFristArea()
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(i==0)
|
|
|
|
|
m_AreaVec[i].SetSelState(true);
|
|
|
|
|
else
|
|
|
|
|
m_AreaVec[i].SetSelState(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>ȡ
|
|
|
|
|
void CMarkAreaMgr::SaveOrLoad(bool bSave,bool bFixed)
|
|
|
|
|
{
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
|
|
char filepath[1024];
|
|
|
|
|
if(bFixed)
|
|
|
|
|
FileMgr.GetFullFilePath(filepath,FIXED_FILE_PATH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
else
|
|
|
|
|
FileMgr.GetFullFilePath(filepath,FILE_PATH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
|
|
|
|
|
if(bSave)
|
|
|
|
|
{
|
|
|
|
|
CFile file(filepath,CFile::modeReadWrite|CFile::modeCreate);
|
|
|
|
|
CArchive ar(&file,CArchive::store);
|
|
|
|
|
SaveOrLoadExt(ar);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CFile file;
|
|
|
|
|
if(file.Open(filepath,CFile::modeRead))
|
|
|
|
|
{
|
|
|
|
|
CArchive ar(&file,CArchive::load);
|
|
|
|
|
SaveOrLoadExt(ar);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("MarkArea File Read Err", _LOG_ERROR);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::SaveOrLoadExt(CArchive &ar)
|
|
|
|
|
{
|
|
|
|
|
int size = 0;
|
|
|
|
|
if(ar.IsStoring())
|
|
|
|
|
{
|
|
|
|
|
size = m_AreaVec.size();//area <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ar<<size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ar>>size;
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
CMarkArea Area;
|
|
|
|
|
if(i==0)
|
|
|
|
|
Area.SetSelState(true);//Ĭ<><C4AC>ѡ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
m_AreaVec.push_back(Area);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec[i].Serialize(ar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void CMarkAreaMgr::WriteWorkFileExt(vector<CLab> &LabVec)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
LabVec.push_back(CLab(LAB_MARK_AREA_START));
|
|
|
|
|
m_AreaVec[i].WriteWorkFile(LabVec);
|
|
|
|
|
LabVec.push_back(CLab(LAB_MARK_AREA_END));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::ReadWorkFile(CLabVecRang &LabVecRang)
|
|
|
|
|
{
|
|
|
|
|
vector<CLabVecRang> LabVecRangVec;
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
WorkFileMgr.SeparateStrVec(LabVecRang,LabVecRangVec,LAB_MARK_AREA_START,LAB_MARK_AREA_END);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>
|
|
|
|
|
if(!LabVecRangVec.empty())
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec.clear();
|
|
|
|
|
vector<CLabVecRang>::iterator iter = LabVecRangVec.begin();
|
|
|
|
|
vector<CLabVecRang>::iterator iter_end = LabVecRangVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CMarkArea MarkArea;
|
|
|
|
|
MarkArea.ReadWorkFile(*iter);
|
|
|
|
|
m_AreaVec.push_back(MarkArea);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if 1//<2F>༭area <20>õĺ<C3B5><C4BA><EFBFBD>
|
|
|
|
|
void CMarkAreaMgr::Add()
|
|
|
|
|
{
|
|
|
|
|
if(m_AreaVec.empty())//<2F>½<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
CMarkArea Area;
|
|
|
|
|
m_AreaVec.push_back(Area);
|
|
|
|
|
}
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if(IdxValid(m_CurSelIdx))
|
|
|
|
|
{
|
|
|
|
|
CMarkArea Area(m_AreaVec[m_CurSelIdx]);
|
|
|
|
|
m_AreaVec.push_back(Area);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::InsertList(CListCtrl &List)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
int idx = 0;
|
|
|
|
|
List.InsertItem(i," ");//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
List.SetItemText(i,idx++,Int2CString(i+1));//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy pt = m_AreaVec[i].GetBasePt();//<2F><><EFBFBD><D7BC>
|
|
|
|
|
List.SetItemText(i,idx++,Db2CString(pt.x));
|
|
|
|
|
List.SetItemText(i,idx++,Db2CString(pt.y));
|
|
|
|
|
DbSize size = m_AreaVec[i].GetSize();//<2F>ߴ<EFBFBD>
|
|
|
|
|
List.SetItemText(i,idx++,Db2CString(size.w));
|
|
|
|
|
List.SetItemText(i,idx++,Db2CString(size.h));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>idx <20>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
|
|
|
|
|
bool CMarkAreaMgr::IdxValid(int idx)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
if(idx<0 || idx>= size)
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::DelSel(int &idx)
|
|
|
|
|
{
|
|
|
|
|
if(!IdxValid(idx))
|
|
|
|
|
return;
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
int i=0;
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if(i==idx)
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec.erase(iter);
|
|
|
|
|
idx = -1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::DelAll()
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec.clear();
|
|
|
|
|
m_CurSelIdx = -1;//<2F><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>idx <20><><EFBFBD><EFBFBD>
|
|
|
|
|
void CMarkAreaMgr::OpArea(int idx,CMarkArea &Area,bool bRead)
|
|
|
|
|
{
|
|
|
|
|
if(!IdxValid(idx))
|
|
|
|
|
return;
|
|
|
|
|
ResetAllAreaSelState();
|
|
|
|
|
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(idx == i)
|
|
|
|
|
{
|
|
|
|
|
if(bRead)
|
|
|
|
|
{
|
|
|
|
|
Area = m_AreaVec[i];
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬
|
|
|
|
|
m_AreaVec[i].SetSelState(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_AreaVec[i] = Area;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
|
|
|
|
|
void CMarkAreaMgr::Order(int &idx,bool bMoveUp)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
if(bMoveUp)//ǰ<><C7B0>
|
|
|
|
|
{
|
|
|
|
|
SwapArea(idx,idx-1);
|
|
|
|
|
}
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
SwapArea(idx,idx+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::SwapArea(int &idx1,int idx2)
|
|
|
|
|
{
|
|
|
|
|
if(!IdxValid(idx1) || !IdxValid(idx2))
|
|
|
|
|
return;
|
|
|
|
|
CMarkArea tmp = m_AreaVec[idx1];
|
|
|
|
|
m_AreaVec[idx1] = m_AreaVec[idx2];
|
|
|
|
|
m_AreaVec[idx2] = tmp;
|
|
|
|
|
//ָ<><EFBFBD><F2BDBBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
idx1 = idx2;
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::MoveAllArea(double Val,DIRECTION dir)
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt = m_AreaVec[i].GetBasePt();
|
|
|
|
|
if(dir==_DIR_L ||dir==_DIR_R)
|
|
|
|
|
pt.x += Val;
|
|
|
|
|
else
|
|
|
|
|
pt.y += Val;
|
|
|
|
|
m_AreaVec[i].SetBasePt(pt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F>ռ<EFBFBD><D5BC>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CMarkAreaMgr::CollectWorkData(bool bNeedSel)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("Func---->CollectWorkData");
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>obj <20><><EFBFBD>ռ<EFBFBD>״̬----------------------------------
|
|
|
|
|
gObjComponentMgr->ResetObjCollectState(false);
|
|
|
|
|
CObjContainer &LayerObjContainer = gLayer.GetObjContainer();
|
|
|
|
|
LayerObjContainer.ResetAllCollectedState();
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(int i=0;iter!=iter_end;iter++,i++)
|
|
|
|
|
{
|
|
|
|
|
(*iter).CollectWorkData(bNeedSel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F>Ƿ<EFBFBD><C7B7>мӹ<D0BC><D3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int CMarkAreaMgr::GetHasWorkDataAreaCnt()
|
|
|
|
|
{
|
|
|
|
|
int Cnt = 0;
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if((*iter).HasWorkData())//ֻҪһ<D2AA><D2BB>area <20><><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Cnt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(Cnt == 0)
|
|
|
|
|
gLogMgr->WriteDebugLog("Err----> not have work data",_LOG_ERROR);
|
|
|
|
|
return Cnt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
//<2F><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
|
|
|
|
|
void CMarkAreaMgr::ArrayCreat(int CntX,int CntY,double Offset)
|
|
|
|
|
{
|
|
|
|
|
DelAll();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD>area <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy pt;
|
|
|
|
|
pt.x = ((CntX-1)*Offset)/2;
|
|
|
|
|
pt.y = ((CntY-1)*Offset)/2;
|
|
|
|
|
double flag = -1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
for(int i=0;i<CntX;i++)
|
|
|
|
|
{
|
|
|
|
|
for(int j=0;j<CntY;j++)
|
|
|
|
|
{
|
|
|
|
|
CMarkArea Area;
|
|
|
|
|
Area.SetBasePt(pt);
|
|
|
|
|
m_AreaVec.push_back(Area);
|
|
|
|
|
if(j<CntY-1)//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ƫ<EFBFBD><C6AB>
|
|
|
|
|
pt.y += Offset*(flag);
|
|
|
|
|
}
|
|
|
|
|
pt.x -= Offset;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
flag *= (-1);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMarkAreaMgr::ResetAllAreaSelState()
|
|
|
|
|
{
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter).SetSelState(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int CMarkAreaMgr::GetCurSelIdx()
|
|
|
|
|
{
|
|
|
|
|
int size = m_AreaVec.size();
|
|
|
|
|
if(m_CurSelIdx<size)
|
|
|
|
|
return m_CurSelIdx;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::SetAllMarkSize()
|
|
|
|
|
{
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter).UpdateSize();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CMarkAreaMgr::ReReadFixMarkArea()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD>¶<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>markaera <20><><EFBFBD><EFBFBD>
|
|
|
|
|
DelAll();
|
|
|
|
|
SaveOrLoad(false,true);//<2F>ӹ̶<D3B9><CCB6>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
//ͨ<><CDA8>obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>markarea <20><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ͷ<EFBFBD>Χ
|
|
|
|
|
void CMarkAreaMgr::AdjustByObj()
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("func : Adjust MarkArea By Obj");
|
|
|
|
|
ReReadFixMarkArea();
|
|
|
|
|
|
|
|
|
|
double MaxSize = 0;
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter).AdjustByObj();
|
|
|
|
|
DbSize size = (*iter).GetSize();
|
|
|
|
|
if(size.w>MaxSize)
|
|
|
|
|
MaxSize = size.w;
|
|
|
|
|
if(size.h>MaxSize)
|
|
|
|
|
MaxSize = size.h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format(_T("[MaxAreaSize] = [%.3f]"),MaxSize);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ѻ<EFBFBD><D1BB><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʹ<EFBFBD><CAB9>)
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ͬ<EFBFBD><CDAC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MarkArea <20>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
void CMarkAreaMgr::Adjust()
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("func : CMarkAreaMgr---->Adjust");
|
|
|
|
|
int idx = 0;
|
|
|
|
|
vector<CMarkArea>::iterator iter = m_AreaVec.begin();
|
|
|
|
|
vector<CMarkArea>::iterator iter_end = m_AreaVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if((*iter).HasWorkData())//ֻҪһ<D2AA><D2BB>area <20><><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
(*iter).SetAreaIdx(idx++);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ѻ<EFBFBD><D1BB><EFBFBD>
|
|
|
|
|
DataVec <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
TempIdx ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
TempCnt ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PenPar <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CardIdx <EFBFBD>ѻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void CMarkAreaMgr::SendDataToCard(int CardIdx)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ȫ<EFBFBD><C8AB>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool CMarkAreaMgr::IsAllPtData(vector<vector<Dbxy>> &PtDataVec)
|
|
|
|
|
{
|
|
|
|
|
int size = PtDataVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
vector<Dbxy> &OneDataVec = PtDataVec[i];
|
|
|
|
|
int size1 = OneDataVec.size();
|
|
|
|
|
if(size1 > 1)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//ת<><D7AA>Ԫ<EFBFBD><D4AA>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ݵĸ<DDB5>ʽ
|
|
|
|
|
void CMarkAreaMgr::ConvertTempData(vector<vector<Dbxy>> &DataVec,vector<double> &TempDataVec)
|
|
|
|
|
{
|
|
|
|
|
CPenPar &PenPar = gPenParMgr->GetCurPen();
|
|
|
|
|
|
|
|
|
|
int size = DataVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
vector<Dbxy> &OneDataVec = DataVec[i];
|
|
|
|
|
int size1 = OneDataVec.size();
|
|
|
|
|
int WorkTimes = 1;
|
|
|
|
|
|
|
|
|
|
if(size1 == 1)//ֻ<><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
TempDataVec.push_back((double)(size1*WorkTimes));//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
for(int k=0;k<WorkTimes;k++)
|
|
|
|
|
{
|
|
|
|
|
TempDataVec.push_back(OneDataVec[0].x);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X
|
|
|
|
|
TempDataVec.push_back(OneDataVec[0].y);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else//<2F><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
TempDataVec.push_back((double)(size1*WorkTimes));//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
for(int k=0;k<WorkTimes;k++)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
for(int m=0;m<size1;m++)
|
|
|
|
|
{
|
|
|
|
|
TempDataVec.push_back(OneDataVec[m].x);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X
|
|
|
|
|
TempDataVec.push_back(OneDataVec[m].y);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TempDataVec.push_back(0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
}
|
|
|
|
|
//ת<><D7AA>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
void CMarkAreaMgr::ConvertPosVec(vector<vector<Dbxy>> &DataVec,vector<Dbxy> &PosVec)
|
|
|
|
|
{
|
|
|
|
|
int size = DataVec.size();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
vector<Dbxy> &OneDataVec = DataVec[i];
|
|
|
|
|
int size1 = OneDataVec.size();
|
|
|
|
|
if(size1 == 1)//ֻ<><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
PosVec.push_back(OneDataVec[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>鴥<EFBFBD><E9B4A5>ģ<EFBFBD><C4A3><EFBFBD>İ<EFBFBD>ȫ<EFBFBD><C8AB>
|
|
|
|
|
bool CMarkAreaMgr::CheckTempIdx(int idx)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
if(idx<0 || idx>=m_CurTempCnt)
|
|
|
|
|
{
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format(_T("Err----><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[idx] = [%d]"),idx);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|