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. mapping dynamic points on a map

mapping dynamic points on a map

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlqml mapgeocoordinate
3 Posts 1 Posters 533 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.
  • K Offline
    K Offline
    koahnig
    wrote on 21 Jan 2022, 17:47 last edited by
    #1

    This is for an application running on an Android smartphone. The app shall show dynamically different points which are updated every epoch. The tables and coordinates are updated through the c++ part of the application. QML is just used for display.

    By assigning different points manually here in the example for 5 points, I got to work. However, the list is basically dynamic and it should look a bit better.

    Page {
        id: pageSnr
        property Map map
    
            Plugin {
                id: mapPlugin
                name: "osm" // "mapboxgl", "esri", ...
            }
    
            PositionSource {
                id: snrSource
                property variant solution0: satelliteModel.CoordList[0]
                property variant solution1: satelliteModel.CoordList[1]
                property variant solution2: satelliteModel.CoordList[2]
                property variant solution3: satelliteModel.CoordList[3]
                property variant solution4: satelliteModel.CoordList[4]
    
                active: true
                updateInterval: 2000 // 2 mins
                onPositionChanged:  {
                    var currentPosition = snrSource.position.coordinate
                    myMap.center = currentPosition
                    solution0 = satelliteModel.CoordList[0]
                    solution1 = satelliteModel.CoordList[1]
                    solution2 = satelliteModel.CoordList[2]
                    solution3 = satelliteModel.CoordList[3]
                    solution4 = satelliteModel.CoordList[4]
    
                    var distance = currentPosition.distanceTo(lastSearchPosition)
                    if (distance > 500) {
                        // 500m from last performed pizza search
                        lastSearchPosition = currentPosition
                        searchModel.searchArea = QtPositioning.circle(currentPosition)
                        searchModel.update()
                    }
                }
            }
    
            Map {
                id: myMap
                anchors.fill: parent
                anchors.bottomMargin: 150
                plugin: mapPlugin
                center: currentPosition
                zoomLevel: 20
                MapCircle {
                    center: snrSource.solution1
                    color: "black"
                    radius: 20
                    opacity: 1
                }
                ListView {
                    model: mySolutions
    
                    delegate: MapCircle {
                        center: model.locationCoord
                        color: "red"
                        radius: 20
                        opacity: 1
                    }
                }
            }
    }
    

    I have tried to use a list which is already in place for creation of a table. The list of objects is accessed through "mySolutions". One of the access points is "locationCoord". The routine of C++ is accessed every epoch while processing. However, the map circles are not shown through ListView while the crude way with QList of QGeoCoordinates is working in the example given.

    Any suggestion how to get this to work?

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 22 Jan 2022, 17:30 last edited by
      #2

      Found in the mean time MapObjectView. Looks promising but does not work yet either.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on 23 Jan 2022, 09:47 last edited by
        #3

        Finally found MapItemView which does what I am searching for.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0

        1/3

        21 Jan 2022, 17:47

        • Login

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