|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "EasyOperationMgr.h"
|
|
|
|
|
#include "DrawSimpleShape.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "GlobalDrawMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CEasyOperationMgr *gEasyOperationMgr = new CEasyOperationMgr;
|
|
|
|
|
CEasyOperationMgr::CEasyOperationMgr(void)
|
|
|
|
|
{
|
|
|
|
|
m_bShow = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ
|
|
|
|
|
m_Gap = 0.002;//<2F><>ѡ<EFBFBD><D1A1>obj <20>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CEasyOperationMgr::~CEasyOperationMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CEasyOperationMgr::SetRect(DbRect rect)
|
|
|
|
|
{
|
|
|
|
|
m_OperatRect = rect;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡʵ<C8A1>ʻ<EFBFBD><CABB>Ƶ<EFBFBD>rect
|
|
|
|
|
DbRect CEasyOperationMgr::GetDrawRect()
|
|
|
|
|
{
|
|
|
|
|
DbRect rect = m_OperatRect;
|
|
|
|
|
double Gap = GetCurViewPtr()->GetCurrScaleVal(m_Gap);
|
|
|
|
|
rect.L -= Gap;
|
|
|
|
|
rect.R += Gap;
|
|
|
|
|
rect.B -= Gap;
|
|
|
|
|
rect.T += Gap;
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC>
|
|
|
|
|
Dbxy CEasyOperationMgr::GetBasePt()
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt;
|
|
|
|
|
switch(m_OprDir)
|
|
|
|
|
{
|
|
|
|
|
case _DIR_U:
|
|
|
|
|
case _DIR_R:
|
|
|
|
|
case _DIR_RT:
|
|
|
|
|
pt.x = m_OperatRect.L;
|
|
|
|
|
pt.y = m_OperatRect.B;
|
|
|
|
|
break;
|
|
|
|
|
case _DIR_D:
|
|
|
|
|
case _DIR_RB:
|
|
|
|
|
pt.x = m_OperatRect.L;
|
|
|
|
|
pt.y = m_OperatRect.T;
|
|
|
|
|
break;
|
|
|
|
|
case _DIR_L:
|
|
|
|
|
case _DIR_LT:
|
|
|
|
|
pt.x = m_OperatRect.R;
|
|
|
|
|
pt.y = m_OperatRect.B;
|
|
|
|
|
break;
|
|
|
|
|
case _DIR_LB:
|
|
|
|
|
pt.x = m_OperatRect.R;
|
|
|
|
|
pt.y = m_OperatRect.T;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return pt;
|
|
|
|
|
}
|
|
|
|
|
double CEasyOperationMgr::GetSize(X_OR_Y xy)
|
|
|
|
|
{
|
|
|
|
|
double size = 0;
|
|
|
|
|
if(xy = _X)
|
|
|
|
|
size = m_OperatRect.Width();
|
|
|
|
|
else
|
|
|
|
|
size = m_OperatRect.Height();
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
Dbxy CEasyOperationMgr::GetDiff(Dbxy StartPt,Dbxy EndPt)
|
|
|
|
|
{
|
|
|
|
|
Dbxy diff;
|
|
|
|
|
switch(m_OprDir)
|
|
|
|
|
{
|
|
|
|
|
case _DIR_R:
|
|
|
|
|
case _DIR_RT:
|
|
|
|
|
case _DIR_RB:
|
|
|
|
|
diff.x = EndPt.x - StartPt.x;
|
|
|
|
|
break;
|
|
|
|
|
case _DIR_L:
|
|
|
|
|
case _DIR_LT:
|
|
|
|
|
case _DIR_LB:
|
|
|
|
|
diff.x = StartPt.x - EndPt.x;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch(m_OprDir)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
case _DIR_LT:
|
|
|
|
|
case _DIR_U:
|
|
|
|
|
case _DIR_RT:
|
|
|
|
|
diff.y = EndPt.y - StartPt.y;
|
|
|
|
|
break;
|
|
|
|
|
case _DIR_LB:
|
|
|
|
|
case _DIR_D:
|
|
|
|
|
case _DIR_RB:
|
|
|
|
|
diff.y = StartPt.y - EndPt.y;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return diff;
|
|
|
|
|
}
|
|
|
|
|
void CEasyOperationMgr::Draw(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
if(m_bShow)
|
|
|
|
|
{
|
|
|
|
|
DbRect rect = GetDrawRect();
|
|
|
|
|
COLORREF color = gDraw->GetEasyOperationColor();
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.L,rect.T);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.L,rect.B);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.R,rect.B);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.R,rect.T);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt((rect.R+rect.L)/2,rect.T);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt((rect.R+rect.L)/2,rect.B);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.L,(rect.T+rect.B)/2);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt(rect.R,(rect.T+rect.B)/2);
|
|
|
|
|
DrawSolidRect(pDC,color,gDraw->GetCurPointRect(pt));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CEasyOperationMgr::Refresh()
|
|
|
|
|
{
|
|
|
|
|
if(gDraw->IsbUseEasyOperation())
|
|
|
|
|
{
|
|
|
|
|
CLayer &layer = gLayer;
|
|
|
|
|
if(layer.HasObjSel())
|
|
|
|
|
{
|
|
|
|
|
m_bShow = true;
|
|
|
|
|
SetRect(layer.GetSelObjRect());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_bShow = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>깤<EFBFBD><EAB9A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
MOUSE_TOOL CEasyOperationMgr::JudgeMouseToolType(Dbxy MousePt)
|
|
|
|
|
{
|
|
|
|
|
MOUSE_TOOL type = _TOOL_POINT;
|
|
|
|
|
if(!m_bShow)
|
|
|
|
|
return type;
|
|
|
|
|
|
|
|
|
|
DbRect rect = GetDrawRect();
|
|
|
|
|
if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.L,rect.T),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_LT;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.L,rect.B),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_LB;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.R,rect.B),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_RB;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.R,rect.T),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_RT;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy((rect.R+rect.L)/2,rect.T),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_U;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy((rect.R+rect.L)/2,rect.B),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_D;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.L,(rect.T+rect.B)/2),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_L;
|
|
|
|
|
}
|
|
|
|
|
else if(JudgeMouseToolTypeExt(MousePt,Dbxy(rect.R,(rect.T+rect.B)/2),type) != _TOOL_POINT)
|
|
|
|
|
{
|
|
|
|
|
m_OprDir = _DIR_R;
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
MOUSE_TOOL CEasyOperationMgr::JudgeMouseToolTypeExt(Dbxy MousePt,Dbxy pt,MOUSE_TOOL &type)
|
|
|
|
|
{
|
|
|
|
|
DbRect rect = gDraw->GetCurPointRect(pt);
|
|
|
|
|
if(IsPointInRect(MousePt,rect))
|
|
|
|
|
{
|
|
|
|
|
type = _TOOL_STRETCH;
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
}
|