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 "TreeNode.h"
27 
32 #include <ArmarXCore/interface/observers/ConditionHandlerInterface.h>
33 
34 #include <QTableWidget>
35 
36 #include <mutex>
37 
38 namespace 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,
48  public Logging
49  {
50  Q_OBJECT
51  private:
52  // constants
53  static const QSize LiteralNodeSize;
54  static const QSize ExpressionNodeSize;
55  static const QSize ConditionRootNodeSize;
56 
57  public:
59  {
64  eCurrentValueCol
65  };
66 
67  // constructs a term node
68  TermNode(TermTreeGraphicsScene* scene, QTableWidget* checksTable, TermImplPtr term, int conditionId, IceManagerPtr manager, ConditionHandlerInterfacePrx handler);
69  ~TermNode() override;
71  {
72  return term;
73  }
74 
75  QString getDatafieldValue();
76  void setTermEvaluationState(TermImplPtr term);
77  public slots:
78  void graphicsItemClicked();
79  void checksTableSelectionChanged();
80  void updateValueString(const QString& valueString);
81  void setTermEvaluationState(bool truthy);
82  signals:
83  void literalClicked(int);
84  void newLiteralValue(bool truthy);
85  void newValueString(QString newValue);
86  protected:
87  void drawNode(QRectF boundingBox) override;
88  void drawEdge(QLineF line) override;
89 
90  private:
91  void updateChecksTable(TermImplPtr term);
92 
93  // reference to term
94  TermImplPtr term;
95  int conditionId;
96 
97  // graphical items
98  TermNodeGraphicsItem* graphicsItem;
99  TermTreeGraphicsScene* scene;
100  QTableWidget* checksTable;
101  int literalRow;
102  std::string literaldatafieldName;
103  DatafieldRefPtr curDatafield;
104  std::recursive_mutex dataMutex;
105 
106  IceManagerPtr manager;
107  ConditionHandlerInterfacePrx handler;
108  // QObject interface
109  protected:
110  void timerEventRun();
111 
112  friend class ConditionViewerWidget;
113  };
114 }
115 
armarx::TermNodePtr
std::shared_ptr< TermNode > TermNodePtr
Definition: TermNode.h:42
armarx::TermNode::eDataFieldCol
@ eDataFieldCol
Definition: TermNode.h:60
TreeNode.h
armarx::TermNodeGraphicsItem
Definition: TermNodeGraphicsItem.h:33
TermImpl.h
armarx::TermNodeWeakPtr
std::weak_ptr< TermNode > TermNodeWeakPtr
Definition: TermNode.h:43
armarx::TermNode::eStateCol
@ eStateCol
Definition: TermNode.h:63
IceInternal::Handle< TermImpl >
DatafieldRef.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::TermNode::eParametersCol
@ eParametersCol
Definition: TermNode.h:62
armarx::TermTreeGraphicsScene
Definition: TermTreeGraphicsScene.h:32
armarx::ConditionViewerWidget
Definition: ConditionViewerWidget.h:49
armarx::TermNode::CheckTableColumns
CheckTableColumns
Definition: TermNode.h:58
IceManager.h
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
IceUtil::Handle< IceManager >
TermTreeGraphicsScene.h
armarx::TermNode::getImpl
TermImplPtr getImpl()
Definition: TermNode.h:70
armarx::TermNode
class ARMARXCOMPONENT_IMPORT_EXPORT TermNode
Definition: TermNode.h:40
armarx::TermNode
Definition: TermNode.h:47
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::TreeNode
Definition: TreeNode.h:43
armarx::TermNode::eCheckTypeCol
@ eCheckTypeCol
Definition: TermNode.h:61
ImportExportComponent.h