|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "ObjChar.h"
|
|
|
|
|
#include "ObjPline.h"
|
|
|
|
|
#include "DataPoint.h"
|
|
|
|
|
#include "FontTypeMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CObjChar::CObjChar(char *p)
|
|
|
|
|
{
|
|
|
|
|
m_pChar = p;
|
|
|
|
|
}
|
|
|
|
|
CObjChar::~CObjChar(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
CString CObjChar::GetStr()
|
|
|
|
|
{
|
|
|
|
|
CString str = "<EFBFBD>ַ<EFBFBD>";
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
void CObjChar::Creat()
|
|
|
|
|
{
|
|
|
|
|
CFontTypeMgr &pFontTypeMgr = CFontTypeMgr::Instance();
|
|
|
|
|
//<2F>ȶ<EFBFBD>ȡ<EFBFBD><C8A1>m_PonitVec <20><>
|
|
|
|
|
vector<PointType> m_PonitVec;
|
|
|
|
|
//<2F>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pFontTypeMgr.CreatCharVec(m_pChar,m_PonitVec);
|
|
|
|
|
//<2F><>ת<EFBFBD><D7AA>Ϊobj
|
|
|
|
|
CreatObjData(m_PonitVec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡobj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CObjChar::CreatObjData(vector<PointType> &m_PonitVec)
|
|
|
|
|
{
|
|
|
|
|
if(m_PonitVec.size() <= 1)//û<><C3BB>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
CObjPline *pPline = new CObjPline;
|
|
|
|
|
|
|
|
|
|
DbRect rect(0,100,100,0);
|
|
|
|
|
pPline->CreatRect(rect);
|
|
|
|
|
m_ObjContainer.AddObject(pPline);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int size = m_PonitVec.size();
|
|
|
|
|
|
|
|
|
|
//ȥ<><C8A5>ĩβ<C4A9><CEB2>Ҫ<EFBFBD><D2AA>ƫ<EFBFBD><C6AB>-----------------------------------
|
|
|
|
|
if(m_PonitVec[size-1].second == TRUE)
|
|
|
|
|
{
|
|
|
|
|
m_PonitVec.pop_back();
|
|
|
|
|
size--;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>m_PonitVec <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>obj
|
|
|
|
|
CObjPline *pPline = NULL;
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(m_PonitVec[i].second == true)
|
|
|
|
|
{
|
|
|
|
|
pPline = new CObjPline;
|
|
|
|
|
m_ObjContainer.AddObject(pPline);
|
|
|
|
|
}
|
|
|
|
|
if(pPline)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt;
|
|
|
|
|
pt.x = m_PonitVec[i].first.x;
|
|
|
|
|
pt.y = m_PonitVec[i].first.y;
|
|
|
|
|
CDataPoint DataPoint(pt);
|
|
|
|
|
//DataPoint.SetIsNode(true);//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
pPline->AddDataPoint(DataPoint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
|
|
|
|
m_ObjContainer.DelNullLine();
|
|
|
|
|
}
|
|
|
|
|
void CObjChar::Operate(SObjOperatePar &par)
|
|
|
|
|
{
|
|
|
|
|
if(par.OpType == _OP_SCALE)
|
|
|
|
|
{
|
|
|
|
|
DbRect rect = m_ObjContainer.GetObjRect(false);
|
|
|
|
|
DbSize s = rect.GetSize();
|
|
|
|
|
|
|
|
|
|
SObjOperatePar parX;
|
|
|
|
|
{
|
|
|
|
|
parX.OpType = _OP_STRETCH;
|
|
|
|
|
parX.BasePt = rect.GetCenterPt();
|
|
|
|
|
|
|
|
|
|
parX.OldSize = s.w;
|
|
|
|
|
parX.NewSize = s.w*par.Scale;
|
|
|
|
|
parX.Diff = parX.NewSize-parX.OldSize;
|
|
|
|
|
parX.xy = _X;
|
|
|
|
|
}
|
|
|
|
|
SObjOperatePar parY;
|
|
|
|
|
{
|
|
|
|
|
parY.OpType = _OP_STRETCH;
|
|
|
|
|
parX.BasePt = rect.GetCenterPt();
|
|
|
|
|
|
|
|
|
|
parY.OldSize = s.h;
|
|
|
|
|
parY.NewSize = s.h*par.Scale;
|
|
|
|
|
parY.Diff = parY.NewSize-parY.OldSize;
|
|
|
|
|
parY.xy = _Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int size = m_ObjContainer.GetSize();
|
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.Operate(parX,i);
|
|
|
|
|
m_ObjContainer.Operate(parY,i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CObjComposite::Operate(par);
|
|
|
|
|
}
|
|
|
|
|
}
|