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 
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, 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:
58  {
63  eCurrentValueCol
64  };
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;
106  TermTreeGraphicsScene* scene;
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 
119  friend class ConditionViewerWidget;
120  };
121 } // namespace armarx
armarx::TermNodePtr
std::shared_ptr< TermNode > TermNodePtr
Definition: TermNode.h:42
armarx::TermNode::eDataFieldCol
@ eDataFieldCol
Definition: TermNode.h:59
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:62
IceInternal::Handle< TermImpl >
DatafieldRef.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::TermNode::eParametersCol
@ eParametersCol
Definition: TermNode.h:61
armarx::TermTreeGraphicsScene
Definition: TermTreeGraphicsScene.h:33
armarx::ConditionViewerWidget
Definition: ConditionViewerWidget.h:48
armarx::TermNode::CheckTableColumns
CheckTableColumns
Definition: TermNode.h:57
IceManager.h
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:239
IceUtil::Handle< IceManager >
TermTreeGraphicsScene.h
armarx::TermNode::getImpl
TermImplPtr getImpl()
Definition: TermNode.h:76
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:27
armarx::TreeNode
Definition: TreeNode.h:43
armarx::TermNode::eCheckTypeCol
@ eCheckTypeCol
Definition: TermNode.h:60
ImportExportComponent.h