Commit 32146c9e authored by Valentin Platzgummer's avatar Valentin Platzgummer

_currentItems removed from WimaController

parent c8c80fb1
This diff is collapsed.
This diff is collapsed.
......@@ -228,7 +228,7 @@ FlightMap {
color: "gray"
}
// current Items
WimaPlanMapItems {
/*WimaPlanMapItems {
map: flightMap
largeMapView: _mainIsMap
missionItems: wimaController.currentMissionItems
......@@ -237,7 +237,7 @@ FlightMap {
zOrderWP: QGroundControl.zOrderWaypointIndicators-1
zOrderLines: QGroundControl.zOrderWaypointIndicators-2
color: "green" // gray with alpha 0.7
}
}*/
// Add trajectory points to the map
MapItemView {
......
......@@ -34,7 +34,6 @@ Item {
// Add the mission item visuals to the map
Repeater {
property bool show: largeMapView
property var wimaController
model: show ? _missionController.visualItems : 0
delegate: MissionItemMapVisual {
......
......@@ -331,6 +331,27 @@ void MissionController::convertToKMLDocument(QDomDocument& document)
kml.save(document);
}
//QList<QObject *> MissionController::takeVisualItems()
//{
// QList<QObject *> objectList;
// if (_visualItems) {
// _deinitAllVisualItems();
// QList<QObject *> *objectListPt = _visualItems->objectList();
// for (auto object : *objectListPt)
// objectList.append(object);
// _visualItems->clear();
// _visualItems->deleteLater();
// _settingsItem = nullptr;
// _visualItems = new QmlObjectListModel(this);
// _addMissionSettings(_visualItems, false /* addToCenter */);
// _initAllVisualItems();
// setDirty(true);
// _resetMissionFlightStatus();
// }
// return objectList;
//}
void MissionController::sendItemsToVehicle(Vehicle* vehicle, QmlObjectListModel* visualMissionItems)
{
if (vehicle) {
......@@ -438,7 +459,7 @@ int MissionController::insertSimpleMissionItem(const QList<const MissionItem *>
return (newItem != nullptr) ? newItem->sequenceNumber(): -1;
}
int MissionController::insertSimpleMissionItem(SimpleMissionItem &missionItem, int i)
/*int MissionController::insertSimpleMissionItem(SimpleMissionItem &missionItem, int i)
{
int sequenceNumber = _nextSequenceNumber();
SimpleMissionItem * newItem = new SimpleMissionItem(missionItem, _flyView, this);
......@@ -455,7 +476,7 @@ int MissionController::insertSimpleMissionItem(SimpleMissionItem &missionItem, i
_visualItems->insert(i, newItem);
return newItem->sequenceNumber();
}
}*/
int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
{
......
......@@ -122,7 +122,7 @@ public:
/// Add a new simple mission item to the list
/// @param i: index to insert at
/// @return Sequence number for new item
int insertSimpleMissionItem(SimpleMissionItem &missionItem, int i);
//int insertSimpleMissionItem(SimpleMissionItem &missionItem, int i);
/// Add a new ROI mission item to the list
/// @param i: index to insert at
......@@ -196,6 +196,7 @@ public:
// Property accessors
QmlObjectListModel* visualItems (void) { return _visualItems; }
//QList<QObject *> takeVisualItems (void);
QmlObjectListModel* waypointLines (void) { return &_waypointLines; }
QVariantList waypointPath (void) { return _waypointPath; }
QStringList complexMissionItemNames (void) const;
......
This diff is collapsed.
......@@ -44,9 +44,7 @@ public:
Q_PROPERTY(QString fileExtension READ fileExtension CONSTANT)
Q_PROPERTY(WimaDataContainer* dataContainer READ dataContainer WRITE setDataContainer NOTIFY dataContainerChanged)
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems NOTIFY missionItemsChanged)
Q_PROPERTY(QmlObjectListModel* currentMissionItems READ currentMissionItems NOTIFY currentMissionItemsChanged)
Q_PROPERTY(QVariantList waypointPath READ waypointPath NOTIFY waypointPathChanged)
Q_PROPERTY(QVariantList currentWaypointPath READ currentWaypointPath NOTIFY currentWaypointPathChanged)
Q_PROPERTY(Fact* enableWimaController READ enableWimaController CONSTANT)
Q_PROPERTY(Fact* overlapWaypoints READ overlapWaypoints CONSTANT)
Q_PROPERTY(Fact* maxWaypointsPerPhase READ maxWaypointsPerPhase CONSTANT)
......@@ -75,9 +73,7 @@ public:
QGCMapPolygon joinedArea (void) const;
WimaDataContainer* dataContainer (void);
QmlObjectListModel* missionItems (void);
QmlObjectListModel* currentMissionItems (void);
QVariantList waypointPath (void);
QVariantList currentWaypointPath (void);
Fact* enableWimaController (void);
Fact* overlapWaypoints (void);
Fact* maxWaypointsPerPhase (void);
......@@ -157,9 +153,7 @@ signals:
void dataContainerChanged ();
void readyForSaveSendChanged (bool ready);
void missionItemsChanged (void);
void currentMissionItemsChanged (void);
void waypointPathChanged (void);
void currentWaypointPathChanged (void);
void uploadOverrideRequiredChanged (void);
void phaseDistanceChanged (void);
void phaseDurationChanged (void);
......@@ -171,7 +165,6 @@ private slots:
bool fetchContainerData();
bool calcNextPhase(void);
void updateWaypointPath (void);
void updateCurrentPath (void);
void updateNextWaypoint (void);
void recalcCurrentPhase (void);
bool setTakeoffLandPosition (void);
......@@ -205,11 +198,8 @@ private:
WimaCorridorData _corridor; // corridor connecting opArea and serArea
bool _localPlanDataValid;
QmlObjectListModel _missionItems; // all mission itmes (Mission Items) generaded by wimaPlaner, displayed in flightView
QmlObjectListModel _currentMissionItems; // contains the current mission items, which are a sub set of _missionItems,
// _currentMissionItems contains a number of mission items which can be worked off with a single battery chrage
QmlObjectListModel _missionItemsBuffer; // Buffer to store mission items, e.g. for storing _currentMissionItems when smartRTL() is invoked
QmlObjectListModel _missionItemsBuffer; // Buffer to store mission items, e.g. for storing _missionController->visualItems() when smartRTL() is invoked
QVariantList _waypointPath; // path connecting the items in _missionItems
QVariantList _currentWaypointPath; // path connecting the items in _currentMissionItems
QGeoCoordinate _takeoffLandPostion;
......@@ -227,9 +217,9 @@ private:
SettingsFact _reverse; // Reverses the phase direction. Phases go from high to low waypoint numbers, if true.
int _endWaypointIndex; // index of the mission item stored in _missionItems defining the last element
// (which is not part of the return path) of _currentMissionItem
// (which is not part of the return path) of _missionController.visualItems()
int _startWaypointIndex; // index of the mission item stored in _missionItems defining the first element
// (which is not part of the arrival path) of _currentMissionItem
// (which is not part of the arrival path) of _missionController.visualItems()
bool _uploadOverrideRequired; // Is set to true if uploadToVehicle() did not suceed because the vehicle is not inside the service area.
// The user can override the upload lock with a slider, this will reset this variable to false.
double _measurementPathLength; // the lenght of the phase in meters
......@@ -269,9 +259,6 @@ private:
* 3+n+m+2+l Return Path Waypoint l-1
* 3+n+m+2+l+1 Land command
*
* _currentMissionItems is equal to
* _missionController.visualItems() except that it
* is missing the MissionSettingsItem
*/
......@@ -715,6 +715,10 @@ QSharedPointer<WimaPlanData> WimaPlaner::toPlanData()
QList<MissionItem*> rgMissionItems;
QmlObjectListModel *visualItems = _missionController->visualItems();
MissionController::convertToMissionItems(visualItems, rgMissionItems, nullptr);
for (int i = 0; i <= _arrivalPathLength; ++i)
rgMissionItems.removeFirst();
for (int i = 0; i < _returnPathLength; ++i)
rgMissionItems.removeLast();
// store mavlink commands
planData->append(rgMissionItems);
......
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