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
5d91598d
Commit
5d91598d
authored
Oct 16, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service area depot issue solved.
parent
0397d607
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
205 additions
and
163 deletions
+205
-163
QGCMapPolygon.h
src/MissionManager/QGCMapPolygon.h
+124
-118
WimaServiceArea.cc
src/Wima/Geometry/WimaServiceArea.cc
+28
-2
WimaServiceArea.h
src/Wima/Geometry/WimaServiceArea.h
+4
-2
EmptyManager.cpp
src/Wima/WaypointManager/EmptyManager.cpp
+4
-4
DragCoordinate.qml
src/WimaView/DragCoordinate.qml
+12
-13
WimaServiceAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
+33
-24
No files found.
src/MissionManager/QGCMapPolygon.h
View file @
5d91598d
This diff is collapsed.
Click to expand it.
src/Wima/Geometry/WimaServiceArea.cc
View file @
5d91598d
...
...
@@ -23,10 +23,16 @@ WimaServiceArea &WimaServiceArea::operator=(const WimaServiceArea &other) {
return
*
this
;
}
const
QGeoCoordinate
&
WimaServiceArea
::
depot
()
const
{
return
_depot
;
}
QGeoCoordinate
WimaServiceArea
::
depotQml
()
const
{
return
_depot
;
}
bool
WimaServiceArea
::
setDepot
(
const
QGeoCoordinate
&
coordinate
)
{
if
(
_depot
!=
coordinate
)
{
if
(
_depot
.
latitude
()
!=
coordinate
.
latitude
()
||
_depot
.
longitude
()
!=
coordinate
.
longitude
())
{
if
(
this
->
containsCoordinate
(
coordinate
))
{
_depot
=
coordinate
;
_depot
.
setAltitude
(
0
);
emit
depotChanged
();
return
true
;
}
...
...
@@ -90,7 +96,27 @@ void WimaServiceArea::init() {
this
->
setObjectName
(
wimaServiceAreaName
);
connect
(
this
,
&
WimaArea
::
pathChanged
,
[
this
]
{
if
(
!
this
->
_depot
.
isValid
()
||
!
this
->
containsCoordinate
(
this
->
_depot
))
{
this
->
setDepot
(
this
->
center
());
if
(
this
->
containsCoordinate
(
this
->
center
()))
{
// Use center.
this
->
setDepot
(
this
->
center
());
}
else
if
(
this
->
_depot
.
isValid
())
{
// Use nearest coordinate.
auto
minDist
=
std
::
numeric_limits
<
double
>::
infinity
();
auto
minIt
=
this
->
pathReference
().
begin
();
for
(
auto
it
=
this
->
pathReference
().
begin
();
it
<
this
->
pathReference
().
end
();
++
it
)
{
const
auto
vertex
=
it
->
value
<
QGeoCoordinate
>
();
auto
d
=
vertex
.
distanceTo
(
this
->
_depot
);
if
(
d
<
minDist
)
{
minDist
=
d
;
minIt
=
it
;
}
}
this
->
setDepot
(
minIt
->
value
<
QGeoCoordinate
>
());
}
else
if
(
this
->
pathReference
().
size
()
>
0
)
{
// Use first coordinate.
this
->
setDepot
(
this
->
pathReference
().
value
(
0
).
value
<
QGeoCoordinate
>
());
}
}
});
}
src/Wima/Geometry/WimaServiceArea.h
View file @
5d91598d
...
...
@@ -11,14 +11,16 @@ public:
WimaServiceArea
(
const
WimaServiceArea
&
other
,
QObject
*
parent
);
WimaServiceArea
&
operator
=
(
const
WimaServiceArea
&
other
);
Q_PROPERTY
(
QGeoCoordinate
depot
READ
depot
WRITE
setDepot
NOTIFY
depotChanged
)
Q_PROPERTY
(
QGeoCoordinate
depot
READ
depotQml
WRITE
setDepot
NOTIFY
depotChanged
)
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaServiceAreaMapVisual.qml"
;
}
QString
editorQML
(
void
)
const
{
return
"WimaServiceAreaEditor.qml"
;
}
// Property acessors
const
QGeoCoordinate
&
depot
(
void
)
const
{
return
_depot
;
}
const
QGeoCoordinate
&
depot
(
void
)
const
;
QGeoCoordinate
depotQml
(
void
)
const
;
// Member Methodes
void
saveToJson
(
QJsonObject
&
json
);
...
...
src/Wima/WaypointManager/EmptyManager.cpp
View file @
5d91598d
...
...
@@ -7,12 +7,12 @@ WaypointManager::EmptyManager::EmptyManager(Settings &settings, AreaInterface &)
void
WaypointManager
::
EmptyManager
::
clear
()
{}
bool
WaypointManager
::
EmptyManager
::
update
()
{}
bool
WaypointManager
::
EmptyManager
::
update
()
{
return
true
;
}
bool
WaypointManager
::
EmptyManager
::
next
()
{}
bool
WaypointManager
::
EmptyManager
::
next
()
{
return
true
;
}
bool
WaypointManager
::
EmptyManager
::
previous
()
{}
bool
WaypointManager
::
EmptyManager
::
previous
()
{
return
true
;
}
bool
WaypointManager
::
EmptyManager
::
reset
()
{}
bool
WaypointManager
::
EmptyManager
::
reset
()
{
return
true
;
}
}
// namespace WaypointManager
src/WimaView/DragCoordinate.qml
View file @
5d91598d
...
...
@@ -29,10 +29,8 @@ Item {
property
bool
checked
property
string
label
:
"
Reference
"
property
var
_itemVisual
property
bool
_itemVisualShowing
:
false
property
var
_dragArea
property
bool
_dragAreaShowing
:
false
property
var
_itemVisual
:
undefined
property
var
_dragArea
:
undefined
signal
clicked
()
signal
released
()
...
...
@@ -45,31 +43,30 @@ Item {
signal
dragReleased
()
function
hideItemVisuals
()
{
if
(
_itemVisualShowing
)
{
if
(
_itemVisual
)
{
map
.
removeMapItem
(
_itemVisual
)
_itemVisual
.
destroy
()
_itemVisual
Showing
=
false
_itemVisual
=
undefined
}
}
function
showItemVisuals
()
{
if
(
!
_itemVisual
Showing
)
{
if
(
!
_itemVisual
)
{
_itemVisual
=
indicatorComponent
.
createObject
(
map
)
map
.
addMapItem
(
_itemVisual
)
_itemVisualShowing
=
true
}
}
function
hideDragArea
()
{
if
(
_dragArea
Showing
)
{
if
(
_dragArea
)
{
_dragArea
.
destroy
()
_dragArea
Showing
=
false
_dragArea
=
undefined
}
}
function
showDragArea
()
{
if
(
!
_dragArea
Showing
)
{
if
(
!
_dragArea
)
{
_dragArea
=
dragAreaComponent
.
createObject
(
map
)
_dragAreaShowing
=
true
}
}
...
...
@@ -102,7 +99,9 @@ Item {
itemIndicator
:
_itemVisual
Component.onCompleted
:
itemCoordinate
=
_root
.
coordinate
onItemCoordinateChanged
:
_root
.
coordinate
=
itemCoordinate
onItemCoordinateChanged
:
{
_root
.
coordinate
=
itemCoordinate
}
onDragStart
:
_root
.
dragStart
()
onDragStop
:
_root
.
dragStop
()
...
...
src/WimaView/WimaServiceAreaMapVisual.qml
View file @
5d91598d
...
...
@@ -26,35 +26,32 @@ Item {
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
property
var
_depot
property
bool
showDepot
:
areaItem
.
interactive
||
areaItem
.
borderPolygon
.
interactive
property
bool
_depotVisible
:
false
onShowDepotChanged
:
{
if
(
showDepot
){
if
(
!
_depotVisible
){
_addDepot
()
}
property
var
_depot
:
undefined
property
bool
_showDepot
:
areaItem
.
interactive
||
areaItem
.
borderPolygon
.
interactive
on_ShowDepotChanged
:
{
if
(
_showDepot
){
_addDepot
()
}
else
{
if
(
_depotVisible
){
_destroyDepot
()
}
_destroyDepot
()
}
}
signal
clicked
(
int
sequenceNumber
)
function
_addDepot
()
{
_depot
=
depotPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
_depot
)
_depotVisible
=
true
if
(
!
_depot
){
_depot
=
depotPointComponent
.
createObject
(
_root
)
map
.
addMapItem
(
_depot
)
}
}
function
_destroyDepot
()
{
if
(
_depot
){
map
.
removeMapItem
(
_depot
)
_depot
.
destroy
()
_depot
=
undefined
}
_depotVisible
=
false
}
/// Add an initial 4 sided polygon if there is none
...
...
@@ -104,7 +101,7 @@ Item {
Component.onCompleted
:
{
_addInitialPolygon
()
if
(
showDepot
){
if
(
_
showDepot
){
_addDepot
()
}
}
...
...
@@ -137,21 +134,33 @@ Item {
Component
{
id
:
depotPointComponent
DragCoordinate
{
property
var
depot
:
areaItem
.
depot
property
var
depot
:
_root
.
areaItem
.
depot
map
:
_root
.
map
qgcView
:
_root
.
qgcView
z
:
QGroundControl
.
zOrderMapItems
checked
:
showDepot
coordinate
:
depot
checked
:
_root
.
_
showDepot
coordinate
:
_root
.
areaItem
.
depot
label
:
"
Depot
"
onDragReleased
:
{
if
(
areaItem
.
containsCoordinate
(
coordinate
)){
areaItem
.
depot
=
coordinate
function
syncAndBind
(){
if
(
coordinate
.
latitude
!==
depot
.
latitude
||
coordinate
.
longitude
!==
depot
.
longitude
){
if
(
_root
.
areaItem
.
containsCoordinate
(
coordinate
)){
_root
.
areaItem
.
depot
=
coordinate
}
}
coordinate
=
Qt
.
binding
(
function
()
{
return
areaItem
.
depot
;
})
coordinate
=
Qt
.
binding
(
function
()
{
return
_root
.
areaItem
.
depot
})
}
onDragReleased
:
{
syncAndBind
()
}
Component.onCompleted
:
{
syncAndBind
()
}
}
}
...
...
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