Skip to content
Snippets Groups Projects
FlightMap.qml 9.94 KiB
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

/**
 * @file
 *   @brief QGC Map Background
 *   @author Gus Grubba <mavlink@grubba.com>
 */

import QtQuick          2.4
import QtQuick.Controls 1.3
import QtLocation       5.3
import QtPositioning    5.3

import QGroundControl                       1.0
import QGroundControl.Controls              1.0
import QGroundControl.FlightMap             1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Vehicle               1.0
import QGroundControl.Mavlink               1.0

Map {
    id: _map

    property real   latitude:           64.154549   //-- If you find yourself here on startup, something went wrong :)
    property real   longitude:          -22.023540
    property real   heading:            0
    property bool   interactive:        true
    property string mapName:            'defaultMap'
    property string mapType:            QGroundControl.flightMapSettings.mapTypeForMapName(mapName)
//  property alias  mapWidgets:         controlWidgets
    property bool   isSatelliteMap:     mapType == "Satellite Map" || mapType == "Hybrid Map"

    property real   lon: (longitude >= -180 && longitude <= 180) ? longitude : 0
    property real   lat: (latitude  >=  -90 && latitude  <=  90) ? latitude  : 0

    readonly property real maxZoomLevel:    20

    zoomLevel:                  18
    center:                     QtPositioning.coordinate(lat, lon)
    gesture.flickDeceleration:  3000
    gesture.enabled:            interactive
    gesture.activeGestures:     MapGestureArea.ZoomGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture

    plugin: Plugin { name: "QGroundControl" }

    ExclusiveGroup { id: mapTypeGroup }

    Component.onCompleted: onMapTypeChanged