# HG changeset patch # User Matt Johnston # Date 1350831831 -28800 # Node ID fb5784aa45e6eda74642ed6967792755cc7bab4c from monotone. problematic https vs v2 API diff -r 000000000000 -r fb5784aa45e6 bluedot.png Binary file bluedot.png has changed diff -r 000000000000 -r fb5784aa45e6 conv.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conv.py Sun Oct 21 23:03:51 2012 +0800 @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# This Python file uses the following encoding: utf-8 + +import re +import sys + +s = """ +PerthAP: 31°57'34.78"S 115°52'20.29"E +WannerooAP: 31°47'26.03"S 115°49'12.34"E +Belmont2: 31°57'34.19"S 115°55'42.52"E +MitchLand: 31°47'17.81"S 115°46'10.70"E +Mystic: 31°46'19.51"S 115°45'43.89"E +NHE (Welvis): 31°46'29.52"S 115°49'7.87"E +Doubleview: 31°53'41.14"S 115°46'50.86"E +BelmontAP: 31°57'4.63"S 115°55'15.38"E +Zaphod: 31°46'13.77"S 115°46'11.24"E +TIC Hill: 31°49'32.77"S 116°3'51.87"E +kaelnorr: 31°40'40.79"S 115°42'58.29"E +""" + +l = s.split('\n') + +r = re.compile(r'(\d+)°(\d+)\'([\d\.]+)".') + +def coord_to_decimal(coord): + lparts = r.match(coord) + deg, min, sec = map(float, lparts.groups()) + val = deg + min/60.0 + sec/(60.0**2) + + return val + +for i in l: + try: + name, coords = i.split(':') + + lat, long = coords.strip().split() + + lat_dec = -coord_to_decimal(lat) + long_dec = coord_to_decimal(long) + + print '"%s": [%f, %f, "%s", ""],' % (name.lower(), lat_dec, long_dec, name) + + except Exception, e: + print>>sys.stderr, "Error for line '%s': %s" % (i, e) + continue + + diff -r 000000000000 -r fb5784aa45e6 freenet_data.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/freenet_data.js Sun Oct 21 23:03:51 2012 +0800 @@ -0,0 +1,62 @@ +// format is +// 'nodeid': [lat, long, "Name", "Description", "url"] +// nodeid should be lowercase (for simplicity) +// lat/long must be decimal coords. +// Name and Description can be anything, valid HTML helps, so escape ampersands etc... +// url is optional + +freenet_nodes = { + + "perthap": [-31.959661, 115.872303, "PerthAP", ""], + "wannerooap": [-31.790564, 115.820094, "WannerooAP", ""], + "belmont2": [-31.959497, 115.928478, "Belmont2", ""], + "mitchland": [-31.788281, 115.769639, "MitchLand", ""], + "mystic": [-31.772086, 115.762192, "Mystic", ""], + "nhe": [-31.774867, 115.818853, "NHE (Welvis)", ""], + "doubleview": [-31.894761, 115.780794, "KodEBlaK", ""], + "belmontap": [-31.951286, 115.920939, "BelmontAP", ""], + "frogstar1": [-31.770429, 115.76983, "Frogstar 1", "15m", "http://www.wafreenet.org/node-Frogstar"], + "frogstar2": [-31.767973, 115.771309, "Frogstar 2", "22m", "http://www.wafreenet.org/node-Frogstar"], + "tichill": [-31.825769, 116.064408, "TIC Hill", ""], + "niak": [-32.101311, 115.943632, "niak", ""], + "msh": [-31.9285, 115.9085, "msh", ""], + "kaelnorr": [-31.6779966, 115.7161922, "kaelnorr", "", ""], + // the following are guessed from the map. + "duncraig": [-31.83017,115.772552, "Duncraig", "", "http://www.wafreenet.org/node-Duncraig"], + "spiked": [-31.812521,115.86113, "Spiked", "", "http://www.wafreenet.org/node-Spiked"], + "dericote": [-31.831774,115.803795, "Dericote", "", "http://www.wafreenet.org/node-Dericote"], + "vipernet": [-31.842566,115.801907, "Vipernet", "", "http://www.wafreenet.org/node-Vipernet"], + "bungknee": [-31.739263,115.801392, "Bungknee", "", ""], + "wirelesshill": [-32.030754,115.827302, "Wireless Hill", "", ""], + "jandakot": [-32.099736,115.870743, "Jandakot", "", "http://www.wafreenet.org/node-Jandakot"], + "armadale": [-32.128669,116.002235, "ArmadaleAP", "", "http://www.wafreenet.org/node-ArmadaleAP"], + "sgnet": [-32.132304,115.997772, "SGNet", "", "http://www.wafreenet.org/node-SGNet"] +}; + +// format is ['kind', 'node1', 'node2']. +// Make sure that nodes are defined in the freenet_nodes list above. +// Defined kinds are: +// '2ghz', '5ghz', 'vpn'. + +freenet_links = [ + [ '5ghz', 'perthap', 'tichill'], + [ '5ghz', 'niak', 'tichill'], + [ '5ghz', 'mitchland', 'mystic'], + [ '5ghz', 'nhe', 'mitchland'], + [ '5ghz', 'belmontap', 'belmont2'], + [ '5ghz', 'perthap', 'belmont2'], + [ '5ghz', 'msh', 'perthap'], + [ '5ghz', 'mystic', 'frogstar1'], + [ '5ghz', 'mitchland', 'frogstar1'], + [ 'vpn', 'mitchland', 'kaelnorr'], + [ '5ghz', 'mitchland', 'wannerooap'], + [ '5ghz', 'mystic', 'wannerooap'], + [ '5ghz', 'doubleview', 'wannerooap'], + [ '5ghz', 'doubleview', 'perthap'], + [ '5ghz', 'duncraig', 'nhe'], + [ '2ghz', 'mystic', 'spiked'], + [ '2ghz', 'mystic', 'dericote'], + [ '5ghz', 'mystic', 'vipernet'], + [ '2ghz', 'jandakot', 'armadale'], + [ '2ghz', 'sgnet', 'armadale'] +]; diff -r 000000000000 -r fb5784aa45e6 labeled_marker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/labeled_marker.js Sun Oct 21 23:03:51 2012 +0800 @@ -0,0 +1,106 @@ +/* +* LabeledMarker Class +* +* Copyright 2007 Mike Purvis (http://uwmike.com) +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* This class extends the Maps API's standard GMarker class with the ability +* to support markers with textual labels. Please see articles here: +* +* http://googlemapsbook.com/2007/01/22/extending-gmarker/ +* http://googlemapsbook.com/2007/03/06/clickable-labeledmarker/ +*/ + +/* Constructor */ +function LabeledMarker(latlng, options){ + this.latlng = latlng; + this.labelText = options.labelText || ""; + this.labelClass = options.labelClass || "markerLabel"; + this.labelOffset = options.labelOffset || new GSize(0, 0); + + this.clickable = options.clickable || true; + + if (options.draggable) { + // This version of LabeledMarker doesn't support dragging. + options.draggable = false; + } + + GMarker.apply(this, arguments); +} + + +/* It's a limitation of JavaScript inheritance that we can't conveniently + extend GMarker without having to run its constructor. In order for the + constructor to run, it requires some dummy GLatLng. */ +LabeledMarker.prototype = new GMarker(new GLatLng(0, 0)); + + +// Creates the text div that goes over the marker. +LabeledMarker.prototype.initialize = function(map) { + // Do the GMarker constructor first. + GMarker.prototype.initialize.apply(this, arguments); + + var div = document.createElement("div"); + div.className = this.labelClass; + div.innerHTML = this.labelText; + div.style.position = "absolute"; + map.getPane(G_MAP_MARKER_PANE).appendChild(div); + + if (this.clickable) { + // Pass through events fired on the text div to the marker. + var eventPassthrus = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout']; + for(var i = 0; i < eventPassthrus.length; i++) { + var name = eventPassthrus[i]; + GEvent.addDomListener(div, name, newEventPassthru(this, name)); + } + + // Mouseover behaviour for the cursor. + div.style.cursor = "pointer"; + } + + this.map = map; + this.div = div; +} + +function newEventPassthru(obj, event) { + return function() { + GEvent.trigger(obj, event); + }; +} + +// Redraw the rectangle based on the current projection and zoom level +LabeledMarker.prototype.redraw = function(force) { + GMarker.prototype.redraw.apply(this, arguments); + + // We only need to do anything if the coordinate system has changed + if (!force) return; + + // Calculate the DIV coordinates of two opposite corners of our bounds to + // get the size and position of our rectangle + var p = this.map.fromLatLngToDivPixel(this.latlng); + var z = GOverlay.getZIndex(this.latlng.lat()); + + // Now position our DIV based on the DIV coordinates of our bounds + this.div.style.left = (p.x + this.labelOffset.width) + "px"; + this.div.style.top = (p.y + this.labelOffset.height) + "px"; + this.div.style.zIndex = z + 1; // in front of the marker +} + +// Remove the main DIV from the map pane, destroy event handlers +LabeledMarker.prototype.remove = function() { + GEvent.clearInstanceListeners(this.div); + this.div.parentNode.removeChild(this.div); + this.div = null; + GMarker.prototype.remove.apply(this, arguments); +} diff -r 000000000000 -r fb5784aa45e6 linkmap.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linkmap.html Sun Oct 21 23:03:51 2012 +0800 @@ -0,0 +1,307 @@ + + + + + + Link Map + + + + + + + + + + + + + + + + +
+
+ + diff -r 000000000000 -r fb5784aa45e6 yellowdot.png Binary file yellowdot.png has changed