WaypointEditableView.h 4.5 KB
Newer Older
pixhawk's avatar
pixhawk committed
1
/*===================================================================
2
QGroundControl Open Source Ground Control Station
pixhawk's avatar
pixhawk committed
3

4
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
pixhawk's avatar
pixhawk committed
5

6
This file is part of the QGROUNDCONTROL project
pixhawk's avatar
pixhawk committed
7

8
    QGROUNDCONTROL is free software: you can redistribute it and/or modify
pixhawk's avatar
pixhawk committed
9 10 11
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
12

13
    QGROUNDCONTROL is distributed in the hope that it will be useful,
pixhawk's avatar
pixhawk committed
14 15 16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
17

pixhawk's avatar
pixhawk committed
18
    You should have received a copy of the GNU General Public License
19
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
20

pixhawk's avatar
pixhawk committed
21 22 23 24 25 26 27 28
======================================================================*/

/**
 * @file
 *   @brief Displays one waypoint
 *
 *   @author Lorenz Meier <mavteam@student.ethz.ch>
 *   @author Benjamin Knecht <mavteam@student.ethz.ch>
29
 *   @author Petri Tanskanen <mavteam@student.ethz.ch>
30
 *   @author Alex Trofimov <talex@student.ethz.ch>
pixhawk's avatar
pixhawk committed
31 32
 */

33 34
#ifndef WAYPOINTEDITABLEVIEW_H
#define WAYPOINTEDITABLEVIEW_H
pixhawk's avatar
pixhawk committed
35 36 37

#include <QtGui/QWidget>
#include "Waypoint.h"
38
#include <iostream>
pixhawk's avatar
pixhawk committed
39

40
enum QGC_WAYPOINTEDITABLEVIEW_MODE {
41
    QGC_WAYPOINTEDITABLEVIEW_MODE_DEFAULT,
42
    QGC_WAYPOINTEDITABLEVIEW_MODE_DIRECT_EDITING
43 44
};

45 46
namespace Ui
{
47
class WaypointEditableView;
pixhawk's avatar
pixhawk committed
48
}
49
class QGCMissionNavWaypoint;
50 51 52
class QGCMissionNavLoiterUnlim;
class QGCMissionNavLoiterTurns;
class QGCMissionNavLoiterTime;
53 54 55
class QGCMissionNavReturnToLaunch;
class QGCMissionNavLand;
class QGCMissionNavTakeoff;
56
class QGCMissionNavSweep;
57
class QGCMissionDoJump;
58 59
class QGCMissionDoStartSearch;
class QGCMissionDoFinishSearch;
60
class QGCMissionConditionDelay;
pixhawk's avatar
pixhawk committed
61
class QGCMissionOther;
62

63
class WaypointEditableView : public QWidget
64
{
pixhawk's avatar
pixhawk committed
65
    Q_OBJECT
66
    Q_DISABLE_COPY(WaypointEditableView)
pixhawk's avatar
pixhawk committed
67
public:
68 69
    explicit WaypointEditableView(Waypoint* wp, QWidget* parent);
    virtual ~WaypointEditableView();
70

pixhawk's avatar
pixhawk committed
71
public:
pixhawk's avatar
pixhawk committed
72
    void setCurrent(bool state);
73

pixhawk's avatar
pixhawk committed
74 75 76 77
public slots:
    void moveUp();
    void moveDown();
    void remove();
pixhawk's avatar
pixhawk committed
78 79
    /** @brief Waypoint matching this widget has been deleted */
    void deleted(QObject* waypoint);
80
    void changedAutoContinue(int);
81
    void changedFrame(int state);
82
    void updateActionView(int action);
83
    void initializeActionView(int action);
84

pixhawk's avatar
pixhawk committed
85
    void changedCurrent(int);
86
    void updateValues(void);
87 88 89 90 91 92 93 94 95
    void changedAction(int state); //change commandID, including the view
    void changedCommand(int mav_cmd_id); //only update WP->command, but do not change the view. Should only be used for "other" waypoint-type.
    void changedParam1(double value);
    void changedParam2(double value);
    void changedParam3(double value);
    void changedParam4(double value);
    void changedParam5(double value);
    void changedParam6(double value);
    void changedParam7(double value);
96

97 98
protected slots:

pixhawk's avatar
pixhawk committed
99 100
protected:
    virtual void changeEvent(QEvent *e);
101
    virtual void paintEvent(QPaintEvent *);
pixhawk's avatar
pixhawk committed
102
    Waypoint* wp;
103 104
    QGC_WAYPOINTEDITABLEVIEW_MODE viewMode;
    // Widgets for every mission element
105
    QGCMissionNavWaypoint* MissionNavWaypointWidget;
106 107 108
    QGCMissionNavLoiterUnlim* MissionNavLoiterUnlimWidget;
    QGCMissionNavLoiterTurns* MissionNavLoiterTurnsWidget;
    QGCMissionNavLoiterTime* MissionNavLoiterTimeWidget;
109 110 111
    QGCMissionNavReturnToLaunch* MissionNavReturnToLaunchWidget;
    QGCMissionNavLand* MissionNavLandWidget;
    QGCMissionNavTakeoff* MissionNavTakeoffWidget;
112
    QGCMissionNavSweep* MissionNavSweepWidget;
113
    QGCMissionDoJump* MissionDoJumpWidget;
114 115
    QGCMissionDoStartSearch* MissionDoStartSearchWidget;
    QGCMissionDoFinishSearch* MissionDoFinishSearchWidget;
116
    QGCMissionConditionDelay* MissionConditionDelayWidget;
pixhawk's avatar
pixhawk committed
117
    QGCMissionOther* MissionOtherWidget;
118

119

pixhawk's avatar
pixhawk committed
120
private:
121
    Ui::WaypointEditableView *m_ui;
122

pixhawk's avatar
pixhawk committed
123 124 125
signals:
    void moveUpWaypoint(Waypoint*);
    void moveDownWaypoint(Waypoint*);
126
    void removeWaypoint(Waypoint*);
127
    void changeCurrentWaypoint(quint16);
pixhawk's avatar
pixhawk committed
128
    void setYaw(double);
129 130 131 132 133 134 135 136 137 138

    void commandBroadcast(int mav_cmd_id);
    void frameBroadcast(MAV_FRAME frame);
    void param1Broadcast(double value);
    void param2Broadcast(double value);
    void param3Broadcast(double value);
    void param4Broadcast(double value);
    void param5Broadcast(double value);
    void param6Broadcast(double value);
    void param7Broadcast(double value);
pixhawk's avatar
pixhawk committed
139 140
};

141
#endif // WAYPOINTEDITABLEVIEW_H