GPSBabel / gpsbabel

GPSBabel: convert, manipulate, and transfer data from GPS programs or GPS receivers. Open Source and supported on MacOS, Windows, Linux, and more. Pointy clicky GUI or a command line version...
https://www.gpsbabel.org
GNU General Public License v2.0
473 stars 126 forks source link

Remove per-ext IGC specific logic from KML writer #1183

Open PacketFiend opened 12 months ago

PacketFiend commented 12 months ago

This removes quite a bit of IGC specific code from kml.h and kml.cc, including most data structure definitions and most loops/if ladders/switch blocks that iterate over IGC data structures by name, and replaces those with much more generic logic. It places all this in igc.h and igc.cc. There's two edge cases (overriding wpt->temperature and wpt->sat) that kml.cc still has logic for.

kml.h defines a igc_mt_field_t struct, which is populated in igc.h. The thinking there is that igc_mt_field_t is useful only to the KML writer, however the IGC parts should be defining the metadata. igc_wp_field, for example, may be useful to CSV or GeoJSON writers, so should be defined in igc.h rather than kml.h.

Note that this will currently fail tests. That's because the tests for kIncludeIGCSIU and kIncludeIGCTRT have been removed. #1180 resolves this by replacing those with default options. #1180 should be merged before this PR. After rebasing, this should pass tests.

Of course, there may be far better ways to achieve this, but this works, and I think y'all get the idea of what I'm trying to do here.

Marking as draft is it can't be merged before #1180 and is failing tests.