📄 gpsdata.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 GPSDATA_H
#define GPSDATA_H
#include <qsocket.h>
#include <qvbox.h>
#include <qhbox.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 <qvector.h>
#include <qwidget.h>
#include <qcombobox.h>
#include <qscrollview.h>
#include <qstringlist.h>
#include <qcolor.h>
#include <qregexp.h>
#include <math.h>
#define HAVE_STDINT_H 1
#include <gps.h> // libgpsd
#include "datum/datum.h"
#include "datum/ellipse.h"
class Track;
class Qpegps;
struct Altitude
{
// ----- MEMBERS -----
double val; // in meters
// ----- METHODS -----
Altitude(double a = 0) : val(a) {}
~Altitude() {}
QString toString(bool bUnit = true);
// ----- TYPEDEFS -----
enum Unit { None = 0, Meter, Feet, FL };
// ----- STATIC MEMBERS -----
static Unit unit; // print format
};
struct Speed
{
// ----- MEMBERS -----
double val; // in knots
// ----- METHODS -----
Speed(double s = 0) : val(s) {}
~Speed() {}
QString toString();
// ----- TYPEDEFS -----
enum Unit { None = 0, Kmh, Knots, Mph };
// ----- STATIC MEMBERS -----
static Unit unit; // print format
};
struct Distance
{
// ----- MEMBERS -----
double val; // in nautical miles
// ----- METHODS -----
Distance(double d = 0) : val(d) {}
~Distance() {}
QString toString();
// ----- TYPEDEFS -----
enum Unit { None = 0, Km, Naut, Statute };
// ----- STATIC MEMBERS -----
static Unit unit; // print format
};
struct Position
{
// ----- MEMBERS -----
double lat, lon; // in decimal degrees
// ----- METHODS -----
Position(double lat = 0, double lon = 0)
: lat(lat), lon(lon) {}
~Position() {}
// ----- TYPEDEFS -----
enum Unit { Degree = 0, DegMin, DegMinSec };
enum Axis { Lat = 0, Lon };
// ----- STATIC METHODS -----
static QString string(double l, Axis a = Lat);
static double number(const QString & ltString, Axis a = Lat);
// ----- STATIC MEMBERS -----
static Unit unit; // print format
};
struct Angle
{
// ----- MEMBERS -----
double val; // in degrees?
// bool show;
// ----- METHODS -----
Angle(double a = 0) : val(a) {}
~Angle() {}
QString toString();
};
class Time : public QObject
{
Q_OBJECT
// ----- METHODS -----
public:
Time(QWidget * parent = 0, const char * name = 0)
: QObject(parent, name) {}
~Time() {}
QString toString();
};
struct TimeStamp
{
// ----- MEMBERS -----
QString date;
QString time;
// ----- METHODS -----
TimeStamp(
const QString & date = QString(), const QString & time = QString())
: date(date), time(time) {}
~TimeStamp() {}
QString toString();
};
class Satellite
{
// ----- METHODS -----
public:
Satellite(int n = -1, int e = 0, int a = 0, int s = 0, bool u = false,
bool up = false)
: name(n), elevation(e), azimut(a), snr(s), used(u), updated(up) {}
~Satellite() {}
bool operator==(const Satellite & other) const;
bool operator!=(const Satellite & other) const;
Satellite & operator=(const Satellite & other);
// ----- MEMBERS -----
public:
// name used to identify this satellite
int name;
// elevation of satellite
int elevation;
// azimut angle
int azimut;
// signal noise ratio (db)
int snr;
// used to fix
bool used;
// flag if the value has changed
bool updated;
};
class GeoDatum : public QObject
{
Q_OBJECT
// ----- METHODS -----
public:
GeoDatum(QObject * parent=0, const char * name=0);
~GeoDatum() {}
QStringList getDatumList() { return datumList; }
void convertDatum(long fromIdx, long toIdx,
double * lt, double * lg, double * altitude);
// ----- MEMBERS -----
private:
long errorCode, datumCount;
QStringList datumList;
};
struct GpsFix
{
// ----- MEMBERS -----
Altitude altitude;
Speed speed;
Position position;
Angle heading;
Angle bearing;
};
struct GpsData
{
// ----- MEMBERS -----
bool connected;
bool online;
QString gpsName;
enum Status { NoFix = 0, Fix2D = 1, Fix3D = 2};
int status;
QString statusStr;
QDateTime timestamp;
GpsFix fix;
QVector<Satellite> satellites;
int satellites_used;
Speed avspeed;
// ----- METHODS -----
GpsData(){satellites.setAutoDelete(true);}
~GpsData() {satellites.clear();}
};
struct GpsOptions
{
// ----- MEMBERS -----
QString host;
Q_UINT16 port;
QStringList startScript;
QStringList resumeScript;
QStringList stopScript;
};
struct MapOptions
{
QString mapPathStr;
bool searchMapsInSubdirs;
};
struct TrackOptions
{
QString trackPathStr;
int track_thick; // trackline thickness
int updt_freq; // minimal time difference between 2 positionsm
QColor trackColor;
};
struct GeoDatumOptions
{
long gpsDatumIdx;
long mapDatumIdx;
};
struct MapDispOptions
{
int textSize;
bool showTime;
bool showHeading;
bool showBearing;
bool rotateMap; // rotate map to follows heading
bool zoom2x;
enum MapModes { GpsMode = 0, ManualMode};
int mode;
QColor statusOkColor;
QColor statusNoFixColor;
QColor headColor;
QColor bearColor;
QColor scaleColor;
};
struct PlacesOptions
{
bool showPlaces;
int placesTextSize;
QColor placesColor;
};
#endif // GPSDATA_H
// end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -