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
a0c951cb
Commit
a0c951cb
authored
Sep 15, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
234
parent
0510d157
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
5600 additions
and
743 deletions
+5600
-743
KlingenbachTest.wima
Paths/KlingenbachTest.wima
+5144
-253
WimaMeasurementArea.cc
src/Wima/Geometry/WimaMeasurementArea.cc
+146
-71
WimaMeasurementArea.h
src/Wima/Geometry/WimaMeasurementArea.h
+31
-9
WimaMeasurementArea.SettingsGroup.json
...Wima/Geometry/json/WimaMeasurementArea.SettingsGroup.json
+35
-11
SnakeThread.cc
src/Wima/Snake/SnakeThread.cc
+92
-104
SnakeTile.cpp
src/Wima/Snake/SnakeTile.cpp
+1
-1
SnakeTile.h
src/Wima/Snake/SnakeTile.h
+1
-1
snake.cpp
src/Wima/Snake/snake.cpp
+75
-186
snake.h
src/Wima/Snake/snake.h
+28
-91
WimaMeasurementAreaEditor.qml
src/WimaView/WimaMeasurementAreaEditor.qml
+47
-16
No files found.
Paths/KlingenbachTest.wima
View file @
a0c951cb
This diff is collapsed.
Click to expand it.
src/Wima/Geometry/WimaMeasurementArea.cc
View file @
a0c951cb
This diff is collapsed.
Click to expand it.
src/Wima/Geometry/WimaMeasurementArea.h
View file @
a0c951cb
#pragma once
#include "QScopedPointer"
#include <QObject>
#include <QTimer>
#include "WimaArea.h"
...
...
@@ -14,14 +14,25 @@ public:
WimaMeasurementArea
(
const
WimaMeasurementArea
&
other
,
QObject
*
parent
=
nullptr
);
WimaMeasurementArea
&
operator
=
(
const
WimaMeasurementArea
&
other
);
~
WimaMeasurementArea
();
Q_PROPERTY
(
Fact
*
borderPolygonOffset
READ
borderPolygonOffsetFact
CONSTANT
)
Q_PROPERTY
(
Fact
*
tileHeight
READ
tileHeight
CONSTANT
)
Q_PROPERTY
(
Fact
*
tileWidth
READ
tileWidth
CONSTANT
)
Q_PROPERTY
(
Fact
*
minTileArea
READ
minTileArea
CONSTANT
)
Q_PROPERTY
(
Fact
*
transectDistance
READ
transectDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
minTransectLength
READ
minTransectLength
CONSTANT
)
Q_PROPERTY
(
Fact
*
showTiles
READ
showTiles
CONSTANT
)
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaMeasurementAreaMapVisual.qml"
;
}
QString
editorQML
(
void
)
const
{
return
"WimaMeasurementAreaEditor.qml"
;
}
QString
mapVisualQML
(
void
)
const
;
QString
editorQML
(
void
)
const
;
Fact
*
tileHeight
();
Fact
*
tileWidth
();
Fact
*
minTileArea
();
Fact
*
transectDistance
();
Fact
*
minTransectLength
();
Fact
*
showTiles
();
// Member Methodes
void
saveToJson
(
QJsonObject
&
json
);
...
...
@@ -36,14 +47,19 @@ public:
static
const
char
*
tileHeightName
;
static
const
char
*
tileWidthName
;
static
const
char
*
minTileAreaName
;
static
const
char
*
transcetDistanceName
;
static
const
char
*
minTransectLength
;
static
const
char
*
transectDistanceName
;
static
const
char
*
minTransectLengthName
;
static
const
char
*
showTilesName
;
static
const
char
*
WimaMeasurementAreaName
;
signals:
public
slots
:
private
slots
:
void
doUpdate
();
void
deferUpdate
();
private:
// Member Methodes
void
init
();
...
...
@@ -51,9 +67,15 @@ private:
// Members
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
SettingsFact
_tileWidth
;
SettingsFact
_tileHeight
;
SettingsFact
_tileWidth
;
SettingsFact
_minTileArea
;
SettingsFact
_transectDistance
;
SettingsFact
_minTransectLength
;
SettingsFact
_showTiles
;
// Tile stuff.
QTimer
_timer
;
std
::
atomic_bool
_calculating
;
QmlObjectListModel
_tiles
;
};
src/Wima/Geometry/json/WimaMeasurementArea.SettingsGroup.json
View file @
a0c951cb
[
{
"name"
:
"
BottomLayerAltitude
"
,
"shortDescription"
:
"The
distance between the terrain and the first layer of the measurement path.
"
,
"name"
:
"
TileHeight
"
,
"shortDescription"
:
"The
height of a tile
"
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
1
,
"min"
:
0.3
,
"decimalPlaces"
:
2
,
"defaultValue"
:
5
},
{
"name"
:
"
NumberOfLayers
"
,
"shortDescription"
:
"The
number of layers.
"
,
"type"
:
"
uint32
"
,
"name"
:
"
TileWidth
"
,
"shortDescription"
:
"The
height of a tile
"
,
"type"
:
"
double
"
,
"units"
:
"m"
,
"min"
:
1
,
"decimalPlaces"
:
0
,
"defaultValue"
:
1
"min"
:
0.3
,
"decimalPlaces"
:
2
,
"defaultValue"
:
5
},
{
"name"
:
"LayerDistance"
,
"shortDescription"
:
"Specify the time between each photo"
,
"name"
:
"MinTileArea"
,
"shortDescription"
:
"The minimal allowed area of a tile"
,
"type"
:
"double"
,
"units"
:
"m^2"
,
"min"
:
0
,
"decimalPlaces"
:
2
,
"defaultValue"
:
5
},
{
"name"
:
"TransectDistance"
,
"shortDescription"
:
"The transect distance"
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
0.3
,
"decimalPlaces"
:
2
,
"defaultValue"
:
2
},
{
"name"
:
"MinTransectLength"
,
"shortDescription"
:
"The minimal transect length"
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
0
,
"decimalPlaces"
:
2
,
"defaultValue"
:
1
},
{
"name"
:
"ShowTiles"
,
"shortDescription"
:
"Show tiles"
,
"type"
:
"bool"
,
"defaultValue"
:
true
},
{
"name"
:
"BorderPolygonOffset"
,
"shortDescription"
:
"The distance between the measurement area and it's enclosing polygon"
,
...
...
src/Wima/Snake/SnakeThread.cc
View file @
a0c951cb
This diff is collapsed.
Click to expand it.
src/Wima/Snake/SnakeTile.cpp
View file @
a0c951cb
#include "SnakeTile.h"
SnakeTile
::
SnakeTile
(
)
:
WimaAreaData
(
)
{}
SnakeTile
::
SnakeTile
(
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{}
SnakeTile
::
SnakeTile
(
const
SnakeTile
&
other
,
QObject
*
parent
)
:
WimaAreaData
(
parent
)
{
...
...
src/Wima/Snake/SnakeTile.h
View file @
a0c951cb
...
...
@@ -4,7 +4,7 @@
class
SnakeTile
:
public
WimaAreaData
{
public:
SnakeTile
();
SnakeTile
(
QObject
*
parent
=
nullptr
);
SnakeTile
(
const
SnakeTile
&
other
,
QObject
*
parent
=
nullptr
);
QString
type
()
const
{
return
"Tile"
;
}
...
...
src/Wima/Snake/snake.cpp
View file @
a0c951cb
This diff is collapsed.
Click to expand it.
src/Wima/Snake/snake.h
View file @
a0c951cb
...
...
@@ -103,6 +103,7 @@ void toENU(const GeoPoint &origin, const GeoPoint &in, BoostPoint &out) {
out
.
set
<
1
>
(
y
);
(
void
)
z
;
}
template
<
class
GeoPoint
>
void
fromENU
(
const
GeoPoint
&
origin
,
const
BoostPoint
&
in
,
GeoPoint
&
out
)
{
GeographicLib
::
Geocentric
earth
(
GeographicLib
::
Constants
::
WGS84_a
(),
...
...
@@ -117,88 +118,6 @@ void fromENU(const GeoPoint &origin, const BoostPoint &in, GeoPoint &out) {
out
.
setAltitude
(
alt
);
}
void
polygonCenter
(
const
BoostPolygon
&
polygon
,
BoostPoint
&
center
);
bool
minimalBoundingBox
(
const
BoostPolygon
&
polygon
,
BoundingBox
&
minBBox
);
void
offsetPolygon
(
const
BoostPolygon
&
polygon
,
BoostPolygon
&
polygonOffset
,
double
offset
);
void
graphFromPolygon
(
const
BoostPolygon
&
polygon
,
const
BoostLineString
&
vertices
,
Matrix
<
double
>
&
graph
);
void
toDistanceMatrix
(
Matrix
<
double
>
&
graph
);
bool
dijkstraAlgorithm
(
const
size_t
numElements
,
size_t
startIndex
,
size_t
endIndex
,
std
::
vector
<
size_t
>
&
elementPath
,
std
::
function
<
double
(
const
size_t
,
const
size_t
)
>
distanceDij
);
void
shortestPathFromGraph
(
const
Matrix
<
double
>
&
graph
,
size_t
startIndex
,
size_t
endIndex
,
std
::
vector
<
size_t
>
&
pathIdx
);
//=========================================================================
// Scenario.
//=========================================================================
typedef
bu
::
quantity
<
bu
::
si
::
length
>
Length
;
typedef
bu
::
quantity
<
bu
::
si
::
area
>
Area
;
typedef
bu
::
quantity
<
bu
::
si
::
plane_angle
>
Angle
;
class
Scenario
{
public:
Scenario
();
void
setMeasurementArea
(
const
BoostPolygon
&
area
);
void
setServiceArea
(
const
BoostPolygon
&
area
);
void
setCorridor
(
const
BoostPolygon
&
area
);
const
BoundingBox
&
mAreaBoundingBox
()
const
;
const
BoostPolygon
&
measurementArea
()
const
;
const
BoostPolygon
&
serviceArea
()
const
;
const
BoostPolygon
&
corridor
()
const
;
BoostPolygon
&
measurementArea
();
BoostPolygon
&
serviceArea
();
BoostPolygon
&
corridor
();
Length
tileWidth
()
const
;
void
setTileWidth
(
Length
tileWidth
);
Length
tileHeight
()
const
;
void
setTileHeight
(
Length
tileHeight
);
Area
minTileArea
()
const
;
void
setMinTileArea
(
Area
minTileArea
);
const
BoostPolygon
&
joinedArea
()
const
;
const
vector
<
BoostPolygon
>
&
tiles
()
const
;
const
BoostLineString
&
tileCenterPoints
()
const
;
const
BoundingBox
&
measurementAreaBBox
()
const
;
const
BoostPoint
&
homePositon
()
const
;
bool
update
();
mutable
string
errorString
;
private:
bool
_calculateBoundingBox
()
const
;
bool
_calculateTiles
()
const
;
bool
_calculateJoinedArea
()
const
;
Length
_tileWidth
;
Length
_tileHeight
;
Area
_minTileArea
;
mutable
bool
_needsUpdate
;
BoostPolygon
_mArea
;
BoostPolygon
_sArea
;
BoostPolygon
_corridor
;
mutable
BoostPolygon
_jArea
;
mutable
BoundingBox
_mAreaBoundingBox
;
mutable
vector
<
BoostPolygon
>
_tiles
;
mutable
BoostLineString
_tileCenterPoints
;
mutable
BoostPoint
_homePosition
;
};
template
<
class
GeoPoint
,
template
<
class
,
class
...
>
class
Container
>
void
areaToEnu
(
const
GeoPoint
&
origin
,
const
Container
<
GeoPoint
>
&
in
,
BoostPolygon
&
out
)
{
...
...
@@ -220,25 +139,43 @@ void areaFromEnu(const GeoPoint &origin, BoostPolygon &in,
}
}
bool
joinAreas
(
const
std
::
vector
<
BoostPolygon
>
&
areas
,
BoostPolygon
&
joinedArea
);
void
polygonCenter
(
const
BoostPolygon
&
polygon
,
BoostPoint
&
center
);
bool
minimalBoundingBox
(
const
BoostPolygon
&
polygon
,
BoundingBox
&
minBBox
);
void
offsetPolygon
(
const
BoostPolygon
&
polygon
,
BoostPolygon
&
polygonOffset
,
double
offset
);
void
graphFromPolygon
(
const
BoostPolygon
&
polygon
,
const
BoostLineString
&
vertices
,
Matrix
<
double
>
&
graph
);
void
toDistanceMatrix
(
Matrix
<
double
>
&
graph
);
bool
dijkstraAlgorithm
(
const
size_t
numElements
,
size_t
startIndex
,
size_t
endIndex
,
std
::
vector
<
size_t
>
&
elementPath
,
std
::
function
<
double
(
const
size_t
,
const
size_t
)
>
distanceDij
);
void
shortestPathFromGraph
(
const
Matrix
<
double
>
&
graph
,
size_t
startIndex
,
size_t
endIndex
,
std
::
vector
<
size_t
>
&
pathIdx
);
//========================================================================================
// flight_plan
//========================================================================================
typedef
bu
::
quantity
<
bu
::
si
::
length
>
Length
;
typedef
bu
::
quantity
<
bu
::
si
::
area
>
Area
;
typedef
bu
::
quantity
<
bu
::
si
::
plane_angle
>
Angle
;
namespace
flight_plan
{
bool
joinedArea
(
const
std
::
vector
<
BoostPolygon
*>
&
areas
,
BoostPolygon
&
jArea
);
bool
joinedArea
(
const
BoostPolygon
&
mArea
,
const
BoostPolygon
&
sArea
,
const
BoostPolygon
&
corridor
,
BoostPolygon
&
jArea
,
std
::
string
&
errorString
);
bool
tiles
(
const
BoostPolygon
&
area
,
Length
tileHeight
,
Length
tileWidth
,
Area
minTileArea
,
std
::
vector
<
BoostPolygon
>
&
tiles
,
BoundingBox
&
bbox
,
std
::
string
&
errorString
);
using
Transects
=
vector
<
BoostLineString
>
;
using
Progress
=
vector
<
int
>
;
using
Route
=
vector
<
BoostPoint
>
;
bool
transectsFromScenario
(
Length
distance
,
Length
minLength
,
Angle
angle
,
const
Scenario
&
scenario
,
const
Progress
&
p
,
Transects
&
t
,
string
&
errorString
);
const
BoostPolygon
&
mArea
,
const
std
::
vector
<
BoostPolygon
>
&
tiles
,
const
Progress
&
p
,
Transects
&
t
,
string
&
errorString
);
bool
route
(
const
BoostPolygon
&
area
,
const
Transects
&
transects
,
Transects
&
transectsRouted
,
Route
&
route
,
string
&
errorString
);
}
// namespace flight_plan
namespace
detail
{
const
double
offsetConstant
=
...
...
src/WimaView/WimaMeasurementAreaEditor.qml
View file @
a0c951cb
...
...
@@ -43,7 +43,7 @@ Rectangle {
SectionHeader
{
id
:
settingsHeader
text
:
qsTr
(
"
Settings
"
)
text
:
qsTr
(
"
General
"
)
}
Column
{
...
...
@@ -79,12 +79,18 @@ Rectangle {
}
}
// Column - Settings
SectionHeader
{
id
:
snake
Header
text
:
qsTr
(
"
Snake
"
)
id
:
tiles
Header
text
:
qsTr
(
"
Tiles
"
)
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
tilesHeader
.
checked
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
...
...
@@ -92,44 +98,69 @@ Rectangle {
rowSpacing
:
_margin
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Tile
Height
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Height
"
)
}
FactTextField
{
//fact: areaItem.borderPolygonOffse
t
fact
:
areaItem
.
tileHeigh
t
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Tile
Width
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Width
"
)
}
FactTextField
{
//fact: areaItem.borderPolygonOffset
fact
:
areaItem
.
tileWidth
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Min.
Tile
Area
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Min. Area
"
)
}
FactTextField
{
//fact: areaItem.borderPolygonOffset
fact
:
areaItem
.
minTileArea
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Transect Distance
"
)
}
FactCheckBox
{
text
:
qsTr
(
"
Show Tiles
"
)
fact
:
areaItem
.
showTiles
}
}
// Tile GridLayout
}
// Tile Column
SectionHeader
{
id
:
transectsHeader
text
:
qsTr
(
"
Transects
"
)
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
transectsHeader
.
checked
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columnSpacing
:
_margin
rowSpacing
:
_margin
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Distance
"
)
}
FactTextField
{
//fact: areaItem.borderPolygonOffset
fact
:
areaItem
.
transectDistance
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Min.
Transect
Length
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Min. Length
"
)
}
FactTextField
{
//fact: areaItem.borderPolygonOffset
fact
:
areaItem
.
minTransectLength
Layout.fillWidth
:
true
}
}
}
// Transects GridLayout
}
// Transects Column
}
// Snake
SectionHeader
{
id
:
statsHeader
...
...
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