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.
124 lines
3.7 KiB
C++
124 lines
3.7 KiB
C++
#include "StdAfx.h"
|
|
#include "MouseToolMeasure.h"
|
|
#include "GlobalFunction.h"
|
|
#include "CommandMove.h"
|
|
#include "GlobalDrawMgr.h"
|
|
#include "LogMgr.h"
|
|
#include "DrawSimpleShape.h"
|
|
|
|
CMouseToolMeasure::CMouseToolMeasure(void)
|
|
{
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
GetFrame()->SetCaptionCmdStr(CMD_TOOL_MEASURE_FIRST_PT);
|
|
GetFrame()->RefreashCaptionBar();
|
|
//깃푯으-------------------------end
|
|
|
|
}
|
|
CMouseToolMeasure::~CMouseToolMeasure(void)
|
|
{
|
|
}
|
|
void CMouseToolMeasure::OperateOver()
|
|
{
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
//깃푯으-------------------------end
|
|
CMouseTool::OperateOver();
|
|
m_Status = _STATUS_END;
|
|
}
|
|
void CMouseToolMeasure::OnLButtonDown(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
Dbxy pt = gDraw->CPoint2Dbxy(point);
|
|
if(m_Status==_STATUS_1)
|
|
{
|
|
SaveDownPoint(point);
|
|
//------------------------------------휑羚start
|
|
CString val1;
|
|
val1.Format("%lf",pt.x);
|
|
CString val2;
|
|
val2.Format("%lf",pt.y);
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_FIRST_PT,STR_NULL,STR_NULL,pt.x,pt.y);
|
|
//------------------------------------휑羚end
|
|
//깃푯으-------------------------start
|
|
GetFrame()->ResetCaptionBar();
|
|
GetFrame()->SetCaptionCmdStr(CMD_TOOL_MEASURE_SECOND_PT);
|
|
GetFrame()->RefreashCaptionBar();
|
|
//깃푯으-------------------------end
|
|
ToNextStatus();
|
|
}
|
|
else
|
|
{
|
|
//------------------------------------휑羚start
|
|
{
|
|
CString val1;
|
|
val1.Format("%lf",pt.x);
|
|
CString val2;
|
|
val2.Format("%lf",pt.y);
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_SECOND_PT,STR_NULL,STR_NULL,pt.x,pt.y);
|
|
}
|
|
{
|
|
//셕炬약잼
|
|
m_Dis = CalDistance(m_DownPoint,pt);
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_RESULT,STR_NULL,m_Dis);
|
|
}
|
|
{
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_RESULT2,STR_NULL,STR_NULL,pt.x-m_DownPoint.x,pt.y-m_DownPoint.y);
|
|
}
|
|
//셕炬실똑
|
|
{
|
|
double Ang = Cal360AngleByTwoPt(pt,m_DownPoint);
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_RESULT3,STR_NULL,Ang);
|
|
}
|
|
//좃몸듐뵨(0,0)듐돨셸실
|
|
{
|
|
double Ang = Cal360AngleByTwoPt(pt,Dbxy(0,0));
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_RESULT4,STR_NULL,Ang);
|
|
}
|
|
{
|
|
double Ang = Cal360AngleByTwoPt(m_DownPoint,Dbxy(0,0));
|
|
gLogMgr->WriteDebugLog(CMD_TOOL_MEASURE_RESULT4,STR_NULL,Ang);
|
|
}
|
|
//------------------------------------휑羚end
|
|
ClearFirstPoint();
|
|
m_Status = _STATUS_1;
|
|
}
|
|
}
|
|
void CMouseToolMeasure::OnLButtonUp(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
|
|
}
|
|
void CMouseToolMeasure::OnMouseMove(UINT nFlags, CPoint point,CClientDC &dc)
|
|
{
|
|
Dbxy OldPt = gDraw->CPoint2Dbxy(m_PreMovePt);
|
|
Dbxy CurPt = gDraw->CPoint2Dbxy(point);
|
|
CLayer &layer = gLayer;
|
|
if(m_Status!=_STATUS_1)
|
|
{
|
|
if(HasPreMovePt())//꼰뇜裂품돨窟
|
|
{
|
|
XorDrawLine(&dc,gDraw->GetMeasurePen(),m_DownPoint,OldPt);
|
|
}
|
|
XorDrawLine(&dc,gDraw->GetMeasurePen(),m_DownPoint,CurPt);
|
|
|
|
//셕炬약잼
|
|
m_Dis = CalDistance(m_DownPoint,CurPt);
|
|
|
|
//榴檄으-----------------------------start
|
|
CString str1 = "꿎좆[약잼]";
|
|
CString str2;
|
|
str2.Format("%lf",m_Dis);
|
|
GetFrame()->ResetStatusBarExtStr();
|
|
GetFrame()->SetStatusBarExtStr(str1,str2,STR_NULL);
|
|
//榴檄으-----------------------------end
|
|
SavePreMovePt(point);
|
|
}
|
|
}
|
|
void CMouseToolMeasure::OnEscapeKey()
|
|
{
|
|
if(m_Status!=_STATUS_1)//뒤랗늴듐
|
|
{
|
|
OperateOver();
|
|
}
|
|
}
|
|
|