Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add export in flarmcfg.txt format #26

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ clean-deploy:
# OpenLayers

OPENLAYERS_VERSION = 2.13.1
OPENLAYERS_NAME = OpenLayers-$(OPENLAYERS_VERSION)
OPENLAYERS_NAME = openlayers-$(OPENLAYERS_VERSION)
OPENLAYERS_ARCHIVE = $(OPENLAYERS_NAME).tar.gz
OPENLAYERS_URL = http://github.com/openlayers/openlayers/releases/download/release-$(OPENLAYERS_VERSION)/$(OPENLAYERS_ARCHIVE)
OPENLAYERS_URL = https://github.com/openlayers/openlayers/archive/v$(OPENLAYERS_VERSION).tar.gz
OPENLAYERS_JS_FOLDER = $(JS_FOLDER)/OpenLayers
OPENLAYERS_IMG_FOLDER = $(IMG_FOLDER)/OpenLayers

Expand All @@ -38,12 +38,13 @@ $(DOWNLOAD_FOLDER)/$(OPENLAYERS_ARCHIVE):

# MooTools

# http://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools.js
MOOTOOLS_CORE_VERSION = 1.4.5
MOOTOOLS_CORE_FILE = mootools-core-$(MOOTOOLS_CORE_VERSION)-full-compat.js
MOOTOOLS_CORE_URL = http://mootools.net/download/get/$(MOOTOOLS_CORE_FILE)
MOOTOOLS_CORE_FILE = mootools.js
MOOTOOLS_CORE_URL = http://ajax.googleapis.com/ajax/libs/mootools/$(MOOTOOLS_CORE_VERSION)/$(MOOTOOLS_CORE_FILE)

MOOTOOLS_MORE_VERSION = 1.4.0.1
MOOTOOLS_MORE_ARCHIVE = $(MOOTOOLS_MORE_VERSION).tar.gz
MOOTOOLS_MORE_ARCHIVE = mootools-more-$(MOOTOOLS_MORE_VERSION).tar.gz
MOOTOOLS_MORE_URL = https://github.com/mootools/mootools-more/archive/$(MOOTOOLS_MORE_ARCHIVE)
MOOTOOLS_MORE_FOLDER = $(DOWNLOAD_FOLDER)/mootools-more-$(MOOTOOLS_MORE_VERSION)
MOOTOOLS_MORE_COMPONENTS = \
Expand Down
2 changes: 1 addition & 1 deletion deploy/deploy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7

from flask.ext.script import Manager

Expand Down
2 changes: 1 addition & 1 deletion prosoar/igc/trace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7

from pyproj import Proj, transform
import math
Expand Down
21 changes: 21 additions & 0 deletions prosoar/task/flarm_writer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from aerofiles.flarmcfg import Writer


def write_flarm_task(fp, task, taskname=''):
writer = Writer(fp)

writer.write_waypoint(None, None, 'TAKEOFF')

for i, turnpoint in enumerate(task):
if turnpoint.name == 'Free turnpoint':
name = '{0:0=2d} '.format(i + 1) + turnpoint.name
else:
name = turnpoint.name

writer.write_waypoint(
latitude=float(turnpoint.lat),
longitude=float(turnpoint.lon),
description=name,
)

writer.write_waypoint(None, None, 'LANDING')
4 changes: 3 additions & 1 deletion prosoar/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

<script type="text/javascript" src="js/MooTools/mootools-core.js"></script>
<script type="text/javascript" src="js/MooTools/mootools-more.js"></script>
{% if get_locale() != 'en'%}

<link rel="gettext" href="LC_MESSAGES/{{ get_locale() }}.json" />
<link rel="gettext" href="LC_MESSAGES/{{ get_locale() }}.json" />
{% endif %}

<script type="text/javascript" src="settings/initial.js"></script>

Expand Down
10 changes: 10 additions & 0 deletions prosoar/views/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from prosoar.task.json_reader import parse_json_task
from prosoar.task.json_writer import write_json_task
from prosoar.task.flarm_writer import write_flarm_task
from prosoar.task.seeyou_writer import write_seeyou_task
from prosoar.task.xcsoar_reader import parse_xcsoar_task
from prosoar.task.xcsoar_writer import write_xcsoar_task
Expand Down Expand Up @@ -83,6 +84,10 @@ def download(uid, taskname, filetype, temptask=False):
mimetype = 'application/seeyou'
file_extension = 'cup'
write_seeyou_task(io, task, taskname)
elif filetype == 'flarm':
mimetype = 'text/plain'
file_extension = 'txt'
write_flarm_task(io, task, taskname)

io.seek(0)

Expand Down Expand Up @@ -247,5 +252,10 @@ def save_temp():
'url': base_url + '/seeyou',
'qrcode': base_url + '/seeyou/qr',
},
'flarm': {
'name': 'Flarm (flarmcfg.txt)',
'url': base_url + '/flarm',
'qrcode': base_url + '/flarm/qr',
},
}
})
2 changes: 1 addition & 1 deletion prosoar/waypoints/welt2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __get_database_file(dir_data):

# Download the current file
# (only if server file is newer than local file)
url = 'http://www.segelflug.de/vereine/welt2000/download/WELT2000.TXT'
url = 'https://raw.githubusercontent.com/skylines-project/welt2000/master/WELT2000.TXT'
subprocess.check_call(['wget', '-N', '-P', os.path.dirname(path), url])

# Check if download succeeded
Expand Down
2 changes: 1 addition & 1 deletion scripts/cleanup_prosoar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7

import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_airports
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.7

import os
import sys
Expand Down
Binary file added web_dev/images/software/flarm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 161 additions & 0 deletions web_dev/images/software/flarm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 2 additions & 46 deletions web_dev/js/proSoar/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,68 +56,24 @@ var MapWindow = new Class({
this.epsg4326 = new OpenLayers.Projection("EPSG:4326");

var hillshading = new OpenLayers.Layer.XYZ(_("Hill shading"),
"http://toolserver.org/~cmarqu/hill/${z}/${x}/${y}.png", {
// "terrain/${z}/${x}/${y}.png", {
"http://c.tiles.wmflabs.org/hillshading/${z}/${x}/${y}.png", {
isBaseLayer: false,
sphericalMercator: true,
transparent: true,
'visibility': true,
'displayInLayerSwitcher': false,
});

/*
var hillshading = new OpenLayers.Layer.TMS(_("Hill shading"),
// "http://toolserver.org/~cmarqu/hill/", {
"terrain/", {
type: 'png',
getURL: function osm_getTileURL(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit) return OpenLayers.Util.getImagesLocation() + "404.png";
else x = ((x % limit) + limit) % limit;
return this.url + z + "/" + x + "/" + y + "." + this.type;
},
isBaseLayer: false,
transparent: true,
'visibility': true,
'displayInLayerSwitcher': false,
});
*/
this.map.addLayer(hillshading);

osm.events.register('visibilitychanged', this, function() { hillshading.setVisibility(osm.getVisibility()); });

var airspace = new OpenLayers.Layer.XYZ(_("Airspace"),
"https://www.skylines-project.org/mapproxy/tiles/1.0.0/airspace/${z}/${x}/${y}.png", {
"https://www.skylines.aero/mapproxy/tiles/1.0.0/airspace/${z}/${x}/${y}.png", {
isBaseLayer: false,
transparent: true,
'visibility': true,
'displayInLayerSwitcher': true
});

/*
var airspace = new OpenLayers.Layer.TMS(_("Airspace"),
"airspace/", {
type: 'png',
getURL: function osm_getTileURL(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit) return OpenLayers.Util.getImagesLocation() + "404.png";
else x = ((x % limit) + limit) % limit;
return this.url + z + "/" + x + "/" + y + "." + this.type;
},
isBaseLayer: false,
transparent: true,
'visibility': true,
'displayInLayerSwitcher': true
});
*/
this.map.addLayer(airspace);

OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '4';
Expand Down