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
b37dda84
Commit
b37dda84
authored
Jun 26, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editing WimaController ofter repurposeing
parent
c878bb8a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
774 additions
and
527 deletions
+774
-527
WimaController.cc
src/Wima/WimaController.cc
+5
-481
WimaController.h
src/Wima/WimaController.h
+17
-39
WimaDataContainer.cc
src/Wima/WimaDataContainer.cc
+9
-0
WimaDataContainer.h
src/Wima/WimaDataContainer.h
+4
-0
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+610
-1
WimaPlaner.h
src/Wima/WimaPlaner.h
+129
-6
No files found.
src/Wima/WimaController.cc
View file @
b37dda84
This diff is collapsed.
Click to expand it.
src/Wima/WimaController.h
View file @
b37dda84
...
...
@@ -32,14 +32,12 @@ public:
Q_PROPERTY
(
PlanMasterController
*
masterController
READ
masterController
WRITE
setMasterController
NOTIFY
masterControllerChanged
)
Q_PROPERTY
(
MissionController
*
missionController
READ
missionController
WRITE
setMissionController
NOTIFY
missionControllerChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
visualItems
READ
visualItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
int
currentPolygonIndex
READ
currentPolygonIndex
WRITE
setCurrentPolygonIndex
NOTIFY
currentPolygonIndexChanged
)
Q_PROPERTY
(
QString
currentFile
READ
currentFile
NOTIFY
currentFileChanged
)
Q_PROPERTY
(
QStringList
loadNameFilters
READ
loadNameFilters
CONSTANT
)
Q_PROPERTY
(
QStringList
saveNameFilters
READ
saveNameFilters
CONSTANT
)
Q_PROPERTY
(
QString
fileExtension
READ
fileExtension
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
joinedAreaCenter
READ
joinedAreaCenter
CONSTANT
)
Q_PROPERTY
(
WimaArea
joinedArea
READ
joinedArea
NOTIFY
joinedAreaChanged
)
Q_PROPERTY
(
bool
flyView
READ
flyView
CONSTANT
)
Q_PROPERTY
(
WimaDataContainer
*
dataContainer
WRITE
setDataContainer
NOTIFY
dataContainerChanged
)
Q_PROPERTY
(
bool
readyForSaveSend
READ
readyForSaveSend
NOTIFY
readyForSaveSendChanged
)
...
...
@@ -48,13 +46,12 @@ public:
PlanMasterController
*
masterController
(
void
)
const
{
return
_masterController
;
}
MissionController
*
missionController
(
void
)
const
{
return
_missionController
;
}
QmlObjectListModel
*
visualItems
(
void
)
;
int
currentPolygonIndex
(
void
)
const
{
return
_currentPolygonIndex
;
}
QString
currentFile
(
void
)
const
{
return
_currentFile
;
}
QStringList
loadNameFilters
(
void
)
const
;
QStringList
saveNameFilters
(
void
)
const
;
QString
fileExtension
(
void
)
const
{
return
wimaFileExtension
;
}
QGeoCoordinate
joinedAreaCenter
(
void
)
const
;
WimaArea
joinedArea
(
void
)
const
;
QGCMapPolygon
joinedArea
(
void
)
const
;
bool
readyForSaveSend
(
void
)
const
{
return
_readyForSaveSend
;
}
...
...
@@ -62,35 +59,20 @@ public:
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void
setCurrentPolygonIndex
(
int
index
);
void
setDataContainer
(
WimaDataContainer
*
container
);
// Member Methodes
Q_INVOKABLE
void
startWimaController
(
bool
flyView
);
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
bool
addServiceArea
();
Q_INVOKABLE
bool
addVehicleCorridor
();
/// Remove all areas from WimaController and all mission items from MissionController
Q_INVOKABLE
void
removeAll
();
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
Q_INVOKABLE
void
pauseMission
();
Q_INVOKABLE
void
resumeMission
();
/// Recalculates vehicle corridor, flight path, etc.
Q_INVOKABLE
bool
updateMission
();
Q_INVOKABLE
void
saveToCurrent
();
Q_INVOKABLE
void
saveToFile
(
const
QString
&
filename
);
Q_INVOKABLE
void
saveToCurrent
();
Q_INVOKABLE
void
saveToFile
(
const
QString
&
filename
);
Q_INVOKABLE
bool
loadFromCurrent
();
Q_INVOKABLE
bool
loadFromFile
(
const
QString
&
filename
);
Q_INVOKABLE
void
resetAllInteractive
(
void
);
Q_INVOKABLE
void
setInteractive
(
void
);
Q_INVOKABLE
bool
loadFromFile
(
const
QString
&
filename
);
// static Members
...
...
@@ -102,32 +84,28 @@ public:
QJsonDocument
saveToJson
(
FileType
fileType
);
void
setReadyForSaveSend
(
bool
ready
);
signals:
void
masterControllerChanged
(
void
);
void
missionControllerChanged
(
void
);
void
visualItemsChanged
(
void
);
void
currentPolygonIndexChanged
(
int
index
);
void
currentFileChanged
();
void
joinedAreaChanged
();
void
dataContainerChanged
();
void
readyForSaveSendChanged
(
bool
ready
);
private
slots
:
void
recalcPolygonInteractivity
(
int
index
);
bool
recalcJoinedArea
();
void
updateContainer
();
// only executed if flyView == false
void
downloadFromContainer
();
// only executed if flyView == true
void
pullFromContainer
();
private:
bool
_readyForSaveSend
;
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentPolygonIndex
;
QString
_currentFile
;
WimaDataContainer
*
_container
;
QmlObjectListModel
_visualItems
;
WimaArea
_joinedArea
;
WimaGOperationArea
_opArea
;
WimaServiceArea
_serArea
;
WimaVCorridor
_corridor
;
bool
_readyForSaveSend
;
// basically true if updateMission() was sucessful
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
QString
_currentFile
;
// file for saveing
WimaDataContainer
*
_container
;
// container for data exchange with WimaController
QmlObjectListModel
_visualItems
;
// contains all visible areas
// The following areas are of type QGCMapPolygon (only path information is required, as they are used for visualisation)
QGCMapPolygon
_joinedArea
;
// joined area fromed by opArea, serArea, _corridor
QGCMapPolygon
_opArea
;
// measurement area
QGCMapPolygon
_serArea
;
// area for supplying
QGCMapPolygon
_corridor
;
// corridor connecting opArea and serArea
};
src/Wima/WimaDataContainer.cc
View file @
b37dda84
...
...
@@ -45,3 +45,12 @@ void WimaDataContainer::setCorridor(const WimaVCorridor *corridor)
emit
corridorChanged
(
_corridor
);
}
}
void
WimaDataContainer
::
setVisualItems
(
const
QmlObjectListModel
*
visualItems
)
{
if
(
_visualItems
!=
visualItems
)
{
_visualItems
=
visualItems
;
emit
visualItemsChanged
(
_visualItems
);
}
}
src/Wima/WimaDataContainer.h
View file @
b37dda84
...
...
@@ -21,23 +21,27 @@ public:
const
WimaGOperationArea
*
opArea
(
void
)
{
return
_opArea
;
}
const
WimaServiceArea
*
serArea
(
void
)
{
return
_serArea
;
}
const
WimaVCorridor
*
corridor
(
void
)
{
return
_corridor
;
}
const
QmlObjectListModel
*
visualItems
(
void
)
{
return
_visualItems
;
}
signals:
void
joinedAreaChanged
(
const
WimaArea
*
area
);
void
opAreaChanged
(
const
WimaGOperationArea
*
area
);
void
serAreaChanged
(
const
WimaServiceArea
*
area
);
void
corridorChanged
(
const
WimaVCorridor
*
area
);
void
visualItemsChanged
(
const
QmlObjectListModel
*
area
);
public
slots
:
void
setJoinedArea
(
const
WimaArea
*
joinedArea
);
void
setOpArea
(
const
WimaGOperationArea
*
opArea
);
void
setSerArea
(
const
WimaServiceArea
*
serArea
);
void
setCorridor
(
const
WimaVCorridor
*
corridor
);
void
setVisualItems
(
const
QmlObjectListModel
*
visualItems
);
private:
const
WimaArea
*
_joinedArea
;
const
WimaGOperationArea
*
_opArea
;
const
WimaServiceArea
*
_serArea
;
const
WimaVCorridor
*
_corridor
;
const
QmlObjectListModel
*
_visualItems
;
};
src/Wima/WimaPlaner.cc
View file @
b37dda84
This diff is collapsed.
Click to expand it.
src/Wima/WimaPlaner.h
View file @
b37dda84
#ifndef WIMAPLANER_H
#define WIMAPLANER_H
#pragma once
#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
class
WimaPlaner
#include "WimaArea.h"
#include "WimaGOperationArea.h"
#include "WimaServiceArea.h"
#include "WimaVCorridor.h"
#include "WimaDataContainer.h"
#include "PlanMasterController.h"
#include "MissionController.h"
#include "SurveyComplexItem.h"
#include "SimpleMissionItem.h"
#include "MissionSettingsItem.h"
#include "JsonHelper.h"
#include "QGCApplication.h"
class
WimaPlaner
:
public
QObject
{
Q_OBJECT
enum
FileType
{
WimaFile
,
PlanFile
};
public:
WimaPlaner
();
};
WimaPlaner
(
QObject
*
parent
=
nullptr
);
template
<
class
T
>
WimaPlaner
(
T
t
,
QObject
*
parent
=
nullptr
)
=
delete
;
template
<
class
T
>
WimaPlaner
(
T
t
)
=
delete
;
Q_PROPERTY
(
PlanMasterController
*
masterController
READ
masterController
WRITE
setMasterController
NOTIFY
masterControllerChanged
)
Q_PROPERTY
(
MissionController
*
missionController
READ
missionController
WRITE
setMissionController
NOTIFY
missionControllerChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
visualItems
READ
visualItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
int
currentPolygonIndex
READ
currentPolygonIndex
WRITE
setCurrentPolygonIndex
NOTIFY
currentPolygonIndexChanged
)
Q_PROPERTY
(
QString
currentFile
READ
currentFile
NOTIFY
currentFileChanged
)
Q_PROPERTY
(
QStringList
loadNameFilters
READ
loadNameFilters
CONSTANT
)
Q_PROPERTY
(
QStringList
saveNameFilters
READ
saveNameFilters
CONSTANT
)
Q_PROPERTY
(
QString
fileExtension
READ
fileExtension
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
joinedAreaCenter
READ
joinedAreaCenter
CONSTANT
)
Q_PROPERTY
(
WimaArea
joinedArea
READ
joinedArea
NOTIFY
joinedAreaChanged
)
Q_PROPERTY
(
WimaDataContainer
*
dataContainer
WRITE
setDataContainer
NOTIFY
dataContainerChanged
)
Q_PROPERTY
(
bool
readyForSaveSend
READ
readyForSaveSend
NOTIFY
readyForSaveSendChanged
)
// Property accessors
PlanMasterController
*
masterController
(
void
)
const
{
return
_masterController
;
}
MissionController
*
missionController
(
void
)
const
{
return
_missionController
;
}
QmlObjectListModel
*
visualItems
(
void
)
;
int
currentPolygonIndex
(
void
)
const
{
return
_currentAreaIndex
;
}
QString
currentFile
(
void
)
const
{
return
_currentFile
;
}
QStringList
loadNameFilters
(
void
)
const
;
QStringList
saveNameFilters
(
void
)
const
;
QString
fileExtension
(
void
)
const
{
return
wimaFileExtension
;
}
QGeoCoordinate
joinedAreaCenter
(
void
)
const
;
WimaArea
joinedArea
(
void
)
const
;
bool
readyForSaveSend
(
void
)
const
{
return
_readyForSaveSend
;
}
#endif // WIMAPLANER_H
\ No newline at end of file
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void
setCurrentPolygonIndex
(
int
index
);
void
setDataContainer
(
WimaDataContainer
*
container
);
// Member Methodes
Q_INVOKABLE
void
startWimaPlaner
(
bool
flyView
);
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
bool
addServiceArea
();
Q_INVOKABLE
bool
addVehicleCorridor
();
/// Remove all areas from WimaPlaner and all mission items from MissionController
Q_INVOKABLE
void
removeAll
();
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
Q_INVOKABLE
void
pauseMission
();
Q_INVOKABLE
void
resumeMission
();
/// Recalculates vehicle corridor, flight path, etc.
Q_INVOKABLE
bool
updateMission
();
Q_INVOKABLE
void
saveToCurrent
();
Q_INVOKABLE
void
saveToFile
(
const
QString
&
filename
);
Q_INVOKABLE
bool
loadFromCurrent
();
Q_INVOKABLE
bool
loadFromFile
(
const
QString
&
filename
);
Q_INVOKABLE
void
resetAllInteractive
(
void
);
Q_INVOKABLE
void
setInteractive
(
void
);
// static Members
static
const
char
*
wimaFileExtension
;
static
const
char
*
areaItemsName
;
static
const
char
*
missionItemsName
;
// Member Methodes
QJsonDocument
saveToJson
(
FileType
fileType
);
void
setReadyForSaveSend
(
bool
ready
);
signals:
void
masterControllerChanged
(
void
);
void
missionControllerChanged
(
void
);
void
visualItemsChanged
(
void
);
void
currentPolygonIndexChanged
(
int
index
);
void
currentFileChanged
();
void
joinedAreaChanged
();
void
dataContainerChanged
();
void
readyForSaveSendChanged
(
bool
ready
);
private
slots
:
void
recalcPolygonInteractivity
(
int
index
);
bool
recalcJoinedArea
();
void
pushToContainer
();
private:
bool
_readyForSaveSend
;
// basically true if updateMission() was sucessful
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentAreaIndex
;
QString
_currentFile
;
// file for saveing
WimaDataContainer
*
_container
;
// container for data exchange with WimaController
QmlObjectListModel
_visualItems
;
// contains all visible areas
WimaArea
_joinedArea
;
// joined area fromed by opArea, serArea, _corridor
WimaGOperationArea
_opArea
;
// measurement area
WimaServiceArea
_serArea
;
// area for supplying
WimaVCorridor
_corridor
;
// corridor connecting opArea and serArea
};
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