Warning, /education/marble/examples/qml/data-layers/DynamicLayer.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org> 0004 0005 import QtQuick 1.1 0006 import org.kde.marble 0.20 0007 0008 MarbleWidget { 0009 width: 800; 0010 height: 600 0011 0012 center: Coordinate { longitude: 142.2; latitude: 11.35 } 0013 0014 dataLayers: [ 0015 DataLayer{ 0016 id: layer 0017 // The model defines the data that will appear. The lon and lat 0018 // property of its items define their position 0019 // See EarthquakesModel.qml for details 0020 model: EarthquakesModel { 0021 id: earthquakes 0022 } 0023 0024 // The delegate is the component that shows the items from the 0025 // model on top of the map. Their position and visibility is managed 0026 // automatically by Marble 0027 delegate: Rectangle { 0028 width: magnitude * 10; 0029 height: width 0030 radius: width / 2; 0031 color: magnitude < 5.0 ? "green" : ( magnitude < 6.0 ? "orange" : "red" ) 0032 opacity: 0.67 0033 0034 Text { 0035 anchors.centerIn: parent 0036 font.bold: true 0037 text: magnitude 0038 } 0039 } 0040 0041 // Marble informs us with this signal that new data is needed for the given 0042 // bounding box (north, south, east, west, each in degree). We retrieve new 0043 // data from our model (which calls geonames.org) in that case 0044 onDataRequest: { 0045 earthquakes.north = north 0046 earthquakes.south = south 0047 earthquakes.east = east 0048 earthquakes.west = west 0049 earthquakes.update() 0050 } 0051 } 0052 ] 0053 0054 /** @todo FIXME: Currently we update our model here, but ideally Marble 0055 * detects the arrival of new data by itself in the future and this won't be 0056 * needed anymore then. 0057 */ 0058 Connections { 0059 target: earthquakes 0060 onStatusChanged: { 0061 if ( earthquakes.status == XmlListModel.Ready ) { 0062 layer.model = earthquakes 0063 } 0064 } 0065 } 0066 }