1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
fc3dec8540 German translation update 2024-05-26 12:57:21 +02:00
46b04308db Czech translation update 2024-05-26 12:57:00 +02:00
b51c504d62 Localization update 2024-05-26 12:47:25 +02:00
Hosted Weblate
15a5f71d32
Merge branch 'origin/master' into Weblate. 2024-05-26 11:20:02 +02:00
11b9f842e5 Added hillshading settings 2024-05-26 11:19:53 +02:00
Hosted Weblate
4bb5ed1ec8
Merge branch 'origin/master' into Weblate. 2024-05-25 20:00:04 +02:00
ovl-1
e700c3d729
Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.7% (473 of 474 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2024-05-25 16:16:11 +02:00
28 changed files with 4405 additions and 3506 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@
#include "map/maplist.h"
#include "map/emptymap.h"
#include "map/crs.h"
#include "map/hillshading.h"
#include "icons.h"
#include "keys.h"
#include "settings.h"
@ -2632,6 +2633,11 @@ void GUI::writeSettings()
WRITE(demAuthentication, _options.demAuthorization);
WRITE(demUsername, _options.demUsername);
WRITE(demPassword, _options.demPassword);
WRITE(hillshadingAlpha, _options.hillshadingAlpha);
WRITE(hillshadingBlur, _options.hillshadingBlur);
WRITE(hillshadingAzimuth, _options.hillshadingAzimuth);
WRITE(hillshadingAltitude, _options.hillshadingAltitude);
WRITE(hillshadingZFactor, _options.hillshadingZFactor);
WRITE(positionPlugin(), _options.plugin);
WRITE(positionPluginParameters, _options.pluginParams);
WRITE(useOpenGL, _options.useOpenGL);
@ -2932,6 +2938,11 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs,
_options.demAuthorization = READ(demAuthentication).toBool();
_options.demUsername = READ(demUsername).toString();
_options.demPassword = READ(demPassword).toString();
_options.hillshadingAlpha = READ(hillshadingAlpha).toInt();
_options.hillshadingBlur = READ(hillshadingBlur).toInt();
_options.hillshadingAzimuth = READ(hillshadingAzimuth).toInt();
_options.hillshadingAltitude = READ(hillshadingAltitude).toInt();
_options.hillshadingZFactor = READ(hillshadingZFactor).toDouble();
_options.plugin = READ(positionPlugin()).toString();
_options.pluginParams = READ(positionPluginParameters);
_options.useOpenGL = READ(useOpenGL).toBool();
@ -3026,6 +3037,12 @@ void GUI::loadOptions()
DEM::setCacheSize(_options.demCache * 1024);
DEM::unlock();
HillShading::setAlpha(_options.hillshadingAlpha);
HillShading::setBlur(_options.hillshadingBlur);
HillShading::setAzimuth(_options.hillshadingAzimuth);
HillShading::setAltitude(_options.hillshadingAltitude);
HillShading::setZFactor(_options.hillshadingZFactor);
_poi->setRadius(_options.poiRadius);
_dem->setUrl(_options.demURL);
@ -3062,8 +3079,14 @@ void GUI::updateOptions(const Options &options)
Waypoint::action(options.option); \
reload = true; \
}
#define SET_HS_OPTION(option, action) \
if (options.option != _options.option) { \
HillShading::action(options.option); \
redraw = true; \
}
bool reload = false;
bool redraw = false;
SET_VIEW_OPTION(palette, setPalette);
SET_VIEW_OPTION(mapOpacity, setMapOpacity);
@ -3155,6 +3178,12 @@ void GUI::updateOptions(const Options &options)
DEM::unlock();
}
SET_HS_OPTION(hillshadingAlpha, setAlpha);
SET_HS_OPTION(hillshadingBlur, setBlur);
SET_HS_OPTION(hillshadingAzimuth, setAzimuth);
SET_HS_OPTION(hillshadingAltitude, setAltitude);
SET_HS_OPTION(hillshadingZFactor, setZFactor);
if (options.connectionTimeout != _options.connectionTimeout)
Downloader::setTimeout(options.connectionTimeout);
if (options.enableHTTP2 != _options.enableHTTP2)
@ -3169,6 +3198,8 @@ void GUI::updateOptions(const Options &options)
if (reload)
reloadFiles();
if (redraw)
_mapView->setMap(_map);
_options = options;

View File

@ -135,18 +135,21 @@ QWidget *OptionsDialog::createAppearancePage()
{
// Tracks
_trackWidth = new QSpinBox();
_trackWidth->setValue(_options.trackWidth);
_trackWidth->setMinimum(1);
_trackWidth->setSuffix(UNIT_SPACE + tr("px"));
_trackWidth->setValue(_options.trackWidth);
_trackStyle = new StyleComboBox();
_trackStyle->setValue(_options.trackStyle);
// Routes
_routeWidth = new QSpinBox();
_routeWidth->setValue(_options.routeWidth);
_routeWidth->setMinimum(1);
_routeWidth->setSuffix(UNIT_SPACE + tr("px"));
_routeWidth->setValue(_options.routeWidth);
_routeStyle = new StyleComboBox();
_routeStyle->setValue(_options.routeStyle);
// Areas
_areaWidth = new QSpinBox();
_areaWidth->setSuffix(UNIT_SPACE + tr("px"));
_areaWidth->setValue(_options.areaWidth);
_areaStyle = new StyleComboBox();
_areaStyle->setValue(_options.areaStyle);
@ -214,12 +217,14 @@ QWidget *OptionsDialog::createAppearancePage()
// Waypoints
_waypointSize = new QSpinBox();
_waypointSize->setMinimum(1);
_waypointSize->setSuffix(UNIT_SPACE + tr("px"));
_waypointSize->setValue(_options.waypointSize);
_waypointColor = new ColorBox();
_waypointColor->setColor(_options.waypointColor);
// POI
_poiSize = new QSpinBox();
_poiSize->setMinimum(1);
_poiSize->setSuffix(UNIT_SPACE + tr("px"));
_poiSize->setValue(_options.poiSize);
_poiColor = new ColorBox();
_poiColor->setColor(_options.poiColor);
@ -256,8 +261,9 @@ QWidget *OptionsDialog::createAppearancePage()
_sliderColor = new ColorBox();
_sliderColor->setColor(_options.sliderColor);
_graphWidth = new QSpinBox();
_graphWidth->setValue(_options.graphWidth);
_graphWidth->setMinimum(1);
_graphWidth->setSuffix(UNIT_SPACE + tr("px"));
_graphWidth->setValue(_options.graphWidth);
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
_graphAA->setChecked(_options.graphAntiAliasing);
@ -612,8 +618,39 @@ QWidget *OptionsDialog::createDEMPage()
sourceTab->setLayout(sourceLayout);
#endif // Q_OS_MAC
_hillshadingAlpha = new PercentSlider();
_hillshadingAlpha->setValue(qRound((_options.hillshadingAlpha / 255.0)
* 100));
_hillshadingBlur = new QSpinBox();
_hillshadingBlur->setMaximum(10);
_hillshadingBlur->setSuffix(UNIT_SPACE + tr("px"));
_hillshadingBlur->setValue(_options.hillshadingBlur);
_hillshadingAzimuth = new QSpinBox();
_hillshadingAzimuth->setMaximum(360);
_hillshadingAzimuth->setSuffix(UNIT_SPACE + QChar(0x00B0));
_hillshadingAzimuth->setValue(_options.hillshadingAzimuth);
_hillshadingAltitude = new QSpinBox();
_hillshadingAltitude->setMaximum(90);
_hillshadingAltitude->setSuffix(UNIT_SPACE + QChar(0x00B0));
_hillshadingAltitude->setValue(_options.hillshadingAltitude);
_hillshadingZFactor = new QDoubleSpinBox();
_hillshadingZFactor->setDecimals(1);
_hillshadingZFactor->setSingleStep(0.1);
_hillshadingZFactor->setValue(_options.hillshadingZFactor);
QFormLayout *hillshadingLayout = new QFormLayout();
hillshadingLayout->addRow(tr("Opacity:"), _hillshadingAlpha);
hillshadingLayout->addRow(tr("Blur radius:"), _hillshadingBlur);
hillshadingLayout->addItem(new QSpacerItem(10, 10));
hillshadingLayout->addRow(tr("Azimuth:"), _hillshadingAzimuth);
hillshadingLayout->addRow(tr("Altitude:"), _hillshadingAltitude);
hillshadingLayout->addRow(tr("Z Factor:"), _hillshadingZFactor);
QWidget *hillshadingTab = new QWidget();
hillshadingTab->setLayout(hillshadingLayout);
QTabWidget *demPage = new QTabWidget();
demPage->addTab(sourceTab, tr("Source"));
demPage->addTab(hillshadingTab, tr("Hillshading"));
return demPage;
}
@ -948,6 +985,12 @@ void OptionsDialog::accept()
_options.demAuthorization = _demAuth->isEnabled();
_options.demUsername = _demAuth->username();
_options.demPassword = _demAuth->password();
_options.hillshadingAlpha = qRound((_hillshadingAlpha->value() / 100.0)
* 255);
_options.hillshadingBlur = _hillshadingBlur->value();
_options.hillshadingAzimuth = _hillshadingAzimuth->value();
_options.hillshadingAltitude = _hillshadingAltitude->value();
_options.hillshadingZFactor = _hillshadingZFactor->value();
_options.plugin = _positionPlugin->currentText();
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)

View File

@ -72,6 +72,11 @@ struct Options {
QString demUsername;
QString demPassword;
bool demAuthorization;
int hillshadingAlpha;
int hillshadingBlur;
int hillshadingAzimuth;
int hillshadingAltitude;
double hillshadingZFactor;
// Position
QString plugin;
QMap<QString, QVariantMap> pluginParams;
@ -176,6 +181,11 @@ private:
// DEM
QLineEdit *_demURL;
AuthenticationWidget *_demAuth;
PercentSlider *_hillshadingAlpha;
QSpinBox *_hillshadingBlur;
QSpinBox *_hillshadingAzimuth;
QSpinBox *_hillshadingAltitude;
QDoubleSpinBox *_hillshadingZFactor;
// Position
QComboBox *_positionPlugin;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)

View File

@ -244,6 +244,11 @@ SETTING(demURL, "demURL", DEM_TILES_URL );
SETTING(demAuthentication, "demAuthentication", false );
SETTING(demUsername, "demUsername", "" );
SETTING(demPassword, "demPassword", "" );
SETTING(hillshadingAlpha, "hillshadingAlpha", 102 );
SETTING(hillshadingBlur, "hillshadingBlur", 3 );
SETTING(hillshadingAzimuth, "hillshadingAzimuth", 315 );
SETTING(hillshadingAltitude, "hillshadingAltitude", 45 );
SETTING(hillshadingZFactor, "hillshadingZFactor", 0.6 );
SETTING(useOpenGL, "useOpenGL", false );
SETTING(enableHTTP2, "enableHTTP2", true );
SETTING(pixmapCache, "pixmapCache", PIXMAP_CACHE );

View File

@ -196,6 +196,11 @@ public:
static const Setting demAuthentication;
static const Setting demUsername;
static const Setting demPassword;
static const Setting hillshadingAlpha;
static const Setting hillshadingBlur;
static const Setting hillshadingAzimuth;
static const Setting hillshadingAltitude;
static const Setting hillshadingZFactor;
static const Setting useOpenGL;
static const Setting enableHTTP2;
static const Setting pixmapCache;

View File

@ -29,8 +29,6 @@ using namespace IMG;
#define ROAD 0
#define WATER 1
#define BLUR_RADIUS 3
static const QColor textColor(Qt::black);
static const QColor haloColor(Qt::white);
static const QColor shieldColor(Qt::white);
@ -498,9 +496,14 @@ MatrixD RasterTile::elevation(int extend) const
void RasterTile::drawHillShading(QPainter *painter) const
{
if (_hillShading && _zoom >= 18 && _zoom <= 24) {
MatrixD dem(Filter::blur(elevation(BLUR_RADIUS + 1), BLUR_RADIUS));
QImage img(HillShading::render(dem, BLUR_RADIUS + 1));
painter->drawImage(_rect.x(), _rect.y(), img);
if (HillShading::blur()) {
MatrixD dem(Filter::blur(elevation(HillShading::blur() + 1),
HillShading::blur()));
QImage img(HillShading::render(dem, HillShading::blur() + 1));
painter->drawImage(_rect.x(), _rect.y(), img);
} else
painter->drawImage(_rect.x(), _rect.y(),
HillShading::render(elevation(1), 1));
}
}

View File

@ -26,6 +26,12 @@ struct Derivatives
double dzdy;
};
int HillShading::_alpha = 96;
int HillShading::_blur = 3;
int HillShading::_azimuth = 315;
int HillShading::_altitude = 45;
double HillShading::_z = 0.6;
static void getConstants(double azimuth, double elevation, Constants &c)
{
double alpha = (M_PI / 180.0) * azimuth;
@ -59,8 +65,7 @@ static void getSubmatrix(int x, int y, const MatrixD &m, SubMatrix &sm)
sm.z9 = m.at(bottom, right);
}
QImage HillShading::render(const MatrixD &m, int extend, quint8 alpha, double z,
double azimuth, double elevation)
QImage HillShading::render(const MatrixD &m, int extend)
{
QImage img(m.w() - 2 * extend, m.h() - 2 * extend,
QImage::Format_ARGB32_Premultiplied);
@ -71,12 +76,12 @@ QImage HillShading::render(const MatrixD &m, int extend, quint8 alpha, double z,
SubMatrix sm;
Derivatives d;
getConstants(azimuth, elevation, c);
getConstants(_azimuth, _altitude, c);
for (int y = extend; y < m.h() - extend; y++) {
for (int x = extend; x < m.w() - extend; x++) {
getSubmatrix(x, y, m, sm);
getDerivativesHorn(sm, z, d);
getDerivativesHorn(sm, _z, d);
double L = (c.a1 - c.a2 * d.dzdx - c.a3 * d.dzdy)
/ sqrt(1.0 + d.dzdx * d.dzdx + d.dzdy * d.dzdy);
@ -86,8 +91,8 @@ QImage HillShading::render(const MatrixD &m, int extend, quint8 alpha, double z,
pixel = 0;
else {
L = sqrt(L * 0.8 + 0.2);
quint8 val = (L < 0) ? 0 : L * alpha;
pixel = (alpha - val)<<24;
quint8 val = (L < 0) ? 0 : L * _alpha;
pixel = (_alpha - val)<<24;
}
*(quint32*)(bits + (y - extend) * bpl + (x - extend) * 4) = pixel;

View File

@ -7,8 +7,22 @@
class HillShading
{
public:
static QImage render(const MatrixD &m, int extend, quint8 alpha = 96,
double z = 0.6, double azimuth = 315, double elevation = 45);
static QImage render(const MatrixD &m, int extend);
static int blur() {return _blur;}
static void setAlpha(int alpha) {_alpha = alpha;}
static void setBlur(int blur) {_blur = blur;}
static void setAzimuth(int azimuth) {_azimuth = azimuth;}
static void setAltitude(int altitude) {_altitude = altitude;}
static void setZFactor(double z) {_z = z;}
private:
static int _alpha;
static int _blur;
static int _azimuth;
static int _altitude;
static double _z;
};
#endif // HILLSHADING_H

View File

@ -442,10 +442,14 @@ void RasterTile::drawPaths(QPainter *painter, const QList<MapData::Path> &paths,
painter->drawEllipse(ll2xy(point->coordinates), radius, radius);
} else {
if (_hillShading) {
MatrixD dem(Filter::blur(elevation(BLUR_RADIUS + 1),
BLUR_RADIUS));
QImage img(HillShading::render(dem, BLUR_RADIUS + 1));
painter->drawImage(_rect.x(), _rect.y(), img);
if (HillShading::blur()) {
MatrixD dem(Filter::blur(elevation(HillShading::blur() + 1),
HillShading::blur()));
QImage img(HillShading::render(dem, HillShading::blur() + 1));
painter->drawImage(_rect.x(), _rect.y(), img);
} else
painter->drawImage(_rect.x(), _rect.y(),
HillShading::render(elevation(1), 1));
}
}
}