1 /* 2 3 Transformation filter for GPS data. 4 5 Copyright (C) 2006 Olaf Klein, o.b.klein@gpsbabel.org 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 21 */ 22 23 #ifndef TRANSFORM_H_INCLUDED_ 24 #define TRANSFORM_H_INCLUDED_ 25 26 #include <QtCore/QString> // for QString 27 #include <QtCore/QVector> // for QVector 28 29 #include "defs.h" // for route_head (ptr only), ARG_NOMINMAX, ARGTY... 30 #include "filter.h" // for Filter 31 32 #if FILTERS_ENABLED 33 34 class TransformFilter:public Filter 35 { 36 public: get_args()37 QVector<arglist_t>* get_args() override 38 { 39 return &args; 40 } 41 void process() override; 42 43 private: 44 char current_target{}; 45 route_head* current_trk{}; 46 route_head* current_rte{}; 47 48 char* opt_routes{}, *opt_tracks{}, *opt_waypts{}, *opt_delete{}, *rpt_name_digits{}, *opt_rpt_name{}; 49 QString current_namepart; 50 51 int name_digits{}, use_src_name{}; 52 53 const QString RPT = "RPT"; 54 55 QVector<arglist_t> args = { 56 { 57 "wpt", &opt_waypts, "Transform track(s) or route(s) into waypoint(s) [R/T]", nullptr, 58 ARGTYPE_STRING, ARG_NOMINMAX, nullptr 59 }, 60 { 61 "rte", &opt_routes, "Transform waypoint(s) or track(s) into route(s) [W/T]", nullptr, 62 ARGTYPE_STRING, ARG_NOMINMAX, nullptr 63 }, 64 { 65 "trk", &opt_tracks, "Transform waypoint(s) or route(s) into tracks(s) [W/R]", nullptr, 66 ARGTYPE_STRING, ARG_NOMINMAX, nullptr 67 }, 68 { 69 "rptdigits", &rpt_name_digits, "Number of digits in generated names", nullptr, 70 ARGTYPE_INT, "2", nullptr, nullptr 71 }, 72 { 73 "rptname", &opt_rpt_name, "Use source name for route point names", "N", 74 ARGTYPE_BOOL, ARG_NOMINMAX, nullptr 75 }, 76 { 77 "del", &opt_delete, "Delete source data after transformation", "N", 78 ARGTYPE_BOOL, ARG_NOMINMAX, nullptr 79 }, 80 }; 81 82 void transform_waypoints(); 83 void transform_rte_disp_hdr_cb(const route_head* rte); 84 void transform_trk_disp_hdr_cb(const route_head* trk); 85 void transform_any_disp_wpt_cb(const Waypoint* wpt); 86 void transform_routes(); 87 void transform_tracks(); 88 89 }; 90 91 #endif // FILTERS_ENABLED 92 #endif // TRANSFORM_H_INCLUDED_ 93