From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Mon, 8 Aug 2022 18:46:03 +0000 (-0600) Subject: remove remnants of zombie mapbar. (#907) X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~24^2^2~191 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=74c1d88ac9e37cf1f455ebc7fe53c52e530f9053;p=gpsbabel.git remove remnants of zombie mapbar. (#907) this format was removed in #870 dd320d39acfc7e3ebb57df04f3a52e0350cc6bac --- diff --git a/GPSBabel.pro b/GPSBabel.pro index 90852c54f..46da404b3 100644 --- a/GPSBabel.pro +++ b/GPSBabel.pro @@ -213,7 +213,6 @@ HEADERS = \ legacyformat.h \ lowranceusr.h \ magellan.h \ - mapbar_track.h \ navilink.h \ nmea.h \ osm.h \ diff --git a/deprecated/mapbar_track.cc b/deprecated/mapbar_track.cc new file mode 100644 index 000000000..25df919da --- /dev/null +++ b/deprecated/mapbar_track.cc @@ -0,0 +1,130 @@ +/* + China mapbar navigation track reader for sonim xp3300 + it's maybe can used in other demo devices of mapbar navigation + + Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com + Copyright (C) 2001-2013 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 "mapbar_track.h" + +#include // for QChar +#include // for QDate +#include // for QString +#include // for QTime + +#include // for SEEK_CUR + +#include "defs.h" // for fatal, Waypoint, track_add_head, track_add_wpt, route_head +#include "gbfile.h" // for gbfgetint16, gbfgetint32, gbfseek, gbfclose, gbfopen +#include "src/core/datetime.h" // for DateTime + + +#define MYNAME "mapbar_track" + +/******************************************************************************* +* %%% global callbacks called by gpsbabel main process %%% * +*******************************************************************************/ + +void +MapbarTrackFormat::rd_init(const QString& fname) +{ + fin = gbfopen(fname, "r", MYNAME); +} + +void +MapbarTrackFormat::rd_deinit() +{ + gbfclose(fin); +} + +gpsbabel::DateTime +MapbarTrackFormat::read_datetime() const +{ + int hour = gbfgetint16(fin); + int min = gbfgetint16(fin); + int sec = gbfgetint16(fin); + int year = gbfgetint16(fin); + int mon = gbfgetint16(fin); + int mday = gbfgetint16(fin); + gpsbabel::DateTime t(QDate(year, mon, mday), QTime(hour, min, sec)); + return t; +} + +Waypoint* +MapbarTrackFormat::read_waypoint() const +{ + int longitude = gbfgetint32(fin); + int latitude = gbfgetint32(fin); + + auto* ret = new Waypoint; + + ret->latitude = double(latitude)/DIV_RATE; + ret->longitude = double(longitude)/DIV_RATE; + + return ret; +} + +void +MapbarTrackFormat::read() +{ + auto* track = new route_head; + track_add_head(track); + + (void) read_datetime(); // start_time currently unused + (void) read_datetime(); // end_time currently unused + + QChar name[101]; + // read 100 UCS-2 characters that are each stored little endian. + // note gbfread wouldn't get this right on big endian machines. + for (int idx=0; idx<100; idx++) { + name[idx] = gbfgetint16(fin); + } + name[100] = u'\0'; + // At this point, name is a UCS-2 encoded, zero terminated string. + // All our internals use Qt encoding, so convert now. + track->rte_name = QString(name); + + // skip two pair waypoint + gbfseek(fin, 8*4, SEEK_CUR); + // skip way length + gbfseek(fin, 8, SEEK_CUR); + // skip fixed value + gbfseek(fin, 4, SEEK_CUR); + + int end_flag = gbfgetint32(fin); + while (!end_flag) { + int length = gbfgetint32(fin); + if ((length < 1) || (length > 1600)) { + fatal(MYNAME ": get bad buffer length"); + } + + if (length % 8 != 0) { + fatal(MYNAME ": bad buffer size"); + } + gbfseek(fin, 16, SEEK_CUR); + + const int amount = length/8; + for (int i = 0; i < amount; ++i) { + Waypoint* tmp = read_waypoint(); + track_add_wpt(track, tmp); + } + + end_flag = gbfgetint32(fin); + } +} diff --git a/deprecated/mapbar_track.h b/deprecated/mapbar_track.h new file mode 100644 index 000000000..b522a5593 --- /dev/null +++ b/deprecated/mapbar_track.h @@ -0,0 +1,85 @@ +/* + China mapbar navigation track reader for sonim xp3300 + it's maybe can used in other demo devices of mapbar navigation + + Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com + Copyright (C) 2001-2013 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. + + */ +#ifndef MAPBAR_TRACK_H_INCLUDED_ +#define MAPBAR_TRACK_H_INCLUDED_ + +#include // for QString +#include // for QVector + +#include "defs.h" // for ff_cap, arglist_t, ff_cap_none, CET_CHARSET_UTF8, Waypoint, ff_cap_read, ff_type, ff_type_file +#include "format.h" // for Format +#include "gbfile.h" // for gbfile +#include "src/core/datetime.h" // for DateTime + + +class MapbarTrackFormat : public Format +{ +public: + QVector* get_args() override + { + return &mapbar_track_args; + } + + ff_type get_type() const override + { + return ff_type_file; + } + + QVector get_cap() const override + { + /* waypoints, tracks, routes */ + return { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none }; + } + + QString get_encode() const override + { + return CET_CHARSET_UTF8; + } + + int get_fixed_encode() const override + { + return 0; + } + + void rd_init(const QString& fname) override; + void read() override; + void rd_deinit() override; + +private: + /* Constants */ + + static constexpr double DIV_RATE = 100000.0f; + + /* Member Functions */ + + gpsbabel::DateTime read_datetime() const; + Waypoint* read_waypoint() const; + + /* Data Members */ + + gbfile* fin{}; + + QVector mapbar_track_args = { + }; +}; +#endif // MAPBAR_TRACK_H_INCLUDED_ diff --git a/mapbar_track.cc b/mapbar_track.cc deleted file mode 100644 index 25df919da..000000000 --- a/mapbar_track.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* - China mapbar navigation track reader for sonim xp3300 - it's maybe can used in other demo devices of mapbar navigation - - Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com - Copyright (C) 2001-2013 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 "mapbar_track.h" - -#include // for QChar -#include // for QDate -#include // for QString -#include // for QTime - -#include // for SEEK_CUR - -#include "defs.h" // for fatal, Waypoint, track_add_head, track_add_wpt, route_head -#include "gbfile.h" // for gbfgetint16, gbfgetint32, gbfseek, gbfclose, gbfopen -#include "src/core/datetime.h" // for DateTime - - -#define MYNAME "mapbar_track" - -/******************************************************************************* -* %%% global callbacks called by gpsbabel main process %%% * -*******************************************************************************/ - -void -MapbarTrackFormat::rd_init(const QString& fname) -{ - fin = gbfopen(fname, "r", MYNAME); -} - -void -MapbarTrackFormat::rd_deinit() -{ - gbfclose(fin); -} - -gpsbabel::DateTime -MapbarTrackFormat::read_datetime() const -{ - int hour = gbfgetint16(fin); - int min = gbfgetint16(fin); - int sec = gbfgetint16(fin); - int year = gbfgetint16(fin); - int mon = gbfgetint16(fin); - int mday = gbfgetint16(fin); - gpsbabel::DateTime t(QDate(year, mon, mday), QTime(hour, min, sec)); - return t; -} - -Waypoint* -MapbarTrackFormat::read_waypoint() const -{ - int longitude = gbfgetint32(fin); - int latitude = gbfgetint32(fin); - - auto* ret = new Waypoint; - - ret->latitude = double(latitude)/DIV_RATE; - ret->longitude = double(longitude)/DIV_RATE; - - return ret; -} - -void -MapbarTrackFormat::read() -{ - auto* track = new route_head; - track_add_head(track); - - (void) read_datetime(); // start_time currently unused - (void) read_datetime(); // end_time currently unused - - QChar name[101]; - // read 100 UCS-2 characters that are each stored little endian. - // note gbfread wouldn't get this right on big endian machines. - for (int idx=0; idx<100; idx++) { - name[idx] = gbfgetint16(fin); - } - name[100] = u'\0'; - // At this point, name is a UCS-2 encoded, zero terminated string. - // All our internals use Qt encoding, so convert now. - track->rte_name = QString(name); - - // skip two pair waypoint - gbfseek(fin, 8*4, SEEK_CUR); - // skip way length - gbfseek(fin, 8, SEEK_CUR); - // skip fixed value - gbfseek(fin, 4, SEEK_CUR); - - int end_flag = gbfgetint32(fin); - while (!end_flag) { - int length = gbfgetint32(fin); - if ((length < 1) || (length > 1600)) { - fatal(MYNAME ": get bad buffer length"); - } - - if (length % 8 != 0) { - fatal(MYNAME ": bad buffer size"); - } - gbfseek(fin, 16, SEEK_CUR); - - const int amount = length/8; - for (int i = 0; i < amount; ++i) { - Waypoint* tmp = read_waypoint(); - track_add_wpt(track, tmp); - } - - end_flag = gbfgetint32(fin); - } -} diff --git a/mapbar_track.h b/mapbar_track.h deleted file mode 100644 index b522a5593..000000000 --- a/mapbar_track.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - China mapbar navigation track reader for sonim xp3300 - it's maybe can used in other demo devices of mapbar navigation - - Copyright (C) 2013 xiao jian cheng, azuresky.xjc@gmail.com - Copyright (C) 2001-2013 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. - - */ -#ifndef MAPBAR_TRACK_H_INCLUDED_ -#define MAPBAR_TRACK_H_INCLUDED_ - -#include // for QString -#include // for QVector - -#include "defs.h" // for ff_cap, arglist_t, ff_cap_none, CET_CHARSET_UTF8, Waypoint, ff_cap_read, ff_type, ff_type_file -#include "format.h" // for Format -#include "gbfile.h" // for gbfile -#include "src/core/datetime.h" // for DateTime - - -class MapbarTrackFormat : public Format -{ -public: - QVector* get_args() override - { - return &mapbar_track_args; - } - - ff_type get_type() const override - { - return ff_type_file; - } - - QVector get_cap() const override - { - /* waypoints, tracks, routes */ - return { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none }; - } - - QString get_encode() const override - { - return CET_CHARSET_UTF8; - } - - int get_fixed_encode() const override - { - return 0; - } - - void rd_init(const QString& fname) override; - void read() override; - void rd_deinit() override; - -private: - /* Constants */ - - static constexpr double DIV_RATE = 100000.0f; - - /* Member Functions */ - - gpsbabel::DateTime read_datetime() const; - Waypoint* read_waypoint() const; - - /* Data Members */ - - gbfile* fin{}; - - QVector mapbar_track_args = { - }; -}; -#endif // MAPBAR_TRACK_H_INCLUDED_ diff --git a/reference/track/mapbar.trk b/reference/track/mapbar.trk deleted file mode 100644 index c08ca5d6e..000000000 Binary files a/reference/track/mapbar.trk and /dev/null differ diff --git a/reference/track/mapbar~gpx.gpx b/reference/track/mapbar~gpx.gpx deleted file mode 100644 index b06105bae..000000000 --- a/reference/track/mapbar~gpx.gpx +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - 山顶到豆腐花 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -