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
46bc3bc2
Commit
46bc3bc2
authored
May 30, 2013
by
Bryant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The HSI widget now has different light & dark color schemes that should be more readable.
parent
2e98bbb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
22 deletions
+65
-22
HSIDisplay.cc
src/ui/HSIDisplay.cc
+65
-22
No files found.
src/ui/HSIDisplay.cc
View file @
46bc3bc2
...
...
@@ -43,6 +43,7 @@ This file is part of the QGROUNDCONTROL project
#include <qmath.h>
//#include "Waypoint2DIcon.h"
#include "MAV2DIcon.h"
#include "MainWindow.h"
#include <QDebug>
...
...
@@ -259,7 +260,39 @@ void HSIDisplay::renderOverlay()
// Draw base instrument
// ----------------------
painter
.
setBrush
(
Qt
::
NoBrush
);
const
QColor
ringColor
=
QColor
(
200
,
200
,
200
);
// Set the color scheme depending on the light/dark theme employed.
QColor
ringColor
;
QColor
positionColor
;
QColor
setpointColor
;
QColor
labelColor
;
QColor
valueColor
;
QColor
statusColor
;
QColor
waypointLineColor
;
QColor
attitudeColor
;
if
(
MainWindow
::
instance
()
->
getStyle
()
==
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
)
{
ringColor
=
QGC
::
colorBlack
;
positionColor
=
QColor
(
20
,
20
,
200
);
setpointColor
=
QColor
(
150
,
250
,
150
);
labelColor
=
QGC
::
colorBlack
;
valueColor
=
QColor
(
40
,
40
,
40
);
statusColor
=
QGC
::
colorOrange
;
waypointLineColor
=
QGC
::
colorDarkYellow
;
attitudeColor
=
QColor
(
200
,
20
,
20
);
}
else
{
ringColor
=
QColor
(
200
,
200
,
200
);
positionColor
=
QColor
(
20
,
20
,
200
);
setpointColor
=
QColor
(
150
,
250
,
150
);
labelColor
=
QGC
::
colorCyan
;
valueColor
=
QColor
(
255
,
255
,
255
);
statusColor
=
QGC
::
colorOrange
;
waypointLineColor
=
QGC
::
colorYellow
;
attitudeColor
=
QColor
(
200
,
20
,
20
);
}
QPen
pen
;
pen
.
setColor
(
ringColor
);
pen
.
setWidth
(
refLineWidthToPen
(
1.0
f
));
...
...
@@ -269,7 +302,7 @@ void HSIDisplay::renderOverlay()
{
float
radius
=
(
vwidth
-
(
topMargin
+
bottomMargin
)
*
0.3
f
)
/
(
1.35
f
*
i
+
1
)
/
2.0
f
-
bottomMargin
/
2.0
f
;
drawCircle
(
xCenterPos
,
yCenterPos
,
radius
,
1.0
f
,
ringColor
,
&
painter
);
paintText
(
tr
(
"%1 m"
).
arg
(
refToMetric
(
radius
),
5
,
'f'
,
1
,
' '
),
QGC
::
colorCyan
,
1.6
f
,
vwidth
/
2
-
4
,
vheight
/
2
+
radius
+
2.2
,
&
painter
);
paintText
(
tr
(
"%1 m"
).
arg
(
refToMetric
(
radius
),
5
,
'f'
,
1
,
' '
),
valueColor
,
1.6
f
,
vwidth
/
2
-
4
,
vheight
/
2
+
radius
+
7
,
&
painter
);
}
// Draw orientation labels
...
...
@@ -320,11 +353,9 @@ void HSIDisplay::renderOverlay()
// Draw state indicator
// Draw position
QColor
positionColor
(
20
,
20
,
200
);
drawPositionDirection
(
xCenterPos
,
yCenterPos
,
baseRadius
,
positionColor
,
&
painter
);
// Draw attitude
QColor
attitudeColor
(
200
,
20
,
20
);
drawAttitudeDirection
(
xCenterPos
,
yCenterPos
,
baseRadius
,
attitudeColor
,
&
painter
);
...
...
@@ -340,9 +371,6 @@ void HSIDisplay::renderOverlay()
float
normAngleDiff
=
fabs
(
atan2
(
sin
(
angleDiff
),
cos
(
angleDiff
)));
//if (((userSetPointSet) || (normAngleDiff > 0.05f) || dragStarted) && !(setPointDist < 0.08f && mavInitialized))
// Labels on outer part and bottom
// Draw waypoints
...
...
@@ -373,13 +401,13 @@ void HSIDisplay::renderOverlay()
drawStatusFlag
(
33
,
16
,
tr
(
"VCN"
),
viconON
,
viconKnown
,
viconOK
,
painter
);
// Draw speed to top left
paintText
(
tr
(
"SPEED"
),
QGC
::
colorCyan
,
2.2
f
,
2
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"%1 m/s"
).
arg
(
speed
,
5
,
'f'
,
2
,
'0'
),
Qt
::
white
,
2.2
f
,
12
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"SPEED"
),
labelColor
,
2.2
f
,
2
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"%1 m/s"
).
arg
(
speed
,
5
,
'f'
,
2
,
'0'
),
valueColor
,
2.2
f
,
12
,
topMargin
+
2
,
&
painter
);
// Draw crosstrack error to top right
float
crossTrackError
=
0
;
paintText
(
tr
(
"XTRACK"
),
QGC
::
colorCyan
,
2.2
f
,
54
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"%1 m"
).
arg
(
crossTrackError
,
5
,
'f'
,
2
,
'0'
),
Qt
::
white
,
2.2
f
,
67
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"XTRACK"
),
labelColor
,
2.2
f
,
54
,
topMargin
+
2
,
&
painter
);
paintText
(
tr
(
"%1 m"
).
arg
(
crossTrackError
,
5
,
'f'
,
2
,
'0'
),
valueColor
,
2.2
f
,
67
,
topMargin
+
2
,
&
painter
);
// Draw position to bottom left
if
(
localAvailable
>
0
)
...
...
@@ -388,8 +416,8 @@ void HSIDisplay::renderOverlay()
QString
str
;
float
offset
=
(
globalAvailable
>
0
)
?
-
3.0
f
:
0.0
f
;
str
.
sprintf
(
"%05.2f %05.2f %05.2f m"
,
x
,
y
,
z
);
paintText
(
tr
(
"POS"
),
QGC
::
colorCyan
,
2.6
f
,
2
,
vheight
-
offset
-
2
.0
f
,
&
painter
);
paintText
(
str
,
Qt
::
white
,
2.6
f
,
10
,
vheight
-
offset
-
2
.0
f
,
&
painter
);
paintText
(
tr
(
"POS"
),
labelColor
,
2.6
f
,
2
,
vheight
-
offset
-
4
.0
f
,
&
painter
);
paintText
(
str
,
valueColor
,
2.6
f
,
10
,
vheight
-
offset
-
4
.0
f
,
&
painter
);
}
if
(
globalAvailable
>
0
)
...
...
@@ -397,8 +425,8 @@ void HSIDisplay::renderOverlay()
// Position
QString
str
;
str
.
sprintf
(
"lat: %05.2f lon: %06.2f alt: %06.2f"
,
lat
,
lon
,
alt
);
paintText
(
tr
(
"GPS"
),
QGC
::
colorCyan
,
2.6
f
,
2
,
vheight
-
2
.0
f
,
&
painter
);
paintText
(
str
,
Qt
::
white
,
2.6
f
,
10
,
vheight
-
2
.0
f
,
&
painter
);
paintText
(
tr
(
"GPS"
),
labelColor
,
2.6
f
,
2
,
vheight
-
4
.0
f
,
&
painter
);
paintText
(
str
,
valueColor
,
2.6
f
,
10
,
vheight
-
4
.0
f
,
&
painter
);
}
// Draw Safety
...
...
@@ -407,26 +435,25 @@ void HSIDisplay::renderOverlay()
// drawSafetyArea(QPointF(x1, y1), QPointF(x2, y2), QGC::colorYellow, painter);
// Draw status message
paintText
(
statusMessage
,
QGC
::
colorOrange
,
2.8
f
,
8
,
15
,
&
painter
);
paintText
(
statusMessage
,
statusColor
,
2.8
f
,
8
,
15
,
&
painter
);
// Draw setpoint over waypoints
if
(
positionSetPointKnown
||
setPointKnown
)
{
// Draw setpoint
drawSetpointXYZYaw
(
bodyXSetCoordinate
,
bodyYSetCoordinate
,
bodyZSetCoordinate
,
bodyYawSet
,
QGC
::
colorYellow
,
painter
);
drawSetpointXYZYaw
(
bodyXSetCoordinate
,
bodyYSetCoordinate
,
bodyZSetCoordinate
,
bodyYawSet
,
setpointColor
,
painter
);
// Draw travel direction line
QPointF
m
(
bodyXSetCoordinate
,
bodyYSetCoordinate
);
// Transform from body to world coordinates
m
=
metricWorldToBody
(
m
);
// Scale from metric body to screen reference units
QPointF
s
=
metricBodyToRef
(
m
);
drawLine
(
s
.
x
(),
s
.
y
(),
xCenterPos
,
yCenterPos
,
1.5
f
,
QGC
::
colorYellow
,
&
painter
);
drawLine
(
s
.
x
(),
s
.
y
(),
xCenterPos
,
yCenterPos
,
1.5
f
,
setpointColor
,
&
painter
);
}
if
((
userSetPointSet
||
dragStarted
)
&&
((
normAngleDiff
>
0.05
f
)
||
!
(
setPointDist
<
0.08
f
&&
mavInitialized
)))
{
QColor
spColor
(
150
,
250
,
150
);
drawSetpointXYZYaw
(
uiXSetCoordinate
,
uiYSetCoordinate
,
uiZSetCoordinate
,
uiYawSet
,
spColor
,
painter
);
drawSetpointXYZYaw
(
uiXSetCoordinate
,
uiYSetCoordinate
,
uiZSetCoordinate
,
uiYawSet
,
setpointColor
,
painter
);
}
}
...
...
@@ -438,7 +465,15 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo
void
HSIDisplay
::
drawStatusFlag
(
float
x
,
float
y
,
QString
label
,
bool
status
,
bool
known
,
bool
ok
,
QPainter
&
painter
)
{
paintText
(
label
,
QGC
::
colorCyan
,
2.6
f
,
x
,
y
+
0.8
f
,
&
painter
);
QColor
statusColor
(
250
,
250
,
250
);
QColor
statusColor
;
if
(
MainWindow
::
instance
()
->
getStyle
()
==
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
)
{
statusColor
=
QColor
(
40
,
40
,
40
);
}
else
{
statusColor
=
QColor
(
250
,
250
,
250
);
}
if
(
!
ok
)
{
painter
.
setBrush
(
QGC
::
colorDarkYellow
);
...
...
@@ -484,7 +519,15 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b
QColor
negStatusColor
(
200
,
20
,
20
);
QColor
intermediateStatusColor
(
Qt
::
yellow
);
QColor
posStatusColor
(
20
,
200
,
20
);
QColor
statusColor
(
250
,
250
,
250
);
QColor
statusColor
;
if
(
MainWindow
::
instance
()
->
getStyle
()
==
MainWindow
::
QGC_MAINWINDOW_STYLE_LIGHT
)
{
statusColor
=
QColor
(
40
,
40
,
40
);
}
else
{
statusColor
=
QColor
(
250
,
250
,
250
);
}
if
(
status
==
3
)
{
painter
.
setBrush
(
posStatusColor
);
}
else
if
(
status
==
2
)
{
...
...
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