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
dd135422
Commit
dd135422
authored
Nov 18, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editing added to RouteComplexItem
parent
0877c5b7
Changes
55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
4653 additions
and
7432 deletions
+4653
-7432
qgroundcontrol.pro
qgroundcontrol.pro
+9
-12
qgroundcontrol.qrc
qgroundcontrol.qrc
+7
-15
MissionController.cc
src/MissionManager/MissionController.cc
+2868
-2471
MissionItem.h
src/MissionManager/MissionItem.h
+2
-2
QGCApplication.cc
src/QGCApplication.cc
+841
-729
AreaData.cc
src/RouteMissionItem/AreaData.cc
+165
-91
AreaData.h
src/RouteMissionItem/AreaData.h
+80
-0
CircularGenerator.cpp
src/RouteMissionItem/CircularGenerator.cpp
+92
-66
CircularGenerator.h
src/RouteMissionItem/CircularGenerator.h
+2
-0
GeneratorBase.cc
src/RouteMissionItem/GeneratorBase.cc
+5
-4
GeneratorBase.h
src/RouteMissionItem/GeneratorBase.h
+8
-5
LinearGenerator.cpp
src/RouteMissionItem/LinearGenerator.cpp
+72
-49
LinearGenerator.h
src/RouteMissionItem/LinearGenerator.h
+3
-0
NemoInterface.cpp
src/RouteMissionItem/NemoInterface.cpp
+6
-6
OptimisationTools.cc
src/RouteMissionItem/OptimisationTools.cc
+0
-105
OptimisationTools.h
src/RouteMissionItem/OptimisationTools.h
+0
-12
RouteComplexItem.cc
src/RouteMissionItem/RouteComplexItem.cc
+153
-142
RouteComplexItem.h
src/RouteMissionItem/RouteComplexItem.h
+41
-16
RoutingThread.h
src/RouteMissionItem/RoutingThread.h
+1
-1
GeoArea.cc
src/RouteMissionItem/geometry/GeoArea.cc
+63
-0
GeoArea.h
src/RouteMissionItem/geometry/GeoArea.h
+57
-0
MeasurementArea.cc
src/RouteMissionItem/geometry/MeasurementArea.cc
+69
-80
MeasurementArea.h
src/RouteMissionItem/geometry/MeasurementArea.h
+15
-17
PlanimetryCalculus.cc
src/RouteMissionItem/geometry/PlanimetryCalculus.cc
+0
-774
PlanimetryCalculus.h
src/RouteMissionItem/geometry/PlanimetryCalculus.h
+0
-124
PolygonCalculus.cc
src/RouteMissionItem/geometry/PolygonCalculus.cc
+0
-578
PolygonCalculus.h
src/RouteMissionItem/geometry/PolygonCalculus.h
+0
-45
SafeArea.cc
src/RouteMissionItem/geometry/SafeArea.cc
+38
-31
SafeArea.h
src/RouteMissionItem/geometry/SafeArea.h
+11
-13
WimaArea.cc
src/RouteMissionItem/geometry/WimaArea.cc
+0
-525
WimaArea.h
src/RouteMissionItem/geometry/WimaArea.h
+0
-40
WimaAreaData.cc
src/RouteMissionItem/geometry/WimaAreaData.cc
+0
-127
WimaAreaData.h
src/RouteMissionItem/geometry/WimaAreaData.h
+0
-62
WimaMeasurementAreaData.cc
src/RouteMissionItem/geometry/WimaMeasurementAreaData.cc
+0
-137
WimaMeasurementAreaData.h
src/RouteMissionItem/geometry/WimaMeasurementAreaData.h
+0
-65
WimaServiceAreaData.cc
src/RouteMissionItem/geometry/WimaServiceAreaData.cc
+0
-54
WimaServiceAreaData.h
src/RouteMissionItem/geometry/WimaServiceAreaData.h
+0
-37
RouteComplexItem.SettingsGroup.json
...RouteMissionItem/json/RouteComplexItem.SettingsGroup.json
+0
-0
WimaController.SettingsGroup.json
src/RouteMissionItem/json/WimaController.SettingsGroup.json
+0
-104
SnakeTile.cpp
src/RouteMissionItem/nemo_interface/SnakeTile.cpp
+8
-11
SnakeTile.h
src/RouteMissionItem/nemo_interface/SnakeTile.h
+7
-9
SnakeTileLocal.h
src/RouteMissionItem/nemo_interface/SnakeTileLocal.h
+1
-1
SnakeTilesLocal.h
src/RouteMissionItem/nemo_interface/SnakeTilesLocal.h
+2
-2
CircularSurveyMapVisual.qml
src/WimaView/CircularSurveyMapVisual.qml
+27
-7
MeasurementAreaEditor.qml
src/WimaView/MeasurementAreaEditor.qml
+0
-0
MeasurementAreaMapVisual.qml
src/WimaView/MeasurementAreaMapVisual.qml
+0
-0
SafeAreaEditor.qml
src/WimaView/SafeAreaEditor.qml
+0
-0
SafeAreaMapVisual.qml
src/WimaView/SafeAreaMapVisual.qml
+0
-0
WimaCorridorDataVisual.qml
src/WimaView/WimaCorridorDataVisual.qml
+0
-58
WimaCorridorMapVisual.qml
src/WimaView/WimaCorridorMapVisual.qml
+0
-111
WimaJoinedAreaDataVisual.qml
src/WimaView/WimaJoinedAreaDataVisual.qml
+0
-58
WimaJoinedAreaMapVisual.qml
src/WimaView/WimaJoinedAreaMapVisual.qml
+0
-101
WimaMapPolylineVisuals.qml
src/WimaView/WimaMapPolylineVisuals.qml
+0
-353
WimaMeasurementAreaDataVisual.qml
src/WimaView/WimaMeasurementAreaDataVisual.qml
+0
-124
WimaServiceAreaDataVisual.qml
src/WimaView/WimaServiceAreaDataVisual.qml
+0
-58
No files found.
qgroundcontrol.pro
View file @
dd135422
...
...
@@ -421,6 +421,8 @@ INCLUDEPATH += \
src
/
Vehicle
\
src
/
Audio
\
src
/
comm
\
src
/
RouteMissionItem
\
src
/
RouteMissionItem
/
geometry
\
src
/
comm
/
ros_bridge
\
src
/
input
\
src
/
lib
/
qmapcontrol
\
...
...
@@ -445,7 +447,11 @@ contains (DEFINES, QGC_ENABLE_PAIRING) {
HEADERS
+=
\
src
/
QmlControls
/
QmlUnitsConversion
.
h
\
src
/
RouteMissionItem
/
geometry
/
GeoArea
.
h
\
src
/
RouteMissionItem
/
geometry
/
MeasurementArea
.
h
\
src
/
RouteMissionItem
/
geometry
/
SafeArea
.
h
\
src
/
Vehicle
/
VehicleEscStatusFactGroup
.
h
\
src
/
RouteMissionItem
/
AreaData
.
h
\
src
/
RouteMissionItem
/
RouteComplexItem
.
h
\
src
/
RouteMissionItem
/
GenericSingelton
.
h
\
src
/
RouteMissionItem
/
geometry
/
GenericCircle
.
h
\
...
...
@@ -492,12 +498,6 @@ HEADERS += \
src
/
api
/
QGCSettings
.
h
\
src
/
api
/
QmlComponentInfo
.
h
\
src
/
GPS
/
Drivers
/
src
/
base_station
.
h
\
src
/
RouteMissionItem
/
geometry
/
WimaArea
.
h
\
src
/
RouteMissionItem
/
geometry
/
WimaServiceArea
.
h
\
src
/
RouteMissionItem
/
geometry
/
WimaMeasurementArea
.
h
\
src
/
RouteMissionItem
/
geometry
/
PlanimetryCalculus
.
h
\
src
/
RouteMissionItem
/
geometry
/
PolygonCalculus
.
h
\
src
/
RouteMissionItem
/
OptimisationTools
.
h
\
src
/
Settings
/
WimaSettings
.
h
\
src
/
comm
/
ros_bridge
/
include
/
RosBridgeClient
.
h
\
src
/
comm
/
ros_bridge
/
include
/
com_private
.
h
\
...
...
@@ -522,6 +522,9 @@ contains (DEFINES, QGC_ENABLE_PAIRING) {
}
SOURCES
+=
\
src
/
RouteMissionItem
/
geometry
/
GeoArea
.
cc
\
src
/
RouteMissionItem
/
geometry
/
MeasurementArea
.
cc
\
src
/
RouteMissionItem
/
geometry
/
SafeArea
.
cc
\
src
/
Vehicle
/
VehicleEscStatusFactGroup
.
cc
\
src
/
RouteMissionItem
/
AreaData
.
cc
\
src
/
api
/
QGCCorePlugin
.
cc
\
...
...
@@ -554,12 +557,6 @@ SOURCES += \
src
/
comm
/
ros_bridge
/
include
/
server
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
topic_publisher
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
topic_subscriber
.
cpp
\
src
/
RouteMissionItem
/
geometry
/
WimaArea
.
cc
\
src
/
RouteMissionItem
/
geometry
/
WimaServiceArea
.
cc
\
src
/
RouteMissionItem
/
geometry
/
WimaMeasurementArea
.
cc
\
src
/
RouteMissionItem
/
geometry
/
PlanimetryCalculus
.
cc
\
src
/
RouteMissionItem
/
OptimisationTools
.
cc
\
src
/
RouteMissionItem
/
geometry
/
PolygonCalculus
.
cc
\
src
/
Settings
/
WimaSettings
.
cc
\
src
/
comm
/
ros_bridge
/
src
/
ros_bridge
.
cpp
...
...
qgroundcontrol.qrc
View file @
dd135422
...
...
@@ -261,7 +261,6 @@
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file>
<file alias="RadioComponent.qml">src/AutoPilotPlugins/Common/RadioComponent.qml</file>
<file alias="SerialSettings.qml">src/ui/preferences/SerialSettings.qml</file>
<file alias="Wima/WimaAreaNoVisual.qml">src/Wima/Snake/WimaAreaNoVisual.qml</file>
<file alias="CircularGeneratorEditor.qml">src/WimaView/CircularGeneratorEditor.qml</file>
<file alias="QGroundControl/Controls/CircularGeneratorMapVisual.qml">src/WimaView/CircularGeneratorMapVisual.qml</file>
<file alias="CircularSurveyItemEditor.qml">src/WimaView/CircularSurveyItemEditor.qml</file>
...
...
@@ -273,21 +272,14 @@
<file alias="Wima/ProgressIndicator.qml">src/WimaView/ProgressIndicator.qml</file>
<file alias="Wima/qmldir">src/WimaView/Wima.qmldir</file>
<file alias="Wima/WimaAreaMapVisual.qml">src/WimaView/WimaAreaMapVisual.qml</file>
<file alias="Wima/WimaCorridorDataVisual.qml">src/WimaView/WimaCorridorDataVisual.qml</file>
<file alias="Wima/WimaCorridorEditor.qml">src/WimaView/WimaCorridorEditor.qml</file>
<file alias="Wima/WimaCorridorMapVisual.qml">src/WimaView/WimaCorridorMapVisual.qml</file>
<file alias="Wima/WimaItemEditor.qml">src/WimaView/WimaItemEditor.qml</file>
<file alias="Wima/WimaJoinedAreaDataVisual.qml">src/WimaView/WimaJoinedAreaDataVisual.qml</file>
<file alias="Wima/WimaJoinedAreaMapVisual.qml">src/WimaView/WimaJoinedAreaMapVisual.qml</file>
<file alias="Wima/WimaMapPolygonVisuals.qml">src/WimaView/WimaMapPolygonVisuals.qml</file>
<file alias="Wima/WimaMapPolylineVisuals.qml">src/WimaView/WimaMapPolylineVisuals.qml</file>
<file alias="Wima/WimaMapVisual.qml">src/WimaView/WimaMapVisual.qml</file>
<file alias="Wima/WimaMeasurementAreaDataVisual.qml">src/WimaView/WimaMeasurementAreaDataVisual.qml</file>
<file alias="Wima/WimaMeasurementAreaEditor.qml">src/WimaView/WimaMeasurementAreaEditor.qml</file>
<file alias="Wima/WimaMeasurementAreaMapVisual.qml">src/WimaView/WimaMeasurementAreaMapVisual.qml</file>
<file alias="Wima/WimaServiceAreaDataVisual.qml">src/WimaView/WimaServiceAreaDataVisual.qml</file>
<file alias="Wima/WimaServiceAreaEditor.qml">src/WimaView/WimaServiceAreaEditor.qml</file>
<file alias="Wima/WimaServiceAreaMapVisual.qml">src/WimaView/WimaServiceAreaMapVisual.qml</file>
<file alias="Wima/WimaMeasurementAreaEditor.qml">src/WimaView/MeasurementAreaEditor.qml</file>
<file alias="Wima/WimaMeasurementAreaMapVisual.qml">src/WimaView/MeasurementAreaMapVisual.qml</file>
<file alias="Wima/WimaServiceAreaEditor.qml">src/WimaView/SafeAreaEditor.qml</file>
<file alias="Wima/WimaServiceAreaMapVisual.qml">src/WimaView/SafeAreaMapVisual.qml</file>
<file alias="Wima/WimaToolBar.qml">src/WimaView/WimaToolBar.qml</file>
<file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
...
...
@@ -360,9 +352,9 @@
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
<file alias="VTOLLandingPattern.FactMetaData.json">src/MissionManager/VTOLLandingPattern.FactMetaData.json</file>
<file alias="Wima.SettingsGroup.json">src/Settings/Wima.SettingsGroup.json</file>
<file alias="
CircularSurvey.SettingsGroup.json">src/Wima/json/CircularSurvey
.SettingsGroup.json</file>
<file alias="LinearGenerator.SettingsGroup.json">src/
Wima/Snake
/json/LinearGenerator.SettingsGroup.json</file>
<file alias="CircularGenerator.SettingsGroup.json">src/
Wima/Snake
/json/CircularGenerator.SettingsGroup.json</file>
<file alias="
RouteComplexItem.SettingsGroup.json">src/RouteMissionItem/json/RouteComplexItem
.SettingsGroup.json</file>
<file alias="LinearGenerator.SettingsGroup.json">src/
RouteMissionItem
/json/LinearGenerator.SettingsGroup.json</file>
<file alias="CircularGenerator.SettingsGroup.json">src/
RouteMissionItem
/json/CircularGenerator.SettingsGroup.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduSubMockLink.params">src/comm/APMArduSubMockLink.params</file>
...
...
src/MissionManager/MissionController.cc
View file @
dd135422
This diff is collapsed.
Click to expand it.
src/MissionManager/MissionItem.h
View file @
dd135422
...
...
@@ -26,7 +26,7 @@
#include "QmlObjectListModel.h"
class
SurveyComplexItem
;
class
CircularSurvey
;
class
RouteComplexItem
;
class
SimpleMissionItem
;
class
MissionController
;
#ifdef UNITTEST_BUILD
...
...
@@ -153,7 +153,7 @@ private:
static
const
char
*
_jsonParam4Key
;
friend
class
SurveyComplexItem
;
friend
class
CircularSurvey
;
friend
class
RouteComplexItem
;
friend
class
SimpleMissionItem
;
friend
class
MissionController
;
#ifdef UNITTEST_BUILD
...
...
src/QGCApplication.cc
View file @
dd135422
This diff is collapsed.
Click to expand it.
src/RouteMissionItem/AreaData.cc
View file @
dd135422
#include "
WimaPlan
Data.h"
#include "
Area
Data.h"
AreaData
::
AreaData
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
#include "geometry/MeasurementArea.h"
#include "geometry/SafeArea.h"
AreaData
::
AreaData
(
const
AreaData
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
#include "QGCLoggingCategory.h"
#include "QGCQGeoCoordinate.h"
AreaData
&
AreaData
::
operator
=
(
const
AreaData
&
other
)
{
this
->
append
(
other
.
measurementArea
());
this
->
append
(
other
.
serviceArea
());
this
->
append
(
other
.
joinedArea
());
this
->
append
(
other
.
corridor
());
QGC_LOGGING_CATEGORY
(
AreaDataLog
,
"AreaDataLog"
)
return
*
this
;
}
AreaData
::
AreaData
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
void
AreaData
::
append
(
const
WimaJoinedAreaData
&
areaData
)
{
if
(
_joinedArea
!=
areaData
)
{
_joinedArea
=
areaData
;
emit
joinedAreaChanged
();
}
}
AreaData
::~
AreaData
()
{}
void
AreaData
::
append
(
const
WimaServiceAreaData
&
areaData
)
{
if
(
_serviceArea
!=
areaData
)
{
_serviceArea
=
areaData
;
emit
serviceAreaChanged
();
AreaData
::
AreaData
(
const
AreaData
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
if
(
!
copyAreaList
(
other
.
_areaList
,
_areaList
,
this
))
{
qCWarning
(
AreaDataLog
)
<<
"AreaData(): not able to copy other._areaList"
;
}
else
{
_origin
=
other
.
_origin
;
}
}
void
AreaData
::
append
(
const
WimaCorridorData
&
areaData
)
{
if
(
_corridor
!=
areaData
)
{
_corridor
=
areaData
;
emit
corridorChanged
();
AreaData
&
AreaData
::
operator
=
(
const
AreaData
&
other
)
{
if
(
!
copyAreaList
(
other
.
_areaList
,
_areaList
,
this
))
{
qCWarning
(
AreaDataLog
)
<<
"operator=(): not able to copy other._areaList"
;
}
else
{
_origin
=
other
.
_origin
;
}
return
*
this
;
}
void
AreaData
::
append
(
const
WimaMeasurementAreaData
&
areaData
)
{
if
(
_measurementArea
!=
areaData
)
{
_measurementArea
=
areaData
;
emit
measurementAreaChanged
();
if
(
_measurementArea
.
coordinateList
().
size
()
>
0
)
{
setOrigin
(
_measurementArea
.
coordinateList
().
first
());
}
else
{
setOrigin
(
QGeoCoordinate
());
bool
AreaData
::
insert
(
GeoArea
*
areaData
)
{
{
SafeArea
*
area
=
qobject_cast
<
SafeArea
*>
(
areaData
);
if
(
area
!=
nullptr
)
{
if
(
Q_LIKELY
(
!
this
->
_areaList
.
contains
(
area
)))
{
_areaList
.
append
(
area
);
emit
areaList
();
return
true
;
}
else
{
return
false
;
}
}
}
}
void
AreaData
::
append
(
const
WimaJoinedArea
&
areaData
)
{
if
(
_joinedArea
!=
areaData
)
{
_joinedArea
=
areaData
;
emit
joinedAreaChanged
();
{
MeasurementArea
*
area
=
qobject_cast
<
MeasurementArea
*>
(
areaData
);
if
(
area
!=
nullptr
)
{
if
(
Q_LIKELY
(
!
this
->
_areaList
.
contains
(
area
)))
{
_areaList
.
append
(
area
);
emit
areaList
();
return
true
;
}
else
{
return
false
;
}
}
}
}
void
AreaData
::
append
(
const
WimaArea
&
areaData
)
{
if
(
_serviceArea
!=
areaData
)
{
_serviceArea
=
areaData
;
emit
serviceAreaChanged
();
}
return
false
;
}
void
AreaData
::
append
(
const
WimaCorridor
&
areaData
)
{
if
(
_corridor
!=
areaData
)
{
_corridor
=
areaData
;
emit
corridorChanged
();
}
}
void
AreaData
::
remove
(
GeoArea
*
areaData
)
{
int
index
=
_areaList
.
indexOf
(
areaData
);
if
(
index
>=
0
)
{
QObject
*
obj
=
_areaList
.
removeAt
(
index
);
void
AreaData
::
append
(
const
WimaMeasurementArea
&
areaData
)
{
if
(
_measurementArea
!=
areaData
)
{
_measurementArea
=
areaData
;
emit
measurementAreaChanged
();
_setOrigin
(
_newOrigin
());
if
(
_measurementArea
.
coordinateList
().
size
()
>
0
)
{
setOrigin
(
_measurementArea
.
coordinateList
().
first
());
}
else
{
setOrigin
(
QGeoCoordinate
());
if
(
obj
->
parent
()
==
nullptr
)
{
obj
->
deleteLater
();
}
}
}
void
AreaData
::
clear
()
{
*
this
=
AreaData
();
}
const
QGeoCoordinate
&
AreaData
::
origin
()
const
{
return
_origin
;
}
bool
AreaData
::
isValid
()
{
return
_measurementArea
.
coordinateList
().
size
()
>=
3
&&
_serviceArea
.
coordinateList
().
size
()
>=
3
&&
_origin
.
isValid
();
emit
areaListChanged
();
}
}
const
WimaJoinedAreaData
&
AreaData
::
joinedArea
()
const
{
return
this
->
_joinedArea
;
void
AreaData
::
clear
()
{
if
(
_areaList
.
count
()
>
0
)
{
for
(
int
i
=
0
;
i
<
_areaList
.
count
();
++
i
)
{
remove
(
_areaList
.
value
<
GeoArea
*>
(
i
));
}
emit
areaListChanged
();
}
}
const
WimaServiceAreaData
&
AreaData
::
serviceArea
()
const
{
return
this
->
_serviceArea
;
}
QmlObjectListModel
*
AreaData
::
areaList
()
{
return
&
_areaList
;
}
const
WimaCorridorData
&
AreaData
::
corridor
()
const
{
return
this
->
_corridor
;
}
const
QmlObjectListModel
*
AreaData
::
areaList
()
const
{
return
&
_areaList
;
}
const
WimaMeasurementAreaData
&
AreaData
::
measurementArea
()
const
{
return
this
->
_measurementArea
;
}
const
QGeoCoordinate
&
AreaData
::
origin
()
const
{
return
_origin
;
}
WimaJoinedAreaData
&
AreaData
::
joinedArea
()
{
return
this
->
_joinedArea
;
}
bool
AreaData
::
isValid
()
const
{
qWarning
(
"AreaData::isValid(): impl. incomplete."
);
auto
*
measurementArea
=
getGeoArea
<
const
MeasurementArea
*>
(
_areaList
);
auto
*
safeArea
=
getGeoArea
<
const
SafeArea
*>
(
_areaList
);
return
measurementArea
!=
nullptr
&&
safeArea
!=
nullptr
&&
measurementArea
->
count
()
>=
3
&&
safeArea
->
count
()
>=
3
&&
_origin
.
isValid
();
}
bool
AreaData
::
tryMakeValid
()
{
qWarning
(
"AreaData::tryMakeValid(): impl. missing."
);
return
true
;
}
bool
AreaData
::
initialize
(
const
QGeoCoordinate
&
bottomLeft
,
const
QGeoCoordinate
&
topRight
)
{
// bottomLeft and topRight define the bounding box.
if
(
bottomLeft
.
isValid
()
&&
topRight
.
isValid
()
&&
bottomLeft
!=
topRight
)
{
auto
*
measurementArea
=
getGeoArea
<
MeasurementArea
*>
(
_areaList
);
auto
*
safeArea
=
getGeoArea
<
SafeArea
*>
(
_areaList
);
if
(
safeArea
==
nullptr
)
{
if
(
!
insert
(
new
SafeArea
()))
{
qCCritical
(
AreaDataLog
)
<<
"initialize(): safeArea == nullptr, but insert() failed."
;
return
false
;
}
}
WimaServiceAreaData
&
AreaData
::
serviceArea
()
{
return
this
->
_serviceArea
;
}
if
(
measurementArea
==
nullptr
)
{
if
(
!
insert
(
new
MeasurementArea
()))
{
qCCritical
(
AreaDataLog
)
<<
"initialize(): measurementArea == nullptr, "
"but insert() failed."
;
return
false
;
}
}
WimaCorridorData
&
AreaData
::
corridor
()
{
return
this
->
_corridor
;
}
// Fit safe area to bounding box.
safeArea
->
clear
();
safeArea
->
appendVertex
(
bottomLeft
);
safeArea
->
appendVertex
(
QGeoCoordinate
(
topRight
.
latitude
(),
bottomLeft
.
longitude
()));
safeArea
->
appendVertex
(
topRight
);
safeArea
->
appendVertex
(
QGeoCoordinate
(
bottomLeft
.
latitude
(),
topRight
.
longitude
()));
// Put measurement area inside safeArea;
measurementArea
->
clear
();
measurementArea
->
appendVertex
(
QGeoCoordinate
(
0.8
*
bottomLeft
.
latitude
()
+
0.2
*
topRight
.
latitude
(),
0.8
*
bottomLeft
.
longitude
()
+
0.2
*
topRight
.
longitude
()));
measurementArea
->
appendVertex
(
QGeoCoordinate
(
0.2
*
bottomLeft
.
latitude
()
+
0.8
*
topRight
.
latitude
(),
0.8
*
bottomLeft
.
longitude
()
+
0.2
*
topRight
.
longitude
()));
measurementArea
->
appendVertex
(
QGeoCoordinate
(
0.2
*
bottomLeft
.
latitude
()
+
0.8
*
topRight
.
latitude
(),
0.2
*
bottomLeft
.
longitude
()
+
0.8
*
topRight
.
longitude
()));
measurementArea
->
appendVertex
(
QGeoCoordinate
(
0.8
*
bottomLeft
.
latitude
()
+
0.2
*
topRight
.
latitude
(),
0.2
*
bottomLeft
.
longitude
()
+
0.8
*
topRight
.
longitude
()));
return
true
;
}
else
{
qCWarning
(
AreaDataLog
)
<<
"initialize(): bounding box invaldid (bottomLeft, topRight) "
<<
bottomLeft
<<
","
<<
topRight
;
return
false
;
}
}
WimaMeasurementAreaData
&
AreaData
::
measurementArea
()
{
return
this
->
_measurementArea
;
bool
AreaData
::
initialized
()
{
auto
*
measurementArea
=
getGeoArea
<
MeasurementArea
*>
(
_areaList
);
auto
*
safeArea
=
getGeoArea
<
SafeArea
*>
(
_areaList
);
return
measurementArea
!=
nullptr
&&
safeArea
!=
nullptr
&&
measurementArea
->
count
()
>=
3
&&
safeArea
->
count
()
>=
3
;
}
bool
AreaData
::
operator
==
(
const
AreaData
&
other
)
const
{
return
this
->
_joinedArea
==
other
.
_joinedArea
&&
this
->
_measurementArea
==
other
.
_measurementArea
&&
this
->
_corridor
==
other
.
_corridor
&&
this
->
_serviceArea
==
other
.
_serviceArea
;
if
(
_areaList
.
count
()
==
other
.
_areaList
.
count
())
{
for
(
int
i
=
0
;
i
<
_areaList
.
count
();
++
i
)
{
if
(
_areaList
[
i
]
!=
other
.
_areaList
[
i
])
{
return
false
;
}
}
return
true
;
}
else
{
return
false
;
}
}
bool
AreaData
::
operator
!=
(
const
AreaData
&
other
)
const
{
return
!
(
*
this
==
other
);
}
void
AreaData
::
setOrigin
(
const
QGeoCoordinate
&
origin
)
{
void
AreaData
::
_
setOrigin
(
const
QGeoCoordinate
&
origin
)
{
if
(
this
->
_origin
!=
origin
)
{
this
->
_origin
=
origin
;
emit
originChanged
();
}
}
QGeoCoordinate
AreaData
::
_newOrigin
()
{
auto
*
measurementArea
=
getGeoArea
<
MeasurementArea
*>
(
_areaList
);
auto
*
safeArea
=
getGeoArea
<
SafeArea
*>
(
_areaList
);
if
(
measurementArea
!=
nullptr
&&
measurementArea
->
pathModel
().
count
()
>
0
)
{
QGCQGeoCoordinate
*
ori
=
measurementArea
->
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
0
);
if
(
ori
!=
nullptr
&&
ori
->
coordinate
().
isValid
())
{
return
ori
->
coordinate
();
}
}
if
(
safeArea
!=
nullptr
&&
safeArea
->
pathModel
().
count
()
>
0
)
{
QGCQGeoCoordinate
*
ori
=
measurementArea
->
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
0
);
if
(
ori
!=
nullptr
&&
ori
->
coordinate
().
isValid
())
{
return
ori
->
coordinate
();
}
}
return
QGeoCoordinate
();
}
src/RouteMissionItem/AreaData.h
0 → 100644
View file @
dd135422
#pragma once
#include <QGeoCoordinate>
#include <QObject>
#include "QmlObjectListModel.h"
class
GeoArea
;
class
SafeArea
;
class
MeasurementArea
;
class
AreaData
:
public
QObject
{
Q_OBJECT
public:
AreaData
(
QObject
*
parent
=
nullptr
);
~
AreaData
();
AreaData
(
const
AreaData
&
other
,
QObject
*
parent
=
nullptr
);
AreaData
&
operator
=
(
const
AreaData
&
other
);
// Member Methodes
//!
//! \brief insert Inserts the area if areaList does not contain it.
//! \param areaData
bool
insert
(
GeoArea
*
areaData
);
//!
//! \brief remove
//! \param areaData Removes the area.
//! \note Deletes the area if it has no parent.
void
remove
(
GeoArea
*
areaData
);
void
clear
();
//!
//! \brief areaList
//! \return Returns the list of areas.
//! \note For Qml use only, don't alter the list, or risk to break invariants.
QmlObjectListModel
*
areaList
();
//!
//! \brief areaList
//! \return Returns the list of areas.
const
QmlObjectListModel
*
areaList
()
const
;
//!
//! \brief origin
//! \return Returns an origin near one of the areas.
//! \note Origin might change if the list of areas changes.
const
QGeoCoordinate
&
origin
()
const
;
Q_INVOKABLE
bool
isValid
()
const
;
Q_INVOKABLE
bool
tryMakeValid
();
//!
//! \brief initialize Initializes the areas in a valid way, such that they
//! area inside the bounding box. \param bottomLeft bottom left corner of the
//! bounding box. \param topRight top right corner of the bounding box. \note
//! Behavior is undefined, if \p bottomLeft and \p topRight are not the bottom
//! left and the top right corner of the bounding box. \return Returns true on
//! succes, false either.
//!
Q_INVOKABLE
bool
initialize
(
const
QGeoCoordinate
&
bottomLeft
,
const
QGeoCoordinate
&
topRight
);
//!
//! \brief initialized Checks if area data is initialized
//! \return Returns true if area list contains a SafeArea and a
//! MeasurementArea and both areas have atleast three vertices, returns false
//! either.
//!
Q_INVOKABLE
bool
initialized
();
bool
operator
==
(
const
AreaData
&
other
)
const
;
bool
operator
!=
(
const
AreaData
&
other
)
const
;
signals:
void
areaListChanged
();
void
originChanged
();
private:
void
_setOrigin
(
const
QGeoCoordinate
&
origin
);
QGeoCoordinate
_newOrigin
();
QGeoCoordinate
_origin
;
QmlObjectListModel
_areaList
;
};
src/RouteMissionItem/CircularGenerator.cpp
View file @
dd135422
#include "CircularGenerator.h"
#include "QGCLoggingCategory.h"
QGC_LOGGING_CATEGORY
(
CircularGeneratorLog
,
"CircularGeneratorLog"
)
#include "SettingsFact.h"
#define CLIPPER_SCALE 1000000
#include "Wima/Geometry/GenericCircle.h"
#include "clipper/clipper.hpp"
#include "RoutingThread.h"
#include "geometry/GenericCircle.h"
#include "geometry/MeasurementArea.h"
#include "geometry/SafeArea.h"
#include "geometry/clipper/clipper.hpp"
#include "nemo_interface/SnakeTile.h"
QGC_LOGGING_CATEGORY
(
CircularGeneratorLog
,
"CircularGeneratorLog"
)
using
namespace
ClipperLib
;
template
<>
inline
auto
get
<
0
>
(
const
IntPoint
&
p
)
{
return
p
.
X
;
}
template
<>
inline
auto
get
<
1
>
(
const
IntPoint
&
p
)
{
return
p
.
Y
;
}
#include "SnakeTile.h"
#include "Wima/RoutingThread.h"
namespace
routing
{
bool
circularTransects
(
const
snake
::
FPoint
&
reference
,
...
...
@@ -77,7 +80,13 @@ bool CircularGenerator::get(Generator &generator) {
snake
::
FPoint
reference
;
snake
::
toENU
(
origin
,
ref
,
reference
);
auto
geoPolygon
=
this
->
_d
->
measurementArea
().
coordinateList
();
auto
measurementArea
=
getGeoArea
<
const
MeasurementArea
*>
(
*
this
->
_d
->
areaList
());
if
(
measurementArea
==
nullptr
)
{
qCDebug
(
CircularGeneratorLog
)
<<
"get(): measurement area == nullptr"
;
return
false
;
}
auto
geoPolygon
=
measurementArea
->
coordinateList
();
for
(
auto
&
v
:
geoPolygon
)
{
if
(
v
.
isValid
())
{
v
.
setAltitude
(
0
);
...
...
@@ -93,8 +102,8 @@ bool CircularGenerator::get(Generator &generator) {
snake
::
areaToEnu
(
origin
,
geoPolygon
,
*
pPolygon
);
// Progress and tiles.
const
auto
&
progress
=
this
->
_d
->
measurementArea
().
progress
();
const
auto
*
tiles
=
this
->
_d
->
measurementArea
().
tiles
();
const
auto
&
progress
=
measurementArea
->
progress
();
const
auto
*
tiles
=
measurementArea
->
tiles
();
auto
pTiles
=
std
::
make_shared
<
std
::
vector
<
snake
::
FPolygon
>>
();
if
(
progress
.
size
()
==
tiles
->
count
())
{
for
(
int
i
=
0
;
i
<
tiles
->
count
();
++
i
)
{
...
...
@@ -119,7 +128,12 @@ bool CircularGenerator::get(Generator &generator) {
return
false
;
}
auto
geoDepot
=
this
->
_d
->
serviceArea
().
depot
();
auto
serviceArea
=
getGeoArea
<
const
SafeArea
*>
(
*
this
->
_d
->
areaList
());
if
(
measurementArea
==
nullptr
)
{
qCDebug
(
CircularGeneratorLog
)
<<
"get(): measurement area == nullptr"
;
return
false
;
}
auto
geoDepot
=
serviceArea
->
depot
();
if
(
!
geoDepot
.
isValid
())
{
qCDebug
(
CircularGeneratorLog
)
<<
"get(): depot invalid."
<<
geoDepot
;
return
false
;
...
...
@@ -169,73 +183,85 @@ void CircularGenerator::resetReferenceIfInvalid() {
}
void
CircularGenerator
::
resetReference
()
{
if
(
this
->
_d
->
measurementArea
().
center
().
isValid
())
{
setReference
(
this
->
_d
->
measurementArea
().
center
());
auto
measurementArea
=
getGeoArea
<
const
MeasurementArea
*>
(
*
this
->
_d
->
areaList
());
if
(
measurementArea
!=
nullptr
)
{
if
(
measurementArea
->
center
().
isValid
())
{
setReference
(
measurementArea
->
center
());
}
else
{
qCWarning
(
CircularGeneratorLog
)
<<
"measurement area center"
<<
measurementArea
->
center
();
}
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"
measurement area center"
<<
this
->
_d
->
measurementArea
().
center
()
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"
resetReference(): measurement area == nullptr"
;
}
}
void
CircularGenerator
::
establishConnections
()
{
if
(
this
->
_d
&&
!
this
->
_connectionsEstablished
)
{
connect
(
this
->
_d
.
get
(),
&
AreaData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
centerChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
deltaAlpha
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
minLength
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
,
&
CircularGenerator
::
referenceChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
this
->
_connectionsEstablished
=
true
;
auto
measurementArea
=
getGeoArea
<
const
MeasurementArea
*>
(
*
this
->
_d
->
areaList
());
auto
serviceArea
=
getGeoArea
<
const
SafeArea
*>
(
*
this
->
_d
->
areaList
());
if
(
measurementArea
!=
nullptr
&&
serviceArea
!=
nullptr
)
{
GeneratorBase
::
establishConnections
();
connect
(
this
->
_d
,
&
AreaData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
measurementArea
,
&
MeasurementArea
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
measurementArea
,
&
MeasurementArea
::
tilesChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
measurementArea
,
&
MeasurementArea
::
centerChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
connect
(
measurementArea
,
&
MeasurementArea
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
serviceArea
,
&
SafeArea
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
deltaAlpha
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
minLength
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
,
&
CircularGenerator
::
referenceChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
this
->
_connectionsEstablished
=
true
;
}
}
}
void
CircularGenerator
::
deleteConnections
()
{
if
(
this
->
_d
&&
this
->
_connectionsEstablished
)
{
disconnect
(
this
->
_d
.
get
(),
&
AreaData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
center
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
deltaAlpha
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
minLength
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
,
&
CircularGenerator
::
referenceChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
this
->
_connectionsEstablished
=
false
;
auto
measurementArea
=