-
Notifications
You must be signed in to change notification settings - Fork 127
/
discard.h
134 lines (117 loc) · 4.02 KB
/
discard.h
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
127
128
129
130
131
132
133
134
/*
Discard points based on high Degree of Precision (DOP) values.
Copyright (C) 2005-2014 Robert Lipe, robertlipe+source@gpsbabel.org
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DISCARD_H_INCLUDED_
#define DISCARD_H_INCLUDED_
#include <QList> // for QList
#include <QRegularExpression> // for QRegularExpression
#include <QString> // for QString
#include <QVector> // for QVector
#include "defs.h" // for arglist_t, ARG_NOMINMAX, ARGTYPE_BEGIN_REQ, ARGTYPE_STRING, ARGTYPE_BOOL, ARGTYPE_INT, ARGTYPE_FLOAT, route_head, ARGTYPE_END_REQ, Waypoint, gpsdata_type
#include "filter.h" // for Filter
#include "option.h" // for OptionString, OptionBool
#if FILTERS_ENABLED
class DiscardFilter:public Filter
{
public:
QVector<arglist_t>* get_args() override
{
return &args;
}
void init() override;
void process() override;
private:
/* Member Functions */
void fix_process_wpt(const Waypoint* wpt);
static QRegularExpression generateRegExp(const QString& glob_pattern);
/* Data Members */
OptionDouble hdopopt;
OptionDouble vdopopt;
OptionBool andopt;
OptionInt satopt;
OptionBool fixnoneopt;
OptionBool fixunknownopt;
OptionInt eleminopt;
OptionInt elemaxopt;
OptionString nameopt;
QRegularExpression name_regex;
OptionString descopt;
QRegularExpression desc_regex;
OptionString cmtopt;
QRegularExpression cmt_regex;
OptionString iconopt;
QRegularExpression icon_regex;
double hdopf{};
double vdopf{};
int satpf{};
int eleminpf{};
int elemaxpf{};
QVector<arglist_t> args = {
{
"hdop", &hdopopt, "Suppress points with higher hdop",
"-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr
},
{
"vdop", &vdopopt, "Suppress points with higher vdop",
"-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr
},
{
"hdopandvdop", &andopt, "Link hdop and vdop suppression with AND",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"sat", &satopt, "Minimum sats to keep points",
"-1", ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr
},
{
"fixnone", &fixnoneopt, "Suppress points without fix",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"fixunknown", &fixunknownopt, "Suppress points with unknown fix",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"elemin", &eleminopt, "Suppress points below given elevation in meters",
nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr
},
{
"elemax", &elemaxopt, "Suppress points above given elevation in meters",
nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr
},
{
"matchname", &nameopt,
"Suppress points where name matches given name", nullptr, ARGTYPE_STRING,
ARG_NOMINMAX, nullptr
},
{
"matchdesc", &descopt,
"Suppress points where description matches given name", nullptr, ARGTYPE_STRING,
ARG_NOMINMAX, nullptr
},
{
"matchcmt", &cmtopt,
"Suppress points where comment matches given name", nullptr, ARGTYPE_STRING,
ARG_NOMINMAX, nullptr
},
{
"matchicon", &iconopt,
"Suppress points where type matches given name", nullptr, ARGTYPE_STRING,
ARG_NOMINMAX, nullptr
},
};
};
#endif
#endif // DISCARD_H_INCLUDED_