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
93c53e2b
Commit
93c53e2b
authored
Nov 10, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix entry point problems
parent
bb27f2be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
96 deletions
+13
-96
Survey.SettingsGroup.json
src/MissionManager/Survey.SettingsGroup.json
+1
-1
SurveyMissionItem.cc
src/MissionManager/SurveyMissionItem.cc
+12
-95
No files found.
src/MissionManager/Survey.SettingsGroup.json
View file @
93c53e2b
...
@@ -162,7 +162,7 @@
...
@@ -162,7 +162,7 @@
"name"
:
"GridEntryLocation"
,
"name"
:
"GridEntryLocation"
,
"shortDescription"
:
"Location for entry point into survey area"
,
"shortDescription"
:
"Location for entry point into survey area"
,
"type"
:
"uint32"
,
"type"
:
"uint32"
,
"enumStrings"
:
"Position 1,
Position 2, Position 3,
Position 4"
,
"enumStrings"
:
"Position 1,
Position 2,Position 3,
Position 4"
,
"enumValues"
:
"0,1,2,3"
,
"enumValues"
:
"0,1,2,3"
,
"defaultValue"
:
0
"defaultValue"
:
0
}
}
...
...
src/MissionManager/SurveyMissionItem.cc
View file @
93c53e2b
...
@@ -615,66 +615,26 @@ void SurveyMissionItem::_adjustTransectsToEntryPointLocation(QList<QList<QGeoCoo
...
@@ -615,66 +615,26 @@ void SurveyMissionItem::_adjustTransectsToEntryPointLocation(QList<QList<QGeoCoo
return
;
return
;
}
}
// First determine what location the current entry point is at
int
entryLocation
=
_gridEntryLocationFact
.
rawValue
().
toInt
();
bool
reversePoints
=
false
;
QGeoCoordinate
&
firstTransectEntry
=
transects
.
first
().
first
();
bool
reverseTransects
=
false
;
QGeoCoordinate
&
firstTransectExit
=
transects
.
first
().
last
();
QGeoCoordinate
&
lastTransectExit
=
transects
.
last
().
last
();
bool
northSouthTransects
=
_gridAngleIsNorthSouthTransects
();
bool
entryPointBottom
;
bool
entryPointLeft
;
qCDebug
(
SurveyMissionItemLog
)
<<
"Original entry point"
<<
transects
.
first
().
first
();
qCDebug
(
SurveyMissionItemLog
)
<<
"northSouthTransects"
<<
northSouthTransects
;
if
(
northSouthTransects
)
{
double
firstTransectAzimuth
=
firstTransectEntry
.
azimuthTo
(
firstTransectExit
);
qCDebug
(
SurveyMissionItemLog
)
<<
"firstTransectAzimuth"
<<
firstTransectAzimuth
;
entryPointBottom
=
(
firstTransectAzimuth
>=
0.0
&&
firstTransectAzimuth
<
90.0
)
||
(
firstTransectAzimuth
>
270.0
&&
firstTransectAzimuth
<=
360.0
);
qCDebug
(
SurveyMissionItemLog
)
<<
(
entryPointBottom
?
"Entry point is at bottom"
:
"Entry point is at top"
);
double
entryToExitAzimuth
=
firstTransectEntry
.
azimuthTo
(
lastTransectExit
);
qCDebug
(
SurveyMissionItemLog
)
<<
"entryToExitAzimuth"
<<
entryToExitAzimuth
;
entryPointLeft
=
entryToExitAzimuth
<=
180.0
;
qCDebug
(
SurveyMissionItemLog
)
<<
(
entryPointLeft
?
"Entry point is at left"
:
"Entry point is at right"
);
}
else
{
double
firstTransectAzimuth
=
firstTransectEntry
.
azimuthTo
(
firstTransectExit
);
qCDebug
(
SurveyMissionItemLog
)
<<
"firstTransectAzimuth"
<<
firstTransectAzimuth
;
entryPointLeft
=
firstTransectAzimuth
<=
180.0
;
qCDebug
(
SurveyMissionItemLog
)
<<
(
entryPointLeft
?
"Entry point is at left"
:
"Entry point is at right"
);
double
entryToExitAzimuth
=
firstTransectEntry
.
azimuthTo
(
lastTransectExit
);
if
(
entryLocation
==
EntryLocationBottomLeft
||
entryLocation
==
EntryLocationBottomRight
)
{
qCDebug
(
SurveyMissionItemLog
)
<<
"entryToExitAzimuth"
<<
entryToExitAzimuth
;
reversePoints
=
true
;
entryPointBottom
=
(
entryToExitAzimuth
>=
0.0
&&
entryToExitAzimuth
<
90.0
)
||
(
entryToExitAzimuth
>
270.0
&&
entryToExitAzimuth
<=
360.0
);
qCDebug
(
SurveyMissionItemLog
)
<<
(
entryPointBottom
?
"Entry point is at bottom"
:
"Entry point is at top"
);
}
}
if
(
entryLocation
==
EntryLocationTopRight
||
entryLocation
==
EntryLocationBottomRight
)
{
// Now adjust the transects such that the entry point matches the requested location
reverseTransects
=
true
;
int
entryLocation
=
_gridEntryLocationFact
.
rawValue
().
toInt
();
bool
reverseTransects
;
bool
reversePoints
;
if
(
northSouthTransects
)
{
reversePoints
=
((
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationTopRight
)
&&
entryPointBottom
)
||
((
entryLocation
==
EntryLocationBottomLeft
||
entryLocation
==
EntryLocationBottomRight
)
&&
!
entryPointBottom
);
reverseTransects
=
((
entryLocation
==
EntryLocationTopRight
||
entryLocation
==
EntryLocationBottomRight
)
&&
entryPointLeft
)
||
((
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationBottomLeft
)
&&
!
entryPointLeft
);
}
else
{
reverseTransects
=
((
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationTopRight
)
&&
entryPointBottom
)
||
((
entryLocation
==
EntryLocationBottomLeft
||
entryLocation
==
EntryLocationBottomRight
)
&&
!
entryPointBottom
);
reversePoints
=
((
entryLocation
==
EntryLocationTopRight
||
entryLocation
==
EntryLocationBottomRight
)
&&
entryPointLeft
)
||
((
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationBottomLeft
)
&&
!
entryPointLeft
);
}
}
if
(
reversePoints
)
{
if
(
reversePoints
)
{
qCDebug
(
SurveyMissionItemLog
)
<<
"Reverse Points"
;
qCDebug
(
SurveyMissionItemLog
)
<<
"Reverse Points"
;
_reverseInternalTransectPoints
(
transects
);
_reverseInternalTransectPoints
(
transects
);
}
}
if
(
reverseTransects
)
{
if
(
reverseTransects
)
{
// The only way we should end up here is if there is a bug in the original grid line generation
qCDebug
(
SurveyMissionItemLog
)
<<
"Reverse Transects"
;
qCDebug
(
SurveyMissionItemLog
)
<<
"Not Reverse Transects"
;
_reverseTransectOrder
(
transects
);
//_reverseTransectOrder(transects);
}
}
qCDebug
(
SurveyMissionItemLog
)
<<
"Modified entry point"
<<
transects
.
first
().
first
();
qCDebug
(
SurveyMissionItemLog
)
<<
"Modified entry point"
<<
transects
.
first
().
first
();
}
}
...
@@ -965,11 +925,9 @@ int SurveyMissionItem::_gridGenerator(const QList<QPointF>& polygonPoints, QLis
...
@@ -965,11 +925,9 @@ int SurveyMissionItem::_gridGenerator(const QList<QPointF>& polygonPoints, QLis
// bounding box to guarantee intersection.
// bounding box to guarantee intersection.
QList
<
QLineF
>
lineList
;
QList
<
QLineF
>
lineList
;
bool
northSouthTransects
=
_gridAngleIsNorthSouthTransects
();
int
entryLocation
=
_gridEntryLocationFact
.
rawValue
().
toInt
();
// Transects are generated to be as long as the largest width/height of the bounding rect plus some fudge factor.
// Transects are generated to be as long as the largest width/height of the bounding rect plus some fudge factor.
// This way they will always be guaranteed to intersect with a poly
ong
edge no matter what angle they are rotated to.
// This way they will always be guaranteed to intersect with a poly
gon
edge no matter what angle they are rotated to.
// They are initially generated with the transects flowing from west to east and then points within the transect north to south.
// They are initially generated with the transects flowing from west to east and then points within the transect north to south.
double
maxWidth
=
qMax
(
boundingRect
.
width
(),
boundingRect
.
height
())
+
100.0
;
double
maxWidth
=
qMax
(
boundingRect
.
width
(),
boundingRect
.
height
())
+
100.0
;
double
halfWidth
=
maxWidth
/
2.0
;
double
halfWidth
=
maxWidth
/
2.0
;
...
@@ -983,47 +941,6 @@ int SurveyMissionItem::_gridGenerator(const QList<QPointF>& polygonPoints, QLis
...
@@ -983,47 +941,6 @@ int SurveyMissionItem::_gridGenerator(const QList<QPointF>& polygonPoints, QLis
transectX
+=
gridSpacing
;
transectX
+=
gridSpacing
;
}
}
// Adjust the transects and points within transect according to the entry location
bool
reversePoints
=
false
;
bool
reverseTransects
=
false
;
if
(
northSouthTransects
)
{
// Transects start north and end south
// Internal transects points are generated north to south so they are correct
if
(
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationBottomLeft
)
{
// Transects lines start west and end east
// Nothing to do in this case since this is how they were initially generated
}
else
{
// Transects start east and end west
// Need to reverse order of transects
reverseTransects
=
true
;
}
}
else
{
// Transects start south and end north
// Need to reverse transects
reverseTransects
=
true
;
if
(
entryLocation
==
EntryLocationTopLeft
||
entryLocation
==
EntryLocationBottomLeft
)
{
// Transects start west and end east
// Nothing to do in this case since this is how they were initially generated
}
else
{
// Transects start east and end west
// Need to reverse order of transects
reverseTransects
=
true
;
}
}
if
(
reversePoints
)
{
for
(
int
i
=
0
;
i
<
lineList
.
count
();
i
++
)
{
lineList
[
i
]
=
QLineF
(
lineList
[
i
].
p2
(),
lineList
[
i
].
p1
());
}
}
if
(
reverseTransects
)
{
QList
<
QLineF
>
newLineList
;
for
(
int
i
=
0
;
i
<
lineList
.
count
();
i
++
)
{
newLineList
.
prepend
(
lineList
[
i
]);
}
lineList
=
newLineList
;
}
// Now intersect the lines with the polygon
// Now intersect the lines with the polygon
QList
<
QLineF
>
intersectLines
;
QList
<
QLineF
>
intersectLines
;
#if 1
#if 1
...
...
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