⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapdisp.h

📁 给予QT的qps开源最新源码
💻 H
字号:
/*
   qpegps is a program for displaying a map centered at the current longitude/
   latitude as read from a gps receiver.

   Copyright (C) 2002 Ralf Haselmeier <Ralf.Haselmeier@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, or
   (at your option) any later version.

   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., 675 Mass Ave, Cambridge, MA 02139, USA.

 */

#ifndef MAPDISP_H
#define MAPDISP_H

#include <qsocket.h>
#include <time.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qvgroupbox.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qdialog.h>
#include <qsortedlist.h>
#include <qvbuttongroup.h>
#include <qradiobutton.h>
#include <qlistview.h>
#include <qvalidator.h>
#include <qmessagebox.h>
#include <qpalette.h>

#include <qtextview.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtextstream.h>
#include <qtimer.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qfileinfo.h>
#include <qdir.h>
#include <qarray.h>
#include <qwidget.h>
#include <math.h>
#include <qimage.h>

#include "gpsdata.h"
#include "track.h"
#include "qpegps.h"
#include "maps.h"

class MapDisp : public QWidget
{
   Q_OBJECT

   // ----- METHODS -----
   public:
      MapDisp(Qpegps * app, MapSelector * maps, GpsData *gps, 
            QWidget * parent = 0, const char * name = 0, WFlags f = 0);
      ~MapDisp() {}

   protected:
      void createMap();
      void MapDispAddPos(const Position & pos, double altitude);
      void MapDispDist(int mouseEventX, int mouseEventY);
      void MapDispMesure(int X, int Y);
      void ContextMenuGps(const QPoint &pos);
      void ContextMenuManual(const QPoint &pos);
      void swichMode();

      QPoint screenToMap(const QPoint &screenPos);
      QPoint mapToScreen(const QPoint &mapPos);
      
      void mousePressEvent(QMouseEvent * e); // QWidget virtual
      void keyPressEvent(QKeyEvent * e); // QWidget virtual
      void paintEvent(QPaintEvent * e); // QWidget virtual
//      void mouseDoubleClickEvent(QMouseEvent * e); // QWidget virtual
      void mouseReleaseEvent(QMouseEvent * e); // QWidget virtual
      void mouseMoveEvent(QMouseEvent * e); // QWidget virtual
 
	   void DrawStatus(QPainter *painter);
	   void DrawCross(QPainter *painter);
	   void DrawHeading(QPainter *painter);
	   void DrawBearingLine(QPainter *painter);
	   void DrawScaleLine(QPainter *painter);
      void DrawPlaces(QPainter *painter);

      QString timeToString();

   public slots:
      void timerDone();
      void animateTrack();

   // ----- MEMBERS -----
   public:
      Qpegps * app;
      GpsData * gpsData;
      PlaceList * places;
      MapDispOptions mapDispOptions;   // options
      PlacesOptions placesOptions;     // TODO : merge with mapDispOptions
      MapSelector * mapSelector;
      QPixmap *mapdisp;

      QColor statColor;
      int lgth;

      int centerX, centerY;	
      double mapOrientation;
      double accDist;
      Position currentPos;
      Altitude currentAltitude;
      Position dest;
      Position mPos;
      QListIterator<Place> placesIt;
      bool ManualWp;
      bool noDBLC;
      bool noMouseMoved;
      
      Position wpPos;
      Distance wpDistance;
      double ttwph, ttwpm, ttwps; // time to waypoint h, min, sec

      QTimer * timer;
      int mouseEventX, mouseEventY;
      //    int WTconunter;
      time_t WTTimer, WriteTimeout;
      bool FirstKey;

      QTimer * aniTimer;
      bool inAnimation;
      int aniTime;
      int aniTimeZone;
      double aniAccelerator;
      bool aniShortcutTime;
      QFile * aniFile;
      QTextStream *aniTS;      
      int aniNextTime;
      double aniNextLatitude;
      double aniNextLongitude;
      double aniNextAltitude;

   signals:
      void mouseClick(QWidget *);
      void moreDetail();
      void lessDetail();
      void debugMaps();
      void waypointsChanged();
};

class MapCoordEditorDialog : public QDialog
{
   Q_OBJECT

   // ----- METHODS -----
   public:
      MapCoordEditorDialog(PlaceList *pl,
            QWidget * parent = 0, const char * name = 0,
            bool modal = false, WFlags f = 0);
      ~MapCoordEditorDialog() {}

      Position getPosition();
      double getAltitude();

   protected slots:
      void placeSelected(int ind);
      void toggledDDddB(bool state);
      void toggledDDMMmmB(bool state);
      void toggledDDMMSSssB(bool state);
      void editedLtLe(const QString &);

   // ----- MEMBERS -----
   public:
      QLineEdit * AltLE;
      QLineEdit * LatiLEd;
      QLineEdit * LonLEd;
      QLineEdit * LatiLEm;
      QLineEdit * LonLEm;
      QLineEdit * LatiLEs;
      QLineEdit * LonLEs;
      QComboBox * mapLatLonCB;

   protected:
      QMultiLineEdit * commMLE;
      QLabel * AltL;
      QLabel * LonL;
      QLabel * LatiL;
      QLabel * LonLd;
      QLabel * LatiLd;
      QLabel * LonLm;
      QLabel * LatiLm;
      QLabel * LonLs;
      QLabel * LatiLs;
      QLabel * LonLS;
      QLabel * LatiLS;
      QButtonGroup * LatLonBG;
      QRadioButton * DDddB;
      QRadioButton * DDMMmmB;
      QRadioButton * DDMMSSssB;

      QIntValidator valInt360;
      QIntValidator valInt60;
      QDoubleValidator valDouble360;
      QDoubleValidator valDouble60;

      PlaceList * places;
//      Altitude	* alt;
};

class MapPlaceEditorDialog : public QDialog
{
   Q_OBJECT

   // ----- METHODS -----
   public:
      MapPlaceEditorDialog(QWidget * parent = 0, const char * name = 0,
            bool modal = false, WFlags f = 0);
      ~MapPlaceEditorDialog() {}

   // ----- MEMBERS -----
   public:
      QLineEdit * CommentLEd;
      QLineEdit * NameLEd;

   protected:
      QVGroupBox * PlaceGB1;
};

class AnimateParamsDialog : public QDialog
{
    Q_OBJECT

   // ----- METHODS -----
   public:
      AnimateParamsDialog(const QString &trackPath, QWidget *, const char *, bool, WFlags);
      ~AnimateParamsDialog();
   // ----- MEMBERS -----
   public:
      QLabel * AccelL;
      QLabel * AccelLS;
      QLineEdit * AccelLEd;
      QLabel * TZL;
      QLabel * TZLS;
      QLineEdit * TZLEd;
      QCheckBox * scTimeTB;
      QComboBox * trackFileCB;
};

#endif // MAPDISP_H

// end of file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -