From: Robert Lipe Date: Tue, 7 Mar 2023 02:47:51 +0000 (-0600) Subject: Remove gpssim formet per 02/28/2022 proposal. (#1028) X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~1^2~111 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d14e17eb94a6b1028055bafaf4a99fd9f2208df2;p=gpsbabel.git Remove gpssim formet per 02/28/2022 proposal. (#1028) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ea6100cc3..6171b2928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,6 @@ set(ALL_FMTS ${MINIMAL_FMTS} geocache.cc geojson.cc globalsat_sport.cc - gpssim.cc gtm.cc gtrnctr.cc holux.cc @@ -396,7 +395,6 @@ set(TESTS geo globalsat_sport gpsdrive - gpssim gpx grapheme gtm diff --git a/deprecated/gpssim.cc b/deprecated/gpssim.cc new file mode 100644 index 000000000..322564b16 --- /dev/null +++ b/deprecated/gpssim.cc @@ -0,0 +1,201 @@ +/* + Write points to Franson Technology GpsGate simulator + + Copyright (C) 2006 Robert Lipe, robertlipe+source@gpsbabel.org + + 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. + + */ + + +#include "defs.h" +#include +#include +#include +#include "nmea.h" + +#define MYNAME "gpssim" + +static gbfile* fout; +static char* wayptspd; +static char* splitfiles_opt; +static int splitfiles; +static QString fnamestr; +static int trk_count; +static int doing_tracks; + +static +QVector gpssim_args = { + { + "wayptspd", &wayptspd, "Default speed for waypoints (knots/hr)", + nullptr, ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr + }, + { + "split", &splitfiles_opt, "Split input into separate files", + "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + }, +}; + +/* + * The only thing kind of odd about this format is the "split" + * option. There's some trashing about with the 'splitfiles' toggle + * to ensure that waypoints land in one file and each track and each + * route land in files of their own. + */ + +static void +gpssim_wr_init(const QString& fname) +{ + fnamestr = fname; + trk_count = 0; + splitfiles = splitfiles_opt ? xstrtoi(splitfiles_opt, nullptr, 10) : 0; + + /* If writing to stdout, never split files */ + if (0 == strcmp("-",splitfiles_opt)) { + splitfiles = 0; + } + + if (!splitfiles) { + fout = gbfopen(fname, "wb", MYNAME); + } +} + +static void +gpssim_wr_deinit() +{ + if (fout) { + gbfclose(fout); + fout = nullptr; + } + + fnamestr.clear(); +} + + +/* + * All these files are written in binary mode, so put CR/NL pairs + * in them explictly in case we're writing from a UNIX-like host. + */ + +static void +gpssim_write_sentence(const char* const s) +{ + gbfprintf(fout, "$%s*%02X\r\n", s, NmeaFormat::nmea_cksum(s)); +} + +static void +gpssim_write_spd(double knotsperhour) +{ + char obuf[1024]; + + snprintf(obuf, sizeof(obuf), "FRSPD,%.2f", knotsperhour); + gpssim_write_sentence(obuf); +} + +static void +gpssim_write_pt(const Waypoint* wpt) +{ + char obuf[1024]; + + if (wpt->speed_has_value()) { + gpssim_write_spd(MPS_TO_KNOTS(wpt->speed_value())); + } + + double lat = degrees2ddmm(wpt->latitude); + double lon = degrees2ddmm(wpt->longitude); + + snprintf(obuf, sizeof(obuf), "FRWPT,%10.5f,%c,%011.5f,%c,%.1f", + fabs(lat), lat < 0 ? 'S' : 'N', + fabs(lon), lon < 0 ? 'W' : 'E', + wpt->altitude == unknown_alt ? 0 : wpt->altitude + ); + + if (wpt->creation_time.isValid()) { + char tbuf[20]; + + QByteArray dmy = wpt->GetCreationTime().toUTC().toString(u"ddMMyy").toUtf8(); + QByteArray hms = wpt->GetCreationTime().toUTC().toString(u"hhmmss").toUtf8(); + + snprintf(tbuf, sizeof(tbuf), ",%s,%s",dmy.constData(), hms.constData()); + strcat(obuf, tbuf); + } + + gpssim_write_sentence(obuf); +} + +static void +gpssim_trk_hdr(const route_head* rh) +{ + if (splitfiles) { + + if (fout) { + fatal(MYNAME ": output file already open.\n"); + } + + QString ofname = QStringLiteral("%1%2%3.gpssim").arg(fnamestr, doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0')); + fout = gbfopen(ofname, "wb", MYNAME); + } + (void) track_recompute(rh); +} + +static void +gpssim_trk_ftr(const route_head*) +{ + if (splitfiles) { + gbfclose(fout); + fout = nullptr; + } +} + +static void +gpssim_write() +{ + if (waypt_count()) { + if (splitfiles) { + QString ofname = fnamestr + "-waypoints.gpssim"; + fout = gbfopen(ofname, "wb", MYNAME); + } + if (wayptspd && wayptspd[0]) { + gpssim_write_spd(strtod(wayptspd, nullptr)); + } + waypt_disp_all(gpssim_write_pt); + if (splitfiles) { + gbfclose(fout); + fout = nullptr; + } + } + + doing_tracks = 1; + track_disp_all(gpssim_trk_hdr, gpssim_trk_ftr, gpssim_write_pt); + + trk_count = 0; + doing_tracks = 0; + route_disp_all(gpssim_trk_hdr, gpssim_trk_ftr, gpssim_write_pt); +} + + +ff_vecs_t gpssim_vecs = { + ff_type_file, + { ff_cap_write, ff_cap_write, ff_cap_write }, + nullptr, + gpssim_wr_init, + nullptr, + gpssim_wr_deinit, + nullptr, + gpssim_write, + nullptr, + &gpssim_args, + NULL_POS_OPS +}; diff --git a/gpssim.cc b/gpssim.cc deleted file mode 100644 index 322564b16..000000000 --- a/gpssim.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* - Write points to Franson Technology GpsGate simulator - - Copyright (C) 2006 Robert Lipe, robertlipe+source@gpsbabel.org - - 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. - - */ - - -#include "defs.h" -#include -#include -#include -#include "nmea.h" - -#define MYNAME "gpssim" - -static gbfile* fout; -static char* wayptspd; -static char* splitfiles_opt; -static int splitfiles; -static QString fnamestr; -static int trk_count; -static int doing_tracks; - -static -QVector gpssim_args = { - { - "wayptspd", &wayptspd, "Default speed for waypoints (knots/hr)", - nullptr, ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr - }, - { - "split", &splitfiles_opt, "Split input into separate files", - "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr - }, -}; - -/* - * The only thing kind of odd about this format is the "split" - * option. There's some trashing about with the 'splitfiles' toggle - * to ensure that waypoints land in one file and each track and each - * route land in files of their own. - */ - -static void -gpssim_wr_init(const QString& fname) -{ - fnamestr = fname; - trk_count = 0; - splitfiles = splitfiles_opt ? xstrtoi(splitfiles_opt, nullptr, 10) : 0; - - /* If writing to stdout, never split files */ - if (0 == strcmp("-",splitfiles_opt)) { - splitfiles = 0; - } - - if (!splitfiles) { - fout = gbfopen(fname, "wb", MYNAME); - } -} - -static void -gpssim_wr_deinit() -{ - if (fout) { - gbfclose(fout); - fout = nullptr; - } - - fnamestr.clear(); -} - - -/* - * All these files are written in binary mode, so put CR/NL pairs - * in them explictly in case we're writing from a UNIX-like host. - */ - -static void -gpssim_write_sentence(const char* const s) -{ - gbfprintf(fout, "$%s*%02X\r\n", s, NmeaFormat::nmea_cksum(s)); -} - -static void -gpssim_write_spd(double knotsperhour) -{ - char obuf[1024]; - - snprintf(obuf, sizeof(obuf), "FRSPD,%.2f", knotsperhour); - gpssim_write_sentence(obuf); -} - -static void -gpssim_write_pt(const Waypoint* wpt) -{ - char obuf[1024]; - - if (wpt->speed_has_value()) { - gpssim_write_spd(MPS_TO_KNOTS(wpt->speed_value())); - } - - double lat = degrees2ddmm(wpt->latitude); - double lon = degrees2ddmm(wpt->longitude); - - snprintf(obuf, sizeof(obuf), "FRWPT,%10.5f,%c,%011.5f,%c,%.1f", - fabs(lat), lat < 0 ? 'S' : 'N', - fabs(lon), lon < 0 ? 'W' : 'E', - wpt->altitude == unknown_alt ? 0 : wpt->altitude - ); - - if (wpt->creation_time.isValid()) { - char tbuf[20]; - - QByteArray dmy = wpt->GetCreationTime().toUTC().toString(u"ddMMyy").toUtf8(); - QByteArray hms = wpt->GetCreationTime().toUTC().toString(u"hhmmss").toUtf8(); - - snprintf(tbuf, sizeof(tbuf), ",%s,%s",dmy.constData(), hms.constData()); - strcat(obuf, tbuf); - } - - gpssim_write_sentence(obuf); -} - -static void -gpssim_trk_hdr(const route_head* rh) -{ - if (splitfiles) { - - if (fout) { - fatal(MYNAME ": output file already open.\n"); - } - - QString ofname = QStringLiteral("%1%2%3.gpssim").arg(fnamestr, doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0')); - fout = gbfopen(ofname, "wb", MYNAME); - } - (void) track_recompute(rh); -} - -static void -gpssim_trk_ftr(const route_head*) -{ - if (splitfiles) { - gbfclose(fout); - fout = nullptr; - } -} - -static void -gpssim_write() -{ - if (waypt_count()) { - if (splitfiles) { - QString ofname = fnamestr + "-waypoints.gpssim"; - fout = gbfopen(ofname, "wb", MYNAME); - } - if (wayptspd && wayptspd[0]) { - gpssim_write_spd(strtod(wayptspd, nullptr)); - } - waypt_disp_all(gpssim_write_pt); - if (splitfiles) { - gbfclose(fout); - fout = nullptr; - } - } - - doing_tracks = 1; - track_disp_all(gpssim_trk_hdr, gpssim_trk_ftr, gpssim_write_pt); - - trk_count = 0; - doing_tracks = 0; - route_disp_all(gpssim_trk_hdr, gpssim_trk_ftr, gpssim_write_pt); -} - - -ff_vecs_t gpssim_vecs = { - ff_type_file, - { ff_cap_write, ff_cap_write, ff_cap_write }, - nullptr, - gpssim_wr_init, - nullptr, - gpssim_wr_deinit, - nullptr, - gpssim_write, - nullptr, - &gpssim_args, - NULL_POS_OPS -}; diff --git a/reference/format0.txt b/reference/format0.txt index 6d10d5cd0..f03faaf78 100644 --- a/reference/format0.txt +++ b/reference/format0.txt @@ -8,7 +8,6 @@ exif jpg Embedded Exif-GPS data (.jpg) shape shp ESRI shapefile igc FAI/IGC Flight Recorder Data Format garmin_fit fit Flexible and Interoperable Data Transfer (FIT) Activity file -gpssim gpssim Franson GPSGate Simulation garmin301 Garmin 301 Custom position and heartrate garmin_g1000 csv Garmin G1000 datalog input filter file gdb gdb Garmin MapSource - gdb diff --git a/reference/format1.txt b/reference/format1.txt index cc4d87520..424a81f7f 100644 --- a/reference/format1.txt +++ b/reference/format1.txt @@ -11,7 +11,6 @@ file exif jpg Embedded Exif-GPS data (.jpg) file shape shp ESRI shapefile file igc FAI/IGC Flight Recorder Data Format file garmin_fit fit Flexible and Interoperable Data Transfer (FIT) Activity file -file gpssim gpssim Franson GPSGate Simulation file garmin301 Garmin 301 Custom position and heartrate file garmin_g1000 csv Garmin G1000 datalog input filter file file gdb gdb Garmin MapSource - gdb diff --git a/reference/format2.txt b/reference/format2.txt index 713235226..8ddca1773 100644 --- a/reference/format2.txt +++ b/reference/format2.txt @@ -11,7 +11,6 @@ file rw---- exif jpg Embedded Exif-GPS data (.jpg) file rwrwrw shape shp ESRI shapefile file --rwrw igc FAI/IGC Flight Recorder Data Format file -wrw-- garmin_fit fit Flexible and Interoperable Data Transfer (FIT) Activity file -file -w-w-w gpssim gpssim Franson GPSGate Simulation file rw---- garmin301 Garmin 301 Custom position and heartrate file --rw-- garmin_g1000 csv Garmin G1000 datalog input filter file file rwrwrw gdb gdb Garmin MapSource - gdb diff --git a/reference/format3.txt b/reference/format3.txt index 70596a81f..ab9e479ec 100644 --- a/reference/format3.txt +++ b/reference/format3.txt @@ -142,12 +142,6 @@ option garmin_fit allpoints Read all points even if latitude or longitude is mis option garmin_fit recoverymode Attempt to recovery data from corrupt file boolean https://www.gpsbabel.org/WEB_DOC_DIR/fmt_garmin_fit.html#fmt_garmin_fit_o_recoverymode -file -w-w-w gpssim gpssim Franson GPSGate Simulation gpssim - https://www.gpsbabel.org/WEB_DOC_DIR/fmt_gpssim.html -option gpssim wayptspd Default speed for waypoints (knots/hr) float https://www.gpsbabel.org/WEB_DOC_DIR/fmt_gpssim.html#fmt_gpssim_o_wayptspd - -option gpssim split Split input into separate files boolean 0 https://www.gpsbabel.org/WEB_DOC_DIR/fmt_gpssim.html#fmt_gpssim_o_split - file rw---- garmin301 Garmin 301 Custom position and heartrate xcsv https://www.gpsbabel.org/WEB_DOC_DIR/fmt_garmin301.html option garmin301 snlen Max synthesized shortname length integer 1 https://www.gpsbabel.org/WEB_DOC_DIR/fmt_garmin301.html#fmt_garmin301_o_snlen diff --git a/reference/help.txt b/reference/help.txt index edac9da53..715be12bd 100644 --- a/reference/help.txt +++ b/reference/help.txt @@ -79,9 +79,6 @@ File Types (-i and -o options): garmin_fit Flexible and Interoperable Data Transfer (FIT) Act allpoints (0/1) Read all points even if latitude or longitude is m recoverymode (0/1) Attempt to recovery data from corrupt file - gpssim Franson GPSGate Simulation - wayptspd Default speed for waypoints (knots/hr) - split (0/1) Split input into separate files garmin301 Garmin 301 Custom position and heartrate snlen Max synthesized shortname length snwhite (0/1) Allow whitespace synth. shortnames diff --git a/testo.d/gpssim.test b/testo.d/gpssim.test deleted file mode 100644 index 175c774e8..000000000 --- a/testo.d/gpssim.test +++ /dev/null @@ -1,10 +0,0 @@ -# -# Franson GPSGate simulation -# -gpsbabel -i geo -f ${REFERENCE}/geocaching.loc -o gpssim -F ${TMPDIR}/waypoints.gpssim -compare ${TMPDIR}/waypoints.gpssim ${REFERENCE} -gpsbabel -i gpx -f ${REFERENCE}/track/tracks.gpx -o gpssim -F ${TMPDIR}/tracks.gpssim -compare ${TMPDIR}/tracks.gpssim ${REFERENCE}/track -gpsbabel -i gpx -f ${REFERENCE}/track/nmeadate.gpx -o gpssim -F ${TMPDIR}/nmeadate.gpssim -compare ${REFERENCE}/track/nmeadate.gpssim ${TMPDIR}/nmeadate.gpssim - diff --git a/vecs.cc b/vecs.cc index a48a380aa..e91aa923a 100644 --- a/vecs.cc +++ b/vecs.cc @@ -92,7 +92,6 @@ extern ff_vecs_t wbt_fvecs; //extern ff_vecs_t wbt_fvecs; extern ff_vecs_t vcf_vecs; extern ff_vecs_t gtm_vecs; -extern ff_vecs_t gpssim_vecs; #if CSVFMTS_ENABLED extern ff_vecs_t garmin_txt_vecs; #endif // CSVFMTS_ENABLED @@ -152,7 +151,6 @@ struct Vecs::Impl { LegacyFormat vcf_fmt {vcf_vecs}; UnicsvFormat unicsv_fmt; LegacyFormat gtm_fmt {gtm_vecs}; - LegacyFormat gpssim_fmt {gpssim_vecs}; #if CSVFMTS_ENABLED LegacyFormat garmin_txt_fmt {garmin_txt_vecs}; #endif // CSVFMTS_ENABLED @@ -389,13 +387,6 @@ struct Vecs::Impl { "gtm", nullptr, }, - { - &gpssim_fmt, - "gpssim", - "Franson GPSGate Simulation", - "gpssim", - nullptr, - }, #if CSVFMTS_ENABLED { &garmin_txt_fmt, diff --git a/xmldoc/formats/gpssim.xml b/xmldoc/formats/gpssim.xml deleted file mode 100644 index 320c51d1a..000000000 --- a/xmldoc/formats/gpssim.xml +++ /dev/null @@ -1,9 +0,0 @@ - - This is a write-only format used to feed waypoints, tracks, and routes - into Franson Technolgies' - GpsGate simulator. - - - To use these files in GpsGate, select 'Simulator' and then - "File->Open". - diff --git a/xmldoc/formats/options/gpssim-split.xml b/xmldoc/formats/options/gpssim-split.xml deleted file mode 100644 index 26a5c9c46..000000000 --- a/xmldoc/formats/options/gpssim-split.xml +++ /dev/null @@ -1,17 +0,0 @@ -When this option is specified, GPSBabel will split - split the output into multiple files using the output filename - as a base. For example, if you specify an output file of 'mytrip', - - mytrip-waypoints.gpssim - will contain the waypoints. - mytrip-track0000.gpssim - will contain the first track. - mytrip-track0001.gpssim - will contain the second track. - ... and so on. - mytrip-route0000.gpssim - will contain the first route. - mytrip-route0001.gpssim - will contain the seconds route. - ... and so on. - - - - -Valid values for this option are 0 (off) and 1 (on). The default is '0'. -