Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ option(BUILD_FOR_LOCAL_SYSTEM "Build for local system ONLY (resulting binary mig
# Off by default on purpose: only a build that is deliberately refreshing the catalogs may run
# lupdate and rewrite the tracked .ts files.
option(UPDATE_TRANSLATIONS "Update translation files" OFF)
option(BUILD_TESTING "Build the unit tests (run them with ctest)" OFF)
option(UPDATE_TRANSLATIONS_PURGE_OBSOLETE "Remove obsolete translations" OFF)


Expand Down Expand Up @@ -168,6 +169,7 @@ qms_add_flag_if_supported(-Woverloaded-virtual)
###############################################################################################
# Core5Compat provides QTextCodec, which decodes the Garmin codepages QStringConverter cannot.
find_package(Qt6 6.8 REQUIRED COMPONENTS
Concurrent
Core
Core5Compat
Help
Expand Down Expand Up @@ -217,6 +219,11 @@ if(USE_QT6DBus)
find_package(Qt6 REQUIRED COMPONENTS DBus)
endif()

if(BUILD_TESTING)
find_package(Qt6 REQUIRED COMPONENTS Test)
enable_testing()
endif()

# Everything included. Let's finetune the mess a bit more

if(APPLE)
Expand Down Expand Up @@ -301,6 +308,7 @@ add_subdirectory(src/common/svgticon)

if(BUILD_QMAPSHACK)
add_subdirectory(src/qmapshack)
add_subdirectory(src/qms_surfacedb)
endif(BUILD_QMAPSHACK)

if(BUILD_QMAPTOOL)
Expand All @@ -318,6 +326,7 @@ if(BUILD_QMAPSHACK)
install( FILES src/icons/48x48/QMapShack.png DESTINATION ${DATA_INSTALL_PREFIX}/pixmaps )
install( DIRECTORY src/icons/qmapshack/hicolor DESTINATION ${ICON_INSTALL_DIR} )
install( FILES qmapshack.1 DESTINATION ${MAN_INSTALL_DIR}/man1 )
install( FILES qms_surfacedb.1 DESTINATION ${MAN_INSTALL_DIR}/man1 )
install( FILES src/qmapshack/doc/QMSHelp.qhc DESTINATION ${HTML_INSTALL_DIR})
install( FILES src/qmapshack/doc/QMSHelp.qch DESTINATION ${HTML_INSTALL_DIR})
endif(BUILD_QMAPSHACK)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ cmake --build . -j$(nproc)
sudo cmake --install .
```

This builds and installs `qmapshack`, `qmaptool`, `qmt_rgb2pct` and `qmt_map2jnx`. Configure with
This builds and installs `qmapshack`, `qms_surfacedb`, `qmaptool`, `qmt_rgb2pct` and `qmt_map2jnx`. Configure with
`-DBUILD_QMAPTOOL=OFF` to leave out the three QMapTool binaries, or build a single binary with
`--target qmapshack` — note that `cmake --install` then fails on the binaries that were not built.

Expand Down
2 changes: 1 addition & 1 deletion README_PRESETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The build presets compile everything. To build just one binary, pass the target
cmake --build --preset linux-debug --target qmapshack -j$(nproc)
```

Targets: `qmapshack`, `qmaptool`, `qmt_map2jnx`, `qmt_rgb2pct`.
Targets: `qmapshack`, `qms_surfacedb`, `qmaptool`, `qmt_map2jnx`, `qmt_rgb2pct`.

## Adding options on top of a preset

Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ V1.XX.X
[QMS-1274] Pass QMS look-and-feel to internally called QMT
[QMS-1276] macOS build scripts maintenance
[QMS-1278] More macOS build scripts maintenance
[QMS-1280] Show surfaces and way types of tracks from OpenStreetMap data
[QMS-1281] Support Mapsforge POI files of version 3 and 4

V1.21.1
Expand Down
41 changes: 41 additions & 0 deletions qms_surfacedb.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.TH "QMS_SURFACEDB" "1" "Oct 2026" "" ""
.SH "NAME"
qms_surfacedb \- build a QMapShack surface database from an OpenStreetMap extract
.SH "SYNOPSIS"
\fBqms_surfacedb\fR [\fB\-n\fR|\fB\-\-name\fR <name>] [\fB\-q\fR|\fB\-\-quiet\fR] \fIsource\fR \fItarget\fR
.SH "DESCRIPTION"
Reads the roads and paths of an OpenStreetMap extract (\fI.osm.pbf\fR) and writes them with their
surface and way type into a surface database (\fI<name>.surface.sqlite\fR). Put the database into
one of the paths set up in QMapShack's "Create Surface Database" tool. QMapShack then shows the
surfaces and way types of every track it covers.
.PP
This is the same as the "Create Surface Database" tool of
.BR qmapshack (1),
without the GUI, e.g. for a script that also builds the Routino databases.
.SH "OPTIONS"
.TP
\fB\-h, \-\-help\fR
Displays the help.
.TP
\fB\-v, \-\-version\fR
Displays the version.
.TP
\fB\-n, \-\-name\fR <name>
The name of the region shown in QMapShack. Default: the target file name up to the first dot.
.TP
\fB\-q, \-\-quiet\fR
No progress output.
.SH "ARGUMENTS"
.TP
\fIsource\fR
The OpenStreetMap extract, e.g. belgium\-latest.osm.pbf from download.geofabrik.de.
.TP
\fItarget\fR
The database file to write, e.g. Belgium.surface.sqlite. An existing file is replaced only when the
new database is complete.
.SH "EXIT STATUS"
0 on success, 1 on an error, which is printed to standard error.
.SH "SEE ALSO"
.BR qmapshack (1)
.SH "AUTHOR"
qms_surfacedb was written by Gert Pellin <gert@pellin.be>.
Binary file added src/icons/32x32/CSrcSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/32x32/CSrcWayType.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/48x48/CSrcSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/48x48/CSrcWayType.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions src/icons/CSrcSurface.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions src/icons/CSrcWayType.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/icons/svg.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ c0fb36bd12c6609e59eda19ce11898cb3b8865ff57a642fc3a596ceb3172e673 CSrcSeaLevelPr
b42306efeac95c318aebfdf5befafa650fddf2c01a3bd54ee25d7646aa29876a CSrcSlope.svg
4f65e88b26f8faafebd60c9bd8fd397a01133c0996bdfd25c947e67aa37850f5 CSrcSolid.svg
9f1e1e315b2adc273d529d30c808671c33e1ce249bb7db8da7dde99a4e386075 CSrcSpeed.svg
8e760077d5d48946a2e0d9e08093977987623d43c85b6008719bfecfc95c55f7 CSrcSurface.svg
c1c3fcd9fb8bbff35a3e82dd7d214ba1942a9c8ec7804c3ce8c95999eb3723cb CSrcUnknown.svg
ec17fc1c8d9ed196f218d8820832cbdcc534ec4d79c3da3e70119506c4cc9837 CSrcVertSpeed.svg
2e9cc7b5f115407b2337f5d4d669e1f16ffff0589e196f6bb56d9592084cae37 CSrcWTemp.svg
881ac2372d2c8f7c7e2f0ecda94e2804bf9ae0fc20bf0f013b2a829fb0961a5f CSrcWayType.svg
3f3fd593edc5342162001ecab34dddba794fe475479c3163318a4ccb94273630 Cancel.svg
fe8bd81289412e8d2b36c8e9dc424ba96e145ded27b1c40cb213babf63c65796 Check.svg
866375cc0f10a3b421a787eab2a0da90eb79dfdce3492f07baa2f956e178923a CloneMapWorkspace.svg
Expand Down
18 changes: 18 additions & 0 deletions src/qmapshack/CMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "gis/trk/CActivityTrk.h"
#include "gis/trk/CDetailsTrk.h"
#include "gis/trk/CKnownExtension.h"
#include "gis/trk/surface/CSurfaceDbManager.h"
#include "gis/wpt/CGisItemWpt.h"
#include "help/CHelp.h"
#include "helpers/CMapIconSizesSetup.h"
Expand All @@ -66,6 +67,7 @@
#include "tool/CImportDatabase.h"
#include "tool/CMapVrtBuilder.h"
#include "tool/CRoutinoDatabaseBuilder.h"
#include "tool/CSurfaceDatabaseBuilder.h"
#include "units/CCoordFormatSetup.h"
#include "units/CTimeZoneSetup.h"
#include "units/CUnitsSetup.h"
Expand Down Expand Up @@ -142,6 +144,8 @@ CMainWindow::CMainWindow() : id(QRandomGenerator::global()->generate()) {

CKnownExtension::init(IUnit::self());
CActivityTrk::init();
// scans the surface databases now, not while the first track loads under IGisItem::mutexItems
CSurfaceDbManager::self();

widgetGisWorkspace = new CGisWorkspace(menuProject, this);
dockWorkspace->setWidget(widgetGisWorkspace);
Expand Down Expand Up @@ -222,6 +226,7 @@ CMainWindow::CMainWindow() : id(QRandomGenerator::global()->generate()) {
connect(actionLoadView, &QAction::triggered, this, &CMainWindow::slotLoadView);
connect(actionClose, &QAction::triggered, this, &CMainWindow::close);
connect(actionCreateRoutinoDatabase, &QAction::triggered, this, &CMainWindow::slotCreateRoutinoDatabase);
connect(actionCreateSurfaceDatabase, &QAction::triggered, this, &CMainWindow::slotCreateSurfaceDatabase);
connect(actionPrintMap, &QAction::triggered, this, &CMainWindow::slotPrintMap);
connect(actionTakeScreenshot, &QAction::triggered, this, &CMainWindow::slotTakeScreenshot);
connect(actionCloseTab, &QAction::triggered, this, &CMainWindow::slotCloseTab);
Expand Down Expand Up @@ -458,6 +463,7 @@ CMainWindow::CMainWindow() : id(QRandomGenerator::global()->generate()) {
actionClose,
actionCloneMapView,
actionCreateRoutinoDatabase,
actionCreateSurfaceDatabase,
actionPrintMap,
actionTakeScreenshot,
actionSetupCoordFormat,
Expand Down Expand Up @@ -1281,6 +1287,18 @@ void CMainWindow::slotCreateRoutinoDatabase() {
addWidgetToTab(widget);
}

void CMainWindow::slotCreateSurfaceDatabase() {
// one tab is enough, it also lists the databases
for (qint32 i = 0; i < tabWidget->count(); i++) {
if (dynamic_cast<CSurfaceDatabaseBuilder*>(tabWidget->widget(i)) != nullptr) {
tabWidget->setCurrentIndex(i);
return;
}
}
CSurfaceDatabaseBuilder* widget = new CSurfaceDatabaseBuilder(this);
addWidgetToTab(widget);
}

void CMainWindow::slotLoadGISData() {
SETTINGS;
QString path = cfg.value("Paths/lastGisPath", QDir::homePath()).toString();
Expand Down
2 changes: 2 additions & 0 deletions src/qmapshack/CMainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class CMainWindow : public QMainWindow, private Ui::IMainWindow {
void sigCanvasChange();

public slots:
/** @brief open the tool tab to build surface databases */
void slotCreateSurfaceDatabase();
void slotLinkActivated(const QString& link);
void slotLinkActivated(const QUrl& url);
void slotSetupMapView();
Expand Down
30 changes: 30 additions & 0 deletions src/qmapshack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ set( SRCS
gis/trk/CTrkToAreaDialog.cpp
gis/trk/CTrkToRteDialog.cpp
gis/trk/CTrackData.cpp
gis/trk/surface/CPbfReader.cpp
gis/trk/surface/CSurface.cpp
gis/trk/surface/CSurfaceAnalyzer.cpp
gis/trk/surface/CSurfaceBar.cpp
gis/trk/surface/CSurfaceDb.cpp
gis/trk/surface/CSurfaceDbBuilder.cpp
gis/trk/surface/CSurfaceDbManager.cpp
gis/trk/surface/CSurfaceDbSet.cpp
gis/trk/surface/CSurfaceTrk.cpp
gis/trk/surface/CSurfaceWidget.cpp
gis/trk/filter/CFilterChangeStartPoint.cpp
gis/trk/filter/CFilterDelete.cpp
gis/trk/filter/CFilterDeleteExtension.cpp
Expand Down Expand Up @@ -321,6 +331,7 @@ set( SRCS
tool/CImportDatabase.cpp
tool/CMapVrtBuilder.cpp
tool/CRoutinoDatabaseBuilder.cpp
tool/CSurfaceDatabaseBuilder.cpp
tool/IToolShell.cpp
units/CCoordFormatSetup.cpp
units/CTimeZoneSetup.cpp
Expand Down Expand Up @@ -527,6 +538,16 @@ set( HDRS
gis/trk/CTrkToAreaDialog.h
gis/trk/CTrkToRteDialog.h
gis/trk/CTrackData.h
gis/trk/surface/CPbfReader.h
gis/trk/surface/CSurface.h
gis/trk/surface/CSurfaceAnalyzer.h
gis/trk/surface/CSurfaceBar.h
gis/trk/surface/CSurfaceDb.h
gis/trk/surface/CSurfaceDbBuilder.h
gis/trk/surface/CSurfaceDbManager.h
gis/trk/surface/CSurfaceDbSet.h
gis/trk/surface/CSurfaceTrk.h
gis/trk/surface/CSurfaceWidget.h
gis/trk/filter/CFilterChangeStartPoint.h
gis/trk/filter/CFilterDelete.h
gis/trk/filter/CFilterDeleteExtension.h
Expand Down Expand Up @@ -717,6 +738,7 @@ set( HDRS
tool/CImportDatabase.h
tool/CMapVrtBuilder.h
tool/CRoutinoDatabaseBuilder.h
tool/CSurfaceDatabaseBuilder.h
tool/IToolShell.h
units/CCoordFormatSetup.h
units/CTimeZoneSetup.h
Expand Down Expand Up @@ -1054,6 +1076,7 @@ target_link_libraries(${APPLICATION_NAME} PRIVATE
qms_options
svgticonengine
Qt6::Widgets
Qt6::Concurrent
# Nothing includes a QtSvg header: QIcon(":/x.svg") is served by the qsvg image plugin and
# the qsvgicon icon engine, both loaded at runtime. Linking the module is what makes
# windeployqt/macdeployqt detect and ship those plugins. Linux distros package them anyway.
Expand Down Expand Up @@ -1108,3 +1131,10 @@ if(WIN32)
)
install(SCRIPT ${deploy_script_${APPLICATION_NAME}})
endif()

###############################################################################################
# Unit tests
###############################################################################################
if(BUILD_TESTING)
add_subdirectory(gis/trk/surface/test)
endif()
Loading