1 /* 2 Discard points based on high Degree of Precision (DOP) values. 3 4 Copyright (C) 2005-2014 Robert Lipe, robertlipe+source@gpsbabel.org 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 20 */ 21 22 #ifndef DISCARD_H_INCLUDED_ 23 #define DISCARD_H_INCLUDED_ 24 25 // Can't use QRegularExpression because Linux won't get Qt 5 for years. 26 #include <QtCore/QRegExp> // for QRegExp 27 #include <QtCore/QVector> // for QVector 28 29 #include "defs.h" // for ARG_NOMINMAX, ARGTYPE_BEGIN_REQ, ARGTYPE_S... 30 #include "filter.h" // for Filter 31 32 #if FILTERS_ENABLED 33 class DiscardFilter:public Filter 34 { 35 public: get_args()36 QVector<arglist_t>* get_args() override 37 { 38 return &args; 39 } 40 void init() override; 41 void process() override; 42 43 private: 44 char* hdopopt = nullptr; 45 char* vdopopt = nullptr; 46 char* andopt = nullptr; 47 char* satopt = nullptr; 48 char* fixnoneopt = nullptr; 49 char* fixunknownopt = nullptr; 50 char* eleminopt = nullptr; 51 char* elemaxopt = nullptr; 52 char* nameopt = nullptr; 53 QRegExp name_regex; 54 char* descopt = nullptr; 55 QRegExp desc_regex; 56 char* cmtopt = nullptr; 57 QRegExp cmt_regex; 58 char* iconopt = nullptr; 59 QRegExp icon_regex; 60 61 double hdopf{}; 62 double vdopf{}; 63 int satpf{}; 64 int eleminpf{}; 65 int elemaxpf{}; 66 gpsdata_type what; 67 route_head* head{}; 68 69 QVector<arglist_t> args = { 70 { 71 "hdop", &hdopopt, "Suppress points with higher hdop", 72 "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr 73 }, 74 { 75 "vdop", &vdopopt, "Suppress points with higher vdop", 76 "-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr 77 }, 78 { 79 "hdopandvdop", &andopt, "Link hdop and vdop suppression with AND", 80 nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr 81 }, 82 { 83 "sat", &satopt, "Minimum sats to keep points", 84 "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr 85 }, 86 { 87 "fixnone", &fixnoneopt, "Suppress points without fix", 88 nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr 89 }, 90 { 91 "fixunknown", &fixunknownopt, "Suppress points with unknown fix", 92 nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr 93 }, 94 { 95 "elemin", &eleminopt, "Suppress points below given elevation in meters", 96 nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr 97 }, 98 { 99 "elemax", &elemaxopt, "Suppress points above given elevation in meters", 100 nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr 101 }, 102 { 103 "matchname", &nameopt, 104 "Suppress points where name matches given name", nullptr, ARGTYPE_STRING, 105 ARG_NOMINMAX, nullptr 106 }, 107 { 108 "matchdesc", &descopt, 109 "Suppress points where description matches given name", nullptr, ARGTYPE_STRING, 110 ARG_NOMINMAX, nullptr 111 }, 112 { 113 "matchcmt", &cmtopt, 114 "Suppress points where comment matches given name", nullptr, ARGTYPE_STRING, 115 ARG_NOMINMAX, nullptr 116 }, 117 { 118 "matchicon", &iconopt, 119 "Suppress points where type matches given name", nullptr, ARGTYPE_STRING, 120 ARG_NOMINMAX, nullptr 121 }, 122 }; 123 124 void fix_process_wpt(const Waypoint* wpt); 125 void fix_process_head(const route_head* trk); 126 127 }; 128 129 #endif 130 #endif // DISCARD_H_INCLUDED_ 131