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
87ae0874
Commit
87ae0874
authored
Jun 18, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
befor editing WimaView.qml (allow only one masterController)
parent
8f6a4a95
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
389 additions
and
172 deletions
+389
-172
WimaArea.cc
src/Wima/WimaArea.cc
+2
-0
WimaController.cc
src/Wima/WimaController.cc
+129
-25
WimaController.h
src/Wima/WimaController.h
+9
-6
WimaToolBar.qml
src/WimaView/WimaToolBar.qml
+3
-3
WimaView.qml
src/WimaView/WimaView.qml
+191
-124
MainWindowInner.qml
src/ui/MainWindowInner.qml
+37
-10
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+18
-4
No files found.
src/Wima/WimaArea.cc
View file @
87ae0874
...
...
@@ -127,6 +127,8 @@ void WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly)
if
(
poly1
.
count
()
>=
3
&&
poly2
.
count
()
>=
3
)
{
joinedPoly
.
clear
();
poly1
.
verifyClockwiseWinding
();
poly2
.
verifyClockwiseWinding
();
...
...
src/Wima/WimaController.cc
View file @
87ae0874
...
...
@@ -45,7 +45,14 @@ void WimaController::setCurrentPolygonIndex(int index)
void
WimaController
::
removeArea
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_visualItems
->
count
()){
_visualItems
->
removeAt
(
index
);
WimaArea
*
area
=
qobject_cast
<
WimaArea
*>
(
_visualItems
->
removeAt
(
index
));
if
(
area
==
nullptr
)
{
qWarning
(
"WimaController::removeArea(): nullptr catched, internal error."
);
return
;
}
disconnect
(
area
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaController
::
updateJoinedArea
);
emit
visualItemsChanged
();
...
...
@@ -67,41 +74,88 @@ void WimaController::removeArea(int index)
}
void
WimaController
::
addGOperationArea
()
bool
WimaController
::
addGOperationArea
()
{
WimaGOperationArea
*
newPoly
=
new
WimaGOperationArea
(
this
);
_visualItems
->
append
(
newPoly
);
// check if opArea exists already
WimaGOperationArea
*
opArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaGOperationArea
*
currentArea
=
qobject_cast
<
WimaGOperationArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
)
{
opArea
=
currentArea
;
return
false
;
}
}
// create one if no opArea available
opArea
=
new
WimaGOperationArea
(
this
);
connect
(
opArea
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaController
::
updateJoinedArea
);
_visualItems
->
append
(
opArea
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
setCurrentPolygonIndex
(
newIndex
);
emit
visualItemsChanged
();
return
true
;
}
void
WimaController
::
addServiceArea
()
bool
WimaController
::
addServiceArea
()
{
WimaServiceArea
*
newPoly
=
new
WimaServiceArea
(
this
);
_visualItems
->
append
(
newPoly
);
// check if serArea exists already
WimaServiceArea
*
serArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaServiceArea
*
currentArea
=
qobject_cast
<
WimaServiceArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
)
{
serArea
=
currentArea
;
return
false
;
}
}
// create one if no serArea available
serArea
=
new
WimaServiceArea
(
this
);
connect
(
serArea
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaController
::
updateJoinedArea
);
_visualItems
->
append
(
serArea
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
setCurrentPolygonIndex
(
newIndex
);
emit
visualItemsChanged
();
return
true
;
}
void
WimaController
::
addVehicleCorridor
()
bool
WimaController
::
addVehicleCorridor
()
{
WimaVCorridor
*
corridor
=
new
WimaVCorridor
(
this
);
// check if corridor exists already
WimaVCorridor
*
corridor
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaVCorridor
*
currentArea
=
qobject_cast
<
WimaVCorridor
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
)
{
corridor
=
currentArea
;
return
false
;
}
}
// create one if no corridor available
corridor
=
new
WimaVCorridor
(
this
);
connect
(
corridor
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaController
::
updateJoinedArea
);
_visualItems
->
append
(
corridor
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
setCurrentPolygonIndex
(
newIndex
);
emit
visualItemsChanged
();
return
true
;
}
void
WimaController
::
removeAll
Areas
()
void
WimaController
::
removeAll
()
{
bool
changesApplied
=
false
;
while
(
_visualItems
->
count
()
>
0
)
{
_visualItems
->
removeAt
(
0
);
removeArea
(
0
);
changesApplied
=
true
;
}
_missionController
->
removeAll
();
_currentFile
=
""
;
emit
currentFileChanged
();
...
...
@@ -165,14 +219,7 @@ bool WimaController::updateMission()
break
;
}
}
// join service area and op area
WimaArea
joinedArea
;
if
(
corridor
!=
nullptr
)
{
WimaArea
::
join
(
*
corridor
,
*
serArea
,
joinedArea
);
joinedArea
.
join
(
*
opArea
);
}
else
{
WimaArea
::
join
(
*
serArea
,
*
opArea
,
joinedArea
);
}
#if debug
WimaArea
*
joinedAreaPt
=
new
WimaArea
(
joinedArea
,
this
);
...
...
@@ -180,10 +227,23 @@ bool WimaController::updateMission()
#endif
// extract survey if present
QmlObjectListModel
*
missionItems
=
_missionController
->
visualItems
();
SurveyComplexItem
*
oldSurveyItem
;
{
int
i
=
0
;
while
(
i
<
missionItems
->
count
()
)
{
oldSurveyItem
=
qobject_cast
<
SurveyComplexItem
*>
(
missionItems
->
get
(
i
));
if
(
oldSurveyItem
!=
nullptr
){
break
;
}
i
++
;
}
}
// reset visual items
_missionController
->
removeAll
();
QmlObjectListModel
*
missionItems
=
_missionController
->
visualItems
();
missionItems
=
_missionController
->
visualItems
();
// set home position to serArea center
MissionSettingsItem
*
settingsItem
=
qobject_cast
<
MissionSettingsItem
*>
(
missionItems
->
get
(
0
));
if
(
settingsItem
==
nullptr
){
...
...
@@ -205,13 +265,14 @@ bool WimaController::updateMission()
}
else
{
survey
->
surveyAreaPolygon
()
->
clear
();
survey
->
surveyAreaPolygon
()
->
appendVertices
(
opArea
->
coordinateList
());
//survey->
}
// calculate path from take off to opArea
QGeoCoordinate
start
=
serArea
->
center
();
QGeoCoordinate
end
=
survey
->
visualTransectPoints
().
first
().
value
<
QGeoCoordinate
>
();
QList
<
QGeoCoordinate
>
path
;
WimaArea
::
dijkstraPath
(
start
,
end
,
joinedArea
,
path
);
WimaArea
::
dijkstraPath
(
start
,
end
,
_
joinedArea
,
path
);
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
_missionController
->
insertSimpleMissionItem
(
path
.
value
(
i
),
i
+
1
);
index
++
;
...
...
@@ -221,7 +282,7 @@ bool WimaController::updateMission()
start
=
survey
->
visualTransectPoints
().
last
().
value
<
QGeoCoordinate
>
();
end
=
serArea
->
center
();
path
.
clear
();
WimaArea
::
dijkstraPath
(
start
,
end
,
joinedArea
,
path
);
WimaArea
::
dijkstraPath
(
start
,
end
,
_
joinedArea
,
path
);
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
_missionController
->
insertSimpleMissionItem
(
path
.
value
(
i
),
index
++
);
}
...
...
@@ -240,9 +301,6 @@ bool WimaController::updateMission()
}
}
//saveToFile("TestFile.wima");
//loadFromFile("TestFile.wima");
return
true
;
}
...
...
@@ -376,6 +434,7 @@ bool WimaController::loadFromFile(const QString &filename)
_currentFile
.
sprintf
(
"%s/%s.%s"
,
fileInfo
.
path
().
toLocal8Bit
().
data
(),
fileInfo
.
completeBaseName
().
toLocal8Bit
().
data
(),
wimaFileExtension
);
emit
currentFileChanged
();
updateJoinedArea
();
return
true
;
...
...
@@ -410,6 +469,51 @@ void WimaController::recalcPolygonInteractivity(int index)
}
}
void
WimaController
::
updateJoinedArea
()
{
// pick first WimaGOperationArea
WimaGOperationArea
*
opArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaGOperationArea
*
currentArea
=
qobject_cast
<
WimaGOperationArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
){
opArea
=
currentArea
;
break
;
}
}
if
(
opArea
==
nullptr
)
return
;
// pick first WimaServiceArea
WimaServiceArea
*
serArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaServiceArea
*
currentArea
=
qobject_cast
<
WimaServiceArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
){
serArea
=
currentArea
;
break
;
}
}
if
(
serArea
==
nullptr
)
return
;
// pick first WimaVCorridor
WimaVCorridor
*
corridor
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaVCorridor
*
currentArea
=
qobject_cast
<
WimaVCorridor
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
){
corridor
=
currentArea
;
break
;
}
}
// join service area, op area and corridor
if
(
corridor
!=
nullptr
)
{
WimaArea
::
join
(
*
corridor
,
*
serArea
,
_joinedArea
);
_joinedArea
.
join
(
*
opArea
);
}
else
{
WimaArea
::
join
(
*
serArea
,
*
opArea
,
_joinedArea
);
}
}
void
WimaController
::
resetAllInteractive
()
{
int
itemCount
=
_visualItems
->
count
();
...
...
src/Wima/WimaController.h
View file @
87ae0874
...
...
@@ -33,6 +33,7 @@ public:
Q_PROPERTY
(
QString
currentFile
READ
currentFile
NOTIFY
currentFileChanged
)
Q_PROPERTY
(
QStringList
loadNameFilters
READ
loadNameFilters
CONSTANT
)
Q_PROPERTY
(
QString
fileExtension
READ
fileExtension
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
joinedAreaCenter
READ
joinedAreaCenter
CONSTANT
)
// Property accessors
...
...
@@ -43,6 +44,7 @@ public:
QString
currentFile
(
void
)
const
{
return
_currentFile
;
}
QStringList
loadNameFilters
(
void
)
const
;
QString
fileExtension
(
void
)
const
{
return
wimaFileExtension
;
}
QGeoCoordinate
joinedAreaCenter
(
void
)
const
{
return
_joinedArea
.
center
();
}
...
...
@@ -52,14 +54,13 @@ public:
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void
setCurrentPolygonIndex
(
int
index
);
Q_INVOKABLE
void
addGOperationArea
();
Q_INVOKABLE
bool
addGOperationArea
();
/// Removes an area from _visualItems
/// @param index Index of the area to be removed
Q_INVOKABLE
void
removeArea
(
int
index
);
Q_INVOKABLE
void
addServiceArea
();
/// @return true if a vehicle corridor was added sucessfully and false otherwise.
Q_INVOKABLE
void
addVehicleCorridor
();
Q_INVOKABLE
void
removeAllAreas
();
Q_INVOKABLE
bool
addServiceArea
();
Q_INVOKABLE
bool
addVehicleCorridor
();
Q_INVOKABLE
void
removeAll
();
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
...
...
@@ -97,11 +98,13 @@ private slots:
void
recalcVehicleMeasurementAreas
();
void
recalcAll
();
void
recalcPolygonInteractivity
(
int
index
);
void
updateJoinedArea
();
private:
bool
_planView
;
QmlObjectListModel
*
_visualItems
;
WimaArea
_joinedArea
;
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentPolygonIndex
;
...
...
src/WimaView/WimaToolBar.qml
View file @
87ae0874
...
...
@@ -21,7 +21,7 @@ Rectangle {
visible
:
false
anchors.bottomMargin
:
1
signal
show
Fly
View
signal
show
WimaFlight
View
property
var
planMasterController
property
var
currentMissionItem
///< Mission item to display status for
...
...
@@ -100,12 +100,12 @@ Rectangle {
id
:
settingsButton
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
source
:
"
/qmlimages/
PaperPlane
.svg
"
source
:
"
/qmlimages/
TelemRSSI
.svg
"
logo
:
true
checked
:
false
onClicked
:
{
checked
=
false
show
Fly
View
()
show
WimaFlight
View
()
}
}
}
...
...
src/WimaView/WimaView.qml
View file @
87ae0874
This diff is collapsed.
Click to expand it.
src/ui/MainWindowInner.qml
View file @
87ae0874
...
...
@@ -33,7 +33,7 @@ Item {
property
var
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
string
formatedMessage
:
activeVehicle
?
activeVehicle
.
formatedMessage
:
""
property
var
_viewList
:
[
settingsViewLoader
,
setupViewLoader
,
planViewLoader
,
wimaViewLoader
,
flightView
,
analyzeViewLoader
]
property
var
_viewList
:
[
settingsViewLoader
,
setupViewLoader
,
planViewLoader
,
wimaViewLoader
,
wimaFlightView
,
flightView
,
analyzeViewLoader
]
readonly
property
string
_settingsViewSource
:
"
AppSettings.qml
"
readonly
property
string
_setupViewSource
:
"
SetupView.qml
"
...
...
@@ -125,6 +125,18 @@ Item {
wimaToolBar
.
visible
=
true
}
function
showWimaFlightView
()
{
mainWindow
.
enableToolbar
()
rootLoader
.
sourceComponent
=
null
if
(
currentPopUp
)
{
currentPopUp
.
close
()
}
ScreenTools
.
availableHeight
=
parent
.
height
-
toolBar
.
height
hideAllViews
()
wimaFlightView
.
visible
=
true
toolBar
.
checkWimaFlyButton
()
}
function
showFlyView
()
{
mainWindow
.
enableToolbar
()
rootLoader
.
sourceComponent
=
null
...
...
@@ -301,7 +313,7 @@ Item {
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
opacity
:
planToolBar
.
visible
?
0
:
1
opacity
:
planToolBar
.
visible
||
wimaToolBar
.
visible
?
0
:
1
z
:
QGroundControl
.
zOrderTopMost
Component.onCompleted
:
ScreenTools
.
availableHeight
=
parent
.
height
-
toolBar
.
height
...
...
@@ -311,6 +323,7 @@ Item {
onShowPlanView
:
mainWindow
.
showPlanView
()
onShowWimaView
:
mainWindow
.
showWimaView
()
onShowAnalyzeView
:
mainWindow
.
showAnalyzeView
()
onShowWimaFlightView
:
mainWindow
.
showWimaFlightView
()
onArmVehicle
:
flightView
.
guidedController
.
confirmAction
(
flightView
.
guidedController
.
actionArm
)
onDisarmVehicle
:
{
if
(
flightView
.
guidedController
.
showEmergenyStop
)
{
...
...
@@ -330,22 +343,22 @@ Item {
}
}
Plan
ToolBar
{
id
:
plan
ToolBar
Wima
ToolBar
{
id
:
wima
ToolBar
height
:
ScreenTools
.
toolbarHeight
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
z
:
toolBar
.
z
+
1
onShow
Fly
View
:
{
plan
ToolBar
.
visible
=
false
mainWindow
.
show
Fly
View
()
onShow
WimaFlight
View
:
{
wima
ToolBar
.
visible
=
false
mainWindow
.
show
WimaFlight
View
()
}
}
Wima
ToolBar
{
id
:
wima
ToolBar
Plan
ToolBar
{
id
:
plan
ToolBar
height
:
ScreenTools
.
toolbarHeight
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
...
...
@@ -353,7 +366,7 @@ Item {
z
:
toolBar
.
z
+
1
onShowFlyView
:
{
wima
ToolBar
.
visible
=
false
plan
ToolBar
.
visible
=
false
mainWindow
.
showFlyView
()
}
}
...
...
@@ -401,6 +414,7 @@ Item {
property
var
toolbar
:
wimaToolBar
}
FlightDisplayView
{
id
:
flightView
anchors.fill
:
parent
...
...
@@ -414,6 +428,19 @@ Item {
}
}
FlightDisplayView
{
id
:
wimaFlightView
anchors.fill
:
parent
visible
:
true
//-------------------------------------------------------------------------
//-- Loader helper for any child, no matter how deep can display an element
// on top of the video window.
/*Loader {
id: rootVideoLoader
anchors.centerIn: parent
}*/
}
Loader
{
id
:
analyzeViewLoader
anchors.left
:
parent
.
left
...
...
src/ui/toolbar/MainToolBar.qml
View file @
87ae0874
...
...
@@ -31,6 +31,7 @@ Rectangle {
signal
showSetupView
signal
showPlanView
signal
showWimaView
signal
showWimaFlightView
signal
showFlyView
signal
showAnalyzeView
signal
armVehicle
...
...
@@ -54,6 +55,10 @@ Rectangle {
wimaButton
.
checked
=
true
}
function
checkWimaFlyButton
()
{
wimaFlyButton
.
checked
=
true
}
function
checkFlyButton
()
{
flyButton
.
checked
=
true
}
...
...
@@ -64,7 +69,7 @@ Rectangle {
Component.onCompleted
:
{
//-- TODO: Get this from the actual state
fly
Button
.
checked
=
true
plan
Button
.
checked
=
true
}
// Prevent all clicks from going through to lower layers
...
...
@@ -126,6 +131,15 @@ Rectangle {
onClicked
:
toolBar
.
showPlanView
()
}
QGCToolBarButton
{
id
:
flyButton
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/PaperPlane.svg
"
onClicked
:
toolBar
.
showFlyView
()
}
QGCToolBarButton
{
id
:
wimaButton
anchors.top
:
parent
.
top
...
...
@@ -136,12 +150,12 @@ Rectangle {
}
QGCToolBarButton
{
id
:
f
lyButton
id
:
wimaF
lyButton
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/
PaperPlane
.svg
"
onClicked
:
toolBar
.
showFlyView
()
source
:
"
/qmlimages/
TelemRSSI
.svg
"
onClicked
:
toolBar
.
show
Wima
FlyView
()
}
QGCToolBarButton
{
...
...
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