10import QtQuick.Controls as QQC2
11import QtQuick.Dialogs as Dialogs
12import org.kde.kirigami as Kirigami
13import org.kde.kpublictransport as PublicTransport
14import org.kde.kosmindoormap
15import org.kde.kosmindoormap.kpublictransport
16import org.kde.kosmindoorrouting
17import org.kde.osm.editorcontroller
18import org.kde.kirigamiaddons.formcard as FormCard
20Kirigami.ApplicationWindow {
21 globalDrawer: Kirigami.GlobalDrawer {
23 titleIcon:
"map-symbolic"
28 icon.name:
"document-open-symbolic"
29 onTriggered: fileDialog.open()
32 text:
"Open MapCSS Stylesheet"
33 icon.name:
"document-open-symbolic"
34 onTriggered: mapcssDialog.open()
37 text:
"Reload Stylesheet"
38 icon.name:
"view-refresh-symbolic"
41 var s = page.map.styleSheet;
42 page.map.styleSheet =
"";
43 page.map.styleSheet = s;
48 text:
i18nc(
"@action",
"Data Sources")
49 icon.name: "help-about-symbolic"
50 onTriggered: pageStack.pushDialogLayer(attributionPage, {}, {
51 title:
i18nc(
"@title:window",
"Data Sources")
57 icon.name:
"help-about-symbolic"
58 onTriggered: pageStack.pushDialogLayer(aboutPage, {}, {
59 title:
i18nc(
"@title:window",
"About")
64 contextDrawer:
Kirigami.ContextDrawer {
70 title:
"Open OSM File"
71 fileMode: Dialogs.FileDialog.OpenFile
72 nameFilters: [
"o5m file (*.o5m)",
"OSM XML file (*.osm *.xml)",
"PBF file (*.osm.pbf)"]
73 onAccepted: page.map.mapLoader.loadFromFile(fileDialog.selectedFile);
77 title:
"Open MapCSS Stylesheet"
78 fileMode: Dialogs.FileDialog.OpenFile
79 nameFilters: [
"MapCSS stylesheet (*.mapcss)"]
80 onAccepted: page.map.styleSheet = mapcssDialog.selectedFile
82 PublicTransport.Manager { id: ptMgr }
85 property alias debugMode: debugAction.checked
86 property alias stylesheet: page.map.styleSheet
87 property alias hoverMode: page.mapHoverEnabled
90 pageStack.initialPage: IndoorMapPage {
92 debug: debugAction.checked
93 routingController: routingController
97 text:
"Select Location"
99 onTriggered: locationSheet.open()
103 onTriggered: page.map.styleSheet =
"breeze-light"
107 onTriggered: page.map.styleSheet =
"breeze-dark"
110 text:
"Diagnostic View"
111 onTriggered: page.map.styleSheet =
"diagnostic"
115 text:
"Debug Info Model"
121 text:
"Find Platform"
122 onTriggered: platformSheet.open()
123 visible: !platformModel.isEmpty
128 onTriggered: gateSheet.open()
129 visible: !gateModel.isEmpty
134 onTriggered: amenitySheet.open()
139 onTriggered: roomSheet.open()
143 text:
"Show Elevator Status"
145 enabled: !page.map.mapLoader.isLoading
146 onTriggered: page.queryLiveLocationData();
149 id: rentalVehicleAction
150 text:
i18n(
"Show Rental Vehicles")
152 enabled: !page.map.mapLoader.isLoading
153 onTriggered: page.queryLiveLocationData();
156 text:
i18n(
"Edit with iD")
157 icon.name: "document-edit"
158 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.ID)
161 text:
i18n(
"Edit with JOSM")
162 icon.name: "
org.openstreetmap.josm"
163 visible: EditorController.hasEditor(Editor.JOSM)
164 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.JOSM)
167 text:
i18n(
"Edit with Vespucci")
168 icon.name: "document-edit"
169 visible: EditorController.hasEditor(Editor.Vespucci)
170 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.Vespucci)
173 text:
i18n(
"Enable hover selection")
174 icon.name: "followmouse"
176 checked: page.mapHoverEnabled
177 onToggled: page.mapHoverEnabled = !page.mapHoverEnabled
180 text:
i18n(
"Configure routing...")
181 icon.name: "settings-configure"
182 visible: routingController.available
184 routingSheet.routingProfile = routingController.profile;
190 function queryLiveLocationData() {
191 if (rentalVehicleAction.checked || equipmentAction.checked) {
192 locationQuery.request.latitude =
map.mapData.center.y;
193 locationQuery.request.longitude =
map.mapData.center.x;
194 locationQuery.request.maximumDistance =
map.mapData.radius;
195 locationQuery.request.types =
196 (rentalVehicleAction.checked ? (PublicTransport.Location.RentedVehicleStation | PublicTransport.Location.RentedVehicle) : 0)
197 | (equipmentAction.checked ? PublicTransport.Location.Equipment : 0);
199 locationQuery.clear();
201 routingController.searchRoute();
206 mapData: page.map.mapData
212 property var platform: model
213 width: ListView.view.width
215 QQC2.Label { text: platform.lines.length == 0 ? platform.display : (platform.display +
" - "); }
217 model: platform.lines
221 height:
Kirigami.Units.iconSizes.small
223 visible: source !=
""
225 switch (platform.mode) {
227 return PublicTransport.LineMetaData.lookup(modelData, platform.coordinate.y, platform.coordinate.x, PublicTransport.Line.Train,
true).logo;
229 return PublicTransport.LineMetaData.lookup(modelData, platform.coordinate.y, platform.coordinate.x, PublicTransport.Line.Tramway,
true).logo;
230 case Platform.Subway:
231 return PublicTransport.LineMetaData.lookup(modelData, platform.coordinate.y, platform.coordinate.x, PublicTransport.Line.Metro,
true).logo;
237 text: modelData +
" "
238 visible: icon.source ==
""
245 page.map.view.floorLevel = model.level
246 page.map.view.centerOnGeoCoordinate(model.coordinate);
247 page.map.view.setZoomLevel(19,
Qt.point(page.map.width / 2.0, page.map.height/ 2.0));
248 platformSheet.close()
256 title:
i18nc(
"@title",
"Find Platform")
258 width: Math.min(applicationWindow().width,
Kirigami.
Units.gridUnit * 24)
259 height: Math.min(applicationWindow().height,
Kirigami.
Units.gridUnit * 32)
261 contentItem: ListView {
264 Layout.preferredWidth:
Kirigami.Units.gridUnit * 25
266 section.property:
"mode"
267 section.delegate:
Kirigami.ListSectionHeader {
268 label:
switch(parseInt(section)) {
269 case Platform.Rail:
return "Railway";
270 case Platform.Subway:
return "Subway";
271 case Platform.Tram:
return "Tramway";
272 case Platform.Bus:
return "Bus";
273 default: console.log(section, Platform.Rail);
return section;
275 width: ListView.view.width
277 section.criteria: ViewSection.FullString
279 delegate: platformDelegate
285 mapData: page.map.mapData
291 title:
i18nc(
"@title",
"Find Gate")
293 width: Math.min(applicationWindow().width,
Kirigami.
Units.gridUnit * 24)
294 height: Math.min(applicationWindow().height,
Kirigami.
Units.gridUnit * 32)
296 contentItem: ListView {
298 Layout.preferredWidth:
Kirigami.Units.gridUnit * 10
299 delegate: QQC2.ItemDelegate {
301 width: ListView.view.width
302 contentItem:
Kirigami.TitleSubtitle {
306 page.map.view.floorLevel = model.level
307 page.map.view.centerOnGeoCoordinate(model.coordinate);
308 page.map.view.setZoomLevel(18,
Qt.point(page.map.width / 2.0, page.map.height/ 2.0));
317 mapData: page.map.mapData
320 AmenitySearchDialog {
322 amenityModel: amenityModel
323 onAmenitySelected: (amenity) => {
324 page.map.view.floorLevel = amenity.level;
325 page.map.view.setZoomLevel(21,
Qt.point(page.map.width / 2.0, page.map.height/ 2.0));
326 page.map.view.centerOnGeoCoordinate(amenity.element.center);
327 console.log(amenity.element.url);
333 mapData: page.map.mapData
339 onRoomSelected: (room) => {
340 page.map.view.floorLevel = room.level;
341 page.map.view.setZoomLevel(21,
Qt.point(page.map.width / 2.0, page.map.height/ 2.0));
342 page.map.view.centerOnGeoCoordinate(room.element.center);
343 console.log(room.element.url);
347 LocationQueryOverlayProxyModel {
349 sourceModel: PublicTransport.LocationQueryModel {
353 mapData: page.map.mapData
356 RealtimeEquipmentModel {
358 mapData: page.map.mapData
359 realtimeModel: locationModel.sourceModel
360 onUpdate: routingController.searchRoute()
363 SelectLocationSheet {
365 publicTransportManager: ptMgr
366 onCoordinateSelected: function() {
367 page.map.mapLoader.loadForCoordinate(locationSheet.coordinate.y, locationSheet.coordinate.x);
368 page.map.view.beginTime =
new Date();
369 page.map.view.endTime =
new Date(page.map.view.beginTime.getTime() + 3600000);
372 settings.setValue(
"latitude", locationSheet.coordinate.y);
373 settings.setValue(
"longitude", locationSheet.coordinate.x);
378 id: routingController
379 mapData: page.map.mapData
380 elevatorModel: equipmentModel
383 anchors.top: parent.top
384 anchors.right: parent.right
385 running: routingController.inProgress
387 RoutingProfileSheet {
389 onApplyRoutingProfile: {
390 routingController.profile = routingSheet.routingProfile;
391 routingController.searchRoute();
395 map.overlaySources: [ gateModel, platformModel, locationModel, equipmentModel, routingController.routeOverlay ]
396 map.timeZone:
"Europe/Berlin"
399 QQC2.Label { text:
"Floor Level:" }
402 model: page.map.floorLevels
404 currentIndex: page.map.floorLevels.rowForLevel(page.map.view.floorLevel);
405 onCurrentIndexChanged:
if (currentIndex >= 0) { page.map.view.floorLevel = page.map.floorLevels.levelForRow(currentIndex); }
406 Layout.fillWidth:
true
409 target: page.map.view
410 function onFloorLevelChanged() { floorLevelCombo.currentIndex = page.map.floorLevels.rowForLevel(page.map.view.floorLevel); }
418 Layout.fillWidth:
true
421 page.map.view.setZoomLevel(value,
Qt.point(page.map.width / 2.0, page.map.height/ 2.0));
425 target: page.map.view
426 function onZoomLevelChanged() { zoomSlider.value = page.map.view.zoomLevel; }
430 coordinate:
Qt.point(settings.value(
"longitude", 11.08196), settings.value(
"latitude", 49.44572))
435 function onMapDataChanged() {
436 page.queryLiveLocationData();
443 publicTransportManager: ptMgr
451 "displayName":
"KDE OSM Indoor Map",
452 "productName":
"org.kde.kosmindoormap",
453 "componentName":
"org.kde.kosmindoormap",
454 "shortDescription":
"OSM Indoor Map Demo",
455 "homepage":
"https://kde.org/",
456 "bugAddress":
"submit@bugs.kde.org",
457 "version": Application.version,
460 "name":
"LGPL 2.0 or later",
461 "spdx":
"LGPL-2.0-or-later"
464 "copyrightStatement":
"© 2020-2024 The KDE Community",
465 "desktopFileName":
"org.kde.kosmindoormap",
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
const QList< QKeySequence > & shortcut(StandardShortcut id)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)