Subversion Repositories public

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
119 andreas 2
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
3
 *   andreas@theosys.at                                                    *
88 andreas 4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
20
#ifndef SPORTWATCHERWIDGET_H
21
#define SPORTWATCHERWIDGET_H
22
 
23
#include <qlabel.h>
24
#include <qdatetime.h>
25
#include <qpixmap.h>
26
#include <qimage.h>
27
#include <qpainter.h>
28
#include <qpen.h>
29
#include <qpoint.h>
30
#include <qpointarray.h>
31
#include <qrect.h>
104 andreas 32
#include <qstring.h>
132 andreas 33
#include <qtimer.h>
88 andreas 34
 
155 andreas 35
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 36
   #include <gdal/gdal_priv.h>
37
#endif
38
 
88 andreas 39
#include "garmin.h"
40
#include "managefile.h"
41
#include "disassemble.h"
42
 
43
#include "sportwatcherwidgetbase.h"
44
 
158 andreas 45
typedef enum {
46
	MPT_BMP = 0,
47
	MPT_SHP = 1,
48
	MPT_VRT = 2,
49
	MPT_GIF = 3,
50
	MPT_PNG = 4,
51
	MPT_SGI = 5,
52
	MPT_TIF = 6,
53
	MPT_WMS = 7
54
} MPT;
55
 
88 andreas 56
typedef struct INDEX
57
{
58
	QString path;
59
	QString activ;
60
	INDEX *next;
61
} INDEX;
62
 
158 andreas 63
typedef struct GEORECT
64
{
65
	double llat;
66
	double llon;
67
	double rlat;
68
	double rlon;
69
	int width;
70
	int height;
71
} GEORECT;
72
 
169 andreas 73
typedef struct AVGHEIGHT
74
{
75
	double alt;		// Altitude
76
	int    pos;		// Position in the chain, starting with 0
77
	struct AVGHEIGHT *prev;
78
	struct AVGHEIGHT *next;
79
} AVGHEIGHT;
80
 
88 andreas 81
class sportwatcherWidget : public sportwatcherWidgetBase
82
{
83
  Q_OBJECT
84
 
85
public:
86
  sportwatcherWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
87
  ~sportwatcherWidget();
88
  /*$PUBLIC_FUNCTIONS$*/
89
 
90
public slots:
91
  /*$PUBLIC_SLOTS$*/
92
  virtual void          btFullscreenSlot();
93
  virtual void          btGlasMinusSlot();
94
  virtual void          btGlasPlusSlot();
95
  virtual void          btHandSlot();
96
  virtual void          btGlasSlot();
97
  virtual void          btFlagSlot();
98
  virtual void          liLapsSlot(QListViewItem *item);
99
  virtual void          liActivitiesSlot(QListViewItem *item);
100
  virtual void          helpAbout();
101
  virtual void          helpContents();
102
  virtual void          helpIndex();
103
  virtual void          fileExit();
104
  virtual void          filePrint();
105
  virtual void          fileSaveAs();
106
  virtual void          fileSave();
107
  virtual void          fileOpen();
217 andreas 108
  virtual void		fileImport();
88 andreas 109
  virtual void          fileNew();
218 andreas 110
  virtual void		editRename();
88 andreas 111
  virtual void		extrasSaveHR();
112
  virtual void		extrasSettings();
152 andreas 113
  virtual void		extrasWMSSettings();
88 andreas 114
 
115
protected:
116
  /*$PROTECTED_FUNCTIONS$*/
100 andreas 117
  void destroy();
88 andreas 118
  void showLaps();
100 andreas 119
  void showTrack();
104 andreas 120
  void showTrack(int zoom);
132 andreas 121
  void showTrack(int zoom, const QRect &pan, LAP *lap);
88 andreas 122
  void showCurves();
148 andreas 123
  void showCurves(LAP *lap);
88 andreas 124
  void resizeEvent(QResizeEvent *e);
125
  void paintEvent(QPaintEvent *e);
132 andreas 126
  void mouseMoveEvent(QMouseEvent *e);
127
  void mousePressEvent(QMouseEvent *e);
128
  void mouseReleaseEvent(QMouseEvent *e);
88 andreas 129
 
132 andreas 130
protected:
131
  QTimer timer;
132
 
88 andreas 133
protected slots:
134
  /*$PROTECTED_SLOTS$*/
135
 
136
private:
137
    QDateTime *garmin_dtime (uint32 t);
138
    void getActivities();
104 andreas 139
    bool writeTag(const QFile &fn, const QString &str, int indent);
132 andreas 140
    bool findIndex(const QString &key);
169 andreas 141
    double getAvgAlt (AVGHEIGHT *avgHeight, int pos);
142
    AVGHEIGHT *getAvgPtr (AVGHEIGHT *avgHeight, int pos);
172 andreas 143
    void saveGPX(const QString &fn);
144
    void saveOSM(const QString &fn);
155 andreas 145
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 146
    bool writeWMSTag(double llat, double llon, double rlat, double rlon, int width, int height);
157 andreas 147
    bool transCoords (double *x1, double *y1, double *x2, double *y2, int code, int width, int height, bool square);
158 andreas 148
    QString *getProjection (int isrs, QString *srs);
149
    bool warpImage(QString fn, QString *fName);
151 andreas 150
#endif
88 andreas 151
 
152
private:
153
  QWidget *mama;
100 andreas 154
  QPixmap pmProfile, pmMap;
88 andreas 155
  QDateTime StartTime;
156
  QStringList files;
132 andreas 157
  QRect mapPan;
88 andreas 158
  manageFile spw;
159
  disassemble ds;
160
  garmin_data *gmn;
161
  int min_hr, max_hr, avg_hr;
104 andreas 162
  int zfactor;
88 andreas 163
  double min_height, max_height;
218 andreas 164
  double min_speed, max_speed;
104 andreas 165
  double total_distance;
132 andreas 166
  double oldTransX, oldTransY;
88 andreas 167
  unsigned long max_time;
132 andreas 168
  bool stateHand, stateFlag, stateGlas;
169
  int lmbPressed;
170
  LAP *mapLap;
88 andreas 171
  INDEX *index;
155 andreas 172
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 173
  GDALDataset *poDataset;
157 andreas 174
  int mFactor;
158 andreas 175
  GEORECT geoRect;
151 andreas 176
#endif
88 andreas 177
 
178
private:
179
  /* Config Parameters */
180
  int lower1, lower2, lower3;
181
  int upper1, upper2, upper3;
182
  int MaxHr, restHr;
183
  int vo2max, weight, sampleTime;
158 andreas 184
  int Units, MapType;
168 andreas 185
  bool Serial, Contour;
143 andreas 186
  QString Device, Data, HRM, MAP;
88 andreas 187
};
188
 
189
#endif
190