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
8af9c882
Commit
8af9c882
authored
Apr 25, 2016
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fact system: Translate between normalized units and percent
parent
04fb087b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+11
-0
FactMetaData.h
src/FactSystem/FactMetaData.h
+2
-0
No files found.
src/FactSystem/FactMetaData.cc
View file @
8af9c882
...
...
@@ -38,6 +38,7 @@
const
FactMetaData
::
BuiltInTranslation_s
FactMetaData
::
_rgBuiltInTranslations
[]
=
{
{
"centi-degrees"
,
"degrees"
,
FactMetaData
::
_centiDegreesToDegrees
,
FactMetaData
::
_degreesToCentiDegrees
},
{
"radians"
,
"degrees"
,
FactMetaData
::
_radiansToDegrees
,
FactMetaData
::
_degreesToRadians
},
{
"norm"
,
"%"
,
FactMetaData
::
_normToPercent
,
FactMetaData
::
_percentToNorm
},
};
// Translations driven by app settings
...
...
@@ -449,6 +450,16 @@ QVariant FactMetaData::_knotsToMetersPerSecond(const QVariant& knots)
return
QVariant
(
knots
.
toDouble
()
*
0.51444444444
);
}
QVariant
FactMetaData
::
_percentToNorm
(
const
QVariant
&
percent
)
{
return
QVariant
(
percent
.
toDouble
()
/
100.0
);
}
QVariant
FactMetaData
::
_normToPercent
(
const
QVariant
&
normalized
)
{
return
QVariant
(
normalized
.
toDouble
()
*
100.0
);
}
void
FactMetaData
::
setRawUnits
(
const
QString
&
rawUnits
)
{
_rawUnits
=
rawUnits
;
...
...
src/FactSystem/FactMetaData.h
View file @
8af9c882
...
...
@@ -163,6 +163,8 @@ private:
static
QVariant
_kilometersPerHourToMetersPerSecond
(
const
QVariant
&
kilometersPerHour
);
static
QVariant
_metersPerSecondToKnots
(
const
QVariant
&
metersPerSecond
);
static
QVariant
_knotsToMetersPerSecond
(
const
QVariant
&
knots
);
static
QVariant
_percentToNorm
(
const
QVariant
&
percent
);
static
QVariant
_normToPercent
(
const
QVariant
&
normalized
);
struct
AppSettingsTranslation_s
{
const
char
*
rawUnits
;
...
...
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