Subversion Repositories public

Rev

Rev 221 | Rev 232 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
221 andreas 2
 *   Copyright (C) 2007 - 2009 by Andreas Theofilu                         *
119 andreas 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>
230 andreas 34
#include <klocale.h>
88 andreas 35
 
155 andreas 36
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 37
   #include <gdal/gdal_priv.h>
38
#endif
39
 
88 andreas 40
#include "garmin.h"
41
#include "managefile.h"
42
#include "disassemble.h"
43
 
44
#include "sportwatcherwidgetbase.h"
45
 
158 andreas 46
typedef enum {
47
	MPT_BMP = 0,
48
	MPT_SHP = 1,
49
	MPT_VRT = 2,
50
	MPT_GIF = 3,
51
	MPT_PNG = 4,
52
	MPT_SGI = 5,
53
	MPT_TIF = 6,
54
	MPT_WMS = 7
55
} MPT;
56
 
88 andreas 57
typedef struct INDEX
58
{
59
	QString path;
60
	QString activ;
61
	INDEX *next;
62
} INDEX;
63
 
158 andreas 64
typedef struct GEORECT
65
{
66
	double llat;
67
	double llon;
68
	double rlat;
69
	double rlon;
70
	int width;
71
	int height;
72
} GEORECT;
73
 
169 andreas 74
typedef struct AVGHEIGHT
75
{
76
	double alt;		// Altitude
77
	int    pos;		// Position in the chain, starting with 0
78
	struct AVGHEIGHT *prev;
79
	struct AVGHEIGHT *next;
80
} AVGHEIGHT;
81
 
88 andreas 82
class sportwatcherWidget : public sportwatcherWidgetBase
83
{
84
  Q_OBJECT
85
 
86
public:
87
  sportwatcherWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
88
  ~sportwatcherWidget();
89
  /*$PUBLIC_FUNCTIONS$*/
90
 
91
public slots:
92
  /*$PUBLIC_SLOTS$*/
93
  virtual void          btFullscreenSlot();
94
  virtual void          btGlasMinusSlot();
95
  virtual void          btGlasPlusSlot();
96
  virtual void          btHandSlot();
97
  virtual void          btGlasSlot();
98
  virtual void          btFlagSlot();
99
  virtual void          liLapsSlot(QListViewItem *item);
100
  virtual void          liActivitiesSlot(QListViewItem *item);
101
  virtual void          helpAbout();
102
  virtual void          helpContents();
103
  virtual void          helpIndex();
104
  virtual void          fileExit();
105
  virtual void          filePrint();
106
  virtual void          fileSaveAs();
107
  virtual void          fileSave();
108
  virtual void          fileOpen();
217 andreas 109
  virtual void		fileImport();
88 andreas 110
  virtual void          fileNew();
218 andreas 111
  virtual void		editRename();
88 andreas 112
  virtual void		extrasSaveHR();
113
  virtual void		extrasSettings();
152 andreas 114
  virtual void		extrasWMSSettings();
88 andreas 115
 
116
protected:
117
  /*$PROTECTED_FUNCTIONS$*/
100 andreas 118
  void destroy();
88 andreas 119
  void showLaps();
100 andreas 120
  void showTrack();
104 andreas 121
  void showTrack(int zoom);
132 andreas 122
  void showTrack(int zoom, const QRect &pan, LAP *lap);
88 andreas 123
  void showCurves();
148 andreas 124
  void showCurves(LAP *lap);
88 andreas 125
  void resizeEvent(QResizeEvent *e);
126
  void paintEvent(QPaintEvent *e);
132 andreas 127
  void mouseMoveEvent(QMouseEvent *e);
128
  void mousePressEvent(QMouseEvent *e);
129
  void mouseReleaseEvent(QMouseEvent *e);
88 andreas 130
 
132 andreas 131
protected:
132
  QTimer timer;
133
 
88 andreas 134
protected slots:
135
  /*$PROTECTED_SLOTS$*/
136
 
137
private:
138
    QDateTime *garmin_dtime (uint32 t);
139
    void getActivities();
104 andreas 140
    bool writeTag(const QFile &fn, const QString &str, int indent);
132 andreas 141
    bool findIndex(const QString &key);
169 andreas 142
    double getAvgAlt (AVGHEIGHT *avgHeight, int pos);
143
    AVGHEIGHT *getAvgPtr (AVGHEIGHT *avgHeight, int pos);
172 andreas 144
    void saveGPX(const QString &fn);
145
    void saveOSM(const QString &fn);
155 andreas 146
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 147
    bool writeWMSTag(double llat, double llon, double rlat, double rlon, int width, int height);
157 andreas 148
    bool transCoords (double *x1, double *y1, double *x2, double *y2, int code, int width, int height, bool square);
158 andreas 149
    QString *getProjection (int isrs, QString *srs);
150
    bool warpImage(QString fn, QString *fName);
151 andreas 151
#endif
88 andreas 152
 
153
private:
154
  QWidget *mama;
100 andreas 155
  QPixmap pmProfile, pmMap;
88 andreas 156
  QDateTime StartTime;
157
  QStringList files;
132 andreas 158
  QRect mapPan;
230 andreas 159
  KLocale *kl;		// This is for translating date and time
88 andreas 160
  manageFile spw;
161
  disassemble ds;
162
  garmin_data *gmn;
163
  int min_hr, max_hr, avg_hr;
104 andreas 164
  int zfactor;
88 andreas 165
  double min_height, max_height;
218 andreas 166
  double min_speed, max_speed;
104 andreas 167
  double total_distance;
132 andreas 168
  double oldTransX, oldTransY;
88 andreas 169
  unsigned long max_time;
132 andreas 170
  bool stateHand, stateFlag, stateGlas;
171
  int lmbPressed;
172
  LAP *mapLap;
88 andreas 173
  INDEX *index;
155 andreas 174
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 175
  GDALDataset *poDataset;
157 andreas 176
  int mFactor;
158 andreas 177
  GEORECT geoRect;
151 andreas 178
#endif
88 andreas 179
 
180
private:
181
  /* Config Parameters */
182
  int lower1, lower2, lower3;
183
  int upper1, upper2, upper3;
184
  int MaxHr, restHr;
185
  int vo2max, weight, sampleTime;
158 andreas 186
  int Units, MapType;
230 andreas 187
  bool Serial, Contour, Forerunner;
143 andreas 188
  QString Device, Data, HRM, MAP;
88 andreas 189
};
190
 
191
#endif
192