Commit a110c7f5 authored by Valentin Platzgummer's avatar Valentin Platzgummer

upload works now + .plan and .wima fully supported

parent ce3fb543
......@@ -34,6 +34,8 @@ QGCView {
id: root
viewPanel: _panel
property var wimaController
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property alias guidedController: guidedActionsController
......
......@@ -32,6 +32,7 @@ FlightMap {
allowVehicleLocationCenter: !_keepVehicleCentered
planView: false
property alias scaleState: mapScale.state
// The following properties must be set by the consumer
......@@ -41,6 +42,7 @@ FlightMap {
property var rightPanelWidth
property var qgcView ///< QGCView control which contains this map
property var multiVehicleView ///< true: multi-vehicle view, false: single vehicle view
property var wimaController
property rect centerViewport: Qt.rect(0, 0, width, height)
......@@ -191,6 +193,16 @@ FlightMap {
property real leftToolWidth: toolStrip.x + toolStrip.width
}
// Add wima Areas to the Map
WimaMapPolygonVisuals {
mapControl: flightMap
mapPolygon: wimaController ? wimaController.joinedArea : undefined
borderWidth: 1
borderColor: "transparent"
interiorColor: "gray"
interiorOpacity: 0.25
}
// Add trajectory points to the map
MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
......
......@@ -106,7 +106,7 @@ QGeoCoordinate WimaArea::getClosestVertex(const QGeoCoordinate& coordinate) cons
return this->vertexCoordinate(getClosestVertexIndex(coordinate));
}
QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &poly) const
QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &poly)
{
QGCMapPolygon qgcPoly;
qgcPoly.setPath(poly.path());
......@@ -117,6 +117,11 @@ QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &poly) const
return QGCMapPolygon(qgcPoly);
}
QGCMapPolygon WimaArea::toQGCPolygon() const
{
return toQGCPolygon(*this);
}
void WimaArea::join(QList<WimaArea *>* polyList, WimaArea* joinedPoly)
{
return;
......@@ -376,7 +381,7 @@ bool WimaArea::intersects(const QGCMapPolyline& line, const WimaArea& poly, QLis
double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate &c2, const WimaArea &poly)
{
WimaArea bigPoly(poly);
bigPoly.offset(0.01); // hack to compensate for numerical issues, migh be replaced in the future...
bigPoly.offset(0.1); // hack to compensate for numerical issues, migh be replaced in the future...
if ( bigPoly.containsCoordinate(c1) && bigPoly.containsCoordinate(c2)) {
QList<QGeoCoordinate> intersectionList;
QList<QPair<int, int>> neighbourlist;
......
......@@ -44,24 +44,25 @@ public:
template <class T>
QList<T*>* splitArea (int numberOfFractions); // use QScopedPointer to store return value*/
//iterates over all vertices in _polygon and returns the index of that one closest to coordinate
int getClosestVertexIndex (const QGeoCoordinate& coordinate) const;
int getClosestVertexIndex (const QGeoCoordinate& coordinate) const;
//iterates over all vertices in _polygon and returns that one closest to coordinate
QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const;
QGCMapPolygon toQGCPolygon (const WimaArea& poly) const;
static void join (QList<WimaArea*>* polyList, WimaArea* joinedPoly);// change to & notation
QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const;
static QGCMapPolygon toQGCPolygon (const WimaArea& poly);
QGCMapPolygon toQGCPolygon () const;
static void join (QList<WimaArea*>* polyList, WimaArea* joinedPoly);// change to & notation
/// joins the poly1 and poly2 if possible, joins the polygons to form a simple polygon (no holes)
/// see https://en.wikipedia.org/wiki/Simple_polygon
/// @return the joined polygon of poly1 and poly2 if possible, poly1 else
static void join (WimaArea &poly1, WimaArea &poly2, WimaArea& joinedPoly);
void join (WimaArea &poly);
bool isDisjunct (QList<WimaArea*>* polyList);// change to & notation, if necessary
bool isDisjunct (WimaArea* poly1, WimaArea* poly2);// change to & notation, if necessary
static void join (WimaArea &poly1, WimaArea &poly2, WimaArea& joinedPoly);
void join (WimaArea &poly);
bool isDisjunct (QList<WimaArea*>* polyList);// change to & notation, if necessary
bool isDisjunct (WimaArea* poly1, WimaArea* poly2);// change to & notation, if necessary
/// calculates the next polygon vertex index
/// @return index + 1 if index < poly->count()-1 && index >= 0, or 0 if index == poly->count()-1, -1 else
int nextVertexIndex (int index) const;
int nextVertexIndex (int index) const;
/// calculates the previous polygon vertex index
/// @return index - 1 if index < poly->count() && index > 0, or poly->count()-1 if index == 0, -1 else
int previousVertexIndex (int index) const;
int previousVertexIndex (int index) const;
/// checks if line1 and line2 intersect with each other, takes latitude and longitute into account only (height neglected)
/// @param line1 line containing two coordinates, height not taken into account
/// @param line2 line containing two coordinates, height not taken into account
......
This diff is collapsed.
......@@ -21,6 +21,8 @@
class WimaController : public QObject
{
enum FileType {WimaFile, PlanFile};
Q_OBJECT
public:
WimaController(QObject *parent = nullptr);
......@@ -32,8 +34,10 @@ public:
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(QGCMapPolygon joinedArea READ joinedArea NOTIFY joinedAreaChanged)
// Property accessors
......@@ -43,8 +47,10 @@ public:
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 { return _joinedArea.center(); }
QGCMapPolygon joinedArea (void) const { return _joinedArea.toQGCPolygon(); }
......@@ -80,9 +86,13 @@ public:
// static Members
static const char* wimaFileExtension;
static const char* areaItemsName;
static const char* missionItemsName;
// Member Methodes
QJsonDocument saveToJson();
QJsonDocument saveToJson(FileType fileType);
......@@ -92,6 +102,7 @@ signals:
void visualItemsChanged (void);
void currentPolygonIndexChanged (int index);
void currentFileChanged ();
void joinedAreaChanged ();
private slots:
void recalcVehicleCorridor();
......
......@@ -9,7 +9,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
// Toolbar for Plan View
// Toolbar for Wima View
Rectangle {
id: _root
height: ScreenTools.toolbarHeight
......@@ -21,7 +21,7 @@ Rectangle {
visible: false
anchors.bottomMargin: 1
signal showWimaFlightView
signal showFlyView
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/TelemRSSI.svg"
source: "/qmlimages/PaperPlane.svg"
logo: true
checked: false
onClicked: {
checked = false
showWimaFlightView()
showFlyView()
}
}
}
......
This diff is collapsed.
......@@ -28,12 +28,14 @@ Item {
QGCPalette { id: qgcPal; colorGroupEnabled: true }
property var wimaController
property bool wimaAvailable: wimaViewLoader.wimaController !== undefined
property var currentPopUp: null
property real currentCenterX: 0
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : ""
property var _viewList: [ settingsViewLoader, setupViewLoader, planViewLoader, wimaViewLoader, wimaFlightView, flightView, analyzeViewLoader ]
property var _viewList: [ settingsViewLoader, setupViewLoader, planViewLoader, wimaViewLoader, flightView, analyzeViewLoader ]
readonly property string _settingsViewSource: "AppSettings.qml"
readonly property string _setupViewSource: "SetupView.qml"
......@@ -48,6 +50,17 @@ Item {
}
}
onWimaAvailableChanged: {
if ( available ) {
wimaController = wimaViewLoader.wimaController
console.log("WimaController connected");
}
else {
wimaController = undefined
}
}
function disableToolbar() {
toolbarBlocker.enabled = true
}
......@@ -75,7 +88,7 @@ Item {
if (settingsViewLoader.source != _settingsViewSource) {
settingsViewLoader.source = _settingsViewSource
}
settingsViewLoader.visible = true
settingsViewLoader.visible = true, wimaFlightView
toolBar.checkSettingsButton()
}
......@@ -125,18 +138,6 @@ 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
......@@ -219,6 +220,8 @@ Item {
visible: false
onYes: finishCloseProcess()
function check() {
if (QGroundControl.multiVehicleManager.activeVehicle) {
activeConnectionsCloseDialog.open()
......@@ -323,7 +326,6 @@ 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) {
......@@ -351,9 +353,9 @@ Item {
anchors.top: parent.top
z: toolBar.z + 1
onShowWimaFlightView: {
onShowFlyView: {
wimaToolBar.visible = false
mainWindow.showWimaFlightView()
mainWindow.showFlyView()
}
}
......@@ -396,7 +398,8 @@ Item {
visible: false
property var planToolBar: planToolBar
}
} wimaController: wimaViewLoader.wimaController ? wimaViewLoader.wimaController : undefined
Loader {
id: planViewLoader
......@@ -419,7 +422,7 @@ Item {
id: flightView
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 {
......@@ -428,19 +431,6 @@ 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
......
......@@ -31,7 +31,6 @@ Rectangle {
signal showSetupView
signal showPlanView
signal showWimaView
signal showWimaFlightView
signal showFlyView
signal showAnalyzeView
signal armVehicle
......@@ -55,10 +54,6 @@ Rectangle {
wimaButton.checked = true
}
function checkWimaFlyButton() {
wimaFlyButton.checked = true
}
function checkFlyButton() {
flyButton.checked = true
}
......@@ -69,7 +64,7 @@ Rectangle {
Component.onCompleted: {
//-- TODO: Get this from the actual state
planButton.checked = true
flyButton.checked = true
}
// Prevent all clicks from going through to lower layers
......@@ -149,15 +144,6 @@ Rectangle {
onClicked: toolBar.showWimaView()
}
QGCToolBarButton {
id: wimaFlyButton
anchors.top: parent.top
anchors.bottom: parent.bottom
exclusiveGroup: mainActionGroup
source: "/qmlimages/TelemRSSI.svg"
onClicked: toolBar.showWimaFlyView()
}
QGCToolBarButton {
id: analyzeButton
anchors.top: parent.top
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment