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. Multiple MapPolylines QML
Forum Updated to NodeBB v4.3 + New Features

Multiple MapPolylines QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 741 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    Hello,

    I have ListModel with coordinates list for each items and I would like draw polyline for each items, how to do that?

    here the model example with concole.log:

    qml: 51° 0' 21.6" N, 2° 4' 1.2" E;50° 59' 27.6" N, 2° 7' 12.0" E;51° 1' 55.2" N, 2° 9' 0.0" E;51° 0' 21.6" N, 2° 10' 48.0" E;51° 2' 38.4" N, 2° 10' 12.0" E;51° 2' 56.4" N, 2° 22' 58.8" E;51° 5' 20.4" N, 2° 32' 45.6" E;
    qml: 50° 21' 7.2" N, 1° 38' 27.6" E;50° 23' 52.8" N, 1° 33' 18.0" E;50° 32' 9.6" N, 1° 35' 6.0" E;50° 30' 28.8" N, 1° 38' 24.0" E;50° 30' 21.6" N, 1° 39' 43.2" E;50° 34' 26.4" N, 1° 34' 33.6" E;50° 43' 30.0" N, 1° 33' 39.6" E;50° 43' 15.6" N, 1° 36' 7.2" E;50° 48' 14.4" N, 1° 36' 32.4" E;50° 52' 8.4" N, 1° 34' 51.6" E;50° 57' 3.6" N, 1° 46' 8.4" E;51° 0' 21.6" N, 2° 4' 1.2" E;
    qml: 50° 9' 0.0" N, 3° 0' 10.8" E;50° 10' 22.8" N, 3° 3' 43.2" E;50° 9' 46.8" N, 3° 5' 42.0" E;50° 6' 43.2" N, 3° 0' 36.0" E;50° 9' 0.0" N, 3° 0' 10.8" E;
    qml: 50° 3' 54.0" N, 1° 22' 44.4" E;50° 12' 50.4" N, 1° 32' 42.0" E;50° 10' 58.8" N, 1° 40' 58.8" E;50° 16' 48.0" N, 1° 32' 16.8" E;50° 21' 46.8" N, 1° 33' 21.6" E;50° 21' 7.2" N, 1° 38' 27.6" E;
    qml: 51° 0' 21.6" N, 2° 4' 1.2" E;50° 57' 46.8" N, 2° 8' 6.0" E;50° 48' 36.0" N, 2° 12' 46.8" E;50° 45' 57.6" N, 2° 24' 39.6" E;50° 44' 24.0" N, 2° 20' 31.2" E;50° 40' 15.6" N, 2° 22' 37.2" E;50° 37' 51.6" N, 2° 29' 27.6" E;50° 38' 9.6" N, 2° 40' 51.6" E;50° 36' 18.0" N, 2° 44' 49.2" E;50° 37' 58.8" N, 2° 47' 31.2" E;50° 39' 46.8" N, 2° 46' 8.4" E;50° 40' 8.4" N, 2° 48' 32.4" E;50° 37' 51.6" N, 2° 52' 8.4" E;50° 34' 58.8" N, 2° 47' 20.4" E;50° 31' 40.8" N, 2° 47' 56.4" E;50° 32' 13.2" N, 2° 53' 9.6" E;50° 30' 7.2" N, 2° 53' 27.6" E;50° 30' 43.2" N, 2° 57' 50.4" E;50° 28' 51.6" N, 3° 1' 26.4" E;50° 26' 31.2" N, 3° 0' 57.6" E;50° 27' 28.8" N, 3° 3' 57.6" E;50° 25' 30.0" N, 3° 4' 4.8" E;50° 24' 7.2" N, 2° 58' 48.0" E;50° 18' 39.6" N, 3° 5' 2.4" E;50° 16' 1.2" N, 3° 0' 43.2" E;50° 15' 54.0" N, 3° 8' 16.8" E;50° 14' 2.4" N, 3° 11' 9.6" E;50° 9' 39.6" N, 3° 6' 0.0" E;50° 8' 24.0" N, 3° 8' 6.0" E;50° 7' 15.6" N, 3° 5' 34.8" E;50° 3' 10.8" N, 3° 5' 24.0" E;
    
    

    I was thinking about repeater to do that but all my attempt are fail

    Thank you for your help

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      To instantiate multiple MapItem inside a Map according to a model, use a MapItemView.

      F 1 Reply Last reply
      1
      • GrecKoG GrecKo

        To instantiate multiple MapItem inside a Map according to a model, use a MapItemView.

        F Offline
        F Offline
        filipdns
        wrote on last edited by filipdns
        #3

        @GrecKo thank a lot, I try to use that but unsuccessfully

        Component.onCompleted: {
        total=list.coordinatesList().length
                    for(var i=0;i<total;i++)
                    {
                        var coupleCount=list.coordinatesList()[i].split(";").length
                        var lat=""
                        var lon=""
                        for(var j=0;j<coupleCount;j++)
                        {
                            lat=list.coordinatesList()[i].split(";")[j].split(",")[1]
                            lon=list.coordinatesList()[i].split(";")[j].split(",")[0]
        
                            routeModel.query.addWaypoint(QtPositioning.coordinate(lat,lon))
                            routeModel.update();
                        }
                    }
        }
            Plugin {
                id: mapPlugin
                name: "esri" // "osm"
            }
        
            Map {
                id:map
                anchors.fill:parent
                plugin: mapPlugin
                RouteModel {
                    id: routeModel
                    query: RouteQuery {}
                }
        
                MapItemView {
                    model: routeModel
                    delegate: routeDelegate
                }
        
                Component {
                    id: routeDelegate
                    MapRoute {
                        route: routeData
                        line.color: "blue"
                        line.width: 5
                        smooth: true
                        opacity: 1.0
        
                    }
                }
            }
        
        1 Reply Last reply
        0

        • Login

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