Subversion Repositories public

Rev

Rev 157 | Rev 168 | Go to most recent revision | Details | Compare with Previous | 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
 
88 andreas 73
class sportwatcherWidget : public sportwatcherWidgetBase
74
{
75
  Q_OBJECT
76
 
77
public:
78
  sportwatcherWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
79
  ~sportwatcherWidget();
80
  /*$PUBLIC_FUNCTIONS$*/
81
 
82
public slots:
83
  /*$PUBLIC_SLOTS$*/
84
  virtual void          btFullscreenSlot();
85
  virtual void          btGlasMinusSlot();
86
  virtual void          btGlasPlusSlot();
87
  virtual void          btHandSlot();
88
  virtual void          btGlasSlot();
89
  virtual void          btFlagSlot();
90
  virtual void          liLapsSlot(QListViewItem *item);
91
  virtual void          liActivitiesSlot(QListViewItem *item);
92
  virtual void          helpAbout();
93
  virtual void          helpContents();
94
  virtual void          helpIndex();
95
  virtual void          fileExit();
96
  virtual void          filePrint();
97
  virtual void          fileSaveAs();
98
  virtual void          fileSave();
99
  virtual void          fileOpen();
100
  virtual void          fileNew();
101
  virtual void		extrasSaveHR();
102
  virtual void		extrasSettings();
152 andreas 103
  virtual void		extrasWMSSettings();
88 andreas 104
 
105
protected:
106
  /*$PROTECTED_FUNCTIONS$*/
100 andreas 107
  void destroy();
88 andreas 108
  void showLaps();
100 andreas 109
  void showTrack();
104 andreas 110
  void showTrack(int zoom);
132 andreas 111
  void showTrack(int zoom, const QRect &pan, LAP *lap);
88 andreas 112
  void showCurves();
148 andreas 113
  void showCurves(LAP *lap);
88 andreas 114
  void resizeEvent(QResizeEvent *e);
115
  void paintEvent(QPaintEvent *e);
132 andreas 116
  void mouseMoveEvent(QMouseEvent *e);
117
  void mousePressEvent(QMouseEvent *e);
118
  void mouseReleaseEvent(QMouseEvent *e);
88 andreas 119
 
132 andreas 120
protected:
121
  QTimer timer;
122
 
88 andreas 123
protected slots:
124
  /*$PROTECTED_SLOTS$*/
125
 
126
private:
127
    QDateTime *garmin_dtime (uint32 t);
128
    void getActivities();
104 andreas 129
    bool writeTag(const QFile &fn, const QString &str, int indent);
132 andreas 130
    bool findIndex(const QString &key);
155 andreas 131
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 132
    bool writeWMSTag(double llat, double llon, double rlat, double rlon, int width, int height);
157 andreas 133
    bool transCoords (double *x1, double *y1, double *x2, double *y2, int code, int width, int height, bool square);
158 andreas 134
    QString *getProjection (int isrs, QString *srs);
135
    bool warpImage(QString fn, QString *fName);
151 andreas 136
#endif
88 andreas 137
 
138
private:
139
  QWidget *mama;
100 andreas 140
  QPixmap pmProfile, pmMap;
88 andreas 141
  QDateTime StartTime;
142
  QStringList files;
132 andreas 143
  QRect mapPan;
88 andreas 144
  manageFile spw;
145
  disassemble ds;
146
  garmin_data *gmn;
147
  int min_hr, max_hr, avg_hr;
104 andreas 148
  int zfactor;
88 andreas 149
  double min_height, max_height;
104 andreas 150
  double total_distance;
132 andreas 151
  double oldTransX, oldTransY;
88 andreas 152
  unsigned long max_time;
132 andreas 153
  bool stateHand, stateFlag, stateGlas;
154
  int lmbPressed;
155
  LAP *mapLap;
88 andreas 156
  INDEX *index;
155 andreas 157
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 158
  GDALDataset *poDataset;
157 andreas 159
  int mFactor;
158 andreas 160
  GEORECT geoRect;
151 andreas 161
#endif
88 andreas 162
 
163
private:
164
  /* Config Parameters */
165
  int lower1, lower2, lower3;
166
  int upper1, upper2, upper3;
167
  int MaxHr, restHr;
168
  int vo2max, weight, sampleTime;
158 andreas 169
  int Units, MapType;
149 andreas 170
  bool Serial;
143 andreas 171
  QString Device, Data, HRM, MAP;
88 andreas 172
};
173
 
174
#endif
175