summaryrefslogtreecommitdiff
path: root/src/GPX.hpp
blob: d937cbb60ec6fb8613e3b330d1c767a2e39d81ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// -*- mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; coding: utf-8-unix -*-
/***************************************************************************
 *   Copyright (C) 2010-2012 by Oleg Khudyakov                             *
 *   prcoder@gmail.com                                                     *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
// ***** BEGIN LICENSE BLOCK *****
//////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011-2014 RALOVICH, Kristóf                            //
//                                                                      //
// 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 3 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.                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////
// ***** END LICENSE BLOCK *****

#pragma once

#include "GarminConvert.hpp"
#include <vector>
#include <string>
#include <fstream>
#include <map>
#include "stdintfwd.hpp"


namespace antpm{

class WayPoint
{
public:
    WayPoint();
    ~WayPoint();

    void putToFile(std::ofstream &file);

public:
    std::string name;
    uint32_t time;
    int32_t latitude;
    int32_t longitude;
    uint16_t altitude;
};

class TrackPoint
{
public:
    TrackPoint();
    ~TrackPoint();

    void putToFile(std::ofstream &file);

public:
    uint32_t time;
    int32_t latitude;
    int32_t longitude;
    uint16_t altitude;
    uint8_t heartRate;
    uint8_t cadence;
};

class TrackSeg
{
public:
    TrackSeg();
    ~TrackSeg();

    void putToFile(std::ofstream &file);

public:
    std::map<uint32_t,TrackPoint> trackPoints;
};

class Track
{
public:
    Track(std::string &name);
    ~Track();

    void newTrackSeg();
    void putToFile(std::ofstream &file);

public:
    std::string name;
    std::vector<TrackSeg> trackSegs;
};

class GPX
{
public:
    GPX();
    ~GPX();

    void newTrack(std::string name);
    void newTrackSeg();
    void newWayPoint();

    bool writeToFile(std::string fileName);

public:
    std::vector<WayPoint> wayPoints;
    std::vector<Track> tracks;
};

}