Subversion Repositories Projects

Rev

Blame | Last modification | View Log | RSS feed

/***************************************************************************
 *   Copyright (C) 2009 by Manuel Schrape                                  *
 *   manuel.schrape@gmx.de                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License.        *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   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.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef DLG_MAIN_H
#define DLG_MAIN_H

#include <QtGui/QMainWindow>
//#include <QTcpServer>
//#include <QTcpSocket>
#include <QFile>

#include "ui_dlg_Main.h"

#include "../Defines.h"
#include "../TypeDefs.h"

#include "../Classes/cSettings.h"

#include "../../Global/Kopter.h"
#include "../../Global/MK_Datatypes.h"

#include "../../Global/Class_QMapControl.h"

#include "../../Global/Class_Input/Input.h"
#include "../../Global/Class_Input/Input_TCP.h"
#include "../../Global/Class_Input/Input_TTY.h"
#include "../../Global/Class_HandlerIP/HandlerIP.h"
#include "../../Global/Class_HandlerMK/HandlerMK.h"
#include "../../Global/Class_HandlerKML/HandlerKML.h"

using namespace qmapcontrol;

class dlg_Main : public QMainWindow, public Ui::dlg_Main_UI
{
    Q_OBJECT

    public:
        dlg_Main();
        ~dlg_Main();
        void create_Map();

    private:
        // Input Device.
        Input *o_Input;

        // Info über die Hardware
        s_Hardware VersionInfo;

        // Settings-Object
        cSettings *o_Settings;

        char c_Data[150];

        // Programm-Initialisirungen
        void init_GUI();
        void init_Connections();

        void init_Directorys();
        s_Directorys s_Dir;

        // Einkommende Datenpackete zerlegen.
        void parse_MK_Data(QString t_Data);
        void parse_IP_Data(QString t_Data);

        // QMK-Maps
        QFile *o_Record;

        QPen* Pen[6];

        MapControl  *o_Map;
        MapAdapter  *o_Adapter;

        Layer       *o_Layer;
        Layer       *o_Click;

        Layer       *o_Info;
        Layer       *o_RouteWP;
        Layer       *o_RouteFL;

        QList<Point*> p_RouteWP;
        LineString*   l_RouteWP;

        QList<Point*> p_RouteFL;
        LineString*   l_RouteFL;

        Point* LastPos;
        Point* LastClick;
        Point* ClickPoint;
        Point* Flag;
        Point* Home;
        Point* Target;

        QPointF MapCenter;

        QList<sWayPoint> l_WayPoints;
        QList<sWayPoint> l_Track;

        QList<sWayPoint> parse_WayPointKML(QString s_File);
        QList<sWayPoint> parse_WayPointMKW(QString s_File);

        void show_WayPoints(QList<sWayPoint> WayPoints);

        void save_WayPointsMKW(QString s_File);

        void add_Position(s_MK_NaviData t_NaviData);
        void show_Data(s_MK_NaviData t_NaviData);
        void send_Target(Point *t_Target);
        void send_WayPoints(QList<sWayPoint> l_WayPoints, int t_Pos = 0);

    private slots:
        void slot_ac_About();
        void slot_ac_Toolbar();

        void slot_ac_Connect();
        void slot_sb_Intervall(int t_Intervall);

        // Einkommende Datenpackete.
        void slot_Input_Data(QString t_Data);
        void slot_Input_Disconnected(int Error);
        void slot_Input_Connected();

        // QMK-Maps
        void slot_Zoom(int t_Zoom);
        void slot_ChangeMap(int);
        void slot_Click(const QMouseEvent*, const QPointF);

        void slot_btn_WPAdd();
        void slot_btn_WPFly();
        void slot_btn_WPDelete();
        void slot_ShowWayPoints(bool);

        void slot_ac_RouteDelete();

        void slot_ac_LoadMapPic();
        void slot_ac_Record();

//    void slot_GotoTarget();
//    void slot_Close();

        void slot_ac_LoadWayPoints();
        void slot_ac_SaveRoute();

    protected:
        virtual void wheelEvent(QWheelEvent *event);
        virtual void resizeEvent ( QResizeEvent * event );

};

#endif // DLG_MAIN_H