ViewerSettingsPanelCamera.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OctoMap - An Efficient Probabilistic 3D Mapping
3  * Framework Based on Octrees
4  * http://octomap.github.io
5  *
6  * Copyright (c) 2009-2014, K.M. Wurm and A. Hornung, University of Freiburg
7  * All rights reserved. License for the viewer octovis: GNU GPL v2
8  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9  *
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  * for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see http://www.gnu.org/licenses/.
23  */
24 
26 #include <iostream>
27 
29 : QWidget(parent), m_currentFrame(1), m_numberFrames(0), m_robotTrajectoryAvailable(false)
30 {
31  ui.setupUi(this);
32  connect(ui.posX, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
33  connect(ui.posY, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
34  connect(ui.posZ, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
35  connect(ui.lookX, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
36  connect(ui.lookY, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
37  connect(ui.lookZ, SIGNAL(valueChanged(double)), this, SLOT(positionEditDone(double)));
38 
39  ui.followTrajectoryButton->setEnabled(m_robotTrajectoryAvailable);
40  dataChanged();
41 }
42 
44 {
45 
46 }
47 
49  return QSize(250, 180);
50 }
51 
53  emit changeCamPosition(ui.posX->value(), ui.posY->value(), ui.posZ->value(), ui.lookX->value(), ui.lookY->value(), ui.lookZ->value());
54 }
55 
57  m_numberFrames = frames;
58  dataChanged();
59 }
60 
62  m_currentFrame = frame;
63  dataChanged();
64 }
65 
67  m_robotTrajectoryAvailable = available;
68  if(!available) ui.followTrajectoryButton->setChecked(false);
69  ui.followTrajectoryButton->setEnabled(available);
70 }
71 
72 void ViewerSettingsPanelCamera::gotoFrame(unsigned int frame) {
73  if(frame > 0 && frame <= m_numberFrames) {
74  m_currentFrame = frame;
76  dataChanged();
77  }
78 }
79 
82 }
83 
86 }
87 
89  gotoFrame(1);
90 }
91 
94 }
95 
97  emit followCameraPath();
98 }
99 
101  emit followRobotPath();
102 }
103 
105  emit addToCameraPath();
106 }
107 
109  emit removeFromCameraPath();
110 }
111 
113  emit clearCameraPath();
114 }
115 
117  emit saveToCameraPath();
118 }
119 
121  if(ui.playScanButton->isChecked()) {
122  ui.scanProgressSlider->setEnabled(false);
123  ui.followGroupBox->setEnabled(false);
124  emit play();
125  } else {
126  ui.scanProgressSlider->setEnabled(true);
127  ui.followGroupBox->setEnabled(true);
128  emit pause();
129  }
130  dataChanged();
131 }
132 
134  gotoFrame(value);
135 }
136 
138  ui.followGroupBox->setEnabled(true);
139  ui.scanProgressSlider->setEnabled(true);
140  ui.playScanButton->setChecked(false);
141  dataChanged();
142 }
143 
144 
146  unsigned int max = std::max(0,int(m_numberFrames));
147  unsigned int cur = std::min(max, m_currentFrame);
148 
149  ui.scanProgressSlider->setMaximum(max);
150  ui.scanProgressSlider->setMinimum(1);
151 
152  if(ui.playScanButton->isChecked()) {
153  ui.firstScanButton->setEnabled(false);
154  ui.nextScanButton->setEnabled(false);
155  ui.previousScanButton->setEnabled(false);
156  ui.lastScanButton->setEnabled(false);
157  } else {
158  if (m_currentFrame >= max){
159  ui.nextScanButton->setEnabled(false);
160  ui.playScanButton->setEnabled(false);
161  ui.lastScanButton->setEnabled(false);
162  } else {
163  ui.nextScanButton->setEnabled(true);
164  ui.playScanButton->setEnabled(true);
165  ui.lastScanButton->setEnabled(true);
166  }
167 
168  if (m_currentFrame < 2){
169  ui.firstScanButton->setEnabled(cur > 0);
170  ui.previousScanButton->setEnabled(false);
171  } else{
172  ui.firstScanButton->setEnabled(true);
173  ui.previousScanButton->setEnabled(true);
174  }
175 
176  if (max > 1) {
177  ui.playScanButton->setEnabled(true);
178  } else {
179  ui.playScanButton->setEnabled(false);
180  }
181  }
182 
183  if(followRobotTrajectory() || ui.playScanButton->isChecked()) {
184  ui.cameraPathAdd->setEnabled(false);
185  ui.cameraPathRemove->setEnabled(false);
186  ui.cameraPathSave->setEnabled(false);
187  ui.cameraPathClear->setEnabled(false);
188  } else {
189  ui.cameraPathAdd->setEnabled(true);
190  ui.cameraPathRemove->setEnabled(m_numberFrames > 0);
191  ui.cameraPathSave->setEnabled(m_numberFrames > 0);
192  ui.cameraPathClear->setEnabled(m_numberFrames > 0);
193  }
194 
195  if(max > 0 && !ui.playScanButton->isChecked()) {
196  ui.scanProgressSlider->setEnabled(true);
197  } else {
198  ui.scanProgressSlider->setEnabled(false);
199  }
200 
201  ui.scanProgressSlider->setValue(cur);
202  ui.scanProgressLabel->setText(QString("%1/%2").arg(cur).arg(max));
203 
204  // queue a redraw:
205  ui.scanProgressSlider->update();
206 
207 }
208 
210  return ui.followTrajectoryButton->isChecked();
211 }
212 
213 
#define value
Definition: qglviewer.cpp:59
Ui::ViewerSettingsPanelCameraClass ui
ViewerSettingsPanelCamera(QWidget *parent=0)
void setNumberOfFrames(unsigned frames)
void jumpToFrame(unsigned int frame)
void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ)
void setRobotTrajectoryAvailable(bool available)
void gotoFrame(unsigned int frame)


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:25