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
b3818e21
Commit
b3818e21
authored
Nov 15, 2019
by
Stefan Dunca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the RallyPoint default value
parent
e9915acb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
7 deletions
+24
-7
RallyPoint.FactMetaData.json
src/MissionManager/RallyPoint.FactMetaData.json
+3
-2
RallyPoint.cc
src/MissionManager/RallyPoint.cc
+17
-4
RallyPoint.h
src/MissionManager/RallyPoint.h
+3
-0
RallyPointController.cc
src/MissionManager/RallyPointController.cc
+1
-1
No files found.
src/MissionManager/RallyPoint.FactMetaData.json
View file @
b3818e21
...
...
@@ -12,10 +12,11 @@
"decimalPlaces"
:
7
},
{
"name"
:
"Altitude"
,
"name"
:
"
Relative
Altitude"
,
"shortDescription"
:
"Altitude of rally point position (home relative)"
,
"type"
:
"double"
,
"decimalPlaces"
:
2
,
"units"
:
"m"
"units"
:
"m"
,
"defaultValue"
:
0.0
}
]
src/MissionManager/RallyPoint.cc
View file @
b3818e21
...
...
@@ -15,7 +15,7 @@
const
char
*
RallyPoint
::
_longitudeFactName
=
"Longitude"
;
const
char
*
RallyPoint
::
_latitudeFactName
=
"Latitude"
;
const
char
*
RallyPoint
::
_altitudeFactName
=
"Altitude"
;
const
char
*
RallyPoint
::
_altitudeFactName
=
"
Relative
Altitude"
;
QMap
<
QString
,
FactMetaData
*>
RallyPoint
::
_metaDataMap
;
...
...
@@ -63,9 +63,7 @@ RallyPoint::~RallyPoint()
void
RallyPoint
::
_factSetup
(
void
)
{
if
(
_metaDataMap
.
isEmpty
())
{
_metaDataMap
=
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/RallyPoint.FactMetaData.json"
),
nullptr
/* metaDataParent */
);
}
_cacheFactMetadata
();
_longitudeFact
.
setMetaData
(
_metaDataMap
[
_longitudeFactName
]);
_latitudeFact
.
setMetaData
(
_metaDataMap
[
_latitudeFactName
]);
...
...
@@ -80,6 +78,12 @@ void RallyPoint::_factSetup(void)
connect
(
&
_altitudeFact
,
&
Fact
::
valueChanged
,
this
,
&
RallyPoint
::
_sendCoordinateChanged
);
}
void
RallyPoint
::
_cacheFactMetadata
()
{
if
(
_metaDataMap
.
isEmpty
())
{
_metaDataMap
=
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/RallyPoint.FactMetaData.json"
),
nullptr
/* metaDataParent */
);
}
}
void
RallyPoint
::
setCoordinate
(
const
QGeoCoordinate
&
coordinate
)
{
if
(
coordinate
!=
this
->
coordinate
())
{
...
...
@@ -99,6 +103,15 @@ void RallyPoint::setDirty(bool dirty)
}
}
double
RallyPoint
::
getDefaultFactAltitude
()
{
_cacheFactMetadata
();
auto
it
=
_metaDataMap
.
find
(
QString
(
_altitudeFactName
));
if
(
it
!=
_metaDataMap
.
end
()
&&
(
*
it
)
->
defaultValueAvailable
())
{
return
(
*
it
)
->
rawDefaultValue
().
toDouble
();
}
return
0.0
;
}
QGeoCoordinate
RallyPoint
::
coordinate
(
void
)
const
{
return
QGeoCoordinate
(
_latitudeFact
.
rawValue
().
toDouble
(),
_longitudeFact
.
rawValue
().
toDouble
(),
_altitudeFact
.
rawValue
().
toDouble
());
...
...
src/MissionManager/RallyPoint.h
View file @
b3818e21
...
...
@@ -39,6 +39,8 @@ public:
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
static
double
getDefaultFactAltitude
();
signals:
void
coordinateChanged
(
const
QGeoCoordinate
&
coordinate
);
void
dirtyChanged
(
bool
dirty
);
...
...
@@ -48,6 +50,7 @@ private slots:
private:
void
_factSetup
(
void
);
static
void
_cacheFactMetadata
();
bool
_dirty
;
Fact
_longitudeFact
;
...
...
src/MissionManager/RallyPointController.cc
View file @
b3818e21
...
...
@@ -243,7 +243,7 @@ void RallyPointController::addPoint(QGeoCoordinate point)
if
(
_points
.
count
())
{
defaultAlt
=
qobject_cast
<
RallyPoint
*>
(
_points
[
_points
.
count
()
-
1
])
->
coordinate
().
altitude
();
}
else
{
defaultAlt
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
defaultMissionItemAltitude
()
->
rawValue
().
toDoubl
e
();
defaultAlt
=
RallyPoint
::
getDefaultFactAltitud
e
();
}
point
.
setAltitude
(
defaultAlt
);
RallyPoint
*
newPoint
=
new
RallyPoint
(
point
,
this
);
...
...
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