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
9d2ac99e
Commit
9d2ac99e
authored
Oct 21, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generators working, wima planer still issues
parent
67cbe3f7
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
490 additions
and
421 deletions
+490
-421
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-2
MissionLineView.qml
src/FlightMap/MapItems/MissionLineView.qml
+4
-0
MissionItemMapVisual.qml
src/PlanView/MissionItemMapVisual.qml
+1
-1
CircularSurvey.cc
src/Wima/CircularSurvey.cc
+67
-65
CircularSurvey.h
src/Wima/CircularSurvey.h
+3
-7
WimaAreaData.cc
src/Wima/Geometry/WimaAreaData.cc
+53
-28
WimaAreaData.h
src/Wima/Geometry/WimaAreaData.h
+15
-16
WimaCorridorData.cpp
src/Wima/Geometry/WimaCorridorData.cpp
+4
-18
WimaCorridorData.h
src/Wima/Geometry/WimaCorridorData.h
+0
-10
WimaJoinedAreaData.cc
src/Wima/Geometry/WimaJoinedAreaData.cc
+4
-17
WimaJoinedAreaData.h
src/Wima/Geometry/WimaJoinedAreaData.h
+0
-6
WimaMeasurementAreaData.cc
src/Wima/Geometry/WimaMeasurementAreaData.cc
+14
-19
WimaMeasurementAreaData.h
src/Wima/Geometry/WimaMeasurementAreaData.h
+0
-4
WimaServiceAreaData.cc
src/Wima/Geometry/WimaServiceAreaData.cc
+4
-18
WimaServiceAreaData.h
src/Wima/Geometry/WimaServiceAreaData.h
+0
-4
RoutingThread.cpp
src/Wima/RoutingThread.cpp
+16
-16
CircularGenerator.cpp
src/Wima/Snake/CircularGenerator.cpp
+48
-37
CircularGenerator.h
src/Wima/Snake/CircularGenerator.h
+4
-1
GeneratorBase.cc
src/Wima/Snake/GeneratorBase.cc
+2
-6
LinearGenerator.cpp
src/Wima/Snake/LinearGenerator.cpp
+19
-17
NemoInterface.cpp
src/Wima/Snake/NemoInterface.cpp
+42
-24
SnakeTile.cpp
src/Wima/Snake/SnakeTile.cpp
+1
-3
CircularGeneratorEditor.qml
src/WimaView/CircularGeneratorEditor.qml
+1
-2
CircularGeneratorMapVisual.qml
src/WimaView/CircularGeneratorMapVisual.qml
+40
-22
CircularSurveyItemEditor.qml
src/WimaView/CircularSurveyItemEditor.qml
+40
-26
CircularSurveyMapVisual.qml
src/WimaView/CircularSurveyMapVisual.qml
+92
-47
LinearGeneratorEditor.qml
src/WimaView/LinearGeneratorEditor.qml
+14
-5
No files found.
qgroundcontrol.qrc
View file @
9d2ac99e
...
...
@@ -195,9 +195,9 @@
<file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="Wima/WimaAreaNoVisual.qml">src/Wima/Snake/WimaAreaNoVisual.qml</file>
<file alias="CircularGeneratorEditor.qml">src/WimaView/CircularGeneratorEditor.qml</file>
<file alias="
Wima
/CircularGeneratorMapVisual.qml">src/WimaView/CircularGeneratorMapVisual.qml</file>
<file alias="
QGroundControl/Controls
/CircularGeneratorMapVisual.qml">src/WimaView/CircularGeneratorMapVisual.qml</file>
<file alias="CircularSurveyItemEditor.qml">src/WimaView/CircularSurveyItemEditor.qml</file>
<file alias="
Wima
/CircularSurveyMapVisual.qml">src/WimaView/CircularSurveyMapVisual.qml</file>
<file alias="
QGroundControl/Controls
/CircularSurveyMapVisual.qml">src/WimaView/CircularSurveyMapVisual.qml</file>
<file alias="Wima/CoordinateIndicator.qml">src/WimaView/CoordinateIndicator.qml</file>
<file alias="Wima/CoordinateIndicatorDrag.qml">src/WimaView/CoordinateIndicatorDrag.qml</file>
<file alias="Wima/DragCoordinate.qml">src/WimaView/DragCoordinate.qml</file>
...
...
src/FlightMap/MapItems/MissionLineView.qml
View file @
9d2ac99e
...
...
@@ -30,5 +30,9 @@ MapItemView {
object
.
coordinate1
,
object
.
coordinate2
,
]
:
[]
// onParentChanged: {
// console.log("MapItemView, path:" + path)
// }
}
}
src/PlanView/MissionItemMapVisual.qml
View file @
9d2ac99e
...
...
@@ -15,7 +15,7 @@ import QtPositioning 5.3
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
Wima
1.0
/// Mission item map visual
Item
{
...
...
src/Wima/CircularSurvey.cc
View file @
9d2ac99e
This diff is collapsed.
Click to expand it.
src/Wima/CircularSurvey.h
View file @
9d2ac99e
...
...
@@ -104,7 +104,6 @@ private slots:
void
_updateWorker
();
void
_changeVariantWorker
();
void
_reverseWorker
();
void
_storeWorker
();
private:
void
_appendLoadedMissionItems
(
QList
<
MissionItem
*>
&
items
,
...
...
@@ -117,7 +116,7 @@ private:
// State.
enum
class
STATE
{
IDLE
,
S
TORE
,
S
KIPP
,
REVERSE
,
VARIANT_CHANGE
,
RUN_CHANGE
,
...
...
@@ -137,11 +136,8 @@ private:
QStringList
_generatorNameList
;
PtrGenerator
_pGenerator
;
// Worker
PtrWorker
_pWorker
;
PtrRoutingData
_pRoutingData
;
// remove this, not necessary.
// Routing data.
// Routing.
using
Variant
=
Transects
;
QVector
<
Variant
>
_variantVector
;
PtrWorker
_pWorker
;
};
src/Wima/Geometry/WimaAreaData.cc
View file @
9d2ac99e
...
...
@@ -2,7 +2,14 @@
WimaAreaData
::
WimaAreaData
(
QObject
*
parent
)
:
QObject
(
parent
)
{}
WimaAreaData
::~
WimaAreaData
()
{}
WimaAreaData
::
WimaAreaData
(
const
WimaAreaData
&
other
,
QObject
*
parent
)
:
QObject
(
parent
),
_path
(
other
.
_path
),
_list
(
other
.
_list
),
_center
(
other
.
_center
)
{}
WimaAreaData
::
WimaAreaData
(
const
WimaArea
&
otherData
,
QObject
*
parent
)
:
QObject
(
parent
),
_center
(
otherData
.
center
())
{
_setPathImpl
(
otherData
.
path
());
}
bool
WimaAreaData
::
operator
==
(
const
WimaAreaData
&
data
)
const
{
return
this
->
_path
==
data
.
_path
&&
this
->
_center
==
data
.
_center
;
...
...
@@ -25,7 +32,7 @@ bool WimaAreaData::containsCoordinate(const QGeoCoordinate &coordinate) const {
using
namespace
PolygonCalculus
;
using
namespace
GeoUtilities
;
if
(
_path
.
size
()
>
2
)
{
if
(
this
->
coordinateList
()
.
size
()
>
2
)
{
QPolygonF
polygon
;
toCartesianList
(
this
->
coordinateList
(),
coordinate
,
polygon
);
return
PlanimetryCalculus
::
contains
(
polygon
,
QPointF
(
0
,
0
));
...
...
@@ -36,44 +43,60 @@ bool WimaAreaData::containsCoordinate(const QGeoCoordinate &coordinate) const {
void
WimaAreaData
::
append
(
const
QGeoCoordinate
&
c
)
{
_list
.
append
(
c
);
_path
.
push_back
(
QVariant
::
fromValue
(
c
));
emit
pathChanged
();
}
void
WimaAreaData
::
push_back
(
const
QGeoCoordinate
&
c
)
{
append
(
c
);
}
void
WimaAreaData
::
clear
()
{
_list
.
clear
();
_path
.
clear
();
if
(
_list
.
size
()
>
0
||
_path
.
size
()
>
0
)
{
_list
.
clear
();
_path
.
clear
();
emit
pathChanged
();
}
}
void
WimaAreaData
::
setPath
(
const
QVariantList
&
coordinateList
)
{
_path
=
coordinateList
;
_list
.
clear
();
for
(
auto
variant
:
coordinateList
)
{
_list
.
push_back
(
variant
.
value
<
QGeoCoordinate
>
());
if
(
_path
!=
coordinateList
)
{
_setPathImpl
(
coordinateList
);
emit
pathChanged
();
}
}
void
WimaAreaData
::
setCenter
(
const
QGeoCoordinate
&
center
)
{
if
(
_center
!=
center
)
{
_center
=
center
;
emit
centerChanged
();
}
}
/*!
* \fn void WimaAreaData::assign(const WimaAreaData &other)
*
* Assigns \a other to the invoking object
*/
void
WimaAreaData
::
assign
(
const
WimaAreaData
&
other
)
{
setPath
(
other
.
path
());
setCenter
(
other
.
center
());
WimaAreaData
&
WimaAreaData
::
operator
=
(
const
WimaAreaData
&
otherData
)
{
setPath
(
otherData
.
_list
);
setCenter
(
otherData
.
_center
);
return
*
this
;
}
void
WimaAreaData
::
assign
(
const
WimaArea
&
other
)
{
setPath
(
other
.
path
());
setCenter
(
other
.
center
());
WimaAreaData
&
WimaAreaData
::
operator
=
(
const
WimaArea
&
otherData
)
{
setPath
(
otherData
.
path
());
setCenter
(
otherData
.
center
());
return
*
this
;
}
void
WimaAreaData
::
_setPathImpl
(
const
QList
<
QGeoCoordinate
>
&
coordinateList
)
{
_list
=
coordinateList
;
_path
.
clear
();
// copy all coordinates to _path
for
(
const
auto
&
vertex
:
coordinateList
)
{
_path
.
append
(
QVariant
::
fromValue
(
vertex
));
}
}
void
WimaAreaData
::
_setPathImpl
(
const
QVariantList
&
coordinateList
)
{
_path
=
coordinateList
;
_list
.
clear
();
for
(
const
auto
&
variant
:
coordinateList
)
{
_list
.
push_back
(
variant
.
value
<
QGeoCoordinate
>
());
}
}
/*!
...
...
@@ -83,24 +106,26 @@ void WimaAreaData::assign(const WimaArea &other) {
* coordinateList. Emits the \c pathChanged() signal.
*/
void
WimaAreaData
::
setPath
(
const
QList
<
QGeoCoordinate
>
&
coordinateList
)
{
_list
=
coordinateList
;
_path
.
clear
();
// copy all coordinates to _path
for
(
int
i
=
0
;
i
<
coordinateList
.
size
();
i
++
)
{
_path
.
append
(
QVariant
::
fromValue
(
coordinateList
.
value
(
i
)));
if
(
_list
!=
coordinateList
)
{
_setPathImpl
(
coordinateList
);
emit
pathChanged
();
}
emit
pathChanged
(
_path
);
}
bool
operator
==
(
const
WimaAreaData
&
m1
,
const
WimaArea
&
m2
)
{
return
m1
.
path
()
==
m2
.
path
()
&&
m1
.
center
()
==
m2
.
center
();
}
bool
operator
!=
(
const
WimaAreaData
&
m1
,
const
WimaArea
&
m2
)
{
return
!
operator
==
(
m1
,
m2
);
}
bool
operator
==
(
const
WimaArea
&
m1
,
const
WimaAreaData
&
m2
)
{
return
m2
==
m1
;
}
bool
operator
!=
(
const
WimaArea
&
m1
,
const
WimaAreaData
&
m2
)
{
return
!
operator
==
(
m2
,
m1
);
}
/*!
* \class WimaArea::WimaAreaData
* \brief Class to store and exchange data of a \c WimaArea Object.
...
...
src/Wima/Geometry/WimaAreaData.h
View file @
9d2ac99e
#pragma once
#
pragma
once
#include <QObject>
...
...
@@ -11,16 +11,12 @@ class WimaAreaData
{
Q_OBJECT
public:
WimaAreaData
(
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
const
QVariantList
path
READ
path
NOTIFY
pathChanged
)
Q_PROPERTY
(
QString
type
READ
type
CONSTANT
)
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
WimaAreaData
(
QObject
*
parent
=
nullptr
);
~
WimaAreaData
();
WimaAreaData
(
const
WimaAreaData
&
otherData
)
=
delete
;
// avoid slicing
WimaAreaData
&
operator
=
(
const
WimaAreaData
&
otherData
)
=
delete
;
// avoid slicing
bool
operator
==
(
const
WimaAreaData
&
data
)
const
;
bool
operator
!=
(
const
WimaAreaData
&
data
)
const
;
...
...
@@ -37,8 +33,8 @@ public:
void
clear
();
signals:
void
pathChanged
(
const
QVariantList
&
coordinateList
);
void
centerChanged
(
void
);
void
pathChanged
();
void
centerChanged
();
public
slots
:
void
setPath
(
const
QList
<
QGeoCoordinate
>
&
coordinateList
);
...
...
@@ -46,18 +42,21 @@ public slots:
void
setCenter
(
const
QGeoCoordinate
&
center
);
protected:
void
assign
(
const
WimaAreaData
&
other
);
void
assign
(
const
WimaArea
&
other
);
WimaAreaData
(
const
WimaAreaData
&
otherData
,
QObject
*
parent
);
WimaAreaData
(
const
WimaArea
&
otherData
,
QObject
*
parent
);
WimaAreaData
&
operator
=
(
const
WimaAreaData
&
otherData
);
WimaAreaData
&
operator
=
(
const
WimaArea
&
otherData
);
private:
// Member Functions
void
_setPathImpl
(
const
QList
<
QGeoCoordinate
>
&
coordinateList
);
void
_setPathImpl
(
const
QVariantList
&
coordinateList
);
// Member Variables
// see WimaArea.h for explanation
QVariantList
_path
;
mutable
QList
<
QGeoCoordinate
>
_list
;
mutable
QVariantList
_path
;
QList
<
QGeoCoordinate
>
_list
;
QGeoCoordinate
_center
;
};
bool
operator
==
(
const
WimaAreaData
&
m1
,
const
WimaArea
&
m2
);
bool
operator
!=
(
const
WimaAreaData
&
m1
,
const
WimaArea
&
m2
);
bool
operator
==
(
const
WimaArea
&
m1
,
const
WimaAreaData
&
m2
);
bool
operator
!=
(
const
WimaArea
&
m1
,
const
WimaAreaData
&
m2
);
src/Wima/Geometry/WimaCorridorData.cpp
View file @
9d2ac99e
...
...
@@ -6,14 +6,10 @@ WimaCorridorData::WimaCorridorData(QObject *parent) : WimaAreaData(parent) {}
WimaCorridorData
::
WimaCorridorData
(
const
WimaCorridorData
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
)
{}
WimaCorridorData
::
WimaCorridorData
(
const
WimaCorridor
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
)
{}
/*!
* \overload operator=()
...
...
@@ -21,8 +17,7 @@ WimaCorridorData::WimaCorridorData(const WimaCorridor &other, QObject *parent)
* Assigns \a other to the invoking object.
*/
WimaCorridorData
&
WimaCorridorData
::
operator
=
(
const
WimaCorridorData
&
other
)
{
this
->
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
return
*
this
;
}
...
...
@@ -32,8 +27,7 @@ WimaCorridorData &WimaCorridorData::operator=(const WimaCorridorData &other) {
* Assigns \a other to the invoking object.
*/
WimaCorridorData
&
WimaCorridorData
::
operator
=
(
const
WimaCorridor
&
other
)
{
this
->
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
return
*
this
;
}
...
...
@@ -43,14 +37,6 @@ QString WimaCorridorData::mapVisualQML() const {
QString
WimaCorridorData
::
type
()
const
{
return
this
->
typeString
;
}
void
WimaCorridorData
::
assign
(
const
WimaCorridorData
&
corridorData
)
{
WimaAreaData
::
assign
(
corridorData
);
}
void
WimaCorridorData
::
assign
(
const
WimaCorridor
&
corridor
)
{
WimaAreaData
::
assign
(
corridor
);
}
/*!
* \class WimaAreaData::WimaCorridorData
* \brief Class to store and exchange data of a \c WimaCorridorData Object.
...
...
src/Wima/Geometry/WimaCorridorData.h
View file @
9d2ac99e
...
...
@@ -23,14 +23,4 @@ public:
WimaCorridorData
*
Clone
()
const
{
return
new
WimaCorridorData
(
*
this
);
}
static
const
char
*
typeString
;
signals:
public
slots
:
protected:
void
assign
(
const
WimaCorridorData
&
corridorData
);
void
assign
(
const
WimaCorridor
&
corridor
);
private:
};
src/Wima/Geometry/WimaJoinedAreaData.cc
View file @
9d2ac99e
...
...
@@ -7,15 +7,11 @@ WimaJoinedAreaData::WimaJoinedAreaData(QObject *parent)
WimaJoinedAreaData
::
WimaJoinedAreaData
(
const
WimaJoinedAreaData
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
)
{}
WimaJoinedAreaData
::
WimaJoinedAreaData
(
const
WimaJoinedArea
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
)
{}
/*!
* \overload operator=()
...
...
@@ -24,8 +20,7 @@ WimaJoinedAreaData::WimaJoinedAreaData(const WimaJoinedArea &other,
*/
WimaJoinedAreaData
&
WimaJoinedAreaData
::
operator
=
(
const
WimaJoinedAreaData
&
other
)
{
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
return
*
this
;
}
...
...
@@ -35,7 +30,7 @@ operator=(const WimaJoinedAreaData &other) {
* Assigns \a other to the invoking object.
*/
WimaJoinedAreaData
&
WimaJoinedAreaData
::
operator
=
(
const
WimaJoinedArea
&
other
)
{
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
return
*
this
;
}
...
...
@@ -45,14 +40,6 @@ QString WimaJoinedAreaData::mapVisualQML() const {
QString
WimaJoinedAreaData
::
type
()
const
{
return
this
->
typeString
;
}
void
WimaJoinedAreaData
::
assign
(
const
WimaJoinedAreaData
&
other
)
{
WimaAreaData
::
assign
(
other
);
}
void
WimaJoinedAreaData
::
assign
(
const
WimaJoinedArea
&
other
)
{
WimaAreaData
::
assign
(
other
);
}
/*!
* \class WimaAreaData::WimaJoinedAreaData
* \brief Class to store and exchange data of a \c WimaJoinedAreaData Object.
...
...
src/Wima/Geometry/WimaJoinedAreaData.h
View file @
9d2ac99e
...
...
@@ -24,10 +24,4 @@ public:
WimaJoinedAreaData
*
Clone
()
const
{
return
new
WimaJoinedAreaData
(
*
this
);
}
static
const
char
*
typeString
;
protected:
void
assign
(
const
WimaJoinedAreaData
&
other
);
void
assign
(
const
WimaJoinedArea
&
other
);
private:
};
src/Wima/Geometry/WimaMeasurementAreaData.cc
View file @
9d2ac99e
...
...
@@ -22,6 +22,7 @@ bool WimaMeasurementAreaData::
operator
==
(
const
WimaMeasurementAreaData
&
other
)
const
{
return
this
->
WimaAreaData
::
operator
==
(
other
)
&&
this
->
_tileData
==
other
.
tileData
()
&&
this
->
_progress
==
other
.
progress
()
&&
this
->
center
()
==
other
.
center
();
}
...
...
@@ -33,6 +34,8 @@ operator!=(const WimaMeasurementAreaData &other) const {
void
WimaMeasurementAreaData
::
setTileData
(
const
TileData
&
d
)
{
if
(
this
->
_tileData
!=
d
)
{
this
->
_tileData
=
d
;
this
->
_progress
.
fill
(
0
,
d
.
size
());
emit
progressChanged
();
emit
tileDataChanged
();
}
}
...
...
@@ -51,7 +54,9 @@ void WimaMeasurementAreaData::setProgress(const QVector<int> &d) {
*/
WimaMeasurementAreaData
&
WimaMeasurementAreaData
::
operator
=
(
const
WimaMeasurementAreaData
&
other
)
{
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
setTileData
(
other
.
_tileData
);
setProgress
(
other
.
_progress
);
return
*
this
;
}
...
...
@@ -63,7 +68,14 @@ operator=(const WimaMeasurementAreaData &other) {
*/
WimaMeasurementAreaData
&
WimaMeasurementAreaData
::
operator
=
(
const
WimaMeasurementArea
&
other
)
{
assign
(
other
);
WimaAreaData
::
operator
=
(
other
);
if
(
other
.
ready
())
{
setTileData
(
other
.
tileData
());
setProgress
(
other
.
progress
());
}
else
{
qWarning
()
<<
"WimaMeasurementAreaData::operator=(): WimaMeasurementArea "
"not ready."
;
}
return
*
this
;
}
...
...
@@ -102,23 +114,6 @@ const QVector<int> &WimaMeasurementAreaData::progress() const {
QVector
<
int
>
&
WimaMeasurementAreaData
::
progress
()
{
return
this
->
_progress
;
}
void
WimaMeasurementAreaData
::
assign
(
const
WimaMeasurementAreaData
&
other
)
{
WimaAreaData
::
assign
(
other
);
setTileData
(
other
.
_tileData
);
setProgress
(
other
.
_progress
);
}
void
WimaMeasurementAreaData
::
assign
(
const
WimaMeasurementArea
&
other
)
{
WimaAreaData
::
assign
(
other
);
if
(
other
.
ready
())
{
setTileData
(
other
.
tileData
());
setProgress
(
other
.
progress
());
}
else
{
qWarning
()
<<
"WimaMeasurementAreaData::assign(): WimaMeasurementArea not ready."
;
}
}
bool
operator
==
(
const
WimaMeasurementAreaData
&
m1
,
const
WimaMeasurementArea
&
m2
)
{
return
operator
==
(
*
static_cast
<
const
WimaAreaData
*>
(
&
m1
),
...
...
src/Wima/Geometry/WimaMeasurementAreaData.h
View file @
9d2ac99e
...
...
@@ -50,10 +50,6 @@ signals:
void
tileDataChanged
();
void
progressChanged
();
protected:
void
assign
(
const
WimaMeasurementAreaData
&
other
);
void
assign
(
const
WimaMeasurementArea
&
other
);
private:
TileData
_tileData
;
QVector
<
int
>
_progress
;
...
...
src/Wima/Geometry/WimaServiceAreaData.cc
View file @
9d2ac99e
...
...
@@ -7,26 +7,22 @@ WimaServiceAreaData::WimaServiceAreaData(QObject *parent)
WimaServiceAreaData
::
WimaServiceAreaData
(
const
WimaServiceAreaData
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
),
_depot
(
other
.
_depot
)
{}
WimaServiceAreaData
::
WimaServiceAreaData
(
const
WimaServiceArea
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
*
this
=
other
;
}
:
WimaAreaData
(
other
,
parent
),
_depot
(
other
.
depot
())
{}
WimaServiceAreaData
&
WimaServiceAreaData
::
operator
=
(
const
WimaServiceAreaData
&
otherData
)
{
this
->
assign
(
otherData
);
WimaAreaData
::
operator
=
(
otherData
);
this
->
setDepot
(
otherData
.
depot
());
return
*
this
;
}
WimaServiceAreaData
&
WimaServiceAreaData
::
operator
=
(
const
WimaServiceArea
&
otherArea
)
{
this
->
assign
(
otherArea
);
WimaAreaData
::
operator
=
(
otherArea
);
this
->
setDepot
(
otherArea
.
depot
());
return
*
this
;
}
...
...
@@ -57,16 +53,6 @@ void WimaServiceAreaData::setDepot(const QGeoCoordinate &newCoordinate) {
}
}
void
WimaServiceAreaData
::
assign
(
const
WimaServiceAreaData
&
other
)
{
WimaAreaData
::
assign
(
other
);
setDepot
(
other
.
depot
());
}
void
WimaServiceAreaData
::
assign
(
const
WimaServiceArea
&
other
)
{
WimaAreaData
::
assign
(
other
);
setDepot
(
other
.
depot
());
}
/*!
* \class WimaAreaData::WimaServiceAreaData
* \brief Class to store and exchange data of a \c WimaServiceArea Object.
...
...
src/Wima/Geometry/WimaServiceAreaData.h
View file @
9d2ac99e
...
...
@@ -31,10 +31,6 @@ signals:
public
slots
:
void
setDepot
(
const
QGeoCoordinate
&
newCoordinate
);
protected:
void
assign
(
const
WimaServiceAreaData
&
other
);
void
assign
(
const
WimaServiceArea
&
other
);
private:
// see WimaServieArea.h for explanation
QGeoCoordinate
_depot
;
...
...
src/Wima/RoutingThread.cpp
View file @
9d2ac99e
...
...
@@ -5,7 +5,7 @@
#include <QDebug>
#include "QGCLoggingCategory.h"
QGC_LOGGING_CATEGORY
(
Routing
WorkerLog
,
"RoutingWorker
Log"
)
QGC_LOGGING_CATEGORY
(
Routing
ThreadLog
,
"RoutingThread
Log"
)
RoutingThread
::
RoutingThread
(
QObject
*
parent
)
:
QThread
(
parent
),
_calculating
(
false
),
_stop
(
false
),
_restart
(
false
)
{
...
...
@@ -44,10 +44,10 @@ void RoutingThread::route(const RoutingParameter &par,
}
void
RoutingThread
::
run
()
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): thread start."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): thread start."
;
while
(
!
this
->
_stop
)
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): calculation "
"started."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): calculation "
"started."
;
// Copy input.
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
...
...
@@ -67,8 +67,8 @@ void RoutingThread::run() {
if
(
generator
(
transectsENU
))
{
// Check if generation was successful.
if
(
transectsENU
.
size
()
==
0
)
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): "
"not able to generate transects."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): "
"not able to generate transects."
;
}
else
{
// Prepare data for routing.
auto
&
solutionVector
=
pRouteData
->
solutionVector
;
...
...
@@ -93,24 +93,24 @@ void RoutingThread::run() {
// Check if routing was successful.
if
((
!
success
||
solutionVector
.
size
()
<
1
)
&&
!
this
->
_restart
)
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): "
"routing failed. "
<<
snakePar
.
errorString
.
c_str
();
qC
Debug
(
RoutingThread
Log
)
<<
"run(): "
"routing failed. "
<<
snakePar
.
errorString
.
c_str
();
}
else
if
(
this
->
_restart
)
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): "
"restart requested."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): "
"restart requested."
;
}
else
{
// Notify main thread.
emit
result
(
pRouteData
);
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): "
"concurrent update success."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): "
"concurrent update success."
;
}
}
}
// end calculation
else
{
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): generator() failed."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): generator() failed."
;
}
qC
Warning
(
RoutingWorker
Log
)
qC
Debug
(
RoutingThread
Log
)
<<
"run(): execution time: "
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
start
)
...
...
@@ -125,5 +125,5 @@ void RoutingThread::run() {
}
this
->
_restart
=
false
;
}
// main loop
qC
Warning
(
RoutingWorker
Log
)
<<
"run(): thread end."
;
qC
Debug
(
RoutingThread
Log
)
<<
"run(): thread end."
;
}
src/Wima/Snake/CircularGenerator.cpp
View file @
9d2ac99e
...
...
@@ -64,14 +64,14 @@ bool CircularGenerator::get(Generator &generator) {
auto
origin
=
this
->
_d
->
origin
();
origin
.
setAltitude
(
0
);
if
(
!
origin
.
isValid
())
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): origin invalid."
<<
origin
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): origin invalid."
<<
origin
;
return
false
;
}
auto
ref
=
this
->
_reference
;
ref
.
setAltitude
(
0
);
if
(
!
ref
.
isValid
())
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): reference invalid."
<<
ref
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): reference invalid."
<<
ref
;
return
false
;
}
snake
::
FPoint
reference
;
...
...
@@ -82,9 +82,9 @@ bool CircularGenerator::get(Generator &generator) {
if
(
v
.
isValid
())
{
v
.
setAltitude
(
0
);
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): measurement area invalid."
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): measurement area invalid."
;
for
(
const
auto
&
w
:
geoPolygon
)
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
w
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
w
;
}
return
false
;
}
...
...
@@ -105,21 +105,21 @@ bool CircularGenerator::get(Generator &generator) {
snake
::
areaToEnu
(
origin
,
tile
->
coordinateList
(),
tileENU
);
pTiles
->
push_back
(
std
::
move
(
tileENU
));
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): progress.size() != tiles->count()."
;
return
false
;
}
}
}
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): progress.size() != tiles->count()."
;
return
false
;
}
auto
geoDepot
=
this
->
_d
->
serviceArea
().
depot
();
if
(
!
geoDepot
.
isValid
())
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): depot invalid."
<<
geoDepot
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): depot invalid."
<<
geoDepot
;
return
false
;
}
snake
::
FPoint
depot
;
...
...
@@ -142,11 +142,11 @@ bool CircularGenerator::get(Generator &generator) {
};
return
true
;
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): data invalid."
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): data invalid."
;
return
false
;
}
}
else
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"get(): data member not set."
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
"get(): data member not set."
;
return
false
;
}
}
...
...
@@ -160,22 +160,29 @@ void CircularGenerator::setReference(const QGeoCoordinate &reference) {
}
}
void
CircularGenerator
::
resetReferenceIfInvalid
()
{
if
(
!
this
->
_reference
.
isValid
())
{
resetReference
();
}
}
void
CircularGenerator
::
resetReference
()
{
setReference
(
_d
->
measurementArea
().
center
());
if
(
this
->
_d
->
measurementArea
().
center
().
isValid
())
{
setReference
(
this
->
_d
->
measurementArea
().
center
());
}
}
void
CircularGenerator
::
establishConnections
()
{
if
(
this
->
_d
&&
!
this
->
_connectionsEstablished
)
{
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
measurementAreaChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
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
::
pathChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -192,8 +199,6 @@ void CircularGenerator::establishConnections() {
void
CircularGenerator
::
deleteConnections
()
{
if
(
this
->
_d
&&
this
->
_connectionsEstablished
)
{
disconnect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
measurementAreaChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
...
...
@@ -202,6 +207,12 @@ void CircularGenerator::deleteConnections() {
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -236,12 +247,12 @@ bool circularTransects(const snake::FPoint &reference,
std
::
string
error
;
// Check validity.
if
(
!
bg
::
is_valid
(
polygon
,
error
))
{
qC
Warnin
g
(
CircularGeneratorLog
)
<<
"circularTransects(): "
"invalid polygon."
;
qC
Warnin
g
(
CircularGeneratorLog
)
<<
error
.
c_str
();
qC
Debu
g
(
CircularGeneratorLog
)
<<
"circularTransects(): "
"invalid polygon."
;
qC
Debu
g
(
CircularGeneratorLog
)
<<
error
.
c_str
();
std
::
stringstream
ss
;
ss
<<
bg
::
wkt
(
polygon
);
qC
Warnin
g
(
CircularGeneratorLog
)
<<
ss
.
str
().
c_str
();
qC
Debu
g
(
CircularGeneratorLog
)
<<
ss
.
str
().
c_str
();
}
else
{
// Calculate polygon distances and angles.
std
::
vector
<
snake
::
Length
>
distances
;
...
...
@@ -249,7 +260,7 @@ bool circularTransects(const snake::FPoint &reference,
std
::
vector
<
snake
::
Angle
>
angles
;
angles
.
reserve
(
polygon
.
outer
().
size
());
//#ifdef DEBUG_CIRCULAR_SURVEY
// qC
Warnin
g(CircularGeneratorLog) << "circularTransects():";
// qC
Debu
g(CircularGeneratorLog) << "circularTransects():";
//#endif
for
(
const
auto
&
p
:
polygon
.
outer
())
{
snake
::
Length
distance
=
bg
::
distance
(
reference
,
p
)
*
si
::
meter
;
...
...
@@ -258,11 +269,11 @@ bool circularTransects(const snake::FPoint &reference,
alpha
=
alpha
<
0
*
si
::
radian
?
alpha
+
2
*
M_PI
*
si
::
radian
:
alpha
;
angles
.
push_back
(
alpha
);
//#ifdef DEBUG_CIRCULAR_SURVEY
// qC
Warnin
g(CircularGeneratorLog) << "distances, angles,
// coordinates:"; qC
Warnin
g(CircularGeneratorLog) <<
// to_string(distance).c_str(); qC
Warnin
g(CircularGeneratorLog)
// qC
Debu
g(CircularGeneratorLog) << "distances, angles,
// coordinates:"; qC
Debu
g(CircularGeneratorLog) <<
// to_string(distance).c_str(); qC
Debu
g(CircularGeneratorLog)
// << to_string(snake::Degree(alpha)).c_str();
// qC
Warnin
g(CircularGeneratorLog) << "x = " << p.get<0>() << "y
// qC
Debu
g(CircularGeneratorLog) << "x = " << p.get<0>() << "y
// = "
// << p.get<1>();
//#endif
...
...
@@ -285,8 +296,8 @@ bool circularTransects(const snake::FPoint &reference,
const
auto
deltaRScaled
=
ClipperLib
::
cInt
(
std
::
round
(
deltaR
.
value
()
*
CLIPPER_SCALE
));
auto
referenceScaled
=
ClipperLib
::
IntPoint
{
ClipperLib
::
cInt
(
std
::
round
(
reference
.
get
<
0
>
())),
ClipperLib
::
cInt
(
std
::
round
(
reference
.
get
<
1
>
()))};
ClipperLib
::
cInt
(
std
::
round
(
reference
.
get
<
0
>
()
*
CLIPPER_SCALE
)),
ClipperLib
::
cInt
(
std
::
round
(
reference
.
get
<
1
>
()
*
CLIPPER_SCALE
))};
// Generate circle sectors.
auto
rScaled
=
rMinScaled
;
...
...
@@ -295,20 +306,20 @@ bool circularTransects(const snake::FPoint &reference,
const
auto
nSectors
=
long
(
std
::
round
(((
alpha2
-
alpha1
)
/
deltaAlpha
).
value
()));
//#ifdef DEBUG_CIRCULAR_SURVEY
// qC
Warnin
g(CircularGeneratorLog) << "circularTransects(): sector
// parameres:"; qC
Warnin
g(CircularGeneratorLog) << "alpha1: " <<
// qC
Debu
g(CircularGeneratorLog) << "circularTransects(): sector
// parameres:"; qC
Debu
g(CircularGeneratorLog) << "alpha1: " <<
// to_string(snake::Degree(alpha1)).c_str();
// qC
Warnin
g(CircularGeneratorLog) << "alpha2:
// qC
Debu
g(CircularGeneratorLog) << "alpha2:
// "
// << to_string(snake::Degree(alpha2)).c_str();
// qC
Warnin
g(CircularGeneratorLog) << "n: "
// qC
Debu
g(CircularGeneratorLog) << "n: "
// << to_string((alpha2 - alpha1) / deltaAlpha).c_str();
// qC
Warnin
g(CircularGeneratorLog)
// << "nSectors: " << nSectors; qC
Warnin
g(CircularGeneratorLog) <<
// qC
Debu
g(CircularGeneratorLog)
// << "nSectors: " << nSectors; qC
Debu
g(CircularGeneratorLog) <<
// "rMin: " << to_string(rMin).c_str();
// qC
Warnin
g(CircularGeneratorLog)
// qC
Debu
g(CircularGeneratorLog)
// << "rMax: " << to_string(rMax).c_str();
// qC
Warnin
g(CircularGeneratorLog) << "nTran: " << nTran;
// qC
Debu
g(CircularGeneratorLog) << "nTran: " << nTran;
//#endif
using
ClipperCircle
=
GenericCircle
<
ClipperLib
::
cInt
,
ClipperLib
::
IntPoint
>
;
...
...
@@ -427,7 +438,7 @@ bool circularTransects(const snake::FPoint &reference,
}
}
qC
Warnin
g
(
CircularGeneratorLog
)
qC
Debu
g
(
CircularGeneratorLog
)
<<
"circularTransects(): transect gen. time: "
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
s1
)
...
...
src/Wima/Snake/CircularGenerator.h
View file @
9d2ac99e
...
...
@@ -30,7 +30,6 @@ public:
Fact
*
minLength
();
void
setReference
(
const
QGeoCoordinate
&
reference
);
Q_INVOKABLE
void
resetReference
();
static
const
char
*
settingsGroup
;
static
const
char
*
distanceName
;
...
...
@@ -43,6 +42,10 @@ public:
signals:
void
referenceChanged
();
public
slots
:
Q_INVOKABLE
void
resetReferenceIfInvalid
();
Q_INVOKABLE
void
resetReference
();
protected:
virtual
void
establishConnections
()
override
;
virtual
void
deleteConnections
()
override
;
...
...
src/Wima/Snake/GeneratorBase.cc
View file @
9d2ac99e
...
...
@@ -12,13 +12,9 @@ GeneratorBase::GeneratorBase(GeneratorBase::Data d, QObject *parent)
GeneratorBase
::~
GeneratorBase
()
{}
QString
GeneratorBase
::
editorQml
()
{
return
QStringLiteral
(
"EmptyGeneratorEditor.qml"
);
}
QString
GeneratorBase
::
editorQml
()
{
return
QStringLiteral
(
""
);
}
QString
GeneratorBase
::
mapVisualQml
()
{
return
QStringLiteral
(
"EmptyGeneratorMapVisual.qml"
);
}
QString
GeneratorBase
::
mapVisualQml
()
{
return
QStringLiteral
(
""
);
}
GeneratorBase
::
Data
GeneratorBase
::
data
()
const
{
return
_d
;
}
...
...
src/Wima/Snake/LinearGenerator.cpp
View file @
9d2ac99e
...
...
@@ -49,7 +49,7 @@ bool LinearGenerator::get(Generator &generator) {
auto
origin
=
this
->
_d
->
origin
();
origin
.
setAltitude
(
0
);
if
(
!
origin
.
isValid
())
{
qC
Warning
(
LinearGeneratorLog
)
<<
"get(): origin invalid."
;
qC
Debug
(
LinearGeneratorLog
)
<<
"get(): origin invalid."
<<
origin
;
}
auto
geoPolygon
=
this
->
_d
->
measurementArea
().
coordinateList
();
...
...
@@ -57,9 +57,9 @@ bool LinearGenerator::get(Generator &generator) {
if
(
v
.
isValid
())
{
v
.
setAltitude
(
0
);
}
else
{
qC
Warnin
g
(
LinearGeneratorLog
)
<<
"get(): measurement area invalid."
;
qC
Debu
g
(
LinearGeneratorLog
)
<<
"get(): measurement area invalid."
;
for
(
const
auto
&
w
:
geoPolygon
)
{
qC
Warnin
g
(
LinearGeneratorLog
)
<<
w
;
qC
Debu
g
(
LinearGeneratorLog
)
<<
w
;
}
return
false
;
}
...
...
@@ -80,21 +80,20 @@ bool LinearGenerator::get(Generator &generator) {
snake
::
areaToEnu
(
origin
,
tile
->
coordinateList
(),
tileENU
);
pTiles
->
push_back
(
std
::
move
(
tileENU
));
}
else
{
qCWarning
(
LinearGeneratorLog
)
<<
"get(): progress.size() != tiles->count()."
;
qCDebug
(
LinearGeneratorLog
)
<<
"get(): tile == nullptr"
;
return
false
;
}
}
}
}
else
{
qC
Warnin
g
(
LinearGeneratorLog
)
qC
Debu
g
(
LinearGeneratorLog
)
<<
"get(): progress.size() != tiles->count()."
;
return
false
;
}
auto
geoDepot
=
this
->
_d
->
serviceArea
().
depot
();
if
(
!
geoDepot
.
isValid
())
{
qC
Warnin
g
(
LinearGeneratorLog
)
<<
"get(): depot invalid."
<<
geoDepot
;
qC
Debu
g
(
LinearGeneratorLog
)
<<
"get(): depot invalid."
<<
geoDepot
;
return
false
;
}
snake
::
FPoint
depot
;
...
...
@@ -116,11 +115,11 @@ bool LinearGenerator::get(Generator &generator) {
};
return
true
;
}
else
{
qC
Warnin
g
(
LinearGeneratorLog
)
<<
"get(): data invalid."
;
qC
Debu
g
(
LinearGeneratorLog
)
<<
"get(): data invalid."
;
return
false
;
}
}
else
{
qC
Warnin
g
(
LinearGeneratorLog
)
<<
"get(): data member not set."
;
qC
Debu
g
(
LinearGeneratorLog
)
<<
"get(): data member not set."
;
return
false
;
}
}
...
...
@@ -133,8 +132,6 @@ Fact *LinearGenerator::minLength() { return &_minLength; }
void
LinearGenerator
::
establishConnections
()
{
if
(
this
->
_d
&&
!
this
->
_connectionsEstablished
)
{
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
measurementAreaChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
...
...
@@ -143,6 +140,8 @@ void LinearGenerator::establishConnections() {
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -167,6 +166,9 @@ void LinearGenerator::deleteConnections() {
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -195,9 +197,9 @@ bool linearTransects(const snake::FPolygon &polygon,
std
::
stringstream
ss
;
ss
<<
bg
::
wkt
(
polygon
);
qC
Warnin
g
(
LinearGeneratorLog
)
<<
"linearTransects(): "
"invalid polygon. "
<<
error
.
c_str
()
<<
ss
.
str
().
c_str
();
qC
Debu
g
(
LinearGeneratorLog
)
<<
"linearTransects(): "
"invalid polygon. "
<<
error
.
c_str
()
<<
ss
.
str
().
c_str
();
}
else
{
tr
::
rotate_transformer
<
bg
::
degree
,
double
,
2
,
2
>
rotate
(
angle
.
value
()
*
180
/
M_PI
);
...
...
@@ -244,7 +246,7 @@ bool linearTransects(const snake::FPolygon &polygon,
std
::
stringstream
ss
;
ss
<<
"Not able to generate transects. Parameter: distance = "
<<
distance
<<
std
::
endl
;
qC
Warnin
g
(
LinearGeneratorLog
)
qC
Debu
g
(
LinearGeneratorLog
)
<<
"linearTransects(): "
<<
ss
.
str
().
c_str
();
return
false
;
}
...
...
@@ -312,12 +314,12 @@ bool linearTransects(const snake::FPolygon &polygon,
std
::
stringstream
ss
;
ss
<<
"Not able to generatetransects. Parameter: minLength = "
<<
minLength
<<
std
::
endl
;
qC
Warnin
g
(
LinearGeneratorLog
)
qC
Debu
g
(
LinearGeneratorLog
)
<<
"linearTransects(): "
<<
ss
.
str
().
c_str
();
return
false
;
}
qC
Warnin
g
(
LinearGeneratorLog
)
qC
Debu
g
(
LinearGeneratorLog
)
<<
"linearTransects(): time: "
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
s1
)
...
...
src/Wima/Snake/NemoInterface.cpp
View file @
9d2ac99e
...
...
@@ -2,6 +2,7 @@
#include "SnakeTilesLocal.h"
#include "QGCApplication.h"
#include "QGCLoggingCategory.h"
#include "QGCToolbox.h"
#include "SettingsFact.h"
#include "SettingsManager.h"
...
...
@@ -26,6 +27,8 @@
#include "ros_bridge/rapidjson/include/rapidjson/ostreamwrapper.h"
#include "ros_bridge/rapidjson/include/rapidjson/writer.h"
QGC_LOGGING_CATEGORY
(
NemoInterfaceLog
,
"NemoInterfaceLog"
)
#define EVENT_TIMER_INTERVAL 100 // ms
auto
static
timeoutInterval
=
std
::
chrono
::
milliseconds
(
3000
);
...
...
@@ -171,15 +174,15 @@ void NemoInterface::Impl::setTileData(const TileData &tileData) {
snake
::
areaToEnu
(
origin
,
tile
->
coordinateList
(),
tileENU
.
path
());
this
->
tilesENU
.
polygons
().
push_back
(
std
::
move
(
tileENU
));
}
else
{
q
Warning
()
<<
"NemoInterface::
Impl::setTileData(): nullptr."
;
q
CDebug
(
NemoInterfaceLog
)
<<
"
Impl::setTileData(): nullptr."
;
break
;
}
}
}
else
{
q
Warning
()
<<
"NemoInterface::
Impl::setTileData(): Origin invalid."
;
q
CDebug
(
NemoInterfaceLog
)
<<
"
Impl::setTileData(): Origin invalid."
;
}
}
else
{
q
Warning
()
<<
"NemoInterface::
Impl::setTileData(): tile empty."
;
q
CDebug
(
NemoInterfaceLog
)
<<
"
Impl::setTileData(): tile empty."
;
}
}
}
else
{
...
...
@@ -300,12 +303,17 @@ void NemoInterface::Impl::doTopicServiceSetup() {
std
::
make_unique
<
rapidjson
::
Document
>
(
rapidjson
::
kObjectType
));
auto
&
origin
=
this
->
ENUOrigin
;
rapidjson
::
Value
jOrigin
(
rapidjson
::
kObjectType
);
bool
ret
=
geographic_msgs
::
geo_point
::
toJson
(
origin
,
jOrigin
,
pDoc
->
GetAllocator
());
lk
.
unlock
();
Q_ASSERT
(
ret
);
(
void
)
ret
;
pDoc
->
AddMember
(
"origin"
,
jOrigin
,
pDoc
->
GetAllocator
());
if
(
geographic_msgs
::
geo_point
::
toJson
(
origin
,
jOrigin
,
pDoc
->
GetAllocator
()))
{
lk
.
unlock
();
pDoc
->
AddMember
(
"origin"
,
jOrigin
,
pDoc
->
GetAllocator
());
}
else
{
lk
.
unlock
();
qCWarning
(
NemoInterfaceLog
)
<<
"/snake/get_origin service: could not create json document."
;
}
return
pDoc
;
});
...
...
@@ -318,11 +326,17 @@ void NemoInterface::Impl::doTopicServiceSetup() {
JsonDocUPtr
pDoc
(
std
::
make_unique
<
rapidjson
::
Document
>
(
rapidjson
::
kObjectType
));
rapidjson
::
Value
jSnakeTiles
(
rapidjson
::
kObjectType
);
bool
ret
=
jsk_recognition_msgs
::
polygon_array
::
toJson
(
this
->
tilesENU
,
jSnakeTiles
,
pDoc
->
GetAllocator
());
Q_ASSERT
(
ret
);
(
void
)
ret
;
pDoc
->
AddMember
(
"tiles"
,
jSnakeTiles
,
pDoc
->
GetAllocator
());
if
(
jsk_recognition_msgs
::
polygon_array
::
toJson
(
this
->
tilesENU
,
jSnakeTiles
,
pDoc
->
GetAllocator
()))
{
lk
.
unlock
();
pDoc
->
AddMember
(
"tiles"
,
jSnakeTiles
,
pDoc
->
GetAllocator
());
}
else
{
lk
.
unlock
();
qCWarning
(
NemoInterfaceLog
)
<<
"/snake/get_tiles service: could not create json document."
;
}
return
pDoc
;
});
}
...
...
@@ -379,22 +393,26 @@ void NemoInterface::Impl::publishTilesENU() {
using
namespace
ros_bridge
::
messages
;
JsonDocUPtr
jSnakeTiles
(
std
::
make_unique
<
rapidjson
::
Document
>
(
rapidjson
::
kObjectType
));
bool
ret
=
jsk_recognition_msgs
::
polygon_array
::
toJson
(
this
->
tilesENU
,
*
jSnakeTiles
,
jSnakeTiles
->
GetAllocator
());
Q_ASSERT
(
ret
);
(
void
)
ret
;
this
->
pRosBridge
->
publish
(
std
::
move
(
jSnakeTiles
),
"/snake/tiles"
);
if
(
jsk_recognition_msgs
::
polygon_array
::
toJson
(
this
->
tilesENU
,
*
jSnakeTiles
,
jSnakeTiles
->
GetAllocator
()))
{
this
->
pRosBridge
->
publish
(
std
::
move
(
jSnakeTiles
),
"/snake/tiles"
);
}
else
{
qCWarning
(
NemoInterfaceLog
)
<<
"Impl::publishTilesENU: could not create json document."
;
}
}
void
NemoInterface
::
Impl
::
publishENUOrigin
()
{
using
namespace
ros_bridge
::
messages
;
JsonDocUPtr
jOrigin
(
std
::
make_unique
<
rapidjson
::
Document
>
(
rapidjson
::
kObjectType
));
bool
ret
=
geographic_msgs
::
geo_point
::
toJson
(
this
->
ENUOrigin
,
*
jOrigin
,
jOrigin
->
GetAllocator
());
Q_ASSERT
(
ret
);
(
void
)
ret
;
this
->
pRosBridge
->
publish
(
std
::
move
(
jOrigin
),
"/snake/origin"
);
if
(
geographic_msgs
::
geo_point
::
toJson
(
this
->
ENUOrigin
,
*
jOrigin
,
jOrigin
->
GetAllocator
()))
{
this
->
pRosBridge
->
publish
(
std
::
move
(
jOrigin
),
"/snake/origin"
);
}
else
{
qCWarning
(
NemoInterfaceLog
)
<<
"Impl::publishENUOrigin: could not create json document."
;
}
}
bool
NemoInterface
::
Impl
::
setStatus
(
NemoInterface
::
STATUS
s
)
{
...
...
@@ -421,7 +439,7 @@ void NemoInterface::stop() { this->pImpl->stop(); }
void
NemoInterface
::
publishTileData
()
{
this
->
pImpl
->
publishTileData
();
}
void
NemoInterface
::
requestProgress
()
{
q
Warning
()
<<
"NemoInterface::
requestProgress(): dummy."
;
q
CWarning
(
NemoInterfaceLog
)
<<
"
requestProgress(): dummy."
;
}
void
NemoInterface
::
setTileData
(
const
TileData
&
tileData
)
{
...
...
src/Wima/Snake/SnakeTile.cpp
View file @
9d2ac99e
...
...
@@ -18,8 +18,6 @@ QString SnakeTile::type() const { return "Tile"; }
SnakeTile
*
SnakeTile
::
Clone
()
const
{
return
new
SnakeTile
(
*
this
);
}
SnakeTile
&
SnakeTile
::
operator
=
(
const
SnakeTile
&
other
)
{
this
->
assign
(
other
);
this
->
WimaAreaData
::
operator
=
(
other
);
return
*
this
;
}
void
SnakeTile
::
assign
(
const
SnakeTile
&
other
)
{
WimaAreaData
::
assign
(
other
);
}
src/WimaView/CircularGeneratorEditor.qml
View file @
9d2ac99e
...
...
@@ -8,8 +8,7 @@ import QGroundControl.ScreenTools 1.0
GridLayout
{
// Item must be loaded, expects the following properties:
// property var generator
property
var
generator
// CircularGenerator
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
...
...
src/WimaView/CircularGeneratorMapVisual.qml
View file @
9d2ac99e
import
QtQuick
2.0
import
QtQuick
2.0
import
Wima
1.0
import
QGroundControl
1.0
Item
{
id
:
_root
visible
:
true
// Expects the following properties:
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
generator
property
bool
checked
:
false
property
var
_referenceComponent
property
var
_referenceComponent
:
undefined
signal
clicked
()
function
_addRefPoint
(){
if
(
!
_referenceComponent
){
_referenceComponent
=
refPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_referenceComponent
)
}
}
function
_destroyRefPoint
(){
if
(
_referenceComponent
){
map
.
removeMapItem
(
_referenceComponent
)
_referenceComponent
.
destroy
()
_referenceComponent
=
undefined
}
}
onVisibleChanged
:
{
if
(
visible
){
_addRefPoint
()
...
...
@@ -41,28 +31,56 @@ Item {
}
}
Component
.
onDestr
oyed
:
{
Component
.
onDestr
uction
:
{
_destroyRefPoint
()
}
function
_addRefPoint
(){
if
(
!
_referenceComponent
){
_referenceComponent
=
refPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_referenceComponent
)
}
}
function
_destroyRefPoint
(){
if
(
_referenceComponent
){
map
.
removeMapItem
(
_referenceComponent
)
_referenceComponent
.
destroy
()
_referenceComponent
=
undefined
}
}
// Ref. point (Base Station)
Component
{
id
:
refPointComponent
DragCoordinate
{
id
:
dragCoordinate
property
var
ref
:
_root
.
generator
.
reference
map
:
_root
.
map
qgcView
:
_root
.
qgcView
z
:
QGroundControl
.
zOrderMapItems
checked
:
_root
.
checked
coordinate
:
_root
.
generator
.
reference
coordinate
:
ref
onDragReleased
:
{
syncAndBind
()
}
Component.onCompleted
:
{
syncAndBind
()
}
onClicked
:
{
_root
.
clicked
()
}
onDragReleased
:
{
_root
.
generator
.
reference
=
coordinate
coordinate
=
Qt
.
binding
(
function
(){
return
_root
.
generator
.
reference
})
function
syncAndBind
(){
if
(
coordinate
.
latitude
!==
ref
.
latitude
||
coordinate
.
longitude
!==
ref
.
longitude
){
_root
.
generator
.
reference
=
coordinate
}
coordinate
=
Qt
.
binding
(
function
(){
return
_root
.
generator
.
reference
})
}
}
}
...
...
src/WimaView/CircularSurveyItemEditor.qml
View file @
9d2ac99e
...
...
@@ -25,31 +25,24 @@ Rectangle {
//property real availableWidth ///< Width for control
//property var missionItem ///< Mission Item for editor
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
_vehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
?
QGroundControl
.
multiVehicleManager
.
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
offlineEditingVehicle
property
real
_cameraMinTriggerInterval
:
missionItem
.
cameraCalc
.
minTriggerInterval
.
rawValue
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
var
_generator
:
missionItem
.
generator
property
var
_generator
:
missionItem
.
generator
property
var
_generatorEditor
:
undefined
function
polygonCaptureStarted
()
{
missionItem
.
clearPolygon
()
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
function
polygonCaptureFinished
(
coordinates
)
{
for
(
var
i
=
0
;
i
<
coordinates
.
length
;
i
++
)
{
missionItem
.
addPolygonCoordinate
(
coordinates
[
i
])
}
Component.onCompleted
:
{
_addGeneratorEditor
()
}
function
polygonAdjustVertex
(
vertexIndex
,
vertexCoordinate
)
{
missionItem
.
adjustPolygonCoordinate
(
vertexIndex
,
vertexCoordinate
)
Component.onDestruction
:
{
_destroyGeneratorEditor
()
}
function
polygonAdjustStarted
()
{
}
function
polygonAdjustFinished
()
{
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
on_GeneratorChanged
:
{
_destroyGeneratorEditor
()
_addGeneratorEditor
()
}
Column
{
id
:
editorColumn
...
...
@@ -156,13 +149,11 @@ Rectangle {
id
:
transectsHeader
text
:
qsTr
(
"
Generator
"
)
}
Loader
{
source
:
_generator
.
editorQml
property
var
generator
:
_generator
property
real
margin
:
_margin
visible
:
transectsHeader
.
checked
}
Column
{
id
:
generatorEditorParent
visible
:
transectsHeader
.
checked
}
Column
{
anchors.left
:
parent
.
left
...
...
@@ -178,7 +169,7 @@ Rectangle {
onCalculatingChanged
:
{
if
(
!
calculating
){
// defer hid
e
ing
// defer hiding
timer
.
restart
()
}
}
...
...
@@ -192,4 +183,27 @@ Rectangle {
}
}
}
// Column
function
_addGeneratorEditor
(){
if
(
_generator
.
editorQml
&&
!
_generatorEditor
)
{
var
component
=
Qt
.
createComponent
(
_generator
.
editorQml
)
if
(
component
.
status
===
Component
.
Error
)
{
console
.
log
(
"
Error loading Qml:
"
,
_generator
.
editorQml
,
component
.
errorString
())
}
else
{
_generatorEditor
=
component
.
createObject
(
generatorEditorParent
,
{
"
generator
"
:
_root
.
_generator
,
})
}
}
}
function
_destroyGeneratorEditor
(){
if
(
_generatorEditor
){
_generatorEditor
.
destroy
()
_generatorEditor
=
undefined
}
}
}
// Rectangle
src/WimaView/CircularSurveyMapVisual.qml
View file @
9d2ac99e
...
...
@@ -26,67 +26,34 @@ Item {
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
_missionItem
:
object
property
var
_transectsComponent
property
var
_entryCoordinate
property
var
_exitCoordinate
property
var
_generator
:
_missionItem
.
generator
signal
clicked
(
int
sequenceNumber
)
function
_addTransectsComponent
(){
if
(
!
_transectsComponent
){
_transectsComponent
=
visualTransectsComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_transectsComponent
)
}
}
function
_addExitCoordinate
(){
if
(
!
_exitCoordinate
){
_exitCoordinate
=
exitPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_exitCoordinate
)
}
}
property
var
_transectsComponent
:
undefined
property
var
_entryCoordinate
:
undefined
property
var
_exitCoordinate
:
undefined
property
var
_generatorVisuals
:
undefined
function
_addEntryCoordinate
(){
if
(
!
_entryCoordinate
){
_entryCoordinate
=
entryPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_entryCoordinate
)
}
}
property
bool
_isCurrentItem
:
_missionItem
.
isCurrentItem
function
_destroyEntryCoordinate
(){
if
(
_entryCoordinate
){
map
.
removeMapItem
(
_entryCoordinate
)
_entryCoordinate
.
destroy
()
_entryCoordinate
=
undefined
}
}
function
_destroyExitCoordinate
(){
if
(
_exitCoordinate
){
map
.
removeMapItem
(
_exitCoordinate
)
_exitCoordinate
.
destroy
()
_exitCoordinate
=
undefined
}
}
function
_destroyTransectsComponent
(){
if
(
_transectsComponent
){
map
.
removeMapItem
(
_transectsComponent
)
_transectsComponent
.
destroy
()
_transectsComponent
=
undefined
}
}
signal
clicked
(
int
sequenceNumber
)
Component.onCompleted
:
{
_addEntryCoordinate
()
_addExitCoordinate
()
_addTransectsComponent
()
_addGeneratorVisuals
()
}
Component.onDestruction
:
{
_destroyEntryCoordinate
()
_destroyExitCoordinate
()
_destroyTransectsComponent
()
_destroyGeneratorVisuals
()
}
on_GeneratorChanged
:
{
_destroyGeneratorVisuals
()
_addGeneratorVisuals
()
}
// Transect lines
...
...
@@ -140,4 +107,82 @@ Item {
}
}
}
// Generator visuals
function
_addGeneratorVisuals
(){
if
(
_generator
.
mapVisualQml
&&
!
_generatorVisuals
)
{
var
component
=
Qt
.
createComponent
(
_generator
.
mapVisualQml
)
if
(
component
.
status
===
Component
.
Error
)
{
console
.
log
(
"
Error loading Qml:
"
,
_generator
.
mapVisualQml
,
component
.
errorString
())
}
else
{
_generatorVisuals
=
component
.
createObject
(
_root
,
{
"
map
"
:
_root
.
map
,
"
qgcView
"
:
_root
.
qgcView
,
"
generator
"
:
_root
.
_generator
,
"
checked
"
:
Qt
.
binding
(
function
(){
return
_root
.
_isCurrentItem
})
})
_generatorVisuals
.
clicked
.
connect
(
function
(){
_root
.
clicked
(
_missionItem
.
sequenceNumber
)})
}
}
}
function
_destroyGeneratorVisuals
(){
if
(
_generatorVisuals
){
_generatorVisuals
.
destroy
()
_generatorVisuals
=
undefined
}
}
function
_addTransectsComponent
(){
if
(
!
_transectsComponent
){
_transectsComponent
=
visualTransectsComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_transectsComponent
)
}
}
function
_addExitCoordinate
(){
if
(
!
_exitCoordinate
){
_exitCoordinate
=
exitPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_exitCoordinate
)
}
}
function
_addEntryCoordinate
(){
if
(
!
_entryCoordinate
){
_entryCoordinate
=
entryPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_entryCoordinate
)
}
}
function
_destroyEntryCoordinate
(){
if
(
_entryCoordinate
){
map
.
removeMapItem
(
_entryCoordinate
)
_entryCoordinate
.
destroy
()
_entryCoordinate
=
undefined
}
}
function
_destroyExitCoordinate
(){
if
(
_exitCoordinate
){
map
.
removeMapItem
(
_exitCoordinate
)
_exitCoordinate
.
destroy
()
_exitCoordinate
=
undefined
}
}
function
_destroyTransectsComponent
(){
if
(
_transectsComponent
){
map
.
removeMapItem
(
_transectsComponent
)
_transectsComponent
.
destroy
()
_transectsComponent
=
undefined
}
}
}
src/WimaView/LinearGeneratorEditor.qml
View file @
9d2ac99e
...
...
@@ -8,8 +8,7 @@ import QGroundControl.ScreenTools 1.0
GridLayout
{
// Item must be loaded, expects the following properties:
// property var generator
property
var
generator
///< LinearGenerator
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
...
...
@@ -23,7 +22,14 @@ GridLayout {
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Alpha
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Alpha:
"
)
Layout.fillWidth
:
true
}
FactTextField
{
fact
:
generator
.
alpha
Layout.fillWidth
:
true
}
QGCSlider
{
id
:
rSlider
minimumValue
:
0
...
...
@@ -33,8 +39,11 @@ GridLayout {
Layout.fillWidth
:
true
Layout.columnSpan
:
2
Layout.preferredHeight
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
onValueChanged
:
generator
.
alpha
.
value
=
value
Component.onCompleted
:
value
=
0
onValueChanged
:
{
generator
.
alpha
.
value
=
value
value
=
Qt
.
binding
(
function
(){
return
generator
.
alpha
.
value
})
}
Component.onCompleted
:
value
=
generator
.
alpha
.
value
updateValueWhileDragging
:
true
}
...
...
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