mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-24 15:34:24 +02:00
Compare commits
14 Commits
22c7ea7de6
...
13.27
Author | SHA1 | Date | |
---|---|---|---|
9a8070bd06 | |||
b721a829b2 | |||
244a7670e7 | |||
3ec36336c1 | |||
86b85e5afc | |||
77f51098f6 | |||
4848190377 | |||
6da8ec3525 | |||
5a71deda15 | |||
5b5e00038f | |||
b348ad6288 | |||
e2b6dcf8d3 | |||
776104a9fa | |||
941aa6d83b |
@ -494,7 +494,7 @@ TRANSLATIONS = lang/gpxsee_en.ts \
|
||||
lang/gpxsee_hu.ts \
|
||||
lang/gpxsee_it.ts \
|
||||
lang/gpxsee_eo.ts \
|
||||
lang/gpxsee_zh.ts \
|
||||
lang/gpxsee_zh_CN.ts \
|
||||
lang/gpxsee_ca.ts \
|
||||
lang/gpxsee_ko.ts
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
||||
<message>
|
||||
<location filename="../src/data/data.cpp" line="169"/>
|
||||
<source>JPEG images</source>
|
||||
<translation>JPEG fájlok</translation>
|
||||
<translation>JPEG képek</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/data/data.cpp" line="170"/>
|
||||
@ -295,7 +295,7 @@
|
||||
<location filename="../src/GUI/fileselectwidget.cpp" line="46"/>
|
||||
<location filename="../src/GUI/fileselectwidget.cpp" line="51"/>
|
||||
<source>Select file</source>
|
||||
<translation>Fájl választása</translation>
|
||||
<translation>Fájl kiválasztása</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/fileselectwidget.cpp" line="61"/>
|
||||
@ -305,12 +305,12 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/fileselectwidget.cpp" line="71"/>
|
||||
<source>%1 is a directory.</source>
|
||||
<translation>A(z) %1 egy mappa.</translation>
|
||||
<translation>%1 egy mappa.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/fileselectwidget.cpp" line="75"/>
|
||||
<source>%1 is not writable.</source>
|
||||
<translation>A(z) %1 írásvédett.</translation>
|
||||
<translation>%1 írásvédett.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -356,7 +356,7 @@
|
||||
<location filename="../src/GUI/gui.cpp" line="974"/>
|
||||
<location filename="../src/GUI/gui.cpp" line="992"/>
|
||||
<source>Paths</source>
|
||||
<translation>Adatmappák</translation>
|
||||
<translation>Elérési útvonalak</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="211"/>
|
||||
@ -369,7 +369,7 @@
|
||||
<location filename="../src/GUI/gui.cpp" line="215"/>
|
||||
<location filename="../src/GUI/gui.cpp" line="901"/>
|
||||
<source>About GPXSee</source>
|
||||
<translation>GPXSee névjegye</translation>
|
||||
<translation>A GPXSee névjegye</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="221"/>
|
||||
@ -429,7 +429,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="297"/>
|
||||
<source>Unselect all files</source>
|
||||
<translation>Összes kijelölés megszüntetése</translation>
|
||||
<translation>Összes kijelölésének visszavonása</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="302"/>
|
||||
|
@ -342,9 +342,10 @@ SectionEnd
|
||||
|
||||
SectionGroup "Localization" SEC_LOCALIZATION
|
||||
!insertmacro LOCALIZATION "Catalan" "ca"
|
||||
!insertmacro LOCALIZATION "Chinese (Simplified)" "zh"
|
||||
!insertmacro LOCALIZATION "Chinese (Simplified)" "zh_CN"
|
||||
!insertmacro LOCALIZATION "Czech" "cs"
|
||||
!insertmacro LOCALIZATION "Danish" "da"
|
||||
!insertmacro LOCALIZATION "English" "en"
|
||||
!insertmacro LOCALIZATION "Esperanto" "eo"
|
||||
!insertmacro LOCALIZATION "Finnish" "fi"
|
||||
!insertmacro LOCALIZATION "French" "fr"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <QtWidgets>
|
||||
#include <QWidget>
|
||||
#include "flowlayout.h"
|
||||
|
||||
struct FlowLayoutItem
|
||||
|
@ -52,6 +52,9 @@ QString Format::distance(qreal value, Units units)
|
||||
if (value < MIINM)
|
||||
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "ft");
|
||||
else if (value < 10 * MIINM)
|
||||
return l.toString(value * M2MI, 'f', 2) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "mi");
|
||||
else
|
||||
return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "mi");
|
||||
@ -59,6 +62,9 @@ QString Format::distance(qreal value, Units units)
|
||||
if (value < NMIINM)
|
||||
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "ft");
|
||||
else if (value < 10 * NMIINM)
|
||||
return l.toString(value * M2NMI, 'f', 2) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "nmi");
|
||||
else
|
||||
return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "nmi");
|
||||
@ -66,6 +72,9 @@ QString Format::distance(qreal value, Units units)
|
||||
if (value < KMINM)
|
||||
return l.toString(value, 'f', 0) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "m");
|
||||
else if (value < 10 * KMINM)
|
||||
return l.toString(value * M2KM, 'f', 2) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "km");
|
||||
else
|
||||
return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "km");
|
||||
|
@ -46,6 +46,8 @@ static inline QPoint POS(QMouseEvent *e)
|
||||
GraphView::GraphView(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
const QPalette &p = palette();
|
||||
|
||||
_scene = new GraphicsScene(this);
|
||||
setScene(_scene);
|
||||
|
||||
@ -53,7 +55,7 @@ GraphView::GraphView(QWidget *parent)
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setBackgroundBrush(QBrush(palette().brush(QPalette::Base)));
|
||||
setBackgroundBrush(QBrush(p.brush(QPalette::Base)));
|
||||
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
grabGesture(Qt::PinchGesture);
|
||||
|
||||
@ -72,8 +74,7 @@ GraphView::GraphView(QWidget *parent)
|
||||
_info = new InfoItem();
|
||||
_grid = new GridItem();
|
||||
_message = new QGraphicsSimpleTextItem(tr("Data not available"));
|
||||
_message->setBrush(QPalette().brush(QPalette::Disabled,
|
||||
QPalette::WindowText));
|
||||
_message->setBrush(p.brush(QPalette::Disabled, QPalette::WindowText));
|
||||
|
||||
connect(_slider, &SliderItem::positionChanged, this,
|
||||
&GraphView::emitSliderPositionChanged);
|
||||
@ -627,9 +628,9 @@ void GraphView::setSliderColor(const QColor &color)
|
||||
void GraphView::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::PaletteChange) {
|
||||
_message->setBrush(QPalette().brush(QPalette::Disabled,
|
||||
QPalette::WindowText));
|
||||
setBackgroundBrush(QBrush(palette().brush(QPalette::Base)));
|
||||
const QPalette &p = palette();
|
||||
_message->setBrush(p.brush(QPalette::Disabled, QPalette::WindowText));
|
||||
setBackgroundBrush(QBrush(p.brush(QPalette::Base)));
|
||||
}
|
||||
|
||||
QGraphicsView::changeEvent(e);
|
||||
|
@ -2019,10 +2019,7 @@ void GUI::demLoaded()
|
||||
}
|
||||
|
||||
_demRects.clear();
|
||||
|
||||
DEM::lock();
|
||||
DEM::clearCache();
|
||||
DEM::unlock();
|
||||
|
||||
reloadFiles();
|
||||
reloadMap();
|
||||
@ -3070,9 +3067,7 @@ void GUI::loadOptions()
|
||||
Downloader::setTimeout(_options.connectionTimeout);
|
||||
|
||||
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
||||
DEM::lock();
|
||||
DEM::setCacheSize(_options.demCache * 1024);
|
||||
DEM::unlock();
|
||||
|
||||
HillShading::setAlpha(_options.hillshadingAlpha);
|
||||
HillShading::setBlur(_options.hillshadingBlur);
|
||||
@ -3211,11 +3206,8 @@ void GUI::updateOptions(const Options &options)
|
||||
|
||||
if (options.pixmapCache != _options.pixmapCache)
|
||||
QPixmapCache::setCacheLimit(options.pixmapCache * 1024);
|
||||
if (options.demCache != _options.demCache) {
|
||||
DEM::lock();
|
||||
if (options.demCache != _options.demCache)
|
||||
DEM::setCacheSize(options.demCache * 1024);
|
||||
DEM::unlock();
|
||||
}
|
||||
|
||||
SET_HS_OPTION(hillshadingAlpha, setAlpha);
|
||||
SET_HS_OPTION(hillshadingBlur, setBlur);
|
||||
|
@ -322,7 +322,7 @@ bool JLS::decode(const SubFile *file, SubFile::Handle &hdl, Matrix<qint16> &img)
|
||||
if (!readLine(bs))
|
||||
return false;
|
||||
|
||||
memcpy(&img.at(i, 0), _current + 1, _w * sizeof(quint16));
|
||||
memcpy(img.row(i), _current + 1, _w * sizeof(quint16));
|
||||
|
||||
quint16 *tmp = _last;
|
||||
_last = _current;
|
||||
|
@ -461,18 +461,15 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
|
||||
|
||||
MatrixD RasterTile::elevation(int extend) const
|
||||
{
|
||||
MatrixD m(_rect.height() + 2 * extend, _rect.width() + 2 * extend);
|
||||
QVector<Coordinates> ll;
|
||||
|
||||
int left = _rect.left() - extend;
|
||||
int right = _rect.right() + extend;
|
||||
int top = _rect.top() - extend;
|
||||
int bottom = _rect.bottom() + extend;
|
||||
|
||||
ll.reserve(m.w() * m.h());
|
||||
for (int y = top; y <= bottom; y++)
|
||||
for (int x = left; x <= right; x++)
|
||||
ll.append(xy2ll(QPointF(x, y)));
|
||||
MatrixC ll(_rect.height() + 2 * extend, _rect.width() + 2 * extend);
|
||||
for (int y = top, i = 0; y <= bottom; y++)
|
||||
for (int x = left; x <= right; x++, i++)
|
||||
ll.at(i) = xy2ll(QPointF(x, y));
|
||||
|
||||
if (_data->hasDEM()) {
|
||||
RectC rect;
|
||||
@ -487,16 +484,13 @@ MatrixD RasterTile::elevation(int extend) const
|
||||
-rect.height() / factor), _zoom, &tiles);
|
||||
|
||||
DEMTree tree(tiles);
|
||||
MatrixD m(ll.h(), ll.w());
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
m.at(i) = tree.elevation(ll.at(i));
|
||||
} else {
|
||||
DEM::lock();
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
m.at(i) = DEM::elevation(ll.at(i));
|
||||
DEM::unlock();
|
||||
}
|
||||
|
||||
return m;
|
||||
return m;
|
||||
} else
|
||||
return DEM::elevation(ll);
|
||||
}
|
||||
|
||||
void RasterTile::drawHillShading(QPainter *painter) const
|
||||
|
@ -23,12 +23,20 @@
|
||||
|
||||
static unsigned int isqrt(unsigned int x)
|
||||
{
|
||||
unsigned int r = 0;
|
||||
unsigned int l = 0;
|
||||
unsigned int m;
|
||||
unsigned int r = x + 1;
|
||||
|
||||
while ((r + 1) * (r + 1) <= x)
|
||||
r++;
|
||||
while (l != r - 1) {
|
||||
m = (l + r) / 2;
|
||||
|
||||
return r;
|
||||
if (m * m <= x)
|
||||
l = m;
|
||||
else
|
||||
r = m;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static double interpolate(double dx, double dy, double p0, double p1, double p2,
|
||||
@ -46,7 +54,6 @@ static double value(int col, int row, int samples, const QByteArray &data)
|
||||
return (val == -32768) ? NAN : val;
|
||||
}
|
||||
|
||||
QMutex DEM::_lock;
|
||||
|
||||
DEM::Entry::Entry(const QByteArray &data) : _data(data)
|
||||
{
|
||||
@ -70,12 +77,16 @@ QString DEM::Tile::fileName() const
|
||||
return QString("%1%2.hgt").arg(latStr(), lonStr());
|
||||
}
|
||||
|
||||
|
||||
QMutex DEM::_lock;
|
||||
QString DEM::_dir;
|
||||
DEM::TileCache DEM::_data;
|
||||
|
||||
void DEM::setCacheSize(int size)
|
||||
{
|
||||
_lock.lock();
|
||||
_data.setMaxCost(size);
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
void DEM::setDir(const QString &path)
|
||||
@ -85,7 +96,9 @@ void DEM::setDir(const QString &path)
|
||||
|
||||
void DEM::clearCache()
|
||||
{
|
||||
_lock.lock();
|
||||
_data.clear();
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
double DEM::height(const Coordinates &c, const Entry *e)
|
||||
@ -126,11 +139,8 @@ DEM::Entry *DEM::loadTile(const Tile &tile)
|
||||
}
|
||||
}
|
||||
|
||||
double DEM::elevation(const Coordinates &c)
|
||||
double DEM::elevationLockFree(const Coordinates &c)
|
||||
{
|
||||
if (_dir.isEmpty())
|
||||
return NAN;
|
||||
|
||||
Tile tile(floor(c.lon()), floor(c.lat()));
|
||||
Entry *e = _data.object(tile);
|
||||
double ele;
|
||||
@ -145,6 +155,33 @@ double DEM::elevation(const Coordinates &c)
|
||||
return ele;
|
||||
}
|
||||
|
||||
double DEM::elevation(const Coordinates &c)
|
||||
{
|
||||
if (_dir.isEmpty())
|
||||
return NAN;
|
||||
|
||||
_lock.lock();
|
||||
double ele = elevationLockFree(c);
|
||||
_lock.unlock();
|
||||
|
||||
return ele;
|
||||
}
|
||||
|
||||
MatrixD DEM::elevation(const MatrixC &m)
|
||||
{
|
||||
if (_dir.isEmpty())
|
||||
return MatrixD(m.h(), m.w(), NAN);
|
||||
|
||||
MatrixD ret(m.h(), m.w());
|
||||
|
||||
_lock.lock();
|
||||
for (int i = 0; i < m.size(); i++)
|
||||
ret.at(i) = elevationLockFree(m.at(i));
|
||||
_lock.unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<Area> DEM::tiles()
|
||||
{
|
||||
static const QRegularExpression re(
|
||||
|
@ -7,8 +7,7 @@
|
||||
#include <QMutex>
|
||||
#include "common/hash.h"
|
||||
#include "data/area.h"
|
||||
|
||||
class Coordinates;
|
||||
#include "matrix.h"
|
||||
|
||||
class DEM
|
||||
{
|
||||
@ -38,8 +37,7 @@ public:
|
||||
static void clearCache();
|
||||
|
||||
static double elevation(const Coordinates &c);
|
||||
static void lock() {_lock.lock();}
|
||||
static void unlock() {_lock.unlock();}
|
||||
static MatrixD elevation(const MatrixC &m);
|
||||
|
||||
static QList<Area> tiles();
|
||||
|
||||
@ -61,6 +59,7 @@ private:
|
||||
|
||||
static double height(const Coordinates &c, const Entry *e);
|
||||
static Entry *loadTile(const Tile &tile);
|
||||
static double elevationLockFree(const Coordinates &c);
|
||||
|
||||
static QString _dir;
|
||||
static TileCache _data;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <cmath>
|
||||
#include <QLineF>
|
||||
#include "dem.h"
|
||||
#include "map.h"
|
||||
|
||||
|
||||
@ -80,14 +79,3 @@ qreal Map::resolution(const QRectF &rect)
|
||||
|
||||
return ds/ps;
|
||||
}
|
||||
|
||||
double Map::elevation(const Coordinates &c)
|
||||
{
|
||||
double ele;
|
||||
|
||||
DEM::lock();
|
||||
ele = DEM::elevation(c);
|
||||
DEM::unlock();
|
||||
|
||||
return ele;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QFlags>
|
||||
#include "common/rectc.h"
|
||||
#include "common/util.h"
|
||||
#include "dem.h"
|
||||
|
||||
|
||||
class QPainter;
|
||||
@ -58,7 +59,7 @@ public:
|
||||
|
||||
virtual void draw(QPainter *painter, const QRectF &rect, Flags flags) = 0;
|
||||
|
||||
virtual double elevation(const Coordinates &c);
|
||||
virtual double elevation(const Coordinates &c) {return DEM::elevation(c);}
|
||||
|
||||
virtual void clearCache() {}
|
||||
|
||||
|
@ -153,6 +153,7 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
|
||||
QList<const Style::TextRender*> labels(_style->areaLabels(_zoom));
|
||||
QList<const Style::Symbol*> symbols(_style->areaSymbols(_zoom));
|
||||
QList<PathText> items;
|
||||
QSet<QByteArray> set;
|
||||
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
const PainterPath &path = paths.at(i);
|
||||
@ -199,12 +200,17 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
|
||||
QPointF pos = p.p->path->labelPos.isNull()
|
||||
? centroid(p.p->pp) : ll2xy(p.p->path->labelPos);
|
||||
|
||||
if (p.ti && p.lbl && set.contains(*p.lbl))
|
||||
continue;
|
||||
|
||||
PointItem *item = new PointItem(pos.toPoint(), p.lbl, font, img, color,
|
||||
hColor);
|
||||
if (item->isValid() && _rect.contains(item->boundingRect().toRect())
|
||||
&& !item->collides(textItems))
|
||||
&& !item->collides(textItems)) {
|
||||
textItems.append(item);
|
||||
else
|
||||
if (p.ti && p.lbl)
|
||||
set.insert(*p.lbl);
|
||||
} else
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
@ -470,26 +476,17 @@ void RasterTile::fetchData(QList<MapData::Path> &paths,
|
||||
|
||||
MatrixD RasterTile::elevation(int extend) const
|
||||
{
|
||||
MatrixD m(_rect.height() + 2 * extend, _rect.width() + 2 * extend);
|
||||
|
||||
int left = _rect.left() - extend;
|
||||
int right = _rect.right() + extend;
|
||||
int top = _rect.top() - extend;
|
||||
int bottom = _rect.bottom() + extend;
|
||||
|
||||
QVector<Coordinates> ll;
|
||||
ll.reserve(m.w() * m.h());
|
||||
for (int y = top; y <= bottom; y++) {
|
||||
for (int x = left; x <= right; x++)
|
||||
ll.append(xy2ll(QPointF(x, y)));
|
||||
}
|
||||
MatrixC ll(_rect.height() + 2 * extend, _rect.width() + 2 * extend);
|
||||
for (int y = top, i = 0; y <= bottom; y++)
|
||||
for (int x = left; x <= right; x++, i++)
|
||||
ll.at(i) = xy2ll(QPointF(x, y));
|
||||
|
||||
DEM::lock();
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
m.at(i) = DEM::elevation(ll.at(i));
|
||||
DEM::unlock();
|
||||
|
||||
return m;
|
||||
return DEM::elevation(ll);
|
||||
}
|
||||
|
||||
void RasterTile::render()
|
||||
|
@ -770,6 +770,7 @@ void Style::clear()
|
||||
_areaLabels = QList<TextRender>();
|
||||
_symbols = QList<Symbol>();
|
||||
_lineSymbols = QList<Symbol>();
|
||||
_hillShading = HillShadingRender();
|
||||
}
|
||||
|
||||
QList<const Style::PathRender *> Style::paths(int zoom, bool closed,
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
|
||||
class Coordinates;
|
||||
|
||||
template <class T>
|
||||
class Matrix
|
||||
{
|
||||
@ -19,6 +21,7 @@ public:
|
||||
T &at(int n) {return _m[n];}
|
||||
T &at(int i, int j) {return _m[_w * i + j];}
|
||||
T const &at(int i, int j) const {return _m.at(_w * i + j);}
|
||||
T *row(int i) {return &_m[_w * i];}
|
||||
|
||||
bool isNull() const {return (_h == 0 || _w == 0);}
|
||||
int size() const {return _m.size();}
|
||||
@ -39,6 +42,8 @@ public:
|
||||
MatrixD augemented(const MatrixD &M) const;
|
||||
};
|
||||
|
||||
typedef Matrix<Coordinates> MatrixC;
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
template <class T>
|
||||
inline QDebug operator<<(QDebug dbg, const Matrix<T> &matrix)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QtCore>
|
||||
#include <cmath>
|
||||
#include <QtMath>
|
||||
#include "common/wgs84.h"
|
||||
#include "osm.h"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <QtCore>
|
||||
#include <QtMath>
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QPixmapCache>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <QtCore>
|
||||
#include <QtMath>
|
||||
#include <QPainter>
|
||||
#include <QDir>
|
||||
#include <QPixmapCache>
|
||||
|
Reference in New Issue
Block a user