Commit 921870e4 authored by hengli's avatar hengli

Fixed bug in bird's eye view in 3D view.

parent 001ccd39
...@@ -25,7 +25,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -25,7 +25,7 @@ This file is part of the QGROUNDCONTROL project
* @file * @file
* @brief Definition of the class GCManipulator. * @brief Definition of the class GCManipulator.
* *
* @author Lionel Heng <hengli@student.ethz.ch> * @author Lionel Heng <hengli@inf.ethz.ch>
* *
*/ */
......
...@@ -292,14 +292,12 @@ Pixhawk3DWidget::modelChanged(int systemId, int index) ...@@ -292,14 +292,12 @@ Pixhawk3DWidget::modelChanged(int systemId, int index)
} }
void void
Pixhawk3DWidget::setBirdView(void) Pixhawk3DWidget::setBirdEyeView(void)
{ {
mViewParamWidget->setFollowCameraId(-1); mViewParamWidget->setFollowCameraId(-1);
mCameraPos = QVector3D(0.0, 0.0, -100.0);
m3DWidget->rotateCamera(0.0, 0.0, 0.0); m3DWidget->rotateCamera(0.0, 0.0, 0.0);
m3DWidget->recenterCamera(mCameraPos.y(), mCameraPos.x(), -mCameraPos.z()); m3DWidget->setCameraDistance(100.0);
} }
void void
...@@ -692,7 +690,7 @@ Pixhawk3DWidget::update(void) ...@@ -692,7 +690,7 @@ Pixhawk3DWidget::update(void)
mCameraPos = QVector3D(x, y, z); mCameraPos = QVector3D(x, y, z);
setBirdView(); setBirdEyeView();
mInitCameraPos = true; mInitCameraPos = true;
} }
} }
...@@ -828,12 +826,12 @@ Pixhawk3DWidget::buildLayout(void) ...@@ -828,12 +826,12 @@ Pixhawk3DWidget::buildLayout(void)
QPushButton* recenterButton = new QPushButton(this); QPushButton* recenterButton = new QPushButton(this);
recenterButton->setText("Recenter Camera"); recenterButton->setText("Recenter Camera");
QPushButton* birdViewButton = new QPushButton(this); QPushButton* birdEyeViewButton = new QPushButton(this);
birdViewButton->setText("Bird's Eye View"); birdEyeViewButton->setText("Bird's Eye View");
QHBoxLayout* layoutBottom = new QHBoxLayout; QHBoxLayout* layoutBottom = new QHBoxLayout;
layoutBottom->addWidget(recenterButton); layoutBottom->addWidget(recenterButton);
layoutBottom->addWidget(birdViewButton); layoutBottom->addWidget(birdEyeViewButton);
layoutBottom->addItem(new QSpacerItem(10, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); layoutBottom->addItem(new QSpacerItem(10, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
QGridLayout* layout = new QGridLayout(this); QGridLayout* layout = new QGridLayout(this);
...@@ -850,8 +848,8 @@ Pixhawk3DWidget::buildLayout(void) ...@@ -850,8 +848,8 @@ Pixhawk3DWidget::buildLayout(void)
this, SLOT(showViewParamWindow())); this, SLOT(showViewParamWindow()));
connect(recenterButton, SIGNAL(clicked()), connect(recenterButton, SIGNAL(clicked()),
this, SLOT(recenterActiveCamera())); this, SLOT(recenterActiveCamera()));
connect(birdViewButton, SIGNAL(clicked()), connect(birdEyeViewButton, SIGNAL(clicked()),
this, SLOT(setBirdView())); this, SLOT(setBirdEyeView()));
} }
void void
......
...@@ -67,7 +67,7 @@ private slots: ...@@ -67,7 +67,7 @@ private slots:
void followCameraChanged(int systemId); void followCameraChanged(int systemId);
void recenterActiveCamera(void); void recenterActiveCamera(void);
void modelChanged(int systemId, int index); void modelChanged(int systemId, int index);
void setBirdView(void); void setBirdEyeView(void);
void selectTargetHeading(void); void selectTargetHeading(void);
void selectTarget(void); void selectTarget(void);
......
...@@ -133,6 +133,12 @@ Q3DWidget::rotateCamera(double roll, double pitch, double yaw) ...@@ -133,6 +133,12 @@ Q3DWidget::rotateCamera(double roll, double pitch, double yaw)
mCameraManipulator->setRotation(q); mCameraManipulator->setRotation(q);
} }
void
Q3DWidget::setCameraDistance(double distance)
{
mCameraManipulator->setDistance(distance);
}
void void
Q3DWidget::setDisplayMode3D(void) Q3DWidget::setDisplayMode3D(void)
{ {
......
...@@ -103,6 +103,11 @@ public: ...@@ -103,6 +103,11 @@ public:
*/ */
void rotateCamera(double roll, double pitch, double yaw); void rotateCamera(double roll, double pitch, double yaw);
/**
* @brief Sets the camera distance.
*/
void setCameraDistance(double distance);
/** /**
* @brief Sets up 3D display mode. * @brief Sets up 3D display mode.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment