Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Showing rote data using OSM
Forum Updated to NodeBB v4.3 + New Features

Showing rote data using OSM

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlpositionmapnavigation
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rwik
    wrote on 2 Apr 2016, 15:20 last edited by rwik 4 Feb 2016, 15:22
    #1

    I am trying to show a blue line between two points. I have followed examples given on youtube(https://www.youtube.com/watch?v=2u5wnrx6J-E) . Map is visible. But route is not visible at all . I have tried different coordinates. Please check the code. TIA

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtLocation 5.3
    import QtPositioning 5.3
    
    //silk board lat 12.917352466802262  long 77.62281109101559
    //CMRIT bus stop lat 12.9677261  long 77.71430729999997
    
    ApplicationWindow {
        visible: true
        width: 800
        height: 600
        title: qsTr("Hello World")
        color: "beige"
    
        Rectangle{
            anchors.fill: parent
            color: "gray"
            Plugin {
                id: mapPlugin
                preferred: "osm"
    
                // code here to choose the plugin as necessary
            }
    
            Map {
                id: map
                width: parent.width
                height: parent.height
    
                plugin: mapPlugin
    
    
                center {
                    latitude: 12.9172
                    longitude: 77.6228
                }
                MapQuickItem{
    
                }
                MapItemView{
                    model:routeModel
                    delegate: routeDelegate
    
                }
                Component{
                    id:routeDelegate
                    MapRoute{
                        route:routeData
                        line.color:"blue"
                        line.width: 3
                    }
                }
    
                zoomLevel: map.maximumZoomLevel
                Keys.onPressed: {
                    if (event.key === Qt.Key_Plus) {
                        map.zoomLevel++
                    } else if (event.key === Qt.Key_Minus) {
                        map.zoomLevel--
                    }
                }
                gesture.flickDeceleration: 3000
                gesture.enabled: true
                GeocodeModel{
                    plugin: mapPlugin
    
    
                }
                RouteModel{
                    id : routeModel
                    plugin: map.plugin
                    query: RouteQuery{
                        id:routeQ
                        travelModes: RouteQuery.PublicTransitTravel
    
                    }
                    Component.onCompleted: {
    //                    routeQ.addWaypoint(QtPositioning.coordinate(12.9172,77.6228));
    //                    routeQ.addWaypoint(QtPositioning.coordinate(12.9677261,77.6228));
    
                        routeQ.addWaypoint(QtPositioning.coordinate(12.917352466802262,77.62281109101559));
                        routeQ.addWaypoint(QtPositioning.coordinate(12.9677261,77.71430729999997));
                        update();
    
                    }
    
    
                }
            }
    
    
            Slider {
                id: sliderVertical1
                x: 714
                y: 187
                width: 22
                height: 202
                z:map.z+1
                orientation: Qt.Vertical
                minimumValue: map.minimumZoomLevel;
                maximumValue: map.maximumZoomLevel;
                value: maximumValue
                onValueChanged: {
                    map.zoomLevel=value
                }
            }
        }
    
    
    
        GroupBox {
            id: groupBox1
            x: 49
            y: 90
            width: 166
            height: 118
            title: qsTr("Settings")
    
            ComboBox {
                id: comboBox1
                x: 0
                y: 5
                width: 82
                model:ListModel{
                    ListElement { text: "SilkBoard to Agara"; color: "Yellow" }
                    ListElement { text: "SilkBoard to BTM"; color: "Green" }
                    ListElement { text: "SilkBoard to Bomasandra"; color: "Brown" }
                }
    
            }
    
            CheckBox {
                id: checkBox1
                x: 0
                y: 39
                text: qsTr("Petrol Pump")
            }
    
            CheckBox {
                id: checkBox2
                x: 0
                y: 68
                text: qsTr("Resturant")
            }
        }
    
    
    }
    
    
    
    • list item
    1 Reply Last reply
    0
    • R Offline
      R Offline
      rwik
      wrote on 2 Apr 2016, 17:25 last edited by
      #2

      Upgrading to 5.6 solved my issue.

      1 Reply Last reply
      0

      1/2

      2 Apr 2016, 15:20

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved