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.kpublictransport.ui as PublicTransport
15import org.kde.kosmindoormap
16import org.kde.kosmindoormap.kpublictransport
17import org.kde.kosmindoorrouting
18import org.kde.osm.editorcontroller
19import org.kde.kirigamiaddons.formcard as FormCard
21Kirigami.ApplicationWindow {
22 globalDrawer: Kirigami.GlobalDrawer {
24 titleIcon:
"map-symbolic"
29 icon.name:
"document-open-symbolic"
30 onTriggered: fileDialog.open()
33 text:
"Open MapCSS Stylesheet"
34 icon.name:
"document-open-symbolic"
35 onTriggered: mapcssDialog.open()
38 text:
"Reload Stylesheet"
39 icon.name:
"view-refresh-symbolic"
42 var s = page.map.styleSheet;
43 page.map.styleSheet =
"";
44 page.map.styleSheet = s;
49 text:
i18nc(
"@action",
"Data Sources")
50 icon.name:
"help-about-symbolic"
51 onTriggered: pageStack.pushDialogLayer(attributionPage, {}, {
52 title:
i18nc(
"@title:window",
"Data Sources")
58 icon.name:
"help-about-symbolic"
59 onTriggered: pageStack.pushDialogLayer(aboutPage, {}, {
60 title:
i18nc(
"@title:window",
"About")
65 contextDrawer:
Kirigami.ContextDrawer {
71 title:
"Open OSM File"
72 fileMode: Dialogs.FileDialog.OpenFile
73 nameFilters: [
"o5m file (*.o5m)",
"OSM XML file (*.osm *.xml)",
"PBF file (*.osm.pbf)"]
74 onAccepted: page.map.mapLoader.loadFromFile(fileDialog.selectedFile);
78 title:
"Open MapCSS Stylesheet"
79 fileMode: Dialogs.FileDialog.OpenFile
80 nameFilters: [
"MapCSS stylesheet (*.mapcss)"]
81 onAccepted: page.map.styleSheet = mapcssDialog.selectedFile
83 PublicTransport.Manager { id: ptMgr }
86 property alias debugMode: debugAction.checked
87 property alias stylesheet: page.map.styleSheet
88 property alias hoverMode: page.mapHoverEnabled
91 pageStack.initialPage: IndoorMapPage {
93 debug: debugAction.checked
94 routingController: routingController
98 text:
"Select Location"
100 onTriggered: locationSheet.open()
104 onTriggered: page.map.styleSheet =
"breeze-light"
108 onTriggered: page.map.styleSheet =
"breeze-dark"
111 text:
"Diagnostic View"
112 onTriggered: page.map.styleSheet =
"diagnostic"
116 text:
"Debug Info Model"
122 text:
"Find Platform"
123 onTriggered: platformSheet.open()
124 visible: !platformModel.isEmpty
129 onTriggered: gateSheet.open()
130 visible: !gateModel.isEmpty
135 onTriggered: amenitySheet.open()
140 onTriggered: roomSheet.open()
144 text:
"Show Elevator Status"
146 enabled: !page.map.mapLoader.isLoading
147 onTriggered: page.queryLiveLocationData();
150 id: rentalVehicleAction
151 text:
i18n(
"Show Rental Vehicles")
153 enabled: !page.map.mapLoader.isLoading
154 onTriggered: page.queryLiveLocationData();
157 text:
i18n(
"Edit with iD")
158 icon.name:
"document-edit"
159 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.ID)
162 text:
i18n(
"Edit with JOSM")
163 icon.name:
"org.openstreetmap.josm"
164 visible: EditorController.hasEditor(Editor.JOSM)
165 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.JOSM)
168 text:
i18n(
"Edit with Vespucci")
169 icon.name:
"document-edit"
170 visible: EditorController.hasEditor(Editor.Vespucci)
171 onTriggered: EditorController.editBoundingBox(page.map.view.mapSceneToGeo(page.map.view.viewport), Editor.Vespucci)
174 text:
i18n(
"Enable hover selection")
175 icon.name:
"followmouse"
177 checked: page.mapHoverEnabled
178 onToggled: page.mapHoverEnabled = !page.mapHoverEnabled
181 text:
i18n(
"Configure routing...")
182 icon.name:
"settings-configure"
183 visible: routingController.available
185 routingSheet.routingProfile = routingController.profile;
191 function queryLiveLocationData() {
192 if (rentalVehicleAction.checked || equipmentAction.checked) {
193 locationQuery.request.latitude =
map.mapData.center.y;
194 locationQuery.request.longitude =
map.mapData.center.x;
195 locationQuery.request.maximumDistance =
map.mapData.radius;
196 locationQuery.request.types =
197 (rentalVehicleAction.checked ? (PublicTransport.Location.RentedVehicleStation | PublicTransport.Location.RentedVehicle) : 0)
198 | (equipmentAction.checked ? PublicTransport.Location.Equipment : 0);
200 locationQuery.clear();
202 routingController.searchRoute();
207 mapData: page.map.mapData
213 property var platform: model
214 width: ListView.view.width
216 QQC2.Label { text: platform.lines.length == 0 ? platform.display : (platform.display +
" - "); }
218 model: platform.lines
220 PublicTransport.TransportIcon {
222 iconHeight:
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)