1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-24 07:34:22 +02:00

Compare commits

..

14 Commits

Author SHA1 Message Date
96a24339c5 Improved DEM filtering when NaNs present 2024-08-27 22:38:32 +02:00
4b3327fcb1 Values to convert from ft to m ma also be decimal numbers 2024-08-27 22:03:12 +02:00
2a4afa042c Fixed Qt5 builds 2024-08-22 07:59:26 +02:00
0d44663570 Cosmetics 2024-08-21 08:38:13 +02:00
92bd37c481 Code cleanup 2024-08-21 08:24:37 +02:00
7167fe3e81 Fixed nonsense time unit 2024-08-09 10:03:53 +02:00
7bd03b0f2e Allow image-based pens with dash patterns 2024-08-08 08:58:11 +02:00
8990f2cfcf Added missing rendering of lines with image-based pens 2024-08-08 08:51:33 +02:00
cc20a9cd59 Render 0x26 areas in the default IMG style 2024-08-07 07:53:57 +02:00
45bf754b0f Version++ 2024-08-04 08:07:25 +02:00
1671904752 Translated using Weblate (Russian)
Currently translated at 100.0% (480 of 480 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2024-08-02 00:09:16 +02:00
5c18827941 Translated using Weblate (French)
Currently translated at 100.0% (480 of 480 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fr/
2024-08-02 00:09:15 +02:00
2a2909be6b Translated using Weblate (Finnish)
Currently translated at 96.0% (461 of 480 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2024-08-02 00:09:14 +02:00
4b19a9a037 Removed unused header file 2024-07-28 14:15:49 +02:00
15 changed files with 159 additions and 96 deletions

View File

@ -1,4 +1,4 @@
version: 13.23.{build}
version: 13.24.{build}
configuration:
- Release

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else {
TARGET = GPXSee
}
VERSION = 13.23
VERSION = 13.24
QT += core \
@ -27,7 +27,6 @@ HEADERS += src/common/config.h \
src/common/garmin.h \
src/common/coordinates.h \
src/common/hash.h \
src/common/linec.h \
src/common/range.h \
src/common/rectc.h \
src/common/textcodec.h \

View File

@ -1162,7 +1162,7 @@
<message>
<location filename="../src/GUI/graphview.cpp" line="162"/>
<source>h</source>
<translation>tim</translation>
<translation>h</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="94"/>

View File

@ -1850,7 +1850,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="649"/>
<source>Altitude:</source>
<translation type="unfinished"></translation>
<translation>Korkeus:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="650"/>

View File

@ -172,7 +172,7 @@
<message>
<location filename="../src/data/data.cpp" line="180"/>
<source>GPSDump files</source>
<translation type="unfinished"></translation>
<translation>Fichiers GPSDump</translation>
</message>
<message>
<location filename="../src/data/data.cpp" line="181"/>
@ -330,7 +330,7 @@
<message>
<location filename="../src/GUI/format.cpp" line="64"/>
<source>nmi</source>
<translation>nmi</translation>
<translation>NM</translation>
</message>
<message>
<location filename="../src/GUI/format.cpp" line="68"/>
@ -457,7 +457,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="276"/>
<source>Clear list</source>
<translation type="unfinished"></translation>
<translation>Vider la liste</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="288"/>
@ -589,7 +589,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="472"/>
<source>Show hillshading</source>
<translation type="unfinished"></translation>
<translation>Afficher les ombrages du relief</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="480"/>
@ -691,7 +691,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="646"/>
<source>Open recent</source>
<translation type="unfinished"></translation>
<translation>Fichiers récents</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="698"/>
@ -818,7 +818,7 @@
<location filename="../src/GUI/gui.cpp" line="1778"/>
<location filename="../src/GUI/gui.cpp" line="1878"/>
<source>Don&apos;t show again</source>
<translation type="unfinished"></translation>
<translation>Ne plus afficher</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="1358"/>
@ -860,14 +860,14 @@
<message>
<location filename="../src/GUI/gui.cpp" line="1961"/>
<source>DEM tiles download limit exceeded. If you really need data for such a huge area, download the files manually.</source>
<translation type="unfinished"></translation>
<translation>Le téléchargement des tuiles MNT a atteint sa limite. Si vous avez vraiment besoin des données pour une zone aussi énorme, téléchargez les fichiers manuellement.</translation>
</message>
<message numerus="yes">
<location filename="../src/GUI/gui.cpp" line="1964"/>
<source>Download %n DEM tiles?</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<translation>
<numerusform>Télécharger %n tuile de MNT&#x202f;?</numerusform>
<numerusform>Télécharger %n tuiles de MNT&#x202f;?</numerusform>
</translation>
</message>
<message>
@ -966,12 +966,12 @@
<message>
<location filename="../src/GUI/gui.cpp" line="458"/>
<source>Download data DEM</source>
<translation type="unfinished"></translation>
<translation>Télécharger les données du MNT</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="464"/>
<source>Download map DEM</source>
<translation type="unfinished"></translation>
<translation>Télécharger la carte du MNT</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="739"/>
@ -1147,7 +1147,7 @@
<message>
<location filename="../src/GUI/graphview.cpp" line="142"/>
<source>nmi</source>
<translation>nmi</translation>
<translation>NM</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="156"/>
@ -1458,7 +1458,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="70"/>
<source>Select the proper coordinate reference system (CRS) of maps without a CRS definition (JNX, KMZ and World file maps).</source>
<translation type="unfinished">Sélectionnez le système de référence de coordonnée (CRS) approprié pour les cartes sans définition de CRS (JNX, KMZ et World file maps).</translation>
<translation>Sélectionnez le système de coordonnées approprié pour les cartes n&apos;en contenant pas (JNX, KMZ et World file maps).</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="73"/>
@ -1750,7 +1750,7 @@
<location filename="../src/GUI/optionsdialog.cpp" line="265"/>
<location filename="../src/GUI/optionsdialog.cpp" line="628"/>
<source>px</source>
<translation type="unfinished">px</translation>
<translation>px</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="175"/>
@ -1801,7 +1801,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="556"/>
<source>nmi</source>
<translation>nmi</translation>
<translation>NM</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="559"/>
@ -1835,27 +1835,27 @@
<location filename="../src/GUI/optionsdialog.cpp" line="306"/>
<location filename="../src/GUI/optionsdialog.cpp" line="644"/>
<source>Opacity:</source>
<translation type="unfinished"></translation>
<translation>Opacité&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="646"/>
<source>Blur radius:</source>
<translation type="unfinished"></translation>
<translation>Rayon de flou&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="648"/>
<source>Azimuth:</source>
<translation type="unfinished"></translation>
<translation>Azimut&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="649"/>
<source>Altitude:</source>
<translation type="unfinished"></translation>
<translation>Altitude&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="650"/>
<source>Z Factor:</source>
<translation type="unfinished"></translation>
<translation>Facteur Z&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="655"/>
@ -1866,7 +1866,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="656"/>
<source>Hillshading</source>
<translation type="unfinished"></translation>
<translation>Ombrage du relief</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="676"/>
@ -1887,7 +1887,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="645"/>
<source>Lightening:</source>
<translation type="unfinished"></translation>
<translation>Éclaircissement&#x202f;:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="702"/>
@ -2309,7 +2309,7 @@
<message>
<location filename="../src/GUI/scaleitem.cpp" line="111"/>
<source>nmi</source>
<translation>nmi</translation>
<translation>NM</translation>
</message>
<message>
<location filename="../src/GUI/scaleitem.cpp" line="114"/>
@ -2353,7 +2353,7 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="31"/>
<source>min/nmi</source>
<translation>min/nmi</translation>
<translation>min/NM</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="34"/>
@ -2416,7 +2416,7 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="28"/>
<source>min/nmi</source>
<translation>min/nmi</translation>
<translation>min/NM</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="31"/>

View File

@ -1889,7 +1889,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="645"/>
<source>Lightening:</source>
<translation type="unfinished"></translation>
<translation>Осветление:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="702"/>

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "13.23"
!define VERSION "13.24"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -1,25 +0,0 @@
#ifndef LINEC_H
#define LINEC_H
#include "coordinates.h"
class LineC
{
public:
LineC(const Coordinates &c1, const Coordinates &c2) : _c1(c1), _c2(c2) {}
const Coordinates &c1() const {return _c1;}
const Coordinates &c2() const {return _c2;}
Coordinates pointAt(double t) const
{
return Coordinates(
_c1.lon() + (_c2.lon() - _c1.lon()) * t,
_c1.lat() + (_c2.lat() - _c1.lat()) * t);
}
private:
Coordinates _c1, _c2;
};
#endif // LINEC_H

View File

@ -1,6 +1,5 @@
#include <QtMath>
#include <QPainter>
#include "common/linec.h"
#include "map/bitmapline.h"
#include "map/textpathitem.h"
#include "map/textpointitem.h"

View File

@ -1,10 +1,9 @@
#include <cmath>
#include <QtMath>
#include "jls.h"
using namespace IMG;
#define max(a, b) ((a) > (b) ? (a) : (b))
static const quint8 Z[] = {
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@ -27,9 +26,9 @@ JLS::JLS(quint16 maxval, quint16 near)
_near = near;
_range = ((_maxval + _near * 2) / (_near * 2 + 1)) + 1;
_qbpp = ceil(log2(_range));
quint8 bpp = max(2, ceil(log2(_maxval + 1)));
quint8 LIMIT = 2 * (bpp + max(8, bpp));
_qbpp = qCeil(log2(_range));
quint8 bpp = qMax(2, qCeil(log2(_maxval + 1)));
quint8 LIMIT = 2 * (bpp + qMax((quint8)8, bpp));
_limit = LIMIT - _qbpp - 1;
}
@ -312,7 +311,7 @@ bool JLS::decode(const SubFile *file, SubFile::Handle &hdl, Matrix<qint16> &img)
_rg = 1;
_lrk = 0;
quint16 A = max(2, (_range + 32) / 64);
quint16 A = qMax(2, (_range + 32) / 64);
for (int i = 0; i < 4; i++) {
_a[i] = A;
_b[i] = 0;

View File

@ -42,7 +42,7 @@ static QString capitalized(const QString &str)
static QByteArray ft2m(const QByteArray &str)
{
bool ok;
int number = str.toInt(&ok);
double number = str.toDouble(&ok);
return ok ? QByteArray::number(qRound(number * 0.3048)) : str;
}

View File

@ -198,6 +198,7 @@ void Style::defaultPolygonStyle()
Qt::BDiagPattern));
_polygons[TYPE(0x1f)] = Polygon(QBrush(QColor(0x9a, 0xc2, 0x69),
Qt::BDiagPattern));
_polygons[TYPE(0x26)] = Polygon(QBrush(QColor(0xd6, 0xd4, 0xce)));
_polygons[TYPE(0x28)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)));
_polygons[TYPE(0x32)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)));
_polygons[TYPE(0x3c)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)));
@ -313,7 +314,7 @@ void Style::defaultPolygonStyle()
<< TYPE(0x04) << 0x10901 << TYPE(0x05) << 0x10902 << TYPE(0x06) << 0x10903
<< TYPE(0x07) << 0x10904 << TYPE(0x08) << 0x10905 << TYPE(0x09) << 0x10906
<< TYPE(0x0a) << 0x10907 << TYPE(0x0b) << 0x10908 << TYPE(0x0c) << 0x10909
<< TYPE(0x0d) << 0x1090a << TYPE(0x0e) << 0x1090b << TYPE(0x0f)
<< TYPE(0x26) << TYPE(0x0d) << 0x1090a << TYPE(0x0e) << 0x1090b << TYPE(0x0f)
<< TYPE(0x10) << TYPE(0x11) << TYPE(0x12) << TYPE(0x19) << 0x1090d
<< TYPE(0x13) << 0x10900 << 0x10613 << 0x10409 << 0x10503 << 0x1060a;
}

View File

@ -95,35 +95,95 @@ static void gaussBlur4(MatrixD &src, MatrixD &dst, int r)
boxBlur4(src, dst, (bxs.at(2) - 1) / 2);
}
static double avg(const MatrixD &m, int pi, int pj, int r)
{
int col, row, cnt = 0;
double sum = 0;
if (r >= qMax(m.h(), m.w()))
return NAN;
row = pi - r;
if (row >= 0) {
for (int j = qMax(pj - r, 0); j < qMin(pj + r, m.w()); j++) {
if (!std::isnan(m.at(row, j))) {
sum += m.at(row, j);
cnt++;
}
}
}
row = pi + r;
if (row < m.h()) {
for (int j = qMax(pj - r, 0); j < qMin(pj + r, m.w()); j++) {
if (!std::isnan(m.at(row, j))) {
sum += m.at(row, j);
cnt++;
}
}
}
col = pj - r;
if (col >= 0) {
for (int i = qMax(pi - r + 1, 0); i < qMin(pi + r - 1, m.h()); i++) {
if (!std::isnan(m.at(i, col))) {
sum += m.at(i, col);
cnt++;
}
}
}
col = pj + r;
if (col < m.w()) {
for (int i = qMax(pi - r + 1, 0); i < qMin(pi + r - 1, m.h()); i++) {
if (!std::isnan(m.at(i, col))) {
sum += m.at(i, col);
cnt++;
}
}
}
if (cnt)
return sum / cnt;
else
return avg(m, pi, pj, r + 1);
}
static bool fillNANs(const MatrixD &m, MatrixD &src)
{
bool hasNAN = false;
for (int i = 0; i < m.h(); i++) {
for (int j = 0; j < m.w(); j++) {
if (std::isnan(m.at(i, j))) {
hasNAN = true;
double val = avg(src, i, j, 1);
if (std::isnan(val))
return false;
else
src.at(i, j) = val;
}
}
}
return hasNAN;
}
static void revertNANs(const MatrixD &m, MatrixD &dst)
{
for (int i = 0; i < m.size(); i++)
if (std::isnan(m.at(i)))
dst.at(i) = NAN;
}
MatrixD Filter::blur(const MatrixD &m, int radius)
{
MatrixD src(m);
MatrixD dst(m.h(), m.w());
double sum = 0;
int cnt = 0;
for (int i = 0; i < m.size(); i++) {
if (!std::isnan(m.at(i))) {
sum += m.at(i);
cnt++;
}
}
if (cnt != m.size()) {
double avg = sum / cnt;
for (int i = 0; i < m.size(); i++)
if (std::isnan(m.at(i)))
src.at(i) = avg;
}
bool hasNAN = fillNANs(m, src);
gaussBlur4(src, dst, radius);
if (cnt != m.size()) {
for (int i = 0; i < dst.size(); i++)
if (std::isnan(m.at(i)))
dst.at(i) = NAN;
}
if (hasNAN)
revertNANs(m, dst);
return dst;
}

View File

@ -241,11 +241,13 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
reader.skipCurrentElement();
}
void Style::line(QXmlStreamReader &reader, qreal baseStrokeWidth,
const Rule &rule)
void Style::line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule)
{
PathRender ri(rule, _paths.size() + _circles.size() + _hillShading.isValid());
const QXmlStreamAttributes &attr = reader.attributes();
QString file;
int height = 0, width = 0, percent = 100;
bool ok;
ri._brush = Qt::NoBrush;
@ -309,6 +311,32 @@ void Style::line(QXmlStreamReader &reader, qreal baseStrokeWidth,
}
}
if (attr.hasAttribute("src"))
file = resourcePath(attr.value("src").toString(), dir);
if (attr.hasAttribute("symbol-height")) {
height = attr.value("symbol-height").toInt(&ok);
if (!ok || height < 0) {
reader.raiseError("invalid symbol-height value");
return;
}
}
if (attr.hasAttribute("symbol-width")) {
width = attr.value("symbol-width").toInt(&ok);
if (!ok || width < 0) {
reader.raiseError("invalid symbol-width value");
return;
}
}
if (attr.hasAttribute("symbol-percent")) {
percent = attr.value("symbol-percent").toInt(&ok);
if (!ok || percent < 0) {
reader.raiseError("invalid symbol-percent value");
return;
}
}
if (!file.isNull())
ri._img = image(file, width, height, percent, ratio);
if (ri.rule()._type == Rule::AnyType || ri.rule()._type == Rule::WayType)
_paths.append(ri);
@ -549,7 +577,7 @@ void Style::rule(QXmlStreamReader &reader, const QString &dir,
else if (reader.name() == QLatin1String("area"))
area(reader, dir, ratio, baseStrokeWidth, r);
else if (reader.name() == QLatin1String("line"))
line(reader, baseStrokeWidth, r);
line(reader, dir, ratio, baseStrokeWidth, r);
else if (reader.name() == QLatin1String("circle"))
circle(reader, baseStrokeWidth, r);
else if (reader.name() == QLatin1String("pathText")) {
@ -852,11 +880,11 @@ QList<const Style::Symbol*> Style::areaSymbols(int zoom) const
QPen Style::PathRender::pen(int zoom) const
{
if (_strokeColor.isValid()) {
if (!_img.isNull() || _strokeColor.isValid()) {
qreal width = (_scale > None && zoom >= 12)
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
QPen p(QBrush(_strokeColor), width, Qt::SolidLine, _strokeCap,
_strokeJoin);
QBrush brush = _img.isNull() ? QBrush(_strokeColor) : QBrush(_img);
QPen p(brush, width, Qt::SolidLine, _strokeCap, _strokeJoin);
if (!_strokeDasharray.isEmpty()) {
QVector<qreal>pattern(_strokeDasharray);
for (int i = 0; i < _strokeDasharray.size(); i++) {

View File

@ -173,6 +173,7 @@ public:
QVector<qreal> _strokeDasharray;
Qt::PenCapStyle _strokeCap;
Qt::PenJoinStyle _strokeJoin;
QImage _img;
QBrush _brush;
bool _area, _curve;
Scale _scale;
@ -320,7 +321,8 @@ private:
const Rule &parent);
void area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule);
void line(QXmlStreamReader &reader, qreal baseStrokeWidth, const Rule &rule);
void line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule);
void circle(QXmlStreamReader &reader, qreal baseStrokeWidth,
const Rule &rule);
void hillshading(QXmlStreamReader &reader, const QSet<QString> &cats);