2017-07-01 1 views
0

Ich konnte keine Möglichkeit finden, MapCircle Radius beim Zoomen Karte auf feste Größe einzustellen. Markierungssymbole werden in PlaceSearchModel verwendet, aber ich konnte es nicht dynamisch machen. Wenn ich die Karte zoome, wird sie größer, beim Minimieren der Karte verschwindet die Markierung. HierWie Markensymbol oder MapCircle als feste Größe für die aktuelle Position auf der Karte in Qt Quick dynamisch gesetzt

ist der Code:

import QtQuick 2.0 
import QtQuick.Controls 2.0 
import QtQuick.Controls.Material 2.0 
import QtQuick.Controls.Universal 2.0 
import Fluid.Controls 1.0 
import QtLocation 5.6 
import QtPositioning 5.6 

TabbedPage { 
    id: frame 
    title: "Web Map" 

    Tab { 
     title: "Map Viewer" 
     anchors { 
      left: parent.left 
      top: parent.top 
      bottom: parent.bottom 
     } 
     width: parent.width 
     clip: true 
     Material.background: "white" 
     Material.elevation: 1 
     Universal.background: Universal.accent 

     Plugin { 
      id: mapPlugin 
      name: "osm" 
     } 

     Map { 
      id:map 
      anchors.fill: parent 
      plugin: mapPlugin 
      zoomLevel: 14 

      MapItemView { 
       model: src 
       delegate: MapQuickItem { 
        coordinate: src.position.coordinate 

        anchorPoint.x: image.width * 0.5 
        anchorPoint.y: image.height 

        sourceItem: Column { 
         Image { id: image; source: "marker.png" } 
         Text { text: title; font.bold: true } 
        } 
       } 
      } 

      MapCircle { 
       center : src.position.coordinate 
       radius: parent.width/10 
       border.width: 1 
       color: 'green' 
      } 
     } 
     PositionSource { 
      id: src 
      updateInterval: 1000 
      active: true 

      onPositionChanged: { 
       var coord = src.position.coordinate; 
       console.debug("current position:", coord.latitude, coord.longitude); 
       map.center = position.coordinate 
      } 
     } 
} 
} 

Screenshot:

enter image description here

Antwort

0

ich eine Lösung von Qt Beispiel genannt Orte gefunden:

MapQuickItem { 
     id: yeahh 
     sourceItem: Rectangle { width: 10; height: 10; color: "red"; border.width: 2; border.color: "blue"; smooth: true; radius: 15 } 
     coordinate :src.position.coordinate 
     opacity:1.0 
     anchorPoint: Qt.point(sourceItem.width/2, sourceItem.height/2) 
    } 
Verwandte Themen