frameeditorwindow.cpp
Go to the documentation of this file.
1 
18 #include <GUI/frameeditorwindow.h>
19 #include <QFileDialog>
20 
21 FrameEditor::FrameEditor(QWidget *parent)
22 {
24 
25  //Set Toolbar
26  fileMenu = this->menuBar()->addMenu("&File");
27  openAct = new QAction(tr("&Open"), this);
28  openAct->setShortcuts(QKeySequence::Open);
29  openAct->setStatusTip(tr("Open a file"));
30  connect(openAct, SIGNAL(triggered()), this, SLOT(openFile()));
31  fileMenu->addAction(openAct);
32  saveAct = new QAction(tr("&Save"), this);
33  saveAct->setShortcuts(QKeySequence::Save);
34  saveAct->setStatusTip(tr("Save file"));
35  connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFile()));
36  fileMenu->addAction(saveAct);
37 
38  lblItemCount = new QLabel(this);
39  lblItemCount->resize(200,30);
40 
41  //Set Listbox
42  lstFrames = new QListWidget(this);
43  lstFrames->move(20,30);
44  lstFrames->setVisible(true);
45  lstFrames->setSelectionMode(QAbstractItemView::SingleSelection);
46  connect(lstFrames, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(lstFramesItemClicked(QListWidgetItem*)));
47 }
48 
49 void FrameEditor::resizeEvent(QResizeEvent * event)
50 {
51  lstFrames->resize(this->width()-40, this->height()-160);
52  lblItemCount->move(20, this->height()-150);
53  QMainWindow::resizeEvent(event);
54 }
55 
56 void FrameEditor::lstFramesItemClicked(QListWidgetItem * item)
57 {
58  int row = item->listWidget()->row( item );
59  colouredCameraFrames.at(row).color.r = 1.0;
60  colouredCameraFrames.at(row).color.g = 0.0;
61  if (lastSelected > -1 )
62  {
63  colouredCameraFrames.at(lastSelected).color.r = 0.0;
64  colouredCameraFrames.at(lastSelected).color.g = 1.0;
65  }
66  lastSelected = row;
68 }
69 
70 
72 {
73  QString fileName = QFileDialog::getOpenFileName(this, "Open File", "CalibrationData.data", tr("Calibrationfile (*.data)"));
74  if (fileName.length() > 0)
75  {
76  ROS_INFO_STREAM("File: " << fileName.toStdString());
77  TransformationFile_Manager_Data fileManager(fileName.toStdString());
78  transformationData = fileManager.readFromFile();
79  lstFrames->clear();
80  colouredCameraFrames.clear();
81  for (unsigned int i = 0; i < transformationData.size(); i++)
82  {
83  Transformation_Data data = transformationData.at(i);
84  QString name = QString::number(data.pan) + ", " + QString::number(data.tilt);
85  new QListWidgetItem(name, lstFrames);
87  cCF.pose = data.PTU_Frame;
88  ROS_INFO_STREAM(data.PTU_Frame(0,3) << ", " << data.PTU_Frame(1,3) << ", " << data.PTU_Frame(2,3));
89  cCF.color.r = 0.0;
90  cCF.color.g = 1.0;
91  cCF.color.b = 0.0;
92  cCF.color.a = 1.0;
93  colouredCameraFrames.push_back(cCF);
94  }
95  lastSelected = -1;
97  }
98 }
99 
101 {
102  QString fileName = QFileDialog::getSaveFileName(this, "Save file", "CalibrationData.data", tr("Calibrationfile (*.data)"));
103  if (fileName.length() > 0)
104  {
105  ROS_INFO_STREAM("File: " << fileName.toStdString());
106  TransformationFile_Manager_Data fileManager(fileName.toStdString());
107  fileManager.writeToFile(transformationData);
108  }
109 }
QAction * saveAct
void lstFramesItemClicked(QListWidgetItem *item)
void publishColouredCameraFrames(std::vector< colouredCameraFrame, Eigen::aligned_allocator< colouredCameraFrame > > *camFrames)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Matrix4d pose
QListWidget * lstFrames
MarkerPublisher * markerPublisher
FrameEditor(QWidget *parent=0)
std_msgs::ColorRGBA color
void resizeEvent(QResizeEvent *event)
QLabel * lblItemCount
Eigen::Matrix4d PTU_Frame
std::vector< Transformation_Data > transformationData
#define ROS_INFO_STREAM(args)
std::vector< colouredCameraFrame, Eigen::aligned_allocator< colouredCameraFrame > > colouredCameraFrames
QAction * openAct


asr_mild_calibration_tool
Author(s): Aumann Florian, Heller Florian, Meißner Pascal
autogenerated on Mon Dec 2 2019 03:11:43