1 /*
2
3 Swap data filter
4
5 Copyright (C) 2008 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 #include "defs.h"
24 #include "swapdata.h"
25
26 #define MYNAME "swapdata"
27
28 #if FILTERS_ENABLED
29
swapdata_cb(const Waypoint * ref)30 void SwapDataFilter::swapdata_cb(const Waypoint* ref)
31 {
32 auto* wpt = const_cast<Waypoint*>(ref);
33
34 double x = wpt->latitude;
35 wpt->latitude = wpt->longitude;
36 wpt->longitude = x;
37 }
38
39 /*******************************************************************************
40 * %%% global callbacks called by gpsbabel main process %%% *
41 *******************************************************************************/
42
process()43 void SwapDataFilter::process() /* this procedure must be present in vecs */
44 {
45 WayptFunctor<SwapDataFilter> swapdata_cb_f(this, &SwapDataFilter::swapdata_cb);
46
47 waypt_disp_all(swapdata_cb_f);
48 route_disp_all(nullptr, nullptr, swapdata_cb_f);
49 track_disp_all(nullptr, nullptr, swapdata_cb_f);
50 }
51
52 #endif // FILTERS_ENABLED
53