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
* @file
* @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)
}
void
Pixhawk3DWidget::setBirdView(void)
Pixhawk3DWidget::setBirdEyeView(void)
{
mViewParamWidget->setFollowCameraId(-1);
mCameraPos = QVector3D(0.0, 0.0, -100.0);
m3DWidget->rotateCamera(0.0, 0.0, 0.0);
m3DWidget->recenterCamera(mCameraPos.y(), mCameraPos.x(), -mCameraPos.z());
m3DWidget->setCameraDistance(100.0);
}
void
......@@ -692,7 +690,7 @@ Pixhawk3DWidget::update(void)
mCameraPos = QVector3D(x, y, z);
setBirdView();
setBirdEyeView();
mInitCameraPos = true;
}
}
......@@ -828,12 +826,12 @@ Pixhawk3DWidget::buildLayout(void)
QPushButton* recenterButton = new QPushButton(this);
recenterButton->setText("Recenter Camera");
QPushButton* birdViewButton = new QPushButton(this);
birdViewButton->setText("Bird's Eye View");
QPushButton* birdEyeViewButton = new QPushButton(this);
birdEyeViewButton->setText("Bird's Eye View");
QHBoxLayout* layoutBottom = new QHBoxLayout;
layoutBottom->addWidget(recenterButton);
layoutBottom->addWidget(birdViewButton);
layoutBottom->addWidget(birdEyeViewButton);
layoutBottom->addItem(new QSpacerItem(10, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
QGridLayout* layout = new QGridLayout(this);
......@@ -850,8 +848,8 @@ Pixhawk3DWidget::buildLayout(void)
this, SLOT(showViewParamWindow()));
connect(recenterButton, SIGNAL(clicked()),
this, SLOT(recenterActiveCamera()));
connect(birdViewButton, SIGNAL(clicked()),
this, SLOT(setBirdView()));
connect(birdEyeViewButton, SIGNAL(clicked()),
this, SLOT(setBirdEyeView()));
}
void
......
......@@ -67,7 +67,7 @@ private slots:
void followCameraChanged(int systemId);
void recenterActiveCamera(void);
void modelChanged(int systemId, int index);
void setBirdView(void);
void setBirdEyeView(void);
void selectTargetHeading(void);
void selectTarget(void);
......
......@@ -133,6 +133,12 @@ Q3DWidget::rotateCamera(double roll, double pitch, double yaw)
mCameraManipulator->setRotation(q);
}
void
Q3DWidget::setCameraDistance(double distance)
{
mCameraManipulator->setDistance(distance);
}
void
Q3DWidget::setDisplayMode3D(void)
{
......
......@@ -103,6 +103,11 @@ public:
*/
void rotateCamera(double roll, double pitch, double yaw);
/**
* @brief Sets the camera distance.
*/
void setCameraDistance(double distance);
/**
* @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