-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGraphicItemWireHandle.h
75 lines (58 loc) · 2.41 KB
/
GraphicItemWireHandle.h
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
////////////////////////////////////////////////////////////////////////
// Copyright 2009-2018 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2018, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.
////////////////////////////////////////////////////////////////////////
#ifndef GRAPHICITEMWIREHANDLE_H
#define GRAPHICITEMWIREHANDLE_H
#include "GlobalIncludes.h"
#include "GraphicItemBase.h"
#include "GraphicItemWire.h"
#include "GraphicItemPort.h"
// Forward declarations to allow compile
class GraphicItemPort;
class GraphicItemWire;
////////////////////////////////////////////////////////////
class GraphicItemWireHandle : public QGraphicsRectItem, public GraphicItemBase
{
public:
// Enumerations for Identifying the Wire Point Position
enum WirePointPosition { STARTPOINT, ENDPOINT };
// Required Virtual function for any QGraphicItem to provide a type value for the qgraphicsitem_cast function
enum { Type = UserType + ITEMTYPE_WIREHANDLE };
int type() const {return Type;}
// Constructor / Destructor
GraphicItemWireHandle(const QPointF& InitPosition, WirePointPosition WirePointPos, QGraphicsItem* parent=0);
virtual ~GraphicItemWireHandle();
// Serialization
void SaveData(QDataStream& DataStreamOut);
public:
// Update Positition and Control Visibility
void UpdatePosition(const QPointF& NewPosition);
void MakeVisible(bool VisibleFlag);
// Set / Get Connected Port
void SetWireHandleConnectedPort(GraphicItemPort* ptrPort);
GraphicItemPort* GetWireHandleConnectedPort() {return m_HandleConnectedPort;}
// Get the parent GraphicItemWire
GraphicItemWire* GetConnectedWire();
// Get the current Point Position of this Wire Handle
WirePointPosition GetWireHandlePointPosition() {return m_WirePointPosition;}
private:
QVariant itemChange(GraphicsItemChange change, const QVariant& value);
private:
QPointF m_CurrentPosition;
WirePointPosition m_WirePointPosition;
GraphicItemPort* m_HandleConnectedPort;
};
#endif // GRAPHICITEMWIREHANDLE_H