1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00
This commit is contained in:
Martin Tůma 2020-03-12 09:37:55 +01:00
commit 98cd3c3922
15 changed files with 40 additions and 13 deletions

View File

@ -1890,7 +1890,7 @@
<message> <message>
<location filename="../src/GUI/waypointitem.cpp" line="44"/> <location filename="../src/GUI/waypointitem.cpp" line="44"/>
<source>Address</source> <source>Address</source>
<translation type="unfinished"></translation> <translation>Adres</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/waypointitem.cpp" line="55"/> <location filename="../src/GUI/waypointitem.cpp" line="55"/>

View File

@ -15,6 +15,8 @@ QString RouteItem::info() const
tt.insert(tr("Name"), _name); tt.insert(tr("Name"), _name);
if (!_desc.isEmpty()) if (!_desc.isEmpty())
tt.insert(tr("Description"), _desc); tt.insert(tr("Description"), _desc);
if (!_comment.isEmpty() && _comment != _desc)
tt.insert(tr("Comment"), _comment);
tt.insert(tr("Distance"), Format::distance(path().last().last().distance(), tt.insert(tr("Distance"), Format::distance(path().last().last().distance(),
_units)); _units));
if (!_links.isEmpty()) { if (!_links.isEmpty()) {
@ -43,6 +45,7 @@ RouteItem::RouteItem(const Route &route, Map *map, QGraphicsItem *parent)
_name = route.name(); _name = route.name();
_desc = route.description(); _desc = route.description();
_comment = route.comment();
_links = route.links(); _links = route.links();
_coordinatesFormat = DecimalDegrees; _coordinatesFormat = DecimalDegrees;
} }

View File

@ -29,6 +29,7 @@ public:
private: private:
QString _name; QString _name;
QString _desc; QString _desc;
QString _comment;
QVector<Link> _links; QVector<Link> _links;
CoordinatesFormat _coordinatesFormat; CoordinatesFormat _coordinatesFormat;

View File

@ -13,6 +13,8 @@ QString TrackItem::info() const
tt.insert(tr("Name"), _name); tt.insert(tr("Name"), _name);
if (!_desc.isEmpty()) if (!_desc.isEmpty())
tt.insert(tr("Description"), _desc); tt.insert(tr("Description"), _desc);
if (!_comment.isEmpty() && _comment != _desc)
tt.insert(tr("Comment"), _comment);
tt.insert(tr("Distance"), Format::distance(path().last().last().distance(), tt.insert(tr("Distance"), Format::distance(path().last().last().distance(),
_units)); _units));
if (_time > 0) if (_time > 0)
@ -41,6 +43,7 @@ TrackItem::TrackItem(const Track &track, Map *map, QGraphicsItem *parent)
{ {
_name = track.name(); _name = track.name();
_desc = track.description(); _desc = track.description();
_comment = track.comment();
_links = track.links(); _links = track.links();
_date = track.date(); _date = track.date();
_time = track.time(); _time = track.time();

View File

@ -22,6 +22,7 @@ public:
private: private:
QString _name; QString _name;
QString _desc; QString _desc;
QString _comment;
QVector<Link> _links; QVector<Link> _links;
QDateTime _date; QDateTime _date;
qreal _time; qreal _time;

View File

@ -30,6 +30,10 @@ QString WaypointItem::info() const
if (!_waypoint.description().isEmpty()) if (!_waypoint.description().isEmpty())
tt.insert(qApp->translate("WaypointItem", "Description"), tt.insert(qApp->translate("WaypointItem", "Description"),
_waypoint.description()); _waypoint.description());
if (!_waypoint.comment().isEmpty()
&& _waypoint.comment() != _waypoint.description())
tt.insert(qApp->translate("WaypointItem", "Comment"),
_waypoint.comment());
if (_waypoint.address().isValid()) { if (_waypoint.address().isValid()) {
QString addr("<address>"); QString addr("<address>");
addr += _waypoint.address().street(); addr += _waypoint.address().street();

View File

@ -282,14 +282,14 @@ static quint32 readNotes(QDataStream &stream, QTextCodec *codec,
if (s1 & 0x1) { if (s1 & 0x1) {
QList<TranslatedString> obj; QList<TranslatedString> obj;
ds += readTranslatedObjects(stream, codec, obj); ds += readTranslatedObjects(stream, codec, obj);
if (!obj.isEmpty() && waypoint.description().isNull()) if (!obj.isEmpty())
waypoint.setDescription(obj.first().str()); waypoint.setComment(obj.first().str());
} }
if (s1 & 0x2) { if (s1 & 0x2) {
QString str; QString str;
ds += readString(stream, codec, str); ds += readString(stream, codec, str);
if (!str.isEmpty() && waypoint.description().isNull()) if (!str.isEmpty())
waypoint.setDescription(str); waypoint.setComment(str);
} }
if (ds != rh.size) if (ds != rh.size)

View File

@ -192,6 +192,8 @@ void GPXParser::waypointData(Waypoint &waypoint, SegmentData *autoRoute)
waypoint.setName(_reader.readElementText()); waypoint.setName(_reader.readElementText());
else if (_reader.name() == QLatin1String("desc")) else if (_reader.name() == QLatin1String("desc"))
waypoint.setDescription(_reader.readElementText()); waypoint.setDescription(_reader.readElementText());
else if (_reader.name() == QLatin1String("cmt"))
waypoint.setComment(_reader.readElementText());
else if (_reader.name() == QLatin1String("ele")) else if (_reader.name() == QLatin1String("ele"))
waypoint.setElevation(number()); waypoint.setElevation(number());
else if (_reader.name() == QLatin1String("geoidheight")) else if (_reader.name() == QLatin1String("geoidheight"))
@ -244,6 +246,8 @@ void GPXParser::routepoints(RouteData &route, QList<TrackData> &tracks)
route.setName(_reader.readElementText()); route.setName(_reader.readElementText());
else if (_reader.name() == QLatin1String("desc")) else if (_reader.name() == QLatin1String("desc"))
route.setDescription(_reader.readElementText()); route.setDescription(_reader.readElementText());
else if (_reader.name() == QLatin1String("cmt"))
route.setComment(_reader.readElementText());
else if (_reader.name() == QLatin1String("link")) { else if (_reader.name() == QLatin1String("link")) {
Link l(link()); Link l(link());
if (!l.URL().isEmpty()) if (!l.URL().isEmpty())
@ -278,6 +282,8 @@ void GPXParser::track(TrackData &track)
track.setName(_reader.readElementText()); track.setName(_reader.readElementText());
else if (_reader.name() == QLatin1String("desc")) else if (_reader.name() == QLatin1String("desc"))
track.setDescription(_reader.readElementText()); track.setDescription(_reader.readElementText());
else if (_reader.name() == QLatin1String("cmt"))
track.setComment(_reader.readElementText());
else if (_reader.name() == QLatin1String("link")) { else if (_reader.name() == QLatin1String("link")) {
Link l(link()); Link l(link());
if (!l.URL().isEmpty()) if (!l.URL().isEmpty())

View File

@ -21,6 +21,7 @@ public:
const QString &name() const {return _data.name();} const QString &name() const {return _data.name();}
const QString &description() const {return _data.description();} const QString &description() const {return _data.description();}
const QString &comment() const {return _data.comment();}
const QVector<Link> &links() const {return _data.links();} const QVector<Link> &links() const {return _data.links();}
bool isValid() const {return _data.size() >= 2;} bool isValid() const {return _data.size() >= 2;}

View File

@ -11,15 +11,18 @@ class RouteData : public QVector<Waypoint>
public: public:
const QString &name() const {return _name;} const QString &name() const {return _name;}
const QString &description() const {return _desc;} const QString &description() const {return _desc;}
const QString &comment() const {return _comment;}
const QVector<Link> &links() const {return _links;} const QVector<Link> &links() const {return _links;}
void setName(const QString &name) {_name = name;} void setName(const QString &name) {_name = name;}
void setDescription(const QString &desc) {_desc = desc;} void setDescription(const QString &desc) {_desc = desc;}
void setComment(const QString &comment) {_comment = comment;}
void addLink(const Link &link) {_links.append(link);} void addLink(const Link &link) {_links.append(link);}
private: private:
QString _name; QString _name;
QString _desc; QString _desc;
QString _comment;
QVector<Link> _links; QVector<Link> _links;
}; };

View File

@ -32,6 +32,7 @@ public:
const QString &name() const {return _data.name();} const QString &name() const {return _data.name();}
const QString &description() const {return _data.description();} const QString &description() const {return _data.description();}
const QString &comment() const {return _data.comment();}
const QVector<Link> &links() const {return _data.links();} const QVector<Link> &links() const {return _data.links();}
bool isValid() const; bool isValid() const;

View File

@ -14,15 +14,18 @@ class TrackData : public QList<SegmentData>
public: public:
const QString &name() const {return _name;} const QString &name() const {return _name;}
const QString &description() const {return _desc;} const QString &description() const {return _desc;}
const QString &comment() const {return _comment;}
const QVector<Link> &links() const {return _links;} const QVector<Link> &links() const {return _links;}
void setName(const QString &name) {_name = name;} void setName(const QString &name) {_name = name;}
void setDescription(const QString &desc) {_desc = desc;} void setDescription(const QString &desc) {_desc = desc;}
void setComment(const QString &comment) {_comment = comment;}
void addLink(const Link &link) {_links.append(link);} void addLink(const Link &link) {_links.append(link);}
private: private:
QString _name; QString _name;
QString _desc; QString _desc;
QString _comment;
QVector<Link> _links; QVector<Link> _links;
}; };

View File

@ -21,6 +21,7 @@ public:
const Coordinates &coordinates() const {return _coordinates;} const Coordinates &coordinates() const {return _coordinates;}
const QString &name() const {return _name;} const QString &name() const {return _name;}
const QString &description() const {return _description;} const QString &description() const {return _description;}
const QString &comment() const {return _comment;}
const Address &address() const {return _address;} const Address &address() const {return _address;}
const QVector<ImageInfo> &images() const {return _images;} const QVector<ImageInfo> &images() const {return _images;}
const QVector<Link> &links() const {return _links;} const QVector<Link> &links() const {return _links;}
@ -32,6 +33,7 @@ public:
void setName(const QString &name) {_name = name;} void setName(const QString &name) {_name = name;}
void setDescription(const QString &description) void setDescription(const QString &description)
{_description = description;} {_description = description;}
void setComment(const QString &comment) {_comment = comment;}
void setAddress(const Address &address) {_address = address;} void setAddress(const Address &address) {_address = address;}
void setTimestamp(const QDateTime &timestamp) {_timestamp = timestamp;} void setTimestamp(const QDateTime &timestamp) {_timestamp = timestamp;}
void setElevation(qreal elevation) {_elevation = elevation;} void setElevation(qreal elevation) {_elevation = elevation;}
@ -48,6 +50,7 @@ private:
Coordinates _coordinates; Coordinates _coordinates;
QString _name; QString _name;
QString _description; QString _description;
QString _comment;
Address _address; Address _address;
QVector<ImageInfo> _images; QVector<ImageInfo> _images;
QVector<Link> _links; QVector<Link> _links;

View File

@ -260,13 +260,6 @@ void IMGMap::unload()
_data->clear(); _data->clear();
} }
QRectF IMGMap::bounds()
{
RectD prect(_data->bounds(), _projection);
return QRectF(_transform.proj2img(prect.topLeft()),
_transform.proj2img(prect.bottomRight()));
}
int IMGMap::zoomFit(const QSize &size, const RectC &rect) int IMGMap::zoomFit(const QSize &size, const RectC &rect)
{ {
if (rect.isValid()) { if (rect.isValid()) {
@ -320,6 +313,10 @@ Transform IMGMap::transform(int zoom) const
void IMGMap::updateTransform() void IMGMap::updateTransform()
{ {
_transform = transform(_zoom); _transform = transform(_zoom);
RectD prect(_data->bounds(), _projection);
_bounds = QRectF(_transform.proj2img(prect.topLeft()),
_transform.proj2img(prect.bottomRight()));
} }
QPointF IMGMap::ll2xy(const Coordinates &c) QPointF IMGMap::ll2xy(const Coordinates &c)

View File

@ -18,7 +18,7 @@ public:
QString name() const {return _data->name();} QString name() const {return _data->name();}
QRectF bounds(); QRectF bounds() {return _bounds;}
virtual int zoom() const {return _zoom;} virtual int zoom() const {return _zoom;}
virtual void setZoom(int zoom); virtual void setZoom(int zoom);
@ -62,6 +62,7 @@ private:
int _zoom; int _zoom;
Projection _projection; Projection _projection;
Transform _transform; Transform _transform;
QRectF _bounds;
bool _valid; bool _valid;
QString _errorString; QString _errorString;