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
741ec708
Commit
741ec708
authored
Dec 09, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editing loading of MeasurementComplexItem
parent
fc4a64de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
40 deletions
+42
-40
MeasurementComplexItem.cc
src/MeasurementComplexItem/MeasurementComplexItem.cc
+36
-24
MeasurementArea.cc
src/MeasurementComplexItem/geometry/MeasurementArea.cc
+4
-10
MeasurementArea.h
src/MeasurementComplexItem/geometry/MeasurementArea.h
+0
-3
SafeArea.cc
src/MeasurementComplexItem/geometry/SafeArea.cc
+2
-3
No files found.
src/MeasurementComplexItem/MeasurementComplexItem.cc
View file @
741ec708
...
...
@@ -143,35 +143,47 @@ bool MeasurementComplexItem::load(const QJsonObject &complexObject,
return
false
;
}
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfoList
=
{
{
VisualMissionItem
::
jsonTypeKey
,
QJsonValue
::
String
,
true
},
{
ComplexMissionItem
::
jsonComplexItemTypeKey
,
QJsonValue
::
String
,
true
},
{
variantName
,
QJsonValue
::
Double
,
false
},
{
altitudeName
,
QJsonValue
::
Double
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
keyInfoList
,
errorString
))
{
return
false
;
}
{
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfoList
=
{
{
VisualMissionItem
::
jsonTypeKey
,
QJsonValue
::
String
,
true
},
{
ComplexMissionItem
::
jsonComplexItemTypeKey
,
QJsonValue
::
String
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
keyInfoList
,
errorString
))
{
return
false
;
}
QString
itemType
=
complexObject
[
VisualMissionItem
::
jsonTypeKey
].
toString
();
QString
complexType
=
complexObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
].
toString
();
if
(
itemType
!=
VisualMissionItem
::
jsonTypeComplexItemValue
||
complexType
!=
jsonComplexItemTypeValue
)
{
errorString
=
tr
(
"%1 does not support loading this complex mission item "
"type: %2:%3"
)
.
arg
(
qgcApp
()
->
applicationName
())
.
arg
(
itemType
)
.
arg
(
complexType
);
return
false
;
QString
itemType
=
complexObject
[
VisualMissionItem
::
jsonTypeKey
].
toString
();
QString
complexType
=
complexObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
].
toString
();
if
(
itemType
!=
VisualMissionItem
::
jsonTypeComplexItemValue
||
complexType
!=
jsonComplexItemTypeValue
)
{
errorString
=
tr
(
"%1 does not support loading this complex mission item "
"type: %2:%3"
)
.
arg
(
qgcApp
()
->
applicationName
())
.
arg
(
itemType
)
.
arg
(
complexType
);
return
false
;
}
}
setSequenceNumber
(
sequenceNumber
);
static_assert
(
false
,
"continue here"
);
_variant
.
setRawValue
(
complexObject
[
variantName
].
toInt
());
_altitude
.
setRawValue
(
complexObject
[
altitudeName
].
toDouble
());
// load variant
if
(
complexObject
.
contains
(
variantName
)
&&
complexObject
[
variantName
].
isDouble
())
{
_variant
.
setRawValue
(
complexObject
[
variantName
].
toInt
());
}
else
{
errorString
.
append
(
tr
(
"Not able to load route variant number."
));
}
// load altitude
if
(
complexObject
.
contains
(
altitudeName
)
&&
complexObject
[
altitudeName
].
isDouble
())
{
_altitude
.
setRawValue
(
complexObject
[
altitudeName
].
toDouble
());
}
else
{
errorString
.
append
(
tr
(
"Not able to load altitude."
));
}
return
true
;
}
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.cc
View file @
741ec708
...
...
@@ -64,10 +64,10 @@ size_t TileData::size() const {
}
const
char
*
MeasurementArea
::
settingsGroup
=
"MeasurementArea"
;
const
char
*
MeasurementArea
::
tileHeightKey
=
"TileHeight"
;
const
char
*
MeasurementArea
::
tileWidthName
=
"TileWidth"
;
const
char
*
MeasurementArea
::
minTileAreaKey
=
"MinTileAreaPercent"
;
const
char
*
MeasurementArea
::
showTilesKey
=
"ShowTiles"
;
const
char
*
tileHeightKey
=
"TileHeight"
;
const
char
*
tileWidthName
=
"TileWidth"
;
const
char
*
minTileAreaKey
=
"MinTileAreaPercent"
;
const
char
*
showTilesKey
=
"ShowTiles"
;
const
char
*
MeasurementArea
::
name
=
"Measurement Area"
;
MeasurementArea
::
MeasurementArea
(
QObject
*
parent
)
...
...
@@ -186,12 +186,6 @@ int MeasurementArea::maxTiles() const { return SNAKE_MAX_TILES; }
bool
MeasurementArea
::
ready
()
const
{
return
this
->
_state
==
STATE
::
IDLE
;
}
const
char
*
MeasurementArea
::
getTileWidthName
()
{
return
tileWidthName
;
}
void
MeasurementArea
::
setTileWidthName
(
const
char
*
value
)
{
tileWidthName
=
value
;
}
bool
MeasurementArea
::
saveToJson
(
QJsonObject
&
json
)
{
if
(
ready
())
{
if
(
this
->
GeoArea
::
saveToJson
(
json
))
{
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.h
View file @
741ec708
...
...
@@ -70,9 +70,6 @@ public:
static
const
char
*
settingsGroup
;
static
const
char
*
name
;
static
const
char
*
getTileWidthName
();
static
void
setTileWidthName
(
const
char
*
value
);
signals:
void
tilesChanged
();
void
maxTilesChanged
();
...
...
src/MeasurementComplexItem/geometry/SafeArea.cc
View file @
741ec708
...
...
@@ -9,7 +9,7 @@
QGC_LOGGING_CATEGORY
(
SafeAreaLog
,
"SafeAreaLog"
)
const
char
*
SafeArea
::
name
=
"Safe Area"
;
const
char
*
SafeArea
::
depotKey
=
"Depot Point"
;
const
char
*
depotKey
=
"Depot Point"
;
SafeArea
::
SafeArea
(
QObject
*
parent
)
:
GeoArea
(
parent
)
{
init
();
}
...
...
@@ -107,8 +107,7 @@ bool SafeArea::loadFromJson(const QJsonObject &json, QString &errorString) {
QList
<
JsonHelper
::
KeyValidateInfo
>
versionKeyInfoList
=
{
{
depotKey
,
QJsonValue
::
Array
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
versionKeyInfoList
,
errorString
))
{
if
(
!
JsonHelper
::
validateKeys
(
json
,
versionKeyInfoList
,
errorString
))
{
returnValue
=
false
;
}
else
{
const
auto
&
jsonDepot
=
json
[
depotKey
];
...
...
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