Warning, /education/marble/src/plasma/wallpapers/worldmap/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau <kossebau@kde.org>
0003     SPDX-License-Identifier: LGPL-2.1-or-later
0004 */
0005 
0006 import QtQuick 2.1
0007 
0008 import org.kde.plasma.core 2.0 as PlasmaCore
0009 import org.kde.plasma.extras 2.0 as PlasmaExtras
0010 
0011 import org.kde.marble.private.plasma 0.20
0012 
0013 MarbleItem {
0014     id: marbleItem
0015 
0016     readonly property int centerMode: wallpaper.configuration.centerMode
0017     readonly property double fixedLongitude: wallpaper.configuration.fixedLongitude
0018     readonly property double locationLongitude: geolocationDataSource.data.longitude
0019 
0020     enabled: false // do not handle input
0021 
0022     radius: {
0023         var ratio = width/height;
0024         if (projection === MarbleItem.Equirectangular) {
0025             if (ratio > 2) {
0026                 return height / 2;
0027             }
0028             return width / 4;
0029         } else {
0030             if (ratio > 1) {
0031                 return height / 4;
0032             }
0033             return width / 4
0034         }
0035     }
0036 
0037     // Theme settings.
0038     projection: (wallpaper.configuration.projection === 0) ? MarbleItem.Equirectangular : MarbleItem.Mercator
0039     mapThemeId: "earth/bluemarble/bluemarble.dgml"
0040 
0041     // Visibility of layers/plugins.
0042     showAtmosphere: false
0043     showClouds: false
0044     showBackground: false
0045 
0046     showGrid: false
0047     showCrosshairs: false
0048     showCompass: false
0049     showOverviewMap: false
0050     showScaleBar: false
0051 
0052     onCenterModeChanged: handleCenterModeChange()
0053     function handleCenterModeChange() {
0054         if (centerMode === 0) {
0055             marbleMap.setLockToSubSolarPoint(true);
0056         } else if (centerMode === 1)  {
0057             marbleMap.setLockToSubSolarPoint(false);
0058             marbleMap.centerOn(fixedLongitude, 0.0);
0059         } else {
0060             marbleMap.setLockToSubSolarPoint(false);
0061             marbleMap.centerOn(locationLongitude, 0.0);
0062         }
0063     }
0064 
0065     onFixedLongitudeChanged: {
0066         if (centerMode === 1) {
0067             marbleMap.centerOn(fixedLongitude, 0.0);
0068         }
0069     }
0070 
0071     onLocationLongitudeChanged: {
0072         if (centerMode === 2) {
0073             marbleMap.centerOn(locationLongitude, 0.0);
0074         }
0075     }
0076 
0077     Component.onCompleted: {
0078         marbleMap.setShowSunShading(true);
0079         marbleMap.setShowCityLights(true);
0080 
0081         marbleMap.setShowPlaces(false);
0082         marbleMap.setShowCities(false);
0083         marbleMap.setShowTerrain(false);
0084         marbleMap.setShowOtherPlaces(false);
0085 
0086         handleCenterModeChange();
0087     }
0088 
0089     PlasmaCore.DataSource {
0090         id: geolocationDataSource
0091         engine: "geolocation"
0092         connectedSources: (marbleItem.centerMode === 2) ? ["location"] : []
0093         interval: 10 * 60 * 1000 // every 30 minutes, might be still too large for users on the ISS :P
0094     }
0095 }