Advertisement
vladislav_larionov

Untitled

May 23rd, 2024
584
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 4.10 KB | None | 0 1
  1. // SPDX-FileCopyrightText: 2023-2024 Open Mobile Platform LLC <community@omp.ru>
  2. // SPDX-License-Identifier: BSD-3-Clause
  3.  
  4. import QtQuick 2.0
  5. import Sailfish.Silica 1.0
  6. import QtPositioning 5.2
  7. import MfwMap 1.0
  8. //import "wrapper.js" as VkMapWrapper
  9. //import "mmr-gl.js" as VkMap
  10.  
  11. Page {
  12.     id: mainPage
  13.  
  14.     objectName: "mainPage"
  15.     allowedOrientations: Orientation.All
  16.  
  17.     MfwMap {
  18.         id: map
  19.  
  20.         width: parent.width
  21.         height: parent.height - header.height
  22.         anchors.top: header.bottom
  23.  
  24.         zoomLevel: 17.0
  25.         metersPerPixelTolerance: 0.1
  26.  
  27.         urlDebug: false        
  28.         cacheDatabaseStoreSettings: true
  29.  
  30.         center: QtPositioning.coordinate(55.752121, 37.617664) // Moscow
  31.  
  32. //        accessToken: "pk.eyJ1Ijoic2xhdmFjaGVybmlrb2ZmIiwiYSI6ImNsZDBlemo0ejAxdnUzd3Fxc242Y2g2dHAifQ.YptKmH0xY8nfDfZnhdPiFg"
  33. //        styleUrl: "mapbox://styles/mapbox/streets-v10"
  34.  
  35.         apiKey: "8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  36.         apiBaseUrl: "https://maps.vk.com/api"
  37.         accessToken: "8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  38.         styleUrl: "https://maps.vk.com/api/styles/main_style.json?api_key=8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  39. //        styleUrl: "mmr://api/styles/main_style.json"
  40.  
  41.         //        apiBaseUrl: "https://tiles.maps.vk.com/tiles/8/153/76.pbf?api_key=8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  42.         onGestureInProgressChanged: {
  43.             mainPage.forwardNavigation = !gestureInProgress
  44.             mainPage.backNavigation = !gestureInProgress
  45.         }
  46.         Text {
  47.             id: license
  48.  
  49.             text: qsTr("License logo clicked")
  50.  
  51.             anchors.margins: 20 * Theme.pixelRatio
  52.             anchors.right: parent.right
  53.             anchors.bottom: parent.bottom
  54.             visible: false
  55.         }
  56.         onLogoClicked: {
  57.             license.visible = true
  58.         }
  59.     }
  60.  
  61.     PageHeader {
  62.         id: header
  63.  
  64.         objectName: "pageHeader"
  65.         title: qsTr("Source control")
  66.     }
  67.  
  68.     Rectangle {
  69.         anchors.fill: menu
  70.         anchors.margins: -20 * Theme.pixelRatio
  71.         radius: 30
  72.         clip: true
  73.         color: "grey"
  74.     }
  75.  
  76.     Column {
  77.         id: menu
  78.  
  79.         anchors.top: header.bottom
  80.         anchors.right: parent.right
  81.         anchors.margins: 30 * Theme.pixelRatio
  82.  
  83.         Button {
  84.             text: qsTr("MapTiler")
  85.             border.color: "black"
  86.  
  87.             onClicked: {
  88.                 map.apiKey = "rIkhrE0BML0xS89iIyfG"
  89.                 map.styleUrl = "https://api.maptiler.com/maps/streets/style.json?key=rIkhrE0BML0xS89iIyfG"
  90.                 map.accessToken = ""
  91.                 map.apiBaseUrl = "https://api.mapbox.com"
  92.             }
  93.         }
  94.  
  95.         Button {
  96.             text: qsTr("Mapbox")
  97.             border.color: "black"
  98.  
  99.             onClicked: {
  100.                 map.accessToken = "pk.eyJ1Ijoic2xhdmFjaGVybmlrb2ZmIiwiYSI6ImNsZDBlemo0ejAxdnUzd3Fxc242Y2g2dHAifQ.YptKmH0xY8nfDfZnhdPiFg"
  101.                 map.styleUrl = "mapbox://styles/mapbox/streets-v10"
  102.                 map.apiKey = ""
  103.                 map.apiBaseUrl = "https://api.mapbox.com"
  104.             }
  105.         }
  106.  
  107.         Button {
  108.             text: qsTr("Vk")
  109.             border.color: "black"
  110.  
  111.             onClicked: {
  112.                 map.accessToken = "8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  113.                 map.apiKey = "8d47d57ee2eacf1935cb4338708369257961f41e84e0f66fafeb5c6b78f09b2c"
  114.                 map.styleUrl = "mmr://api/styles/main_style.json"
  115.                 map.apiBaseUrl = "https://maps.vk.com/api"
  116.             }
  117.         }
  118.     }
  119.     Component.onCompleted: {
  120.         console.log("map.apiBaseUrl = " + map.apiBaseUrl)
  121.         console.log("map.styleUrl = " + map.styleUrl)
  122.         console.log("map.apiKey = " + map.apiKey)
  123.         console.log("map.accessToken = " + map.accessToken)
  124.         console.log("map.mode = " + map.mode)
  125.         console.log("map.urlSuffix = " + map.urlSuffix)
  126. //        VkMapWrapper.createMap();
  127.     }
  128. }
  129.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement