Apollo 11.0
自动驾驶开放平台
scene_camera_dialog.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19#include <QtGui/QVector3D>
20
21#include "modules/tools/visualizer/ui_scene_camera_dialog.h"
22
24 : QDialog(parent), ui(new Ui::SceneCameraDialog) {
25 ui->setupUi(this);
26 ui->cameraX->setEnabled(false);
27 ui->cameraY->setEnabled(false);
28 ui->cameraZ->setEnabled(false);
29
30 connect(ui->resetButton, SIGNAL(clicked()), this, SIGNAL(resetcamera()));
31 connect(ui->cameraTypeComboBox, SIGNAL(currentIndexChanged(int)), this,
32 SLOT(onCameraTypeChanged(int)));
33 connect(ui->cameraX, SIGNAL(valueChanged(double)), this,
34 SIGNAL(xValueChanged(double)));
35 connect(ui->cameraY, SIGNAL(valueChanged(double)), this,
36 SIGNAL(yValueChanged(double)));
37 connect(ui->cameraZ, SIGNAL(valueChanged(double)), this,
38 SIGNAL(zValueChanged(double)));
39 connect(ui->cameraYaw, SIGNAL(valueChanged(double)), this,
40 SIGNAL(yawValueChanged(double)));
41 connect(ui->cameraPitch, SIGNAL(valueChanged(double)), this,
42 SIGNAL(pitchValueChanged(double)));
43 connect(ui->cameraRoll, SIGNAL(valueChanged(double)), this,
44 SIGNAL(rollValueChanged(double)));
45 connect(ui->stepSlider, SIGNAL(valueChanged(int)), this,
46 SLOT(OnStepSlideChanged(int)));
47}
48
50
51void SceneCameraDialog::updateCameraAttitude(const QVector3D& attitude) {
52 ui->cameraYaw->setValue(attitude.x());
53 ui->cameraPitch->setValue(attitude.y());
54 ui->cameraRoll->setValue(attitude.z());
55}
56
57void SceneCameraDialog::updateCameraPos(const QVector3D& pos) {
58 ui->cameraX->setValue(pos.x());
59 ui->cameraY->setValue(pos.y());
60 ui->cameraZ->setValue(pos.z());
61}
62
63void SceneCameraDialog::OnStepSlideChanged(int v) {
64 const float step =
65 static_cast<float>(v) / static_cast<float>(ui->stepSlider->maximum());
66
67 emit sensitivityChanged(step);
68
69 ui->cameraX->setSingleStep(step);
70 ui->cameraY->setSingleStep(step);
71 ui->cameraZ->setSingleStep(step);
72
73 ui->cameraYaw->setSingleStep(step);
74 ui->cameraPitch->setSingleStep(step);
75 ui->cameraRoll->setSingleStep(step);
76}
77
78void SceneCameraDialog::onCameraTypeChanged(int index) {
79 emit cameraTypeChanged(index);
80 ui->cameraX->setEnabled(index);
81 ui->cameraY->setEnabled(index);
82 ui->cameraZ->setEnabled(index);
83}
void updateCameraPos(const QVector3D &)
void pitchValueChanged(double)
void yValueChanged(double)
void sensitivityChanged(float)
void rollValueChanged(double)
void zValueChanged(double)
SceneCameraDialog(QWidget *parent=nullptr)
void yawValueChanged(double)
void xValueChanged(double)
void updateCameraAttitude(const QVector3D &)
void cameraTypeChanged(int)