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
3cf694dd
Commit
3cf694dd
authored
May 14, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slight changes to the HUD per Craig, to make it a bit friendlier
parent
b8d7252f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
HUD.cc
src/ui/HUD.cc
+43
-18
HUD.h
src/ui/HUD.h
+1
-1
No files found.
src/ui/HUD.cc
View file @
3cf694dd
...
...
@@ -433,7 +433,7 @@ void HUD::updateLoad(UASInterface* uas, double load)
*/
float
HUD
::
refToScreenX
(
float
x
)
{
//qDebug() << "sX: " << (scalingFactor * x);
//qDebug() << "sX: " << (scalingFactor * x)
<< "Orig:" << x
;
return
(
scalingFactor
*
x
);
}
/**
...
...
@@ -814,10 +814,10 @@ void HUD::paintHUD()
painter
.
setPen
(
linePen
);
// CHANGE RATE STRIPS
drawChangeRateStrip
(
-
65.0
f
,
-
60.0
f
,
25
.0
f
,
-
10.0
f
,
10.0
f
,
-
zSpeed
,
&
painter
);
drawChangeRateStrip
(
-
95.0
f
,
-
60.0
f
,
40
.0
f
,
-
10.0
f
,
10.0
f
,
-
zSpeed
,
&
painter
);
// CHANGE RATE STRIPS
drawChangeRateStrip
(
65.0
f
,
-
60.0
f
,
25.0
f
,
-
10.0
f
,
10.0
f
,
totalAcc
,
&
painter
);
drawChangeRateStrip
(
95.0
f
,
-
60.0
f
,
40.0
f
,
-
10.0
f
,
10.0
f
,
totalAcc
,
&
painter
,
true
);
// GAUGES
...
...
@@ -833,11 +833,11 @@ void HUD::paintHUD()
painter
.
setBrush
(
Qt
::
NoBrush
);
painter
.
setPen
(
linePen
);
drawChangeIndicatorGauge
(
-
vGaugeSpacing
,
35.0
f
,
30
.0
f
,
10.0
f
,
gaugeAltitude
,
defaultColor
,
&
painter
,
false
);
drawChangeIndicatorGauge
(
-
vGaugeSpacing
,
35.0
f
,
15
.0
f
,
10.0
f
,
gaugeAltitude
,
defaultColor
,
&
painter
,
false
);
paintText
(
"alt m"
,
defaultColor
,
5.5
f
,
-
73.0
f
,
50
,
&
painter
);
// Right speed gauge
drawChangeIndicatorGauge
(
vGaugeSpacing
,
35.0
f
,
30
.0
f
,
10.0
f
,
totalSpeed
,
defaultColor
,
&
painter
,
false
);
drawChangeIndicatorGauge
(
vGaugeSpacing
,
35.0
f
,
15
.0
f
,
10.0
f
,
totalSpeed
,
defaultColor
,
&
painter
,
false
);
paintText
(
"v m/s"
,
defaultColor
,
5.5
f
,
55.0
f
,
50
,
&
painter
);
...
...
@@ -1091,7 +1091,7 @@ void HUD::drawPolygon(QPolygonF refPolygon, QPainter* painter)
painter
->
drawPolygon
(
draw
);
}
void
HUD
::
drawChangeRateStrip
(
float
xRef
,
float
yRef
,
float
height
,
float
minRate
,
float
maxRate
,
float
value
,
QPainter
*
painter
)
void
HUD
::
drawChangeRateStrip
(
float
xRef
,
float
yRef
,
float
height
,
float
minRate
,
float
maxRate
,
float
value
,
QPainter
*
painter
,
bool
reverse
)
{
float
scaledValue
=
value
;
...
...
@@ -1115,6 +1115,30 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat
// Indicator lines
// Top horizontal line
if
(
reverse
)
{
drawLine
(
xRef
,
yRef
,
xRef
-
width
,
yRef
,
lineWidth
,
defaultColor
,
painter
);
// Vertical main line
drawLine
(
xRef
-
width
/
2.0
f
,
yRef
,
xRef
-
width
/
2.0
f
,
yRef
+
height
,
lineWidth
,
defaultColor
,
painter
);
// Zero mark
drawLine
(
xRef
,
yRef
+
height
/
2.0
f
,
xRef
-
width
,
yRef
+
height
/
2.0
f
,
lineWidth
,
defaultColor
,
painter
);
// Horizontal bottom line
drawLine
(
xRef
,
yRef
+
height
,
xRef
-
width
,
yRef
+
height
,
lineWidth
,
defaultColor
,
painter
);
// Text
QString
label
;
label
.
sprintf
(
"%+06.2f >"
,
value
);
QFont
font
(
"Bitstream Vera Sans"
);
// Enforce minimum font size of 5 pixels
//int fSize = qMax(5, (int)(6.0f*scalingFactor*1.26f));
font
.
setPixelSize
(
6.0
f
*
1.26
f
);
QFontMetrics
metrics
=
QFontMetrics
(
font
);
paintText
(
label
,
defaultColor
,
6.0
f
,
(
xRef
-
width
)
-
metrics
.
width
(
label
),
yRef
+
height
-
((
scaledValue
-
minRate
)
/
(
maxRate
-
minRate
))
*
height
-
1.6
f
,
painter
);
}
else
{
drawLine
(
xRef
,
yRef
,
xRef
+
width
,
yRef
,
lineWidth
,
defaultColor
,
painter
);
// Vertical main line
drawLine
(
xRef
+
width
/
2.0
f
,
yRef
,
xRef
+
width
/
2.0
f
,
yRef
+
height
,
lineWidth
,
defaultColor
,
painter
);
...
...
@@ -1127,6 +1151,7 @@ void HUD::drawChangeRateStrip(float xRef, float yRef, float height, float minRat
QString
label
;
label
.
sprintf
(
"< %+06.2f"
,
value
);
paintText
(
label
,
defaultColor
,
6.0
f
,
xRef
+
width
/
2.0
f
,
yRef
+
height
-
((
scaledValue
-
minRate
)
/
(
maxRate
-
minRate
))
*
height
-
1.6
f
,
painter
);
}
}
//void HUD::drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter)
...
...
src/ui/HUD.h
View file @
3cf694dd
...
...
@@ -113,7 +113,7 @@ protected slots:
void
drawEllipse
(
float
refX
,
float
refY
,
float
radiusX
,
float
radiusY
,
float
startDeg
,
float
endDeg
,
float
lineWidth
,
const
QColor
&
color
,
QPainter
*
painter
);
void
drawCircle
(
float
refX
,
float
refY
,
float
radius
,
float
startDeg
,
float
endDeg
,
float
lineWidth
,
const
QColor
&
color
,
QPainter
*
painter
);
void
drawChangeRateStrip
(
float
xRef
,
float
yRef
,
float
height
,
float
minRate
,
float
maxRate
,
float
value
,
QPainter
*
painter
);
void
drawChangeRateStrip
(
float
xRef
,
float
yRef
,
float
height
,
float
minRate
,
float
maxRate
,
float
value
,
QPainter
*
painter
,
bool
reverse
=
false
);
void
drawChangeIndicatorGauge
(
float
xRef
,
float
yRef
,
float
radius
,
float
expectedMaxChange
,
float
value
,
const
QColor
&
color
,
QPainter
*
painter
,
bool
solid
=
true
);
void
drawPolygon
(
QPolygonF
refPolygon
,
QPainter
*
painter
);
...
...
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