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
da286265
Commit
da286265
authored
Jan 14, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CircularSurvey::rebuildTransectsPhase1 split in slow and fast version
parent
46eb801f
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
320 additions
and
224 deletions
+320
-224
TransectStyleComplexItem.cc
src/MissionManager/TransectStyleComplexItem.cc
+3
-5
CircularSurvey.SettingsGroup.json
src/Wima/CircularSurvey.SettingsGroup.json
+2
-1
CircularSurveyComplexItem.cc
src/Wima/CircularSurveyComplexItem.cc
+308
-113
CircularSurveyComplexItem.h
src/Wima/CircularSurveyComplexItem.h
+3
-3
OptimisationTools_delLater.cc
src/Wima/OptimisationTools_delLater.cc
+0
-90
CircularSurveyMapVisual.qml
src/WimaView/CircularSurveyMapVisual.qml
+3
-11
WimaMapPolygonVisuals.qml
src/WimaView/WimaMapPolygonVisuals.qml
+1
-1
No files found.
src/MissionManager/TransectStyleComplexItem.cc
View file @
da286265
...
...
@@ -357,12 +357,10 @@ void TransectStyleComplexItem::_rebuildTransects(void)
return
;
}
//CALLGRIND_TOGGLE_COLLECT;
//auto startTime = std::chrono::high_resolution_clock::now();
auto
startTime
=
std
::
chrono
::
high_resolution_clock
::
now
();
_rebuildTransectsPhase1
();
//auto delta = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
//qWarning() << "TransectStyleComplexItem::_rebuildTransects(): time: " << delta << " us";
//CALLGRIND_TOGGLE_COLLECT;
auto
delta
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
startTime
).
count
();
qWarning
()
<<
"TransectStyleComplexItem::_rebuildTransects(): time: "
<<
delta
<<
" us"
;
if
(
_followTerrain
)
{
// Query the terrain data. Once available terrain heights will be calculated
...
...
src/Wima/CircularSurvey.SettingsGroup.json
View file @
da286265
...
...
@@ -44,6 +44,7 @@
"shortDescription"
:
"The maximum number of waypoints the circular survey can containt. To many waypoints cause a performance hit."
,
"type"
:
"uint32"
,
"defaultValue"
:
2000
,
"min"
:
1
"min"
:
1
,
"max"
:
20000
}
]
src/Wima/CircularSurveyComplexItem.cc
View file @
da286265
This diff is collapsed.
Click to expand it.
src/Wima/CircularSurveyComplexItem.h
View file @
da286265
...
...
@@ -28,7 +28,6 @@ public:
Q_PROPERTY
(
bool
isInitialized
READ
isInitialized
WRITE
setIsInitialized
NOTIFY
isInitializedChanged
)
Q_INVOKABLE
void
resetReference
(
void
);
Q_INVOKABLE
void
setReferencePointBeingChanged
(
bool
changeing
);
// used by gui to indicate a changeing reference point (dagging by user)
// Property setters
void
setRefPoint
(
const
QGeoCoordinate
&
refPt
);
...
...
@@ -90,9 +89,11 @@ signals:
private
slots
:
// Overrides from TransectStyleComplexItem
void
_rebuildTransectsPhase1
(
void
)
final
;
// do not call this function, it is called by TransectStyleComplexItem::_rebuildTransects()
void
_rebuildTransectsSlow
(
void
);
// the slow version of _rebuildTransectsPhase1 which properly connects the _transects
void
_recalcComplexDistance
(
void
)
final
;
void
_recalcCameraShots
(
void
)
final
;
void
_reverseTransects
(
void
);
bool
_shortestPath
(
const
QGeoCoordinate
&
start
,
const
QGeoCoordinate
&
destination
,
QVector
<
QGeoCoordinate
>
shortestPath
);
signals:
...
...
@@ -121,8 +122,7 @@ private:
bool
_referencePointBeingChanged
;
// is set to true by gui, if user is changeing the reference point
int
_updateCounter
;
int
_transectsDiry
;
};
...
...
src/Wima/OptimisationTools_delLater.cc
deleted
100644 → 0
View file @
46eb801f
#include "OptimisationTools.h"
#include <QPointF>
namespace
OptimisationTools
{
namespace
{
}
bool
dijkstraAlgorithm
(
const
int
numNodes
,
const
int
startIndex
,
const
int
endIndex
,
QVector
<
int
>
&
elementPath
,
std
::
function
<
double
(
const
int
,
const
int
)
>
distance
)
{
if
(
numNodes
<
0
||
startIndex
<
0
||
endIndex
<
0
||
endIndex
>=
numNodes
||
startIndex
>=
numNodes
||
endIndex
==
startIndex
)
{
return
false
;
}
// distanceToStart[i] contains the distance of element[i] to element[startIndex] (after successful algorithm termination)
QVector
<
double
>
distanceToStart
(
numNodes
,
std
::
numeric_limits
<
qreal
>::
infinity
());
// elementPredecessor[i] contains the predecessor of element[i]
QVector
<
int
>
elementPredecessor
(
numNodes
,
-
1
);
// Elements will be successively removed from this list during the execution of the Dijkstra Algorithm.
QVector
<
int
>
workingSet
;
workingSet
.
reserve
(
numNodes
);
//fill workingSet with 0, 1, ..., numNodes-1
for
(
int
i
=
0
;
i
<
numNodes
;
i
++
)
workingSet
.
append
(
i
);
distanceToStart
[
startIndex
]
=
0
;
// Dijkstra Algorithm
// https://de.wikipedia.org/wiki/Dijkstra-Algorithmus
while
(
workingSet
.
size
()
>
0
)
{
// serach Node with minimal distance
double
minDist
=
std
::
numeric_limits
<
qreal
>::
infinity
();
int
minIndex
=
-
1
;
// index of element with least distance to element[startIndex]
for
(
int
i
=
0
;
i
<
workingSet
.
size
();
i
++
)
{
int
e
=
workingSet
[
i
];
double
dist
=
distanceToStart
[
e
];
if
(
dist
<
minDist
)
{
minDist
=
dist
;
minIndex
=
i
;
}
}
if
(
minIndex
==
-
1
)
return
false
;
int
u
=
workingSet
.
takeAt
(
minIndex
);
if
(
u
==
endIndex
)
// shortest path found
break
;
//update distance
double
distanceU
=
distanceToStart
[
u
];
for
(
int
i
=
0
;
i
<
workingSet
.
size
();
i
++
)
{
int
v
=
workingSet
[
i
];
double
dist
=
distance
(
u
,
v
);
// is ther a alternative path which is shorter?
double
alternative
=
distanceU
+
dist
;
if
(
alternative
<
distanceToStart
[
v
])
{
distanceToStart
[
v
]
=
alternative
;
elementPredecessor
[
v
]
=
u
;
}
}
}
// end Djikstra Algorithm
// reverse assemble elementPath
int
e
=
endIndex
;
while
(
1
)
{
if
(
e
==
-
1
)
{
if
(
elementPath
[
0
]
==
startIndex
)
// check if starting point was reached
break
;
return
false
;
}
elementPath
.
prepend
(
e
);
//Update Node
e
=
elementPredecessor
[
e
];
}
return
true
;
}
// end anonymous namespace
}
// end OptimisationTools namespace
src/WimaView/CircularSurveyMapVisual.qml
View file @
da286265
...
...
@@ -103,7 +103,7 @@ Item {
_destroyVisualElements
()
}
QGC
MapPolygonVisuals
{
Wima
MapPolygonVisuals
{
id
:
mapPolygonVisuals
qgcView
:
_root
.
qgcView
mapControl
:
map
...
...
@@ -179,7 +179,6 @@ Item {
property
var
refPoint
:
_missionItem
.
refPoint
onCoordinateChanged
:
_missionItem
.
refPoint
=
coordinate
onRefPointChanged
:
{
if
(
refPoint
!==
coordinate
)
{
coordinate
=
refPoint
...
...
@@ -188,17 +187,10 @@ Item {
onClicked
:
{
_root
.
clicked
(
_missionItem
.
sequenceNumber
)
_missionItem
.
setReferencePointBeingChanged
(
true
)
}
onDragClicked
:
{
// replace with entered
_missionItem
.
setReferencePointBeingChanged
(
true
)
console
.
log
(
'
onDragClicked
'
)
}
onDragReleased
:
{
// replace with exited
_missionItem
.
setReferencePointBeingChanged
(
false
)
console
.
log
(
'
onDragReleased
'
)
onDragReleased
:
{
_missionItem
.
refPoint
=
coordinate
}
}
}
...
...
src/WimaView/WimaMapPolygonVisuals.qml
View file @
da286265
...
...
@@ -20,7 +20,7 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
ShapeFileHelper
1.0
///
QGC
MapPolygon map visuals
///
Wima
MapPolygon map visuals
Item
{
id
:
_root
...
...
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