Commit 2ff5f135 authored by Valentin Platzgummer's avatar Valentin Platzgummer

before adding WimaVehicle

parent 03cf8047
......@@ -408,13 +408,13 @@ HEADERS += \
src/comm/MavlinkMessagesTimer.h \
src/GPS/Drivers/src/base_station.h \
src/MissionManager/WimaController.h \
src/MissionManager/WimaFlyArea.h \
src/MissionManager/WimaPolygon.h \
src/MissionManager/WimaServicePolygon.h \
src/MissionManager/WimaVehicleCorridor.h \
src/MissionManager/WimaVehicleMeasurementPolygon.h \
src/MissionManager/WimaGlobalMeasurementPolygon.h \
src/MissionManager/WimaPolygonContainer.h
src/MissionManager/WimaPolygonContainer.h \
src/MissionManager/WimaVehicle.h
SOURCES += \
src/api/QGCCorePlugin.cc \
......@@ -429,7 +429,8 @@ SOURCES += \
src/MissionManager/WimaVehicleCorridor.cc \
src/MissionManager/WimaVehicleMeasurementPolygon.cc \
src/MissionManager/WimaGlobalMeasurementPolygon.cc \
src/MissionManager/WimaPolygonContainer.cc
src/MissionManager/WimaPolygonContainer.cc \
src/MissionManager/WimaVehicle.cc
#
# Unit Test specific configuration goes here (requires full debug build with all plugins)
......
......@@ -9,8 +9,6 @@ WimaController::WimaController(QObject *parent) :
}
void WimaController::setMasterController(PlanMasterController *masterC)
{
_masterController = masterC;
......@@ -26,6 +24,33 @@ void WimaController::setMissionController(MissionController *missionC)
void WimaController::addGlobalMeasurementArea()
{
WimaGlobalMeasurementPolygon* poly = new WimaGlobalMeasurementPolygon(this);
_visualItems.append(poly);
emit visualItemsChanged();
}
void WimaController::removeArea(int index)
{
if(index > 0 && index < _visualItems.size()){
_visualItems.removeAt(index);
emit visualItemsChanged();
}else{
qWarning("Index out of bounds!");
}
}
void WimaController::addServiceArea()
{
WimaServicePolygon* poly = new WimaServicePolygon(this);
_visualItems.append(poly);
emit visualItemsChanged();
}
void WimaController::recalcVehicleCorridor()
{
}
......
......@@ -21,12 +21,13 @@ public:
Q_PROPERTY(PlanMasterController* masterController READ masterController WRITE setMasterController NOTIFY masterControllerChanged)
Q_PROPERTY(MissionController* missionController READ missionController WRITE setMissionController NOTIFY missionControllerChanged)
Q_PROPERTY(QList<WimaPolygon*> visualItems READ visualItems NOTIFY visualItemsChanged)
Q_PROPERTY(QList<WimaPolygon*>& visualItems READ visualItems NOTIFY visualItemsChanged)
Q_PROPERTY(QList<WimaPolygon*>& editorItems READ editorItems NOTIFY visualItemsChanged)
// Property accessors
PlanMasterController* masterController (void) const { return _masterController;}
MissionController* missionController (void) const { return _missionController;}
QList<WimaPolygon*>& visualItems (void) const { return }
QList<WimaPolygon*>& visualItems (void) { return _visualItemsContainer.returnFlatList(); }
......@@ -36,12 +37,8 @@ public:
void setMissionController (MissionController* missionController);
Q_INVOKABLE void addGlobalMeasurementArea();
Q_INVOKABLE void removeGlobalMeasurementArea(int index);
Q_INVOKABLE void removeArea(int index);
Q_INVOKABLE void addServiceArea();
Q_INVOKABLE void removeServiceArea(int index);
Q_INVOKABLE void recalcVehicleCorridor();
Q_INVOKABLE void recalcVehicleMeasurementArea();
Q_INVOKABLE void startMission();
Q_INVOKABLE void abortMission();
......@@ -58,10 +55,15 @@ signals:
void missionControllerChanged (void);
void visualItemsChanged (void);
private slots:
void recalcVehicleCorridor();
void recalcVehicleMeasurementAreas();
void recalcAll();
private:
bool _planView;
WimaPolygonContainer _visualItemsContainer;
QList<WimaPolygon*> _visualItems;
PlanMasterController* _masterController;
MissionController* _missionController;
......
......@@ -11,6 +11,7 @@ WimaPolygon::WimaPolygon(QObject *parent) :
WimaPolygon::WimaPolygon(QGCMapPolygon *other, QObject *parent):
WimaPolygon(parent)
{
delete _polygon;
*_polygon = *other;
}
......@@ -19,7 +20,7 @@ void WimaPolygon::setMaxAltitude(double alt)
{
if(alt > 0 && alt != _maxAltitude){
_maxAltitude = alt;
emit maxAltitudeChanged(_maxAltitude);
emit maxAltitudeChanged();
}
}
......@@ -28,17 +29,15 @@ void WimaPolygon::setVehicle(Vehicle *vehicle)
{
if(_vehicle != vehicle){
_vehicle = vehicle;
emit vehicleChanged(_vehicle);
emit vehicleChanged();
}
}
QmlObjectListModel* WimaPolygon::splitPolygonArea(int numberOfFractions)
QGCMapPolygon* WimaPolygon::splitPolygonArea(int numberOfFractions)
{
if(numberOfFractions > 0){
_polygonFractions->append(this);
emit polygonFractionsChanged(_polygonFractions);
return _polygonFractions;
QGCMapPolygon* poly = new QGCMapPolygon(this->polygon(), this);
return poly;
}
return nullptr;
}
......
......@@ -2,6 +2,7 @@
#define WIMAPOLYGON_H
#include "QGCMapPolygon.h"
#include "QGCMapPolyline.h"
#include "Vehicle.h"
#include "qobject.h"
......@@ -16,39 +17,38 @@ public:
Q_PROPERTY(double maxAltitude READ maxAltitude WRITE setMaxAltitude NOTIFY maxAltitudeChanged)
Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)
Q_PROPERTY(QString editorQML READ editorQML CONSTANT)
Q_PROPERTY(Vehicle* vehicle READ vehicle WRITE setVehicle NOTIFY vehicleChanged)
Q_PROPERTY(QGCMapPolygon* polygon READ polygon NOTIFY polygonChanged)
Q_PROPERTY(double maxAltitude READ maxAltitude WRITE setMaxAltitude NOTIFY maxAltitudeChanged)
Q_PROPERTY(QString mapVisualQML READ mapVisualQML CONSTANT)
Q_PROPERTY(QString editorQML READ editorQML CONSTANT)
Q_PROPERTY(Vehicle* vehicle READ vehicle WRITE setVehicle NOTIFY vehicleChanged)
Q_PROPERTY(QGCMapPolygon* polygon READ polygon NOTIFY polygonChanged)
Q_PROPERTY(QList<WimaPolygon*> subPolygons READ subPolygons NOTIFY subPolygonsChanged)
Q_PROPERTY(QList<QGCMapPolyline*> subPolylines READ subPolylines NOTIFY subPolylinesChanged)
//Property accessors
double maxAltitude (void) const { return _maxAltitude;}
Vehicle* vehicle (void) const { return _vehicle;}
QGCMapPolygon* polygon (void) const { return _polygon;}
QList<WimaPolygon*> subPolygons (void) const { return _subPolygons;}
QList<QGCMapPolyline*> subPolylines (void) const { return _subPolylines;}
virtual QString mapVisualQML (void) const = 0;
virtual QString editorQML (void) const = 0;
virtual QList<WimaPolygon*>& subPolygons (void) { return _subPolygons;}
//Property setters
void setMaxAltitude (double alt);
void setName (QString name);
void setVehicle (Vehicle* vehicle);
/// Splits the polygon in numberOfFractions fractions with equal area.
/// @param polygonFractions The polygon List to add the fractions to.
/// @param numberOfFractions The number of fractions to split the polygon to.
Q_INVOKABLE QmlObjectListModel* splitPolygonArea(int numberOfFractions);
QGCMapPolygon* splitPolygonArea(int numberOfFractions);
signals:
void maxAltitudeChanged (double alt);
void vehicleChanged (Vehicle* vehicle);
void maxAltitudeChanged (void);
void vehicleChanged (void);
void subPolygons (void);
protected:
QGCMapPolygon* extractQGCPolygon(void);
private:
......@@ -57,6 +57,7 @@ private:
Vehicle* _vehicle;
QGCMapPolygon* _polygon;
QList<WimaPolygon*> _subPolygons;
QList<QGCMapPolyline*> _subPolylines;
};
#endif // WIMAPOLYGON_H
......@@ -64,6 +64,11 @@ QList<WimaPolygon*>& WimaPolygonContainer::returnFlatList()
return _flatList;
}
int WimaPolygonContainer::count()
{
return _itemList.size();
}
void WimaPolygonContainer::setFlatListDirty(void)
{
_flatListDirty = true;
......
......@@ -17,6 +17,7 @@ public:
void removeItem(int itemIndex);
void removeItem(WimaPolygon* polygon);
QList<WimaPolygon*>& returnFlatList();
int count(void);
signals:
void itemListChanged(void);
......
#include "WimaVehicle.h"
WimaVehicle::WimaVehicle(QObject *parent):
Vehicle (parent)
{
}
#ifndef WIMAVEHICLE_H
#define WIMAVEHICLE_H
#include <QObject>
#include "Vehicle.h"
class WimaVehicle : public Vehicle
{
Q_OBJECT
public:
WimaVehicle(QObject* parent);
};
#endif // WIMAVEHICLE_H
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