📄 track.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 TRACK_H
#define TRACK_H
#include <qsocket.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qhgroupbox.h>
#include <qvgroupbox.h>
#include <qmultilineedit.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 <qcheckbox.h>
#include <qlist.h>
#include <qcombobox.h>
#include <math.h>
#include "qpegps.h"
#include "maps.h"
#include "gpsdata.h"
#include "dirdialog.h"
#include "settings.h"
#define MINTRACKDIST 0.000001 // minimal distance between tracks [app. degrees]
// track formats
enum {
NMEA,
PCX5,
GPSDRIVE
};
#define DEF_FORMAT GPSDRIVE
/* one track point */
class TrackPoint : public QObject
{
Q_OBJECT
// ----- METHODS -----
public:
TrackPoint(QString *nmea); // create trackpoint from nmea gga sentence
TrackPoint(QString tim,double lat,double lon,double alt);
~TrackPoint() {}
QString toNMEA();
QString toPCX5();
QString toDrive();
double dist(Position & p);
double timediff(const QString & tim);
// ----- MEMBERS -----
public:
double time, altitude;
Position pos;
};
/* writing and reading tracklogs */
class Track : public QScrollView
{
Q_OBJECT
// ----- METHODS -----
public:
Track(Qpegps * appl, PlacesOptions *placesOpts, QWidget * parent = 0,
const char * name = 0, WFlags f = 0);
~Track();
void updateFileList(); // update comboboxes with filenames
void Write(QString filename, int format = DEF_FORMAT);
// write tracklog in memory to file
void Read(QString filename); // read tracklog from file to memory
void update(GpsData *gpsData); // new data from gps, update track
void drawTrack(QPainter * painter, MapBase * actmap,
int x1, int y1, int mx, int my);
// draw tracklog
//void setRate(unsigned message,unsigned rate); // set rate of message
public slots:
void updateConfig();
void updatePlaces();
private slots:
void setWriteCB(bool state); // (un)checked write checkbox
void setReadCB(bool state); // (un)checked read checkbox
void setReadName(const QString &); // changed read log name
void tLEChanged(); // trackdir line edit changed
void setTrackPath(); // searching for trackdir
void dLEChanged(); // trackdir line edit changed
void lMenuBChanged(int idx); // track line thickness changed
// void cLEChanged(); // CF period line edit changed
void setShowPlacesTB(bool state); // (un)checked draw places checkbox
void setPlacesTextSize(int idx); // (un)checked draw places checkbox
void placeSelected(int ind);
void delPlace();
// ----- MEMBERS -----
public:
QDir * logdir; // mapdir, we have .log files there
QComboBox *wLog, *rLog; // write/read tracklog filenames
QLineEdit *tLE, *dLE, *cLE; // trackdir, min. time diff [s], cf period [s]
MenuButton * lMenuB;
QComboBox *mapLatLonCB;
QCheckBox *placesTB; // show places
QSpinBox *textSizeSB; // places text size
TrackOptions trackOptions;
PlacesOptions *placesOptions;
Qpegps * application;
bool wDo, rDo, cDo; // write track? display track? display current?
QList<TrackPoint> wTrack, rTrack;
protected:
QMultiLineEdit * commMLE;
PlaceList *places;
signals:
void trackChanged();
void waypointsChanged();
};
#endif // TRACK_H
// end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -