Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
861ef09e
Commit
861ef09e
authored
Jun 11, 2014
by
Bryant Mairs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all dead code and useless comments from PrimaryFlightDisplay.cc
parent
4d2596ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
243 deletions
+15
-243
PrimaryFlightDisplay.cc
src/ui/PrimaryFlightDisplay.cc
+15
-212
PrimaryFlightDisplay.h
src/ui/PrimaryFlightDisplay.h
+0
-31
No files found.
src/ui/PrimaryFlightDisplay.cc
View file @
861ef09e
#include "PrimaryFlightDisplay.h"
#include "UASManager.h"
//#include "ui_primaryflightdisplay.h"
#include <QDebug>
#include <QRectF>
#include <cmath>
...
...
@@ -10,12 +9,7 @@
#include <QPainterPath>
#include <QResizeEvent>
#include <QtCore/qmath.h>
//#include <cmath>
#if 0
// Left in but ifdef'ed out since there is commented out code below that uses it
static const float SEPARATE_COMPASS_ASPECTRATIO = 3.0f/4.0f;
#endif
static
const
float
LINEWIDTH
=
0.0036
f
;
static
const
float
SMALL_TEXT_SIZE
=
0.028
f
;
static
const
float
MEDIUM_TEXT_SIZE
=
SMALL_TEXT_SIZE
*
1.2
f
;
...
...
@@ -152,13 +146,11 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(QWidget *parent) :
setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
// Connect with UAS signal
//connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASDeleted
(
UASInterface
*
)),
this
,
SLOT
(
forgetUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
// Refresh timer
refreshTimer
->
setInterval
(
updateInterval
);
// connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD()));
connect
(
refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
checkUpdate
()));
}
...
...
@@ -175,8 +167,7 @@ QSize PrimaryFlightDisplay::sizeHint() const
void
PrimaryFlightDisplay
::
showEvent
(
QShowEvent
*
event
)
{
// React only to internal (pre-display)
// events
// React only to internal (pre-display) events
QWidget
::
showEvent
(
event
);
refreshTimer
->
start
(
updateInterval
);
emit
visibilityChanged
(
true
);
...
...
@@ -184,8 +175,7 @@ void PrimaryFlightDisplay::showEvent(QShowEvent* event)
void
PrimaryFlightDisplay
::
hideEvent
(
QHideEvent
*
event
)
{
// React only to internal (pre-display)
// events
// React only to internal (pre-display) events
refreshTimer
->
stop
();
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
...
...
@@ -195,27 +185,15 @@ void PrimaryFlightDisplay::resizeEvent(QResizeEvent *e) {
QWidget
::
resizeEvent
(
e
);
qreal
size
=
e
->
size
().
width
();
//if(e->size().height()<size) size = e->size().height();
lineWidth
=
PrimaryFlightDisplay_constrain
(
size
*
LINEWIDTH
,
1
,
6
);
fineLineWidth
=
PrimaryFlightDisplay_constrain
(
size
*
LINEWIDTH
*
2
/
3
,
1
,
2
);
instrumentEdgePen
.
setWidthF
(
fineLineWidth
);
//AIEdgePen.setWidthF(fineLineWidth);
smallTextSize
=
size
*
SMALL_TEXT_SIZE
;
mediumTextSize
=
size
*
MEDIUM_TEXT_SIZE
;
largeTextSize
=
size
*
LARGE_TEXT_SIZE
;
/*
* Try without layout Change-O-Matic. It was too complicated.
qreal aspect = e->size().width() / e->size().height();
if (aspect <= SEPARATE_COMPASS_ASPECTRATIO)
layout = COMPASS_SEPARATED;
else
layout = COMPASS_INTEGRATED;
*/
// qDebug("Width %d height %d decision %d", e->size().width(), e->size().height(), layout);
}
void
PrimaryFlightDisplay
::
paintEvent
(
QPaintEvent
*
event
)
...
...
@@ -233,20 +211,6 @@ void PrimaryFlightDisplay::checkUpdate()
}
}
///*
// * Interface towards qgroundcontrol
// */
//void PrimaryFlightDisplay::addUAS(UASInterface* uas)
//{
// if (uas)
// {
// if (!this->uas)
// {
// setActiveUAS(uas);
// }
// }
//}
void
PrimaryFlightDisplay
::
forgetUAS
(
UASInterface
*
uas
)
{
if
(
this
->
uas
!=
NULL
&&
this
->
uas
==
uas
)
{
...
...
@@ -290,7 +254,6 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
Q_UNUSED
(
uas
);
Q_UNUSED
(
timestamp
);
// Called from UAS.cc l. 616
if
(
isinf
(
roll
))
{
this
->
roll
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
else
{
...
...
@@ -424,7 +387,7 @@ void PrimaryFlightDisplay::drawTextCenter (
QFontMetrics
metrics
=
QFontMetrics
(
font
);
QRect
bounds
=
metrics
.
boundingRect
(
text
);
int
flags
=
Qt
::
AlignCenter
|
Qt
::
TextDontClip
;
// For some reason the bounds rect is too small!
painter
.
drawText
(
x
/*+bounds.x()*/
-
bounds
.
width
()
/
2
,
y
/*+bounds.y()*/
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
painter
.
drawText
(
x
-
bounds
.
width
()
/
2
,
y
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
}
void
PrimaryFlightDisplay
::
drawTextLeftCenter
(
...
...
@@ -440,7 +403,7 @@ void PrimaryFlightDisplay::drawTextLeftCenter (
QFontMetrics
metrics
=
QFontMetrics
(
font
);
QRect
bounds
=
metrics
.
boundingRect
(
text
);
int
flags
=
Qt
::
AlignLeft
|
Qt
::
TextDontClip
;
// For some reason the bounds rect is too small!
painter
.
drawText
(
x
/*+bounds.x()*/
,
y
/*+bounds.y()*/
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
painter
.
drawText
(
x
,
y
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
}
void
PrimaryFlightDisplay
::
drawTextRightCenter
(
...
...
@@ -456,7 +419,7 @@ void PrimaryFlightDisplay::drawTextRightCenter (
QFontMetrics
metrics
=
QFontMetrics
(
font
);
QRect
bounds
=
metrics
.
boundingRect
(
text
);
int
flags
=
Qt
::
AlignRight
|
Qt
::
TextDontClip
;
// For some reason the bounds rect is too small!
painter
.
drawText
(
x
/*+bounds.x()*/
-
bounds
.
width
(),
y
/*+bounds.y()*/
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
painter
.
drawText
(
x
-
bounds
.
width
(),
y
-
bounds
.
height
()
/
2
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
}
void
PrimaryFlightDisplay
::
drawTextCenterTop
(
...
...
@@ -472,7 +435,7 @@ void PrimaryFlightDisplay::drawTextCenterTop (
QFontMetrics
metrics
=
QFontMetrics
(
font
);
QRect
bounds
=
metrics
.
boundingRect
(
text
);
int
flags
=
Qt
::
AlignCenter
|
Qt
::
TextDontClip
;
// For some reason the bounds rect is too small!
painter
.
drawText
(
x
/*+bounds.x()*/
-
bounds
.
width
()
/
2
,
y
+
bounds
.
height
()
/*+bounds.y()*/
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
painter
.
drawText
(
x
-
bounds
.
width
()
/
2
,
y
+
bounds
.
height
()
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
}
void
PrimaryFlightDisplay
::
drawTextCenterBottom
(
...
...
@@ -488,7 +451,7 @@ void PrimaryFlightDisplay::drawTextCenterBottom (
QFontMetrics
metrics
=
QFontMetrics
(
font
);
QRect
bounds
=
metrics
.
boundingRect
(
text
);
int
flags
=
Qt
::
AlignCenter
;
painter
.
drawText
(
x
/*+bounds.x()*/
-
bounds
.
width
()
/
2
,
y
/*+bounds.y()*/
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
painter
.
drawText
(
x
-
bounds
.
width
()
/
2
,
y
,
bounds
.
width
(),
bounds
.
height
(),
flags
,
text
);
}
void
PrimaryFlightDisplay
::
drawInstrumentBackground
(
QPainter
&
painter
,
QRectF
edge
)
{
...
...
@@ -582,11 +545,6 @@ void PrimaryFlightDisplay::drawAIGlobalFeatures(
qreal
pitchPixels
=
pitchAngleToTranslation
(
mainArea
.
height
(),
pitch
);
qreal
gradientEnd
=
pitchAngleToTranslation
(
mainArea
.
height
(),
60
);
//painter.rotate(-roll);
//painter.translate(0, pitchPixels);
// QTransform forwardTransform;
//forwardTransform.translate(mainArea.center().x(), mainArea.center().y());
painter
.
rotate
(
-
displayRoll
);
painter
.
translate
(
0
,
pitchPixels
);
...
...
@@ -597,6 +555,7 @@ void PrimaryFlightDisplay::drawAIGlobalFeatures(
QPointF
topRight
=
rtx
.
map
(
paintArea
.
topRight
());
QPointF
bottomLeft
=
rtx
.
map
(
paintArea
.
bottomLeft
());
QPointF
bottomRight
=
rtx
.
map
(
paintArea
.
bottomRight
());
// Just KISS... make a rectangluar basis.
qreal
minx
=
min4
(
topLeft
.
x
(),
topRight
.
x
(),
bottomLeft
.
x
(),
bottomRight
.
x
());
qreal
maxx
=
max4
(
topLeft
.
x
(),
topRight
.
x
(),
bottomLeft
.
x
(),
bottomRight
.
x
());
...
...
@@ -727,7 +686,7 @@ void PrimaryFlightDisplay::drawRollScale(
pen
.
setColor
(
Qt
::
white
);
painter
.
setPen
(
pen
);
// We should really do these transforms but they are assumed done by caller
.
// We should really do these transforms but they are assumed done by caller
:
// painter.resetTransform();
// painter.translate(area.center());
// painter.rotate(roll);
...
...
@@ -735,13 +694,11 @@ void PrimaryFlightDisplay::drawRollScale(
qreal
_size
=
w
*
ROLL_SCALE_RADIUS
*
2
;
QRectF
arcArea
(
-
_size
/
2
,
-
_size
/
2
,
_size
,
_size
);
painter
.
drawArc
(
arcArea
,
(
90
-
ROLL_SCALE_RANGE
)
*
16
,
ROLL_SCALE_RANGE
*
2
*
16
);
// painter.drawEllipse(QPoint(0,0),200,200);
if
(
drawTicks
)
{
int
length
=
sizeof
(
tickValues
)
/
sizeof
(
int
);
qreal
previousRotation
=
0
;
for
(
int
i
=
0
;
i
<
length
*
2
+
1
;
i
++
)
{
int
degrees
=
(
i
==
length
)
?
0
:
(
i
>
length
)
?-
tickValues
[
i
-
length
-
1
]
:
tickValues
[
i
];
//degrees = 180 - degrees;
painter
.
rotate
(
degrees
-
previousRotation
);
previousRotation
=
degrees
;
...
...
@@ -750,7 +707,7 @@ void PrimaryFlightDisplay::drawRollScale(
painter
.
drawLine
(
start
,
end
);
QString
s_number
;
//= QString("%d").arg(degrees);
QString
s_number
;
if
(
SHOW_ZERO_ON_SCALES
||
degrees
)
s_number
.
sprintf
(
"%d"
,
abs
(
degrees
));
...
...
@@ -809,7 +766,7 @@ void PrimaryFlightDisplay::drawAICompassDisk(QPainter& painter, QRectF area, flo
// yaw is in center.
float
off
=
tickYaw
-
displayHeading
;
// wrap that to
]
-180..180]
// wrap that to
[
-180..180]
if
(
off
<=-
180
)
off
+=
360
;
else
if
(
off
>
180
)
off
-=
360
;
painter
.
translate
(
area
.
center
());
...
...
@@ -862,7 +819,6 @@ void PrimaryFlightDisplay::drawAICompassDisk(QPainter& painter, QRectF area, flo
}
painter
.
setPen
(
scalePen
);
//painter.setBrush(Qt::SolidPattern);
painter
.
translate
(
area
.
center
());
QPainterPath
markerPath
(
QPointF
(
0
,
-
radius
-
2
));
markerPath
.
lineTo
(
radius
*
COMPASS_DISK_MARKERWIDTH
/
2
,
-
radius
-
radius
*
COMPASS_DISK_MARKERHEIGHT
-
2
);
...
...
@@ -899,10 +855,6 @@ void PrimaryFlightDisplay::drawAICompassDisk(QPainter& painter, QRectF area, flo
drawTextCenter
(
painter
,
s_digitalCompass
,
largeTextSize
,
0
,
-
radius
*
0.38
-
digitalCompassUpshift
);
// dummy
// navigationTargetBearing = 10;
// navigationCrosstrackError = 500;
// The CDI
if
(
shouldDisplayNavigationData
()
&&
!
isnan
(
navigationTargetBearing
)
&&
!
isinf
(
navigationCrosstrackError
))
{
painter
.
resetTransform
();
...
...
@@ -960,7 +912,7 @@ void PrimaryFlightDisplay::drawAltimeter(
// not yet implemented: Display of secondary altitude.
if
(
!
isnan
(
secondaryAltitude
))
{
effectiveHalfHeight
-=
secondaryAltitudeBoxHeight
;
effectiveHalfHeight
-=
secondaryAltitudeBoxHeight
;
}
float
markerHalfHeight
=
mediumTextSize
*
0.8
;
...
...
@@ -1034,12 +986,11 @@ void PrimaryFlightDisplay::drawAltimeter(
float
vvSign
=
vvPixHeight
>
0
?
1
:
-
1
;
// reverse y sign
// QRectF vvRect(rightEdge - w*ALTIMETER_VVI_WIDTH, markerHalfHeight*vvSign, w*ALTIMETER_VVI_WIDTH, abs(vvPixHeight)*vvSign);
QPointF
vvArrowBegin
(
rightEdge
-
w
*
ALTIMETER_VVI_WIDTH
/
2
,
markerHalfHeight
*
vvSign
);
QPointF
vvArrowEnd
(
rightEdge
-
w
*
ALTIMETER_VVI_WIDTH
/
2
,
vvPixHeight
);
painter
.
drawLine
(
vvArrowBegin
,
vvArrowEnd
);
// Yeah this is a rep
itition of above code but we are goigd
to trash it all anyway, so no fix.
// Yeah this is a rep
etition of above code but we are going
to trash it all anyway, so no fix.
float
vvArowHeadSize
=
abs
(
vvPixHeight
-
markerHalfHeight
*
vvSign
);
if
(
vvArowHeadSize
>
w
*
ALTIMETER_VVI_WIDTH
/
3
)
vvArowHeadSize
=
w
*
ALTIMETER_VVI_WIDTH
/
3
;
...
...
@@ -1061,8 +1012,6 @@ void PrimaryFlightDisplay::drawAltimeter(
s_salt
.
sprintf
(
"%3.0f"
,
secondaryAltitude
);
drawTextCenter
(
painter
,
s_salt
,
mediumTextSize
,
0
,
0
);
}
// print target altitude (if applicable)
}
void
PrimaryFlightDisplay
::
drawVelocityMeter
(
...
...
@@ -1142,7 +1091,7 @@ void PrimaryFlightDisplay::drawVelocityMeter(
else
s_alt
.
sprintf
(
"%3.1f"
,
speed
);
float
xCenter
=
(
markerTip
+
leftEdge
)
/
2
;
drawTextCenter
(
painter
,
s_alt
,
/* TAPES_TEXT_SIZE*width()*/
mediumTextSize
,
xCenter
,
0
);
drawTextCenter
(
painter
,
s_alt
,
mediumTextSize
,
xCenter
,
0
);
}
static
const
int
TOP
=
(
1
<<
0
);
...
...
@@ -1243,90 +1192,6 @@ void PrimaryFlightDisplay::doPaint() {
float
compassAIIntrusion
=
0
;
switch
(
layout
)
{
/*
case FEATUREPANELS_IN_CORNERS: {
tapeGaugeWidth = tapesGaugeWidthFor(width(), height());
// A layout optimal for a container wider than it is high.
// The AI gets full height and if tapes are transparent, also full width. If tapes are opague, then
// the AI gets a width to be perfectly square.
AIMainArea = QRectF(
style == NO_OVERLAYS ? tapeGaugeWidth : 0,
0,
style == NO_OVERLAYS ? width() - tapeGaugeWidth * 2: width(),
height());
AIPaintArea = AIMainArea;
// Tape gauges get so much width that the AI area not covered by them is perfectly square.
qreal sidePanelsHeight = height();
altimeterArea = QRectF(AIMainArea.right(), height()/5, tapeGaugeWidth, sidePanelsHeight*3/5);
velocityMeterArea = QRectF (0, height()/5, tapeGaugeWidth, sidePanelsHeight*3/5);
sensorsStatsArea = QRectF(0, 0, tapeGaugeWidth, sidePanelsHeight/5);
linkStatsArea = QRectF(AIMainArea.right(), 0, tapeGaugeWidth, sidePanelsHeight/5);
sysStatsArea = QRectF(0, sidePanelsHeight*4/5, tapeGaugeWidth, sidePanelsHeight/5);
missionStatsArea =QRectF(AIMainArea.right(), sidePanelsHeight*4/5, tapeGaugeWidth, sidePanelsHeight/5);
if (style == NO_OVERLAYS) {
applyMargin(AIMainArea, margin, TOP|BOTTOM);
applyMargin(altimeterArea, margin, TOP|BOTTOM|RIGHT);
applyMargin(velocityMeterArea, margin, TOP|BOTTOM|LEFT);
setMarginsForCornerLayout(margin, sensorsStatsArea, linkStatsArea, sysStatsArea, missionStatsArea);
}
// Compass is inside the AI ans within its margins also.
compassArea = QRectF(AIMainArea.x()+AIMainArea.width()*0.60, AIMainArea.y()+AIMainArea.height()*0.80,
AIMainArea.width()/2, AIMainArea.width()/2);
break;
}
case FEATUREPANELS_AT_BOTTOM: {
// A layout for containers with about the same width and height.
// qreal minor = min(width(), height());
// qreal major = max(width(), height());
qreal aiheight = height()*4.0f/5;
tapeGaugeWidth = tapesGaugeWidthFor(width(), aiheight);
AIMainArea = QRectF(
style == NO_OVERLAYS ? tapeGaugeWidth : 0,
0,
style == NO_OVERLAYS ? width() - tapeGaugeWidth*2 : width(),
aiheight);
AIPaintArea = AIMainArea;
// Tape gauges get so much width that the AI area not covered by them is perfectly square.
altimeterArea = QRectF(AIMainArea.right(), 0, tapeGaugeWidth, aiheight);
velocityMeterArea = QRectF (0, 0, tapeGaugeWidth, aiheight);
qreal panelsHeight = height() / 5.0f;
qreal panelsWidth = width() / 4.0f;
sensorsStatsArea = QRectF(0, AIMainArea.bottom(), panelsWidth, panelsHeight);
linkStatsArea = QRectF(panelsWidth, AIMainArea.bottom(), panelsWidth, panelsHeight);
sysStatsArea = QRectF(panelsWidth*2, AIMainArea.bottom(), panelsWidth, panelsHeight);
missionStatsArea =QRectF(panelsWidth*3, AIMainArea.bottom(), panelsWidth, panelsHeight);
if (style == NO_OVERLAYS) {
applyMargin(AIMainArea, margin, TOP|BOTTOM);
applyMargin(altimeterArea, margin, TOP|BOTTOM|RIGHT);
applyMargin(velocityMeterArea, margin, TOP|BOTTOM|LEFT);
setMarginsForInlineLayout(margin, sensorsStatsArea, linkStatsArea, sysStatsArea, missionStatsArea);
}
// Compass is inside the AI ans within its margins also.
compassArea = QRectF(AIMainArea.x()+AIMainArea.width()*0.60, AIMainArea.y()+AIMainArea.height()*0.80,
AIMainArea.width()/2, AIMainArea.width()/2);
break;
}
*/
case
COMPASS_INTEGRATED
:
{
tapeGaugeWidth
=
tapesGaugeWidthFor
(
width
(),
width
());
qreal
aiheight
=
height
();
...
...
@@ -1362,7 +1227,6 @@ void PrimaryFlightDisplay::doPaint() {
qreal
compassSize
=
compassRelativeWidth
*
AIMainArea
.
width
();
// Diameter is this times the width.
qreal
compassCenterY
;
//if (heightSurplus >= 0) compassCenterY = AIMainArea.bottom() + compassSize/2;
compassCenterY
=
AIMainArea
.
bottom
()
+
compassSize
/
4
;
if
(
height
()
-
compassCenterY
>
AIMainArea
.
width
()
/
2
*
compassBottomMargin
)
...
...
@@ -1409,50 +1273,6 @@ void PrimaryFlightDisplay::doPaint() {
velocityMeterArea
=
QRectF
(
0
,
0
,
tapeGaugeWidth
,
aiheight
);
altimeterArea
=
QRectF
(
AIMainArea
.
right
(),
0
,
tapeGaugeWidth
,
aiheight
);
/*
qreal panelsWidth = width() / 4.0f;
if(remainingHeight > width()) {
// very tall layout, place panels below compass.
sensorsStatsArea = QRectF(0, height()-panelsHeight, panelsWidth, panelsHeight);
linkStatsArea = QRectF(panelsWidth, height()-panelsHeight, panelsWidth, panelsHeight);
sysStatsArea = QRectF(panelsWidth*2, height()-panelsHeight, panelsWidth, panelsHeight);
missionStatsArea =QRectF(panelsWidth*3, height()-panelsHeight, panelsWidth, panelsHeight);
if (style == OPAGUE_TAPES) {
setMarginsForInlineLayout(margin, sensorsStatsArea, linkStatsArea, sysStatsArea, missionStatsArea);
}
compassCenter = QPoint(width()/2, (AIArea.bottom()+height()-panelsHeight)/2);
maxCompassDiam = fmin(width(), height()-AIArea.height()-panelsHeight);
} else {
// Remaining part is wider than high; place panels in corners around compass
// Naaah it is really ugly, do not do that.
sensorsStatsArea = QRectF(0, AIArea.bottom(), panelsWidth, panelsHeight);
linkStatsArea = QRectF(width()-panelsWidth, AIArea.bottom(), panelsWidth, panelsHeight);
sysStatsArea = QRectF(0, height()-panelsHeight, panelsWidth, panelsHeight);
missionStatsArea =QRectF(width()-panelsWidth, height()-panelsHeight, panelsWidth, panelsHeight);
if (style == OPAGUE_TAPES) {
setMarginsForCornerLayout(margin, sensorsStatsArea, linkStatsArea, sysStatsArea, missionStatsArea);
}
compassCenter = QPoint(width()/2, (AIArea.bottom()+height())/2);
// diagonal between 2 panel corners
qreal xd = width()-panelsWidth*2;
qreal yd = height()-panelsHeight - AIArea.bottom();
maxCompassDiam = qSqrt(xd*xd + yd*yd);
if (maxCompassDiam > remainingHeight) {
maxCompassDiam = width() - panelsWidth*2;
if (maxCompassDiam > remainingHeight) {
// If still too large, lower.
// compassCenter.setY();
}
}
}
*/
/*
sensorsStatsArea = QRectF(0, height()-panelsHeight, panelsWidth, panelsHeight);
linkStatsArea = QRectF(panelsWidth, height()-panelsHeight, panelsWidth, panelsHeight);
sysStatsArea = QRectF(panelsWidth*2, height()-panelsHeight, panelsWidth, panelsHeight);
missionStatsArea =QRectF(panelsWidth*3, height()-panelsHeight, panelsWidth, panelsHeight);
*/
QPoint
compassCenter
=
QPoint
(
width
()
/
2
,
AIMainArea
.
bottom
()
+
width
()
/
2
);
qreal
compassDiam
=
width
()
*
0.8
;
compassArea
=
QRectF
(
compassCenter
.
x
()
-
compassDiam
/
2
,
compassCenter
.
y
()
-
compassDiam
/
2
,
compassDiam
,
compassDiam
);
...
...
@@ -1469,9 +1289,6 @@ void PrimaryFlightDisplay::doPaint() {
drawAIAttitudeScales
(
painter
,
AIMainArea
,
compassAIIntrusion
);
drawAIAirframeFixedFeatures
(
painter
,
AIMainArea
);
// if(layout ==COMPASS_SEPARATED)
//drawSeparateCompassDisk(painter, compassArea);
// else
drawAICompassDisk
(
painter
,
compassArea
,
compassHalfSpan
);
painter
.
setClipping
(
hadClip
);
...
...
@@ -1480,19 +1297,5 @@ void PrimaryFlightDisplay::doPaint() {
drawVelocityMeter
(
painter
,
velocityMeterArea
);
/*
drawSensorsStatsPanel(painter, sensorsStatsArea);
drawLinkStatsPanel(painter, linkStatsArea);
drawSysStatsPanel(painter, sysStatsArea);
drawMissionStatsPanel(painter, missionStatsArea);
*/
/*
if (style == OPAGUE_TAPES) {
drawInstrumentBackground(painter, AIArea);
}
*/
painter
.
end
();
}
void
PrimaryFlightDisplay
::
createActions
()
{}
src/ui/PrimaryFlightDisplay.h
View file @
861ef09e
...
...
@@ -23,7 +23,6 @@ public slots:
void
updateNavigationControllerErrors
(
UASInterface
*
uas
,
double
altitudeError
,
double
speedError
,
double
xtrackError
);
/** @brief Set the currently monitored UAS */
//void addUAS(UASInterface* uas);
void
forgetUAS
(
UASInterface
*
uas
);
void
setActiveUAS
(
UASInterface
*
uas
);
...
...
@@ -57,34 +56,10 @@ protected:
/** @brief Stop updating widget */
void
hideEvent
(
QHideEvent
*
event
);
// dongfang: We have no context menu. Viewonly.
// void contextMenuEvent (QContextMenuEvent* event);
// dongfang: What is that?
// dongfang: OK it's for UI interaction. Presently, there is none.
void
createActions
();
signals:
void
visibilityChanged
(
bool
visible
);
private:
/*
enum AltimeterMode {
PRIMARY_MAIN_GPS_SUB, // Show the primary alt. on tape and GPS as extra info
GPS_MAIN // Show GPS on tape and no extra info
};
enum AltimeterFrame {
ASL, // Show ASL altitudes (plane pilots' normal preference)
RELATIVE_TO_HOME // Show relative-to-home altitude (copter pilots)
};
enum SpeedMode {
PRIMARY_MAIN_GROUND_SUB,// Show primary speed (often airspeed) on tape and groundspeed as extra
GROUND_MAIN // Show groundspeed on tape and no extra info
};
*/
/*
* There are at least these differences between airplane and copter PDF view:
* - Airplane show absolute altutude in altimeter, copter shows relative to home
...
...
@@ -122,12 +97,6 @@ private:
UASInterface
*
uas
;
///< The uas currently monitored
/*
AltimeterMode altimeterMode;
AltimeterFrame altimeterFrame;
SpeedMode speedMode;
*/
bool
didReceiveSpeed
;
float
roll
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment