KOSMIndoorMap

routingcontroller.h
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KOSMINDOORROUTING_ROUTINGCONTROLLER_H
7#define KOSMINDOORROUTING_ROUTINGCONTROLLER_H
8
9#include "navmesh.h"
10
11#include <KOSMIndoorMap/OverlaySource>
12#include <KOSMIndoorMap/MapData>
13
14#include <KOSMIndoorRouting/Route>
15#include <KOSMIndoorRouting/RoutingProfile>
16
17#include <qqmlregistration.h>
18#include <QObject>
19
20namespace KOSMIndoorRouting {
21
22class NavMeshBuilder;
23class RoutingJob;
24class RouteOverlay;
25
26/** Routing interface for QML. */
28{
30 QML_ELEMENT
31 Q_PROPERTY(bool available READ routingAvailable CONSTANT)
32 Q_PROPERTY(bool inProgress READ routingInProgress NOTIFY progressChanged)
33 Q_PROPERTY(KOSMIndoorMap::MapData mapData MEMBER m_mapData WRITE setMapData NOTIFY mapDataChanged)
34 Q_PROPERTY(KOSMIndoorMap::AbstractOverlaySource *elevatorModel MEMBER m_elevatorModel NOTIFY elevatorModelChanged)
35 Q_PROPERTY(KOSMIndoorMap::AbstractOverlaySource *routeOverlay READ routeOverlay CONSTANT)
36 Q_PROPERTY(KOSMIndoorRouting::RoutingProfile profile MEMBER m_routingProfile WRITE setProfile NOTIFY profileChanged)
37public:
38 explicit RoutingController(QObject *parent = nullptr);
40
41 /** Indicates that routing support is built-in at all. */
42 [[nodiscard]] bool routingAvailable() const;
43 /** Indicates an ongoing routing or navmesh compilation process. */
44 [[nodiscard]] bool routingInProgress() const;
45
46 Q_INVOKABLE void setStartPosition(double lat, double lon, int floorLevel);
47 Q_INVOKABLE void setEndPosition(double lat, double lon, int floorLevel);
48
49 [[nodiscard]] KOSMIndoorMap::AbstractOverlaySource* routeOverlay() const;
50
51 void setProfile(const RoutingProfile &profile);
52
53public Q_SLOTS:
54 void searchRoute();
55
57 void progressChanged();
58 void mapDataChanged();
59 void elevatorModelChanged();
60 void profileChanged();
61
62private:
63 void setMapData(const KOSMIndoorMap::MapData &mapData);
64
65 void buildNavMesh();
66
67 KOSMIndoorMap::MapData m_mapData;
68 KOSMIndoorMap::AbstractOverlaySource *m_elevatorModel = nullptr;
69 NavMesh m_navMesh;
70 Route m_route;
71 RoutingProfile m_routingProfile;
72
73 OSM::Coordinate m_start;
74 OSM::Coordinate m_end;
75 int m_startLevel = 0;
76 int m_endLevel = 0;
77
78 KOSMIndoorRouting::NavMeshBuilder *m_builder = nullptr;
79 KOSMIndoorRouting::RoutingJob *m_routingJob = nullptr;
80
81 RouteOverlay *m_routeOverlay = nullptr;
82};
83}
84
85#endif
A source for overlay elements, drawn on top of the static map data.
Raw OSM map data, separated by levels.
Definition mapdata.h:60
Job for building a navigation mesh for the given building.
Compiled nav mesh for routing.
Definition navmesh.h:22
bool routingInProgress() const
Indicates an ongoing routing or navmesh compilation process.
bool routingAvailable() const
Indicates that routing support is built-in at all.
Job for running a routing query on a compiled NavMesh instance.
Definition routingjob.h:25
Coordinate, stored as 1e7 * degree to avoid floating point precision issues, and offset to unsigned v...
Definition datatypes.h:37
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.