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
fc4a64de
Commit
fc4a64de
authored
Dec 07, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saveing added, loading of MeasurementComplexItem missing
parent
a0521309
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
488 additions
and
259 deletions
+488
-259
AreaData.cc
src/MeasurementComplexItem/AreaData.cc
+143
-32
AreaData.h
src/MeasurementComplexItem/AreaData.h
+2
-2
CircularGenerator.cpp
src/MeasurementComplexItem/CircularGenerator.cpp
+119
-51
CircularGenerator.h
src/MeasurementComplexItem/CircularGenerator.h
+0
-4
LinearGenerator.cpp
src/MeasurementComplexItem/LinearGenerator.cpp
+92
-46
LinearGenerator.h
src/MeasurementComplexItem/LinearGenerator.h
+1
-4
MeasurementComplexItem.cc
src/MeasurementComplexItem/MeasurementComplexItem.cc
+41
-39
MeasurementComplexItem.h
src/MeasurementComplexItem/MeasurementComplexItem.h
+2
-1
GeoArea.cc
src/MeasurementComplexItem/geometry/GeoArea.cc
+5
-4
GeoArea.h
src/MeasurementComplexItem/geometry/GeoArea.h
+3
-3
MeasurementArea.cc
src/MeasurementComplexItem/geometry/MeasurementArea.cc
+37
-25
MeasurementArea.h
src/MeasurementComplexItem/geometry/MeasurementArea.h
+5
-6
SafeArea.cc
src/MeasurementComplexItem/geometry/SafeArea.cc
+35
-37
SafeArea.h
src/MeasurementComplexItem/geometry/SafeArea.h
+3
-5
No files found.
src/MeasurementComplexItem/AreaData.cc
View file @
fc4a64de
...
...
@@ -12,8 +12,8 @@
QGC_LOGGING_CATEGORY
(
AreaDataLog
,
"AreaDataLog"
)
const
char
*
originJsonKey
=
"Origin"
;
const
char
*
areaList
Json
Key
=
"AreaList"
;
const
char
*
initialized
Json
Key
=
"Initialized"
;
const
char
*
areaListKey
=
"AreaList"
;
const
char
*
initializedKey
=
"Initialized"
;
AreaData
::
AreaData
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
...
...
@@ -133,6 +133,8 @@ bool AreaData::isCorrect() {
"the Measurement Area."
));
return
false
;
}
_initialized
=
true
;
return
true
;
}
...
...
@@ -275,38 +277,147 @@ bool AreaData::operator!=(const AreaData &other) const {
return
!
(
*
this
==
other
);
}
bool
AreaData
::
load
(
const
QJsonObject
&
obj
,
QString
&
guiErrorString
)
{
qWarning
()
<<
"AreaData::load impl. missing"
;
return
true
;
bool
AreaData
::
load
(
const
QJsonObject
&
obj
,
QString
&
errorString
)
{
bool
returnValue
=
true
;
// load initialized.
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
initializedKey
,
QJsonValue
::
Bool
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_initialized
=
obj
[
initializedKey
].
toBool
();
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load areaList.
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
areaListKey
,
QJsonValue
::
Array
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
this
->
clear
();
// iterate over json array
for
(
const
auto
&
jsonArea
:
obj
[
areaListKey
])
{
// check if area type key is present
QList
<
JsonHelper
::
KeyValidateInfo
>
areaInfo
=
{
{
GeoArea
::
areaTypeKey
,
QJsonValue
::
String
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
jsonArea
,
areaInfo
,
e
))
{
// load MeasurementArea
if
(
jsonArea
[
GeoArea
::
areaTypeKey
]
==
MeasurementArea
::
name
)
{
auto
area
=
getGeoArea
<
MeasurementArea
*>
(
_areaList
);
if
(
area
==
nullptr
)
{
auto
area
=
new
MeasurementArea
(
this
);
if
(
area
->
loadFromJson
(
jsonArea
,
e
))
{
this
->
insert
(
area
);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
area
->
deleteLater
();
}
}
else
{
returnValue
=
false
;
errorString
.
append
(
tr
(
"Multiple Measurement Areas detected. Area was ignored."
));
}
}
// load SafeArea
else
if
(
jsonArea
[
GeoArea
::
areaTypeKey
]
==
SafeArea
::
name
)
{
auto
area
=
getGeoArea
<
SafeArea
*>
(
_areaList
);
if
(
area
==
nullptr
)
{
auto
area
=
new
SafeArea
(
this
);
if
(
area
->
loadFromJson
(
jsonArea
,
e
))
{
this
->
insert
(
area
);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
area
->
deleteLater
();
}
}
else
{
returnValue
=
false
;
errorString
.
append
(
tr
(
"Multiple Safe Areas detected. Area was ignored."
));
}
}
// unknown area
else
{
returnValue
=
false
;
errorString
.
append
(
tr
(
"Unknown area type: "
)
+
jsonArea
[
GeoArea
::
areaTypeKey
]);
}
}
// GeoArea::areaTypeKey missing
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
}
// AreaList missing
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load origin
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
originKey
,
QJsonValue
::
Object
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
QGeoCoordinate
origin
;
if
(
JsonHelper
::
loadGeoCoordinate
(
obj
[
originKey
],
false
,
origin
,
e
))
{
_origin
=
origin
;
}
}
}
// check if this is correct.
if
(
!
this
->
isCorrect
())
{
returnValue
=
false
;
}
return
returnValue
;
}
bool
AreaData
::
save
(
QJsonObject
&
obj
)
const
{
// QJsonObject temp;
// QJsonValue jsonOrigin;
// JsonHelper::saveGeoCoordinate(_origin, true, jsonOrigin);
// temp[originJsonKey] = jsonOrigin;
// temp[initializedJsonKey] = _initialized;
// QJsonObject jsonAreaList;
// for (int i = 0; i < _areaList.count(); ++i) {
// auto const &qobj = _areaList[i];
// auto const &area = qobject_cast<const GeoArea *>(qobj);
// QJsonObject jsonArea;
// if (area->saveToJson(jsonArea)) {
// QJsonObject jsonObj;
// jsonObj[area->objectName()] = jsonArea;
// jsonAreaList.append(jsonObj);
// } else {
// qDebug(AreaListLog) << "save(): not able to save area: "
// << area->objectName();
// _processError(tr("Not able to save area: ") + area->objectName());
// return false;
// }
// }
// temp[areaListJsonKey] = jsonAreaList;
// obj = std::move(temp);
bool
AreaData
::
save
(
QJsonObject
&
obj
)
{
QJsonObject
temp
;
QJsonValue
jsonOrigin
;
JsonHelper
::
saveGeoCoordinate
(
_origin
,
true
,
jsonOrigin
);
temp
[
originJsonKey
]
=
jsonOrigin
;
temp
[
initializedKey
]
=
_initialized
;
QJsonArray
jsonAreaList
;
for
(
int
i
=
0
;
i
<
_areaList
.
count
();
++
i
)
{
auto
qobj
=
_areaList
[
i
];
auto
area
=
qobject_cast
<
GeoArea
*>
(
qobj
);
QJsonObject
jsonArea
;
if
(
area
->
saveToJson
(
jsonArea
))
{
jsonAreaList
.
append
(
jsonArea
);
}
else
{
qDebug
(
AreaDataLog
)
<<
"save(): not able to save area: "
<<
area
->
objectName
();
_processError
(
tr
(
"Not able to save area: "
)
+
area
->
objectName
());
return
false
;
}
}
temp
[
areaListKey
]
=
jsonAreaList
;
obj
=
std
::
move
(
temp
);
return
true
;
}
...
...
src/MeasurementComplexItem/AreaData.h
View file @
fc4a64de
...
...
@@ -74,8 +74,8 @@ public:
bool
operator
==
(
const
AreaData
&
other
)
const
;
bool
operator
!=
(
const
AreaData
&
other
)
const
;
bool
load
(
const
QJsonObject
&
obj
,
QString
&
guiE
rrorString
);
bool
save
(
QJsonObject
&
obj
)
const
;
bool
load
(
const
QJsonObject
&
obj
,
QString
&
e
rrorString
);
bool
save
(
QJsonObject
&
obj
);
QString
errorString
()
const
;
// Contains a message about the last error.
...
...
src/MeasurementComplexItem/CircularGenerator.cpp
View file @
fc4a64de
...
...
@@ -27,10 +27,10 @@ bool circularTransects(const snake::FPoint &reference,
snake
::
Length
minLength
,
snake
::
Transects
&
transects
);
const
char
*
CircularGenerator
::
settingsGroup
=
"CircularGenerator"
;
const
char
*
CircularGenerator
::
distance
Name
=
"TransectDistance"
;
const
char
*
CircularGenerator
::
deltaAlpha
Name
=
"DeltaAlpha"
;
const
char
*
CircularGenerator
::
minLength
Name
=
"MinLength"
;
const
char
*
CircularGenerator
::
ref
PointName
=
"ReferencePoint"
;
const
char
*
CircularGenerator
::
distance
Key
=
"TransectDistance"
;
const
char
*
CircularGenerator
::
deltaAlpha
Key
=
"DeltaAlpha"
;
const
char
*
CircularGenerator
::
minLength
Key
=
"MinLength"
;
const
char
*
CircularGenerator
::
ref
erenceKey
=
"ReferencePoint"
;
CircularGenerator
::
CircularGenerator
(
QObject
*
parent
)
:
CircularGenerator
(
nullptr
,
parent
)
{}
...
...
@@ -39,9 +39,9 @@ CircularGenerator::CircularGenerator(GeneratorBase::Data d, QObject *parent)
:
GeneratorBase
(
d
,
parent
),
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/CircularGenerator.SettingsGroup.json"
),
this
)),
_distance
(
settingsGroup
,
_metaDataMap
[
distance
Name
]),
_deltaAlpha
(
settingsGroup
,
_metaDataMap
[
deltaAlpha
Name
]),
_minLength
(
settingsGroup
,
_metaDataMap
[
minLength
Name
]),
_distance
(
settingsGroup
,
_metaDataMap
[
distance
Key
]),
_deltaAlpha
(
settingsGroup
,
_metaDataMap
[
deltaAlpha
Key
]),
_minLength
(
settingsGroup
,
_metaDataMap
[
minLength
Key
]),
_measurementArea
(
nullptr
)
{
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
...
...
@@ -184,53 +184,121 @@ void CircularGenerator::setReference(const QGeoCoordinate &reference) {
}
bool
CircularGenerator
::
save
(
QJsonObject
&
obj
)
const
{
//
QJsonObject temp;
//
bool ok = false;
//
auto variant = _distance.rawValue();
// auto val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(CircularGeneratorLog)
//
<< "save(): not able to save distance. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[distanceName
] = val;
//
}
//
variant = _deltaAlpha.rawValue();
// val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(CircularGeneratorLog)
//
<< "save(): not able to save deltaAlpha. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[deltaAlphaName
] = val;
//
}
//
variant = _minLength.rawValue();
// val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(CircularGeneratorLog)
//
<< "save(): not able to save minLength. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[minLengthName
] = val;
//
}
// QJsonObject
jsonReference;
// JsonHelper::saveGeoCoordinate(_reference, tru
e, jsonReference);
// temp[refPointName
] = jsonReference;
//
obj = std::move(temp);
QJsonObject
temp
;
bool
ok
=
false
;
auto
variant
=
_distance
.
rawValue
();
auto
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
CircularGeneratorLog
)
<<
"save(): not able to save distance. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
distanceKey
]
=
val
;
}
variant
=
_deltaAlpha
.
rawValue
();
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
CircularGeneratorLog
)
<<
"save(): not able to save deltaAlpha. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
deltaAlphaKey
]
=
val
;
}
variant
=
_minLength
.
rawValue
();
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
CircularGeneratorLog
)
<<
"save(): not able to save minLength. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
minLengthKey
]
=
val
;
}
QJsonValue
jsonReference
;
JsonHelper
::
saveGeoCoordinate
(
_reference
,
fals
e
,
jsonReference
);
temp
[
referenceKey
]
=
jsonReference
;
obj
=
std
::
move
(
temp
);
return
true
;
}
bool
CircularGenerator
::
load
(
const
QJsonObject
&
obj
,
QString
&
guiErrorMessage
)
{
qWarning
()
<<
"CircularGenerator::load() impl. missing"
;
return
true
;
bool
CircularGenerator
::
load
(
const
QJsonObject
&
obj
,
QString
&
errorString
)
{
bool
returnValue
=
true
;
// load distance
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
distanceKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_distance
.
setRawValue
(
obj
[
distanceKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load deltaAlpha
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
deltaAlphaKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_deltaAlpha
.
setRawValue
(
obj
[
deltaAlphaKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load distance
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
minLengthKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_minLength
.
setRawValue
(
obj
[
minLengthKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load reference
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
referenceKey
,
QJsonValue
::
Array
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
QGeoCoordinate
ref
;
if
(
JsonHelper
::
loadGeoCoordinate
(
obj
[
referenceKey
],
false
,
ref
,
e
))
{
setReference
(
ref
);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
return
returnValue
;
}
void
CircularGenerator
::
resetReferenceIfInvalid
()
{
if
(
!
this
->
_reference
.
isValid
())
{
...
...
src/MeasurementComplexItem/CircularGenerator.h
View file @
fc4a64de
...
...
@@ -47,10 +47,6 @@ public:
virtual
bool
load
(
const
QJsonObject
&
obj
,
QString
&
guiErrorMessage
)
override
;
static
const
char
*
settingsGroup
;
static
const
char
*
distanceName
;
static
const
char
*
deltaAlphaName
;
static
const
char
*
minLengthName
;
static
const
char
*
refPointName
;
signals:
void
referenceChanged
();
...
...
src/MeasurementComplexItem/LinearGenerator.cpp
View file @
fc4a64de
...
...
@@ -19,9 +19,9 @@ bool linearTransects(const snake::FPolygon &polygon,
snake
::
Length
minLength
,
snake
::
Transects
&
transects
);
const
char
*
LinearGenerator
::
settingsGroup
=
"LinearGenerator"
;
const
char
*
LinearGenerator
::
distance
Name
=
"TransectDistance"
;
const
char
*
LinearGenerator
::
alpha
Name
=
"Alpha"
;
const
char
*
LinearGenerator
::
minLeng
thName
=
"MinLength"
;
const
char
*
LinearGenerator
::
distance
Key
=
"TransectDistance"
;
const
char
*
LinearGenerator
::
alpha
Key
=
"Alpha"
;
const
char
*
LinearGenerator
::
minLeng
hKey
=
"MinLength"
;
LinearGenerator
::
LinearGenerator
(
QObject
*
parent
)
:
LinearGenerator
(
nullptr
,
parent
)
{}
...
...
@@ -30,9 +30,9 @@ LinearGenerator::LinearGenerator(GeneratorBase::Data d, QObject *parent)
:
GeneratorBase
(
d
,
parent
),
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/LinearGenerator.SettingsGroup.json"
),
this
)),
_distance
(
settingsGroup
,
_metaDataMap
[
distance
Name
]),
_alpha
(
settingsGroup
,
_metaDataMap
[
alpha
Name
]),
_minLength
(
settingsGroup
,
_metaDataMap
[
minLeng
thName
]
),
_distance
(
settingsGroup
,
_metaDataMap
[
distance
Key
]),
_alpha
(
settingsGroup
,
_metaDataMap
[
alpha
Key
]),
_minLength
(
settingsGroup
,
_metaDataMap
[
minLeng
hKey
),
_measurementArea
(
nullptr
),
_safeArea
(
nullptr
)
{
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
...
...
@@ -150,49 +150,95 @@ bool LinearGenerator::get(Generator &generator) {
}
bool
LinearGenerator
::
save
(
QJsonObject
&
obj
)
const
{
//
QJsonObject temp;
//
bool ok = false;
//
auto variant = _distance.rawValue();
// auto val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(LinearGeneratorLog)
//
<< "save(): not able to save distance. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[distanceName
] = val;
//
}
//
variant = _alpha.rawValue();
// val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(LinearGeneratorLog)
//
<< "save(): not able to save alpha. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[alphaName
] = val;
//
}
//
variant = _minLength.rawValue();
// val = variant.toDouble(
ok);
//
if (!ok) {
//
qCDebug(LinearGeneratorLog)
//
<< "save(): not able to save minLength. Not a double: "
//
<< variant.typeName();
//
return false;
//
} else {
// temp[minLengthName]
= val;
//
}
//
obj = std::move(temp);
QJsonObject
temp
;
bool
ok
=
false
;
auto
variant
=
_distance
.
rawValue
();
auto
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
LinearGeneratorLog
)
<<
"save(): not able to save distance. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
distanceKey
]
=
val
;
}
variant
=
_alpha
.
rawValue
();
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
LinearGeneratorLog
)
<<
"save(): not able to save alpha. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
alphaKey
]
=
val
;
}
variant
=
_minLength
.
rawValue
();
val
=
variant
.
toDouble
(
&
ok
);
if
(
!
ok
)
{
qCDebug
(
LinearGeneratorLog
)
<<
"save(): not able to save minLength. Not a double: "
<<
variant
.
typeName
();
return
false
;
}
else
{
temp
[
minLenghKey
=
val
;
}
obj
=
std
::
move
(
temp
);
return
true
;
}
bool
LinearGenerator
::
load
(
const
QJsonObject
&
obj
,
QString
&
guiErrorString
)
{
qWarning
()
<<
"LinearGenerator::load() impl. missing"
;
return
true
;
bool
LinearGenerator
::
load
(
const
QJsonObject
&
obj
,
QString
&
errorString
)
{
bool
returnValue
=
true
;
// load distance
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
distanceKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_distance
.
setRawValue
(
obj
[
distanceKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load alpha
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
alphaKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_alpha
.
setRawValue
(
obj
[
alphaKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
// load distance
{
QString
e
;
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfo
=
{
{
minLengthKey
,
QJsonValue
::
Double
,
true
},
};
if
(
JsonHelper
::
validateKeys
(
obj
,
keyInfo
,
e
))
{
_minLength
.
setRawValue
(
obj
[
minLengthKey
]);
}
else
{
returnValue
=
false
;
errorString
.
append
(
e
);
errorString
.
append
(
"
\n
"
);
}
}
return
returnValue
;
}
Fact
*
LinearGenerator
::
distance
()
{
return
&
_distance
;
}
...
...
src/MeasurementComplexItem/LinearGenerator.h
View file @
fc4a64de
...
...
@@ -36,16 +36,13 @@ public:
//! \note This methode does not save the data.
//!
virtual
bool
save
(
QJsonObject
&
obj
)
const
override
;
virtual
bool
load
(
const
QJsonObject
&
obj
,
QString
&
guiE
rrorString
)
override
;
virtual
bool
load
(
const
QJsonObject
&
obj
,
QString
&
e
rrorString
)
override
;
Fact
*
distance
();
Fact
*
alpha
();
Fact
*
minLength
();
static
const
char
*
settingsGroup
;
static
const
char
*
distanceName
;
static
const
char
*
alphaName
;
static
const
char
*
minLengthName
;
private:
void
onAreaListChanged
();
...
...
src/MeasurementComplexItem/MeasurementComplexItem.cc
View file @
fc4a64de
...
...
@@ -33,7 +33,7 @@ const char *MeasurementComplexItem::jsonComplexItemTypeValue =
const
char
*
MeasurementComplexItem
::
variantName
=
"Variant"
;
const
char
*
MeasurementComplexItem
::
altitudeName
=
"Altitude"
;
const
QString
MeasurementComplexItem
::
name
(
tr
(
"Measurement"
));
const
char
*
areaDataName
=
"AreaData
Name
"
;
const
char
*
areaDataName
=
"AreaData"
;
const
char
*
variantNamesName
=
"VariantNames"
;
const
char
*
generatorsName
=
"Generators"
;
const
char
*
variantsName
=
"Variants"
;
...
...
@@ -100,14 +100,9 @@ MeasurementComplexItem::MeasurementComplexItem(
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
[
this
]
{
emit
this
->
complexDistanceChanged
();
});
// Register Generators.
auto
lg
=
new
routing
::
LinearGenerator
(
this
->
_pAreaData
,
this
);
addGenerator
(
lg
->
name
(),
lg
);
auto
cg
=
new
routing
::
CircularGenerator
(
this
->
_pAreaData
,
this
);
addGenerator
(
cg
->
name
(),
cg
);
resetGenerators
();
qCritical
()
<<
"ToDo: _altitude connections missing."
;
qCritical
()
<<
"ToDo: add generator saveing."
;
}
MeasurementComplexItem
::~
MeasurementComplexItem
()
{}
...
...
@@ -174,10 +169,7 @@ bool MeasurementComplexItem::load(const QJsonObject &complexObject,
setSequenceNumber
(
sequenceNumber
);
if
(
!
load
(
complexObject
,
sequenceNumber
,
errorString
))
{
return
false
;
}
static_assert
(
false
,
"continue here"
);
_variant
.
setRawValue
(
complexObject
[
variantName
].
toInt
());
_altitude
.
setRawValue
(
complexObject
[
altitudeName
].
toDouble
());
...
...
@@ -212,7 +204,7 @@ QString MeasurementComplexItem::mapVisualQML() const {
return
QStringLiteral
(
"MeasurementItemMapVisual.qml"
);
}
void
MeasurementComplexItem
::
save
(
QJson
Object
&
planItems
)
{
void
MeasurementComplexItem
::
save
(
QJson
Array
&
planItems
)
{
if
(
idle
())
{
QJsonObject
saveObject
;
...
...
@@ -227,47 +219,47 @@ void MeasurementComplexItem::save(QJsonObject &planItems) {
saveObject
[
altitudeName
]
=
double
(
_altitude
.
rawValue
().
toUInt
());
// Variant names.
QJson
Object
jsonVariantNames
;
QJson
Array
jsonVariantNames
;
for
(
auto
const
&
name
:
_variantNames
)
{
jsonVariantNames
.
append
(
name
);
}
saveObject
[
variantNamesName
]
=
jsonVariantNames
;
// AreaData.
//
QJsonObject jsonAreaData;
//
if (!_pAreaData->save(jsonAreaData)) {
//
qCDebug(MeasurementComplexItemLog)
//
<< "save(): not able to save area data";
//
return;
//
}
//
saveObject[areaDataName] = jsonAreaData;
QJsonObject
jsonAreaData
;
if
(
!
_pAreaData
->
save
(
jsonAreaData
))
{
qCDebug
(
MeasurementComplexItemLog
)
<<
"save(): not able to save area data"
;
return
;
}
saveObject
[
areaDataName
]
=
jsonAreaData
;
// Generators.
//
QJsonArray generatorArray;
//
for (int i = 0; i < _generatorList.size(); ++i) {
//
auto const gen = _generatorList[i];
//
auto const &name = _generatorNameList[i];
//
QJsonObject innerObj;
//
if (!gen->save(innerObj)) {
//
qCDebug(MeasurementComplexItemLog)
//
<< "save(): not able to save generator: " << name;
//
return;
//
} else {
//
QJsonObject outerObj;
//
outerObj[name] = innerObj;
//
generatorArray.append(outerObj);
//
}
//
}
//
saveObject[generatorsName] = generatorArray;
QJsonArray
generatorArray
;
for
(
int
i
=
0
;
i
<
_generatorList
.
size
();
++
i
)
{
auto
const
gen
=
_generatorList
[
i
];
auto
const
&
name
=
_generatorNameList
[
i
];
QJsonObject
innerObj
;
if
(
!
gen
->
save
(
innerObj
))
{
qCDebug
(
MeasurementComplexItemLog
)
<<
"save(): not able to save generator: "
<<
name
;
return
;
}
else
{
QJsonObject
outerObj
;
outerObj
[
name
]
=
innerObj
;
generatorArray
.
append
(
outerObj
);
}
}
saveObject
[
generatorsName
]
=
generatorArray
;
// Route Variants
QJson
Object
variantsArray
;
QJson
Array
variantsArray
;
for
(
auto
const
&
route
:
_variantVector
)
{
QJsonValue
variant
;
if
(
!
(
route
.
size
()
==
0
))
{
JsonHelper
::
saveGeoCoordinateArray
(
route
,
tru
e
,
variant
);
JsonHelper
::
saveGeoCoordinateArray
(
route
,
fals
e
,
variant
);
}
else
{
JsonHelper
::
saveGeoCoordinateArray
(
_route
,
tru
e
,
variant
);
JsonHelper
::
saveGeoCoordinateArray
(
_route
,
fals
e
,
variant
);
}
variantsArray
.
append
(
variant
);
}
...
...
@@ -763,6 +755,16 @@ bool MeasurementComplexItem::switchToGenerator(int index) {
}
}
void
MeasurementComplexItem
::
resetGenerators
()
{
while
(
_generatorList
.
size
()
>
0
)
{
removeGenerator
(
0
);
}
auto
lg
=
new
routing
::
LinearGenerator
(
this
->
_pAreaData
,
this
);
addGenerator
(
lg
->
name
(),
lg
);
auto
cg
=
new
routing
::
CircularGenerator
(
this
->
_pAreaData
,
this
);
addGenerator
(
cg
->
name
(),
cg
);
}
QStringList
MeasurementComplexItem
::
generatorNameList
()
{
return
this
->
_generatorNameList
;
}
...
...
src/MeasurementComplexItem/MeasurementComplexItem.h
View file @
fc4a64de
...
...
@@ -85,7 +85,7 @@ public:
virtual
void
setDirty
(
bool
dirty
)
override
final
;
virtual
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
)
override
final
;
virtual
void
setSequenceNumber
(
int
sequenceNumber
)
override
final
;
virtual
void
save
(
QJson
Object
&
missionItems
)
override
final
;
virtual
void
save
(
QJson
Array
&
missionItems
)
override
final
;
virtual
double
amslEntryAlt
(
void
)
const
override
final
;
virtual
double
amslExitAlt
(
void
)
const
override
final
;
virtual
double
minAMSLAltitude
(
void
)
const
override
final
;
...
...
@@ -100,6 +100,7 @@ public:
bool
removeGenerator
(
int
index
);
Q_INVOKABLE
bool
switchToGenerator
(
const
QString
&
name
);
Q_INVOKABLE
bool
switchToGenerator
(
int
index
);
Q_INVOKABLE
void
resetGenerators
();
QStringList
generatorNameList
();
routing
::
GeneratorBase
*
generator
();
int
generatorIndex
();
...
...
src/MeasurementComplexItem/geometry/GeoArea.cc
View file @
fc4a64de
...
...
@@ -9,8 +9,8 @@
QGC_LOGGING_CATEGORY
(
GeoAreaLog
,
"GeoAreaLog"
)
const
char
*
GeoArea
::
wimaAreaN
ame
=
"GeoArea"
;
const
char
*
GeoArea
::
areaType
Name
=
"AreaType"
;
const
char
*
GeoArea
::
n
ame
=
"GeoArea"
;
const
char
*
GeoArea
::
areaType
Key
=
"AreaType"
;
const
char
*
GeoArea
::
settingsGroup
=
"GeoArea"
;
// Constructors
...
...
@@ -30,8 +30,9 @@ GeoArea &GeoArea::operator=(const GeoArea &other) {
return
*
this
;
}
void
GeoArea
::
saveToJson
(
QJsonObject
&
json
)
{
bool
GeoArea
::
saveToJson
(
QJsonObject
&
json
)
{
this
->
QGCMapPolygon
::
saveToJson
(
json
);
return
true
;
}
bool
GeoArea
::
loadFromJson
(
const
QJsonObject
&
json
,
QString
&
errorString
)
{
...
...
@@ -80,7 +81,7 @@ bool GeoArea::covers(const QGeoCoordinate &c) {
}
void
GeoArea
::
init
()
{
this
->
setObjectName
(
wimaAreaN
ame
);
this
->
setObjectName
(
n
ame
);
// connect(this, &GeoArea::pathChanged, [this] {
// if (this->objectName() != "Tile") {
// qDebug() << this->objectName() << " path: " << this->path() << "\n";
...
...
src/MeasurementComplexItem/geometry/GeoArea.h
View file @
fc4a64de
...
...
@@ -18,7 +18,7 @@ public:
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
virtual
QString
editorQML
(
void
)
const
=
0
;
virtual
void
saveToJson
(
QJsonObject
&
jsonObject
);
virtual
bool
saveToJson
(
QJsonObject
&
jsonObject
);
virtual
bool
loadFromJson
(
const
QJsonObject
&
jsonObject
,
QString
&
errorString
);
...
...
@@ -35,8 +35,8 @@ public:
Q_INVOKABLE
bool
covers
(
const
QGeoCoordinate
&
c
);
// static Members
static
const
char
*
wimaAreaN
ame
;
static
const
char
*
areaType
Name
;
static
const
char
*
n
ame
;
static
const
char
*
areaType
Key
;
static
const
char
*
settingsGroup
;
signals:
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.cc
View file @
fc4a64de
...
...
@@ -64,25 +64,25 @@ size_t TileData::size() const {
}
const
char
*
MeasurementArea
::
settingsGroup
=
"MeasurementArea"
;
const
char
*
MeasurementArea
::
tileHeight
Name
=
"TileHeight"
;
const
char
*
MeasurementArea
::
tileHeight
Key
=
"TileHeight"
;
const
char
*
MeasurementArea
::
tileWidthName
=
"TileWidth"
;
const
char
*
MeasurementArea
::
minTileArea
Name
=
"MinTileAreaPercent"
;
const
char
*
MeasurementArea
::
showTiles
Name
=
"ShowTiles"
;
const
char
*
MeasurementArea
::
measurementAreaN
ame
=
"Measurement Area"
;
const
char
*
MeasurementArea
::
minTileArea
Key
=
"MinTileAreaPercent"
;
const
char
*
MeasurementArea
::
showTiles
Key
=
"ShowTiles"
;
const
char
*
MeasurementArea
::
n
ame
=
"Measurement Area"
;
MeasurementArea
::
MeasurementArea
(
QObject
*
parent
)
:
GeoArea
(
parent
),
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/MeasurementArea.SettingsGroup.json"
),
this
/* QObject parent */
)),
_tileHeight
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileHeight
Name
],
_tileHeight
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileHeight
Key
],
this
/* QObject parent */
)),
_tileWidth
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileWidthName
],
this
/* QObject parent */
)),
_minTileAreaPercent
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileArea
Name
],
_metaDataMap
[
minTileArea
Key
],
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTiles
Name
],
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTiles
Key
],
this
/* QObject parent */
)),
_state
(
STATE
::
IDLE
)
{
init
();
...
...
@@ -93,14 +93,14 @@ MeasurementArea::MeasurementArea(const MeasurementArea &other, QObject *parent)
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/MeasurementArea.SettingsGroup.json"
),
this
/* QObject parent */
)),
_tileHeight
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileHeight
Name
],
_tileHeight
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileHeight
Key
],
this
/* QObject parent */
)),
_tileWidth
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
tileWidthName
],
this
/* QObject parent */
)),
_minTileAreaPercent
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileArea
Name
],
_metaDataMap
[
minTileArea
Key
],
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTiles
Name
],
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTiles
Key
],
this
/* QObject parent */
)),
_state
(
STATE
::
IDLE
)
{
init
();
...
...
@@ -186,17 +186,29 @@ int MeasurementArea::maxTiles() const { return SNAKE_MAX_TILES; }
bool
MeasurementArea
::
ready
()
const
{
return
this
->
_state
==
STATE
::
IDLE
;
}
void
MeasurementArea
::
saveToJson
(
QJsonObject
&
json
)
{
const
char
*
MeasurementArea
::
getTileWidthName
()
{
return
tileWidthName
;
}
void
MeasurementArea
::
setTileWidthName
(
const
char
*
value
)
{
tileWidthName
=
value
;
}
bool
MeasurementArea
::
saveToJson
(
QJsonObject
&
json
)
{
if
(
ready
())
{
this
->
GeoArea
::
saveToJson
(
json
);
json
[
tileHeightName
]
=
_tileHeight
.
rawValue
().
toDouble
();
json
[
tileWidthName
]
=
_tileWidth
.
rawValue
().
toDouble
();
json
[
minTileAreaName
]
=
_minTileAreaPercent
.
rawValue
().
toDouble
();
json
[
showTilesName
]
=
_showTiles
.
rawValue
().
toBool
();
json
[
areaTypeName
]
=
measurementAreaName
;
if
(
this
->
GeoArea
::
saveToJson
(
json
))
{
json
[
tileHeightKey
]
=
_tileHeight
.
rawValue
().
toDouble
();
json
[
tileWidthName
]
=
_tileWidth
.
rawValue
().
toDouble
();
json
[
minTileAreaKey
]
=
_minTileAreaPercent
.
rawValue
().
toDouble
();
json
[
showTilesKey
]
=
_showTiles
.
rawValue
().
toBool
();
json
[
areaTypeKey
]
=
name
;
return
true
;
}
else
{
qCDebug
(
MeasurementAreaLog
)
<<
"saveToJson(): error inside GeoArea::saveToJson()."
;
}
}
else
{
qCDebug
(
MeasurementAreaLog
)
<<
"saveToJson(): not ready
for saveing
."
;
qCDebug
(
MeasurementAreaLog
)
<<
"saveToJson(): not ready
()
."
;
}
return
false
;
}
bool
MeasurementArea
::
loadFromJson
(
const
QJsonObject
&
json
,
...
...
@@ -205,11 +217,11 @@ bool MeasurementArea::loadFromJson(const QJsonObject &json,
disableUpdate
();
bool
retVal
=
true
;
if
(
!
json
.
contains
(
tileHeight
Name
)
||
!
json
[
tileHeightName
].
isDouble
())
{
if
(
!
json
.
contains
(
tileHeight
Key
)
||
!
json
[
tileHeightKey
].
isDouble
())
{
errorString
.
append
(
tr
(
"Could not load tile height!
\n
"
));
retVal
=
false
;
}
else
{
_tileHeight
.
setRawValue
(
json
[
tileHeight
Name
].
toDouble
());
_tileHeight
.
setRawValue
(
json
[
tileHeight
Key
].
toDouble
());
}
if
(
!
json
.
contains
(
tileWidthName
)
||
!
json
[
tileWidthName
].
isDouble
())
{
...
...
@@ -219,18 +231,18 @@ bool MeasurementArea::loadFromJson(const QJsonObject &json,
_tileWidth
.
setRawValue
(
json
[
tileWidthName
].
toDouble
());
}
if
(
!
json
.
contains
(
minTileArea
Name
)
||
!
json
[
minTileAreaName
].
isDouble
())
{
if
(
!
json
.
contains
(
minTileArea
Key
)
||
!
json
[
minTileAreaKey
].
isDouble
())
{
errorString
.
append
(
tr
(
"Could not load minimal tile area!
\n
"
));
retVal
=
false
;
}
else
{
_minTileAreaPercent
.
setRawValue
(
json
[
minTileArea
Name
].
toDouble
());
_minTileAreaPercent
.
setRawValue
(
json
[
minTileArea
Key
].
toDouble
());
}
if
(
!
json
.
contains
(
showTiles
Name
)
||
!
json
[
showTilesName
].
isBool
())
{
if
(
!
json
.
contains
(
showTiles
Key
)
||
!
json
[
showTilesKey
].
isBool
())
{
errorString
.
append
(
tr
(
"Could not load show tiles !
\n
"
));
retVal
=
false
;
}
else
{
_showTiles
.
setRawValue
(
json
[
showTiles
Name
].
toBool
());
_showTiles
.
setRawValue
(
json
[
showTiles
Key
].
toBool
());
}
enableUpdate
();
...
...
@@ -402,7 +414,7 @@ void MeasurementArea::enableUpdate() {
}
void
MeasurementArea
::
init
()
{
this
->
setObjectName
(
measurementAreaN
ame
);
this
->
setObjectName
(
n
ame
);
connect
(
&
this
->
_tileHeight
,
&
Fact
::
rawValueChanged
,
this
,
&
MeasurementArea
::
deferUpdate
);
connect
(
&
this
->
_tileWidth
,
&
Fact
::
rawValueChanged
,
this
,
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.h
View file @
fc4a64de
...
...
@@ -48,7 +48,7 @@ public:
QString
mapVisualQML
(
void
)
const
override
;
QString
editorQML
(
void
)
const
override
;
MeasurementArea
*
clone
(
QObject
*
parent
=
nullptr
)
const
;
void
saveToJson
(
QJsonObject
&
json
)
override
;
bool
saveToJson
(
QJsonObject
&
json
)
override
;
bool
loadFromJson
(
const
QJsonObject
&
json
,
QString
&
errorString
)
override
;
Q_INVOKABLE
virtual
bool
isCorrect
();
...
...
@@ -68,11 +68,10 @@ public:
// Static Variables
static
const
char
*
settingsGroup
;
static
const
char
*
tileHeightName
;
static
const
char
*
tileWidthName
;
static
const
char
*
minTileAreaName
;
static
const
char
*
showTilesName
;
static
const
char
*
measurementAreaName
;
static
const
char
*
name
;
static
const
char
*
getTileWidthName
();
static
void
setTileWidthName
(
const
char
*
value
);
signals:
void
tilesChanged
();
...
...
src/MeasurementComplexItem/geometry/SafeArea.cc
View file @
fc4a64de
#include "SafeArea.h"
#include "JsonHelper.h"
#include "QGCLoggingCategory.h"
#include "QGCQGeoCoordinate.h"
...
...
@@ -7,10 +8,8 @@
QGC_LOGGING_CATEGORY
(
SafeAreaLog
,
"SafeAreaLog"
)
const
char
*
SafeArea
::
safeAreaName
=
"Safe Area"
;
const
char
*
SafeArea
::
depotLatitudeName
=
"DepotLatitude"
;
const
char
*
SafeArea
::
depotLongitudeName
=
"DepotLongitude"
;
const
char
*
SafeArea
::
depotAltitudeName
=
"DepotAltitude"
;
const
char
*
SafeArea
::
name
=
"Safe Area"
;
const
char
*
SafeArea
::
depotKey
=
"Depot Point"
;
SafeArea
::
SafeArea
(
QObject
*
parent
)
:
GeoArea
(
parent
)
{
init
();
}
...
...
@@ -83,43 +82,42 @@ bool SafeArea::setDepot(const QGeoCoordinate &newDepot) {
return
false
;
}
void
SafeArea
::
saveToJson
(
QJsonObject
&
json
)
{
this
->
GeoArea
::
saveToJson
(
json
);
json
[
areaTypeName
]
=
safeAreaName
;
json
[
depotLatitudeName
]
=
_depot
.
latitude
();
json
[
depotLongitudeName
]
=
_depot
.
longitude
();
json
[
depotAltitudeName
]
=
_depot
.
altitude
();
bool
SafeArea
::
saveToJson
(
QJsonObject
&
json
)
{
if
(
this
->
GeoArea
::
saveToJson
(
json
))
{
json
[
areaTypeKey
]
=
name
;
QJsonValue
jsonDepot
;
JsonHelper
::
saveGeoCoordinate
(
_depot
,
false
,
jsonDepot
);
json
[
depotKey
]
=
jsonDepot
;
return
true
;
}
else
{
qCDebug
(
SafeAreaLog
)
<<
"saveToJson(): error in GeoArea::safeToJson()"
;
}
return
false
;
}
bool
SafeArea
::
loadFromJson
(
const
QJsonObject
&
json
,
QString
&
errorString
)
{
bool
retVal
=
false
;
if
(
this
->
GeoArea
::
loadFromJson
(
json
,
errorString
))
{
double
lat
=
0
;
if
(
json
.
contains
(
depotLatitudeName
)
&&
json
[
depotLatitudeName
].
isDouble
())
{
lat
=
json
[
depotLatitudeName
].
toDouble
();
double
lon
=
0
;
if
(
json
.
contains
(
depotLongitudeName
)
&&
json
[
depotLongitudeName
].
isDouble
())
{
lon
=
json
[
depotLongitudeName
].
toDouble
();
double
alt
=
0
;
if
(
json
.
contains
(
depotAltitudeName
)
&&
json
[
depotAltitudeName
].
isDouble
())
{
alt
=
json
[
depotAltitudeName
].
toDouble
();
this
->
setDepot
(
QGeoCoordinate
(
lat
,
lon
,
alt
));
retVal
=
true
;
}
else
{
errorString
=
"Not able to load depot altitude."
;
}
}
else
{
errorString
=
"Not able to load depot longitude."
;
}
}
else
{
errorString
=
"Not able to load depot latitude."
;
bool
returnValue
=
true
;
if
(
!
this
->
GeoArea
::
loadFromJson
(
json
,
errorString
))
{
returnValue
=
false
;
}
QList
<
JsonHelper
::
KeyValidateInfo
>
versionKeyInfoList
=
{
{
depotKey
,
QJsonValue
::
Array
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
versionKeyInfoList
,
errorString
))
{
returnValue
=
false
;
}
else
{
const
auto
&
jsonDepot
=
json
[
depotKey
];
if
(
!
JsonHelper
::
loadGeoCoordinate
(
jsonDepot
,
false
,
_depot
,
errorString
))
{
returnValue
=
false
;
}
retVal
=
true
;
}
return
retVal
;
return
returnValue
;
}
bool
SafeArea
::
isCorrect
()
{
...
...
@@ -138,6 +136,6 @@ bool SafeArea::isCorrect() {
}
void
SafeArea
::
init
()
{
this
->
setObjectName
(
safeAreaN
ame
);
this
->
setObjectName
(
n
ame
);
connect
(
this
,
&
GeoArea
::
pathChanged
,
this
,
&
SafeArea
::
putDepotInside
);
}
src/MeasurementComplexItem/geometry/SafeArea.h
View file @
fc4a64de
...
...
@@ -17,7 +17,7 @@ public:
QString
mapVisualQML
(
void
)
const
override
;
QString
editorQML
(
void
)
const
override
;
SafeArea
*
clone
(
QObject
*
parent
=
nullptr
)
const
;
void
saveToJson
(
QJsonObject
&
json
)
override
;
bool
saveToJson
(
QJsonObject
&
json
)
override
;
bool
loadFromJson
(
const
QJsonObject
&
json
,
QString
&
errorString
)
override
;
Q_INVOKABLE
virtual
bool
isCorrect
();
...
...
@@ -27,10 +27,8 @@ public:
QGeoCoordinate
depotQml
(
void
)
const
;
// static Members
static
const
char
*
safeAreaName
;
static
const
char
*
depotLatitudeName
;
static
const
char
*
depotLongitudeName
;
static
const
char
*
depotAltitudeName
;
static
const
char
*
name
;
signals:
void
depotChanged
(
void
);
private
slots
:
...
...
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