From 74bffa3b21947600a550056d16163f5059d5fa2b Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 17 Mar 2021 12:47:46 +0100 Subject: remove map for now --- gui/assets/svg/world.svg | 2 -- gui/gui.qrc | 3 -- gui/js/maps.js | 83 ------------------------------------------------ gui/qml/VpnState.qml | 23 -------------- gui/qml/main.qml | 64 ------------------------------------- 5 files changed, 175 deletions(-) delete mode 100644 gui/assets/svg/world.svg delete mode 100644 gui/js/maps.js diff --git a/gui/assets/svg/world.svg b/gui/assets/svg/world.svg deleted file mode 100644 index 84597b8..0000000 --- a/gui/assets/svg/world.svg +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/gui/gui.qrc b/gui/gui.qrc index fdea109..22b3b73 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -24,8 +24,5 @@ assets/icon/png/white/vpn_wait_3.png providers/providers.json - assets/svg/world.svg - js/maps.js - diff --git a/gui/js/maps.js b/gui/js/maps.js deleted file mode 100644 index c6f44d2..0000000 --- a/gui/js/maps.js +++ /dev/null @@ -1,83 +0,0 @@ -// Robinson projection calculation - -// Written by Niklas Bichinger (bichinger.de). This code is Public Domain - use as you like. - -// source of robinson numbers: https://simplemaps.com/static/img/flash/robinson_projection_table.jpg -var robinsonAA = [ - 0.84870000, - 0.84751182, - 0.84479598, - 0.84021300, - 0.83359314, - 0.82578510, - 0.81475200, - 0.80006949, - 0.78216192, - 0.76060494, - 0.73658673, - 0.70866450, - 0.67777182, - 0.64475739, - 0.60987582, - 0.57134484, - 0.52729731, - 0.48562614, - 0.45167814 -]; -var robinsonBB = [ - 0.00000000, - 0.08384260, - 0.16768520, - 0.25152780, - 0.33537040, - 0.41921300, - 0.50305560, - 0.58689820, - 0.67047034, - 0.75336633, - 0.83518048, - 0.91537187, - 0.99339958, - 1.06872269, - 1.14066505, - 1.20841528, - 1.27035062, - 1.31998003, - 1.35230000 -]; - -function project(latitude, longitude, mapWidth, heightFactor, mapOffsetX, mapOffsetY) { - if (typeof heightFactor === 'undefined') { heightFactor = 1; } - if (typeof mapOffsetX === 'undefined') { mapOffsetX = 0; } - if (typeof mapOffsetY === 'undefined') { mapOffsetY = 0; } - - // Robinson's latitude interpolation points are in 5-degree-steps - var latitudeAbs = Math.abs(latitude); - var latitudeStepFloor = Math.floor(latitudeAbs / 5); - var latitudeStepCeil = Math.ceil(latitudeAbs / 5); - // calc interpolation factor (>=0 to <1) between two steps - var latitudeInterpolation = (latitudeAbs - latitudeStepFloor * 5) / 5; - - // interpolate robinson table values - var AA = robinsonAA[latitudeStepFloor] + (robinsonAA[latitudeStepCeil] - robinsonAA[latitudeStepFloor]) * latitudeInterpolation; - var BB = robinsonBB[latitudeStepFloor] + (robinsonBB[latitudeStepCeil] - robinsonBB[latitudeStepFloor]) * latitudeInterpolation; - - var robinsonWidth = 2 * Math.PI * robinsonAA[0]; - var widthFactor = mapWidth / robinsonWidth; - var latitudeSign = Math.sign(latitude) || 1; - var x = (widthFactor * AA * longitude * Math.PI) / 180 + mapOffsetX; - var y = widthFactor * BB * latitudeSign * heightFactor + mapOffsetY; - - return {x: x, y: y}; -} - -function projectAbsolute(latitude, longitude, mapWidth, heightFactor, mapOffsetX, mapOffsetY) { - if (typeof heightFactor === 'undefined') { heightFactor = 1; } - - var relative = project(latitude, longitude, mapWidth, heightFactor, mapOffsetX, mapOffsetY); - var widthHeightRatio = Math.PI * robinsonAA[0] / robinsonBB[18]; - var x = mapWidth / 2 + relative.x; - var y = mapWidth / widthHeightRatio * heightFactor / 2 - relative.y; - - return {x: x, y: y}; -} diff --git a/gui/qml/VpnState.qml b/gui/qml/VpnState.qml index ffad207..4906fce 100644 --- a/gui/qml/VpnState.qml +++ b/gui/qml/VpnState.qml @@ -36,16 +36,9 @@ StateGroup { target: mainOffBtn visible: false } - PropertyChanges { - target: gwMarker - color: "red" - } }, State { name: "on" - StateChangeScript { - script: displayGatewayMarker() - } PropertyChanges { target: systray tooltip: toHuman("on") @@ -71,10 +64,6 @@ StateGroup { target: mainOffBtn visible: true } - PropertyChanges { - target: gwMarker - color: "green" - } }, State { name: "starting" @@ -103,10 +92,6 @@ StateGroup { target: mainOffBtn visible: true } - PropertyChanges { - target: gwMarker - color: "orange" - } }, State { name: "stopping" @@ -135,10 +120,6 @@ StateGroup { target: mainOffBtn visible: false } - PropertyChanges { - target: gwMarker - color: "orange" - } }, State { name: "failed" @@ -167,10 +148,6 @@ StateGroup { target: mainOffBtn visible: false } - PropertyChanges { - target: gwMarker - color: "red" - } } ] } diff --git a/gui/qml/main.qml b/gui/qml/main.qml index 03a79cb..502379b 100644 --- a/gui/qml/main.qml +++ b/gui/qml/main.qml @@ -6,8 +6,6 @@ import QtQuick.Extras 1.2 import Qt.labs.platform 1.1 as LabsPlatform -import "qrc:/js/maps.js" as Maps - ApplicationWindow { id: app @@ -85,68 +83,6 @@ ApplicationWindow { } } } - - Item { - Layout.topMargin: app.height * 0.40 - Layout.row: 3 - Layout.column: 1 - Layout.columnSpan: 3 - - Image { - id: worldMap - width: app.width - source: "qrc:/assets/svg/world.svg" - fillMode: Image.PreserveAspectFit - smooth: true - } - - Rectangle { - id: gwMarker - x: worldMap.width * 0.5 - y: worldMap.height * 0.5 - width: 10 - height: 10 - radius: 10 - color: "red" - z: worldMap.z + 1 - } - } - } - - function displayGatewayMarker() { - let coords = { - "paris": { - "x": 48, - "y": 2 - }, - "miami": { - "x": 25.7, - "y": -80.2 - }, - "amsterdam": { - "x": 52.4, - "y": 4.9 - }, - "montreal": { - "x": 45.3, - "y": -73.4 - }, - "seattle": { - "x": 47.4, - "y": -122.2 - } - } - let city = ctx.currentGateway.split('-')[0] - let coord = coords[city] - - // TODO the Robinson projection does not seem to fit super-nicely with - // our map, and this offset doesn't work with bigg-ish sizes. But good - // enough for a proof of concept - if we avoid resizing the window. - let xOffset = -1 * 0.10 * worldMap.width - let p = Maps.projectAbsolute(coord.x, coord.y, worldMap.width, - 1, xOffset) - gwMarker.x = p.x - gwMarker.y = p.y } Connections { -- cgit v1.2.3