You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
1.9 KiB
C++

#include "StdAfx.h"
#include "DataPoint.h"
#include "GlobalDrawMgr.h"
#include "GlobalFunction.h"
CDataPoint::CDataPoint(Dbxy _pt)
{
m_bIsNode = false;//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD>ڵ<EFBFBD>
m_pt = _pt;
}
CDataPoint::CDataPoint()
{
m_bIsNode = false;//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD>ڵ<EFBFBD>
}
CDataPoint::~CDataPoint(void)
{
}
//<2F><><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
CPoint CDataPoint::GetDevicePt()
{
return gDraw->Dbxy2CPoint(m_pt);
}
#if 1
//<2F><><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
void CDataPoint::Operate(SObjOperatePar &par)
{
switch(par.OpType)
{
case _OP_MOVE:
Move(par.MoveX,par.MoveY);
break;
case _OP_MIRROR:
Mirror(par.BasePt,par.xy);
break;
case _OP_ROTATO:
Rotato(par.BasePt,_360ToAngle(par.Angle));
break;
case _OP_STRETCH:
Stretch(par.BasePt,par.OldSize,par.Diff,par.xy);
break;
default:
break;
}
}
//<2F>ƶ<EFBFBD>
void CDataPoint::Move(double MoveX,double MoveY)
{
m_pt.x = m_pt.x+MoveX;
m_pt.y = m_pt.y+MoveY;
}
//<2F><><EFBFBD><EFBFBD>
//BasePt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC>
//Size <20><><EFBFBD><EFBFBD>ǰ<EFBFBD>ijߴ<C4B3>
//Diff <20>Ǿɳߴ<C9B3><DFB4><EFBFBD><EFBFBD>³ߴ<C2B3><DFB4>IJ<EFBFBD>
void CDataPoint::Stretch(Dbxy BasePt,double Size,double Diff,X_OR_Y xy)
{
if(Diff == 0)
return;
if(xy == _X)
{
m_pt.x = m_pt.x+Diff*((m_pt.x-BasePt.x)/Size);
}
else
{
m_pt.y = m_pt.y+Diff*((m_pt.y-BasePt.y)/Size);
}
}
//pt Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC>
void CDataPoint::Mirror(Dbxy pt,X_OR_Y xy)
{
if(xy == _X)
{
m_pt.x = m_pt.x+(pt.x-m_pt.x)*2;
}
else
{
m_pt.y = m_pt.y+(pt.y-m_pt.y)*2;
}
}
//Angle : <20><><EFBFBD>Ƚ<EFBFBD>pt : <20><>ת<EFBFBD><D7AA><EFBFBD>ĵ<EFBFBD>
void CDataPoint::Rotato(Dbxy pt,double Angle)
{
m_pt = RotatoPt(m_pt,Angle,pt);
}
#endif
bool CDataPoint::Equal(CDataPoint &pt)
{
return pt.GetPt().Equal(m_pt);
}
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
bool DbLine::IsSerialLine(DbLine &line)
{
if(m_pt1.Equal(line.m_pt1)||m_pt1.Equal(line.m_pt2)
||m_pt2.Equal(line.m_pt1)||m_pt2.Equal(line.m_pt2))
{
return true;
}
return false;
}