TermNode.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::Gui::TermNode
17* @author Kai Welke ( welke at kit dot edu)
18* @date
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
25#include <mutex>
26
27#include <QTableWidget>
28
31#include <ArmarXCore/interface/observers/ConditionHandlerInterface.h>
34
35#include "TreeNode.h"
37
38namespace armarx
39{
41
42 using TermNodePtr = std::shared_ptr<TermNode>;
43 using TermNodeWeakPtr = std::weak_ptr<TermNode>;
44
46
47 class ARMARXCOMPONENT_IMPORT_EXPORT TermNode : public QObject, public TreeNode, public Logging
48 {
49 Q_OBJECT
50 private:
51 // constants
52 static const QSize LiteralNodeSize;
53 static const QSize ExpressionNodeSize;
54 static const QSize ConditionRootNodeSize;
55
56 public:
65
66 // constructs a term node
68 QTableWidget* checksTable,
69 TermImplPtr term,
70 int conditionId,
71 IceManagerPtr manager,
72 ConditionHandlerInterfacePrx handler);
73 ~TermNode() override;
74
77 {
78 return term;
79 }
80
81 QString getDatafieldValue();
82 void setTermEvaluationState(TermImplPtr term);
83 public slots:
84 void graphicsItemClicked();
85 void checksTableSelectionChanged();
86 void updateValueString(const QString& valueString);
87 void setTermEvaluationState(bool truthy);
88 signals:
89 void literalClicked(int);
90 void newLiteralValue(bool truthy);
91 void newValueString(QString newValue);
92
93 protected:
94 void drawNode(QRectF boundingBox) override;
95 void drawEdge(QLineF line) override;
96
97 private:
98 void updateChecksTable(TermImplPtr term);
99
100 // reference to term
101 TermImplPtr term;
102 int conditionId;
103
104 // graphical items
105 TermNodeGraphicsItem* graphicsItem;
107 QTableWidget* checksTable;
108 int literalRow;
109 std::string literaldatafieldName;
110 DatafieldRefPtr curDatafield;
111 std::recursive_mutex dataMutex;
112
113 IceManagerPtr manager;
114 ConditionHandlerInterfacePrx handler;
115 // QObject interface
116 protected:
117 void timerEventRun();
118
120 };
121} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
void literalClicked(int)
void drawNode(QRectF boundingBox) override
Draws the node.
Definition TermNode.cpp:117
void newValueString(QString newValue)
TermImplPtr getImpl()
Definition TermNode.h:76
void newLiteralValue(bool truthy)
friend class ConditionViewerWidget
Definition TermNode.h:119
void drawEdge(QLineF line) override
Draws an edge to this node.
Definition TermNode.cpp:124
TermNode(TermTreeGraphicsScene *scene, QTableWidget *checksTable, TermImplPtr term, int conditionId, IceManagerPtr manager, ConditionHandlerInterfacePrx handler)
Definition TermNode.cpp:37
TreeNode(QGraphicsScene *scene, QSize nodeSize=TreeNode::DefaultNodeSize)
Constructs a tree node as part of a Qt visualizable tree.
Definition TreeNode.cpp:36
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::weak_ptr< TermNode > TermNodeWeakPtr
Definition TermNode.h:43
std::shared_ptr< TermNode > TermNodePtr
Definition TermNode.h:42
IceInternal::Handle< DatafieldRef > DatafieldRefPtr
Definition Observer.h:43
IceInternal::Handle< TermImpl > TermImplPtr
Typedef of TermImplPtr as IceInternal::Handle<TermImpl> for convenience.
Definition TermImpl.h:41
IceUtil::Handle< IceManager > IceManagerPtr
IceManager smart pointer.
Definition ArmarXFwd.h:39