From b91e069327ba7fbcc83936b49cc7543b477fe0cd Mon Sep 17 00:00:00 2001 From: Tom Nicklin Date: Sat, 1 Oct 2016 14:42:53 +0100 Subject: [PATCH] This branch is now finished, it has met its obejectives and some extra changes. waypointer.pyc has been added as that script is now finished so the compiled version is available for faster run time. waypointer now supports lines from waypoint to waypoint, hovering over waypoints for waypoint number, new sidebar instead of an alert box. Last commit for this branch. --- simplemap/__init__.pyc | Bin 186 -> 189 bytes simplemap/html_render.pyc | Bin 830 -> 839 bytes simplemap/map.pyc | Bin 5010 -> 5058 bytes simplemap/templates/basic.html | 19 ++++-------- simplemap/templates/static/css/basic.css | 6 ++-- waypointer.py | 35 ++++++++++------------- waypointer.pyc | Bin 0 -> 3194 bytes 7 files changed, 24 insertions(+), 36 deletions(-) create mode 100644 waypointer.pyc diff --git a/simplemap/__init__.pyc b/simplemap/__init__.pyc index a4669ce6e89281b2175ea54290748478cbbe6aef..632476fcdb68b117428e3c6f2826320251592671 100644 GIT binary patch delta 35 rcmdnRxR;Tg`7bEs delta 32 ncmdnXxQmgU`7{#AV2YMFMD4 zCQmjti9c8b*+5R^oGir`ja|})gLCsHzIoUzVpE&kEO-f; zY|Al3wI@rk=U|AcPrks%GI>9H1XdZ&$>AKSSY$qPV6(NA6HRpU2hJEKEZUoS^0A0& w@?OOv3UMCmWIH}I!-0XKzWD;*a!d={{map_title}} +
@@ -19,12 +17,6 @@

Waypointer

function initMap() { - /*var message = "{{ message|safe }}"; - //If a message has been added to the alert system be sure to write it. - if (message) { - alert(message); - }*/ - var bounds = new google.maps.LatLngBounds(); var center_lat_lon = {{center|safe}}; @@ -32,13 +24,12 @@

Waypointer

zoom: {{ zoom|safe }}, center: center_lat_lon }); - + // markers is the actual pins you'll see on gmaps. var markers = {{ markers|safe }}; - //points need to be {lon:5.4..., lng:6.342...} - var points = {{ points|safe }} + //points are close to markers but formatted differently as the flightPath var needs it like so. + var points = {{ points|safe }}; - //Doing this on the 'lines' branch - //Draw a line from point to point, not working currently. + // flightPath takes the points and draws lines between them all. var flightPath = new google.maps.Polyline({ path: points, geodesic: true, diff --git a/simplemap/templates/static/css/basic.css b/simplemap/templates/static/css/basic.css index ac29641..7413b51 100644 --- a/simplemap/templates/static/css/basic.css +++ b/simplemap/templates/static/css/basic.css @@ -3,14 +3,16 @@ html, body { margin: 0; padding: 0; } - +/* Width at 80% for sidebar */ #map { height: 100%; width: 80%; } - +/* sidebar on the right of the screen, + because it's not always relavant. */ #sidebar { float:right; margin-right: 1%; overflow: auto; + font-family: 'Ubuntu', sans-serif; } \ No newline at end of file diff --git a/waypointer.py b/waypointer.py index 3fdd538..c9ab55c 100644 --- a/waypointer.py +++ b/waypointer.py @@ -1,6 +1,8 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# @author Tom Nicklin +### @author Tom Nicklin +# This has been specifically set up for the GroundStation application data tables. +# more file types and diffferent SQL querys will change based on new information. from datetime import datetime import simplemap @@ -23,7 +25,7 @@ alert = '' -# In an effor to make this system more modular the user passes in a sequence number and table for the waypoints. +# In an effort to make this system more modular the user passes in a sequence number and table for the waypoints. # this is that argument system. It still doesn't seem right to me but I've tested it enough that it works. if __name__ == '__main__': if len(sys.argv) == 3: @@ -99,22 +101,23 @@ def get_alert(database): #from import datetime library you can simply convert seconds elapsed from 1/1/1970 to get a date. Which is what we are doing here. date = datetime.fromtimestamp(timeinseconds) # Finally we return the string of relevant info that'll eventually be inserted into the alert box. - get_alertOutput = "Sequence: " + str(sequence) + "
Flown on: " + str(date) + "
UUID: " + str(uuid) + get_alertOutput = "Sequence: " + str(sequence) + "

Flown on: " + str(date) + "

UUID: " + str(uuid) return get_alertOutput except: return 'Could not retrieve either UUID or date from database.' - +# Here we change the formatting of the waypoints so gmaps api can use them to plot lines def make_points(coords): if(coords): + # Firstly we don't need the way point number in this as we already have our waypoints in order. for x in range(0, len(coords)): coords[x].pop(0) - #coords[x] = str(coords[x]) - coords[x] = str(coords[x]).replace("[", "{lat: ").replace(",", ", lng:").replace("]", "}") - #coords[x].replace(",", ", lng:") - #coords[x].replace("]", "}") - print '\n', coords[x] - return coords + # List comprehensions are fun. Basically telling it the format I want and then it has its + # own little for loop and then changes all elements. It's more obvious when you look at + # var points in a generated html file. + new_list = [{'lat': d[0], 'lng': d[1]} for d in coords] + # Return the new list after the list comprehension. + return new_list @@ -130,16 +133,8 @@ def make_points(coords): gps_markers = get_coordinates(db) # This gets the information to display in the alert pop up box alert = get_alert(db) - - -#Test -plots = make_points(get_coordinates(db)) - -print plots - -#print plots[0] -#print type(plots[0]) -#print str(plots[0]).replace("[", "{lat: ").replace(",", ", lng:").replace("]", "}") +# This will take the points and make sure they can be used to make lines on the map +plots = make_points(gps_markers) # Here we generate the html page by passing the above # information to the relevant files diff --git a/waypointer.pyc b/waypointer.pyc new file mode 100644 index 0000000000000000000000000000000000000000..298df111eef3030dcde59d3a34be319870d3e186 GIT binary patch literal 3194 zcmb7GUr!^+5wDrC4Q6d%S-{IeHgkWZcuy-UxhQ+e9od8fFN?I;m$3;sOP9I9)4-VV zjG1m9Ai>k-gXBZxF<&7s`2dmf9w`rz@|fgTH8!xy>ZI77c6D`ib#?Xc*EP;Rt8?+6 z{&Co+$!8Y-zrv&cY!QX{SriiuiF!m9_ic(T>RB=d*`}T|l?&7>Oywf=ic`5ny%L2E z^=71caDuqQlvngA&)I6yo4HoDv)+&ke-xEzZLu-RYdP|i3@tz7U zlLZQAY4^2y$bK=?QY9KJ(csb4u1srCXMexfM_A`oE1Y|0-ua>xK6poyVDlCFJuvc2-TDd{u27NOQVmBENk5uN4Vijl=*=)p1 zyozGw_S113x=Cu>Bjp~a<0RDk80(&LFB=BN&D8lg%2en^+WmHPWlqz?y$G&GX_Oe1 zHAYwNriO`1`f9S$OK8sH$iM}bc=>IgzJY)=+l-bQ zo33pd0IwDgS*AdyD5??Vr9p*4f?|Pf(f1pEjJ7B^t zBH0B6c3+!$_6|eqFxjAjS)j8y%9btbW(HgZ53boNvFNwhRHt4>idyg{_J^v_NRAqdWT>6__e&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