cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsTeleOperationQtWidget.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5  Author(s): Zihan Chen, Anton Deguet
6  Created on: 2013-02-20
7 
8  (C) Copyright 2013-2015 Johns Hopkins University (JHU), All Rights Reserved.
9 
10 --- begin cisst license - do not edit ---
11 
12 This software is provided "as is" under an open source license, with
13 no warranty. The complete license can be found in license.txt and
14 http://www.cisst.org/cisst/license.txt.
15 
16 --- end cisst license ---
17 */
18 
19 #ifndef _mtsTeleOperationQtWidget_h
20 #define _mtsTeleOperationQtWidget_h
21 
26 
27 #include <QtCore>
28 #include <QtGui>
29 
31 
32 class CISST_EXPORT mtsTeleOperationQtWidget: public QWidget, public mtsComponent
33 {
34  Q_OBJECT;
36 
37 public:
38  mtsTeleOperationQtWidget(const std::string & componentName, double periodInSeconds = 50.0 * cmn_ms);
40 
41  void Configure(const std::string & filename = "");
42  void Startup(void);
43  void Cleanup(void);
44 
45 protected:
46  virtual void closeEvent(QCloseEvent * event);
47 
48 signals:
49  void SignalEnable(bool enable);
50  void SignalScale(double scale);
51  void SignalRotationLocked(bool lock);
52  void SignalTranslationLocked(bool lock);
53 
54  void SignalAppendMessage(QString);
55  void SignalSetColor(QColor);
56 
57 private slots:
58  void timerEvent(QTimerEvent * event);
59  void SlotTextChanged(void);
60  // to set from the GUI
61  void SlotEnable(bool state);
62  void SlotSetScale(double scale);
63  void SlotLockRotation(bool lock);
64  void SlotLockTranslation(bool lock);
65  // to update GUI from component's events
66  void SlotEnableEventHandler(bool state);
67  void SlotScaleEventHandler(double scale);
68  void SlotRotationLockedEventHandler(bool lock);
69  void SlotTranslationLockedEventHandler(bool lock);
70 
71 private:
73  void setupUi(void);
74  int TimerPeriodInMilliseconds;
75 
76  void EnableEventHandler(const bool & enable);
77  void ScaleEventHandler(const double & scale);
78  void RotationLockedEventHandler(const bool & lock);
79  void TranslationLockedEventHandler(const bool & lock);
80 
81 protected:
82  struct {
91  } TeleOperation;
92 
93 private:
94  QCheckBox * QCBEnable;
95  QCheckBox * QCBLockRotation;
96  QCheckBox * QCBLockTranslation;
97  QDoubleSpinBox * QSBScale;
98  prmPositionCartesianGet PositionMaster;
99  vctQtWidgetFrameDoubleRead * QFRPositionMasterWidget;
100  prmPositionCartesianGet PositionSlave;
101  vctQtWidgetFrameDoubleRead * QFRPositionSlaveWidget;
102  vctMatRot3 RegistrationRotation;
103 
104  // timing
105  mtsIntervalStatistics IntervalStatistics;
106  mtsQtWidgetIntervalStatistics * QMIntervalStatistics;
107 
108  // messages
109  void ErrorEventHandler(const std::string & message);
110  void WarningEventHandler(const std::string & message);
111  void StatusEventHandler(const std::string & message);
112  QTextEdit * QTEMessages;
113 };
114 
116 
117 #endif // _mtsTeleOperationQtWidget_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
mtsFunctionRead GetRegistrationRotation
Definition: mtsTeleOperationQtWidget.h:89
Definition: mtsFunctionRead.h:37
mtsFunctionWrite LockTranslation
Definition: mtsTeleOperationQtWidget.h:86
~mtsTeleOperationQtWidget()
Definition: mtsTeleOperationQtWidget.h:39
mtsFunctionWrite Enable
Definition: mtsTeleOperationQtWidget.h:83
mtsFunctionRead GetPositionCartesianMaster
Definition: mtsTeleOperationQtWidget.h:87
mtsFunctionWrite LockRotation
Definition: mtsTeleOperationQtWidget.h:85
const int CMN_DYNAMIC_CREATION_ONEARG
Definition: cmnClassRegisterMacros.h:333
mtsFunctionRead GetPeriodStatistics
Definition: mtsTeleOperationQtWidget.h:90
virtual void Startup(void)
Definition: mtsComponent.h:262
Declaration of mtsComponent.
Definition: mtsIntervalStatistics.h:45
Definition: mtsQtWidgetIntervalStatistics.h:32
Definition: vctQtWidgetFrame.h:43
Definition: mtsTeleOperationQtWidget.h:32
Definition: mtsComponent.h:150
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
const double cmn_ms
Definition: cmnUnits.h:190
CMN_DECLARE_SERVICES_INSTANTIATION(mtsTeleOperationQtWidget)
mtsFunctionRead GetPositionCartesianSlave
Definition: mtsTeleOperationQtWidget.h:88
Definition: mtsFunctionWrite.h:37
virtual void Configure(const std::string &filename="")
virtual void Cleanup(void)
Definition: mtsComponent.h:267
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
mtsFunctionWrite SetScale
Definition: mtsTeleOperationQtWidget.h:84
Definition: prmPositionCartesianGet.h:37