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
d1d86825
Commit
d1d86825
authored
May 28, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
about to add poly join fkt
parent
d58b6cc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
3 deletions
+54
-3
WimaArea.cc
src/Wima/WimaArea.cc
+46
-1
WimaArea.h
src/Wima/WimaArea.h
+8
-2
No files found.
src/Wima/WimaArea.cc
View file @
d1d86825
#include "WimaArea.h"
const
double
WimaArea
::
numericalAccuracy
=
1e-3
;
// meters
WimaArea
::
WimaArea
(
QObject
*
parent
)
:
WimaArea
(
nullptr
,
parent
)
{
...
...
@@ -108,9 +110,52 @@ QGCMapPolygon* WimaArea::toQGCPolygon(WimaArea *poly)
}
}
QGCMapPolygon
*
WimaArea
::
joinPolygons
(
QList
<
QGCMapPolygon
*>
polyList
)
QGCMapPolygon
*
WimaArea
::
joinPolygons
(
QList
<
QGCMapPolygon
*>*
polyList
)
{
return
new
QGCMapPolygon
(
this
);
}
QGCMapPolygon
*
WimaArea
::
joinPolygons
(
QGCMapPolygon
*
poly1
,
QGCMapPolygon
*
poly2
)
{
return
new
QGCMapPolygon
(
this
);
}
bool
WimaArea
::
isDisjunct
(
QList
<
QGCMapPolygon
*>*
polyList
)
{
// needs improvement
if
(
polyList
!=
nullptr
){
for
(
int
i
=
0
;
i
<
polyList
->
size
()
-
1
;
i
++
)
{
QGCMapPolygon
*
currPoly
=
polyList
->
takeAt
(
i
);
for
(
int
j
=
i
+
1
;
i
<
polyList
->
size
();
j
++
)
{
if
(
isDisjunct
(
currPoly
,
polyList
->
takeAt
(
j
)))
{
return
false
;
}
}
}
return
true
;
}
else
{
qWarning
(
"WimaArea::isDisjunct(polyList): polyList == nullptr!"
);
return
false
;
}
}
bool
WimaArea
::
isDisjunct
(
QGCMapPolygon
*
poly1
,
QGCMapPolygon
*
poly2
)
{
if
(
poly1
!=
nullptr
&&
poly2
!=
nullptr
)
{
QGCMapPolygon
*
poly1Copy
=
new
QGCMapPolygon
(
this
);
poly1Copy
->
setPath
(
poly1
->
path
());
poly1Copy
->
offset
(
numericalAccuracy
);
// take numerical errors in account
for
(
int
i
=
0
;
i
<
poly2
->
count
();
i
++
){
if
(
poly1Copy
->
containsCoordinate
(
poly2
->
vertexCoordinate
(
i
))){
return
false
;
}
}
return
true
;
}
else
{
qWarning
(
"WimaArea::isDisjunct(poly1, poly2): poly1 == nullptr || poly2 == nullptr!"
);
return
false
;
}
}
src/Wima/WimaArea.h
View file @
d1d86825
...
...
@@ -40,8 +40,14 @@ public:
int
getClosestVertexIndex
(
QGeoCoordinate
coordinate
);
//iterates over all vertices in _polygon and returns that one closest to coordinate
QGeoCoordinate
getClosestVertex
(
QGeoCoordinate
coordinate
);
QGCMapPolygon
*
toQGCPolygon
(
WimaArea
*
poly
);
QGCMapPolygon
*
joinPolygons
(
QList
<
QGCMapPolygon
*>
polyList
);
QGCMapPolygon
*
toQGCPolygon
(
WimaArea
*
poly
);
QGCMapPolygon
*
joinPolygons
(
QList
<
QGCMapPolygon
*>*
polyList
);
QGCMapPolygon
*
joinPolygons
(
QGCMapPolygon
*
poly1
,
QGCMapPolygon
*
poly2
);
bool
isDisjunct
(
QList
<
QGCMapPolygon
*>*
polyList
);
bool
isDisjunct
(
QGCMapPolygon
*
poly1
,
QGCMapPolygon
*
poly2
);
// Accurracy used to compute isDisjunct
static
const
double
numericalAccuracy
;
signals:
void
maxAltitudeChanged
(
void
);
...
...
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