-
Notifications
You must be signed in to change notification settings - Fork 128
/
arcdist.h
105 lines (87 loc) · 2.83 KB
/
arcdist.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
/*
Distance from point to arc filter
Copyright (C) 2002-2014 Robert Lipe, [email protected]
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 ARCDIST_H_INCLUDED_
#define ARCDIST_H_INCLUDED_
#include <QList> // for QList
#include <QString> // for QString
#include <QVector> // for QVector
#include "defs.h" // for ARG_NOMINMAX, ARGTYPE_BOOL, Waypoint (ptr only)
#include "filter.h" // for Filter
#include "option.h" // for OptionBool, OptionString
#if FILTERS_ENABLED
class ArcDistanceFilter:public Filter
{
public:
QVector<arglist_t>* get_args() override
{
return &args;
}
void init() override;
void process() override;
private:
/* Types */
struct extra_data {
double distance;
PositionDeg prjpos;
double frac;
const Waypoint* arcpt1;
const Waypoint* arcpt2;
};
/* Member Functions */
void arcdist_arc_disp_wpt_cb(const Waypoint* arcpt2);
void arcdist_arc_disp_hdr_cb(const route_head* /*unused*/);
/* Data Members */
double pos_dist{};
OptionDouble distopt{true};
OptionString arcfileopt;
OptionBool rteopt;
OptionBool trkopt;
OptionBool exclopt;
OptionBool ptsopt;
OptionBool projectopt;
QVector<arglist_t> args = {
{
"file", &arcfileopt, "File containing vertices of arc",
nullptr, ARGTYPE_FILE, ARG_NOMINMAX, nullptr
},
{
"rte", &rteopt, "Route(s) are vertices of arc",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"trk", &trkopt, "Track(s) are vertices of arc",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"distance", &distopt, "Maximum distance from arc",
nullptr, ARGTYPE_STRING | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr
},
{
"exclude", &exclopt, "Exclude points close to the arc", nullptr,
ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"points", &ptsopt, "Use distance from vertices not lines",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
{
"project", &projectopt, "Move waypoints to its projection on lines or vertices",
nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
},
};
};
#endif // FILTERS_ENABLED
#endif // ARCDIST_H_INCLUDED_