-
Notifications
You must be signed in to change notification settings - Fork 0
/
COMMAND.Cpp
75 lines (63 loc) · 1.48 KB
/
COMMAND.Cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "math.h"
#include "Command.h"
#include "mainwindow.h"
#include "diagramscene.h"
#include <QStatusBar>
void CCommand::Prompt(QString sInfo)
{
MainWindow* pMain = (MainWindow*)m_pDiagramScene->parent();
pMain->statusBar()->showMessage(sInfo);
}
//show a circle
void CCommand::ShowCapturePoint(const QPointF &pos, bool bShow)
{
if (bShow)
{
//CDC* pDC = g_pView->GetDC(); // 得到设备环境指针
//CCircle* pTempCircle = new CCircle(pos, 3);
//pTempCircle->Draw(pDC, dmDrag);
//delete pTempCircle;
//g_pView->ReleaseDC(pDC); // 释放设备环境指针
}
}
bool CCommand::GetNearKeyPoint(QPointF &pt)
{
return false;
//CVCadDoc *pDoc = (CVCadDoc *)g_pView->GetDocument();
//POSITION pos = pDoc->m_EntityList.GetHeadPosition();
//while(pos!=NULL)
//{
// MEntity* pEntity = (MEntity *) pDoc->m_EntityList.GetNext(pos);
// /////////////////////////////////////////////////////////
// if(pEntity->m_nOperationNum <= g_pView->m_nCurrentOperation) {
// MEntity * pEntShow = pEntity->GetShowEnt();
// if(pEntShow && pEntShow->m_nOperationNum >= 0 )
// {
// if(pEntity->GetSnapPos(pt))
// {
// return TRUE;
// }
// }
// }
//}
}
//
int CCommand::OnMouseMove(QGraphicsSceneMouseEvent* mouseEvent)
{
QPointF pt = mouseEvent->scenePos();
if(GetNearKeyPoint(pt))
{
if(!m_bCaptured)
{
ShowCapturePoint(pt, true);
}
m_bCaptured = true;
m_ptCapture = pt;
}
else if(m_bCaptured)
{
ShowCapturePoint(m_ptCapture, true);
m_bCaptured = true;
}
return 0;
}