Skip to content
Merged
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
Binary file removed img/markers/balloon-adafruit.png
Binary file not shown.
Binary file removed img/markers/balloon-blue.png
Binary file not shown.
Binary file removed img/markers/balloon-buzz.png
Binary file not shown.
Binary file removed img/markers/balloon-cyan.png
Binary file not shown.
Binary file removed img/markers/balloon-green.png
Binary file not shown.
Binary file removed img/markers/balloon-invisible.png
Binary file not shown.
Binary file removed img/markers/balloon-iss.png
Binary file not shown.
Binary file removed img/markers/balloon-orange.png
Binary file not shown.
Binary file removed img/markers/balloon-purple.png
Binary file not shown.
Binary file removed img/markers/balloon-red.png
Binary file not shown.
Binary file removed img/markers/balloon-rob.png
Binary file not shown.
Binary file removed img/markers/balloon-rpi.png
Binary file not shown.
Binary file removed img/markers/balloon-shockpink.png
Binary file not shown.
Binary file removed img/markers/balloon-thereg.png
Binary file not shown.
Binary file removed img/markers/balloon-yellow.png
Binary file not shown.
55 changes: 55 additions & 0 deletions img/markers/balloon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/markers/car-blue.png
Binary file not shown.
Binary file removed img/markers/car-green.png
Binary file not shown.
Binary file removed img/markers/car-purple.png
Binary file not shown.
Binary file removed img/markers/car-red.png
Binary file not shown.
Binary file removed img/markers/car-teal.png
Binary file not shown.
Binary file removed img/markers/car-yellow.png
Binary file not shown.
88 changes: 88 additions & 0 deletions img/markers/car.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/markers/parachute-blue.png
Binary file not shown.
Binary file removed img/markers/parachute-cyan.png
Binary file not shown.
Binary file removed img/markers/parachute-green.png
Diff not rendered.
Binary file removed img/markers/parachute-orange.png
Diff not rendered.
Binary file removed img/markers/parachute-purple.png
Diff not rendered.
Binary file removed img/markers/parachute-red.png
Diff not rendered.
Binary file removed img/markers/parachute-rpi.png
Diff not rendered.
Binary file removed img/markers/parachute-yellow.png
Diff not rendered.
75 changes: 75 additions & 0 deletions img/markers/parachute.svg
Binary file removed img/markers/payload-blue.png
Diff not rendered.
Binary file removed img/markers/payload-cyan.png
Diff not rendered.
Binary file removed img/markers/payload-green.png
Diff not rendered.
Binary file removed img/markers/payload-orange.png
Diff not rendered.
Binary file removed img/markers/payload-purple.png
Diff not rendered.
Binary file removed img/markers/payload-red.png
Diff not rendered.
Binary file removed img/markers/payload-rpi.png
Diff not rendered.
Binary file removed img/markers/payload-yellow.png
Diff not rendered.
36 changes: 36 additions & 0 deletions img/markers/payload.svg
Binary file removed img/markers/target-blue.png
Diff not rendered.
Binary file removed img/markers/target-cyan.png
Diff not rendered.
Binary file removed img/markers/target-green.png
Diff not rendered.
Binary file removed img/markers/target-orange.png
Diff not rendered.
Binary file removed img/markers/target-purple.png
Diff not rendered.
Binary file removed img/markers/target-red.png
Diff not rendered.
Binary file removed img/markers/target-yellow.png
Diff not rendered.
19 changes: 19 additions & 0 deletions img/markers/target.svg
37 changes: 25 additions & 12 deletions js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ var manual_pan = false;

var car_index = 0;
var car_colors = ["blue", "red", "green", "yellow", "teal", "purple"];
var balloon_colors_name = ["red", "blue", "green", "purple", "orange", "cyan"];
var balloon_colors = ["#f00", "blue", "green", "#c700e6", "#ff8a0f", "#0fffca"];
var balloon_colors = ["red", "blue", "lime", "magenta", "#ffb300", "#00ffff"];

var nyan_color_index = 0;
var nyan_colors = ['nyan', 'nyan-coin', 'nyan-mon', 'nyan-pirate', 'nyan-cool', 'nyan-tothemax', 'nyan-pumpkin', 'nyan-afro', 'nyan-coin', 'nyan-mummy'];
Expand Down Expand Up @@ -2334,6 +2333,20 @@ function drawLaunchPrediction(vcallsign) {
vehicle.prediction_launch_polyline.path_length = path_length;
}

// Takes in an SVG for a balloon, parachute, target, car, etc and sets a dynamic-color
// variable which that SVG can use to recolor any relevant elements.
// See balloon.svg, target.svg, etc for examples
function recolorSVG(svg_path, color) {
const xhr = new XMLHttpRequest();
xhr.open('GET', svg_path, false);
xhr.send();

const parser = new DOMParser();
const svgDocument = parser.parseFromString(xhr.responseText, 'image/svg+xml');
svgDocument.documentElement.style.setProperty("--dynamic-color", color);
return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svgDocument.documentElement.outerHTML);
}

function redrawPrediction(vcallsign) {
var vehicle = vehicles[vcallsign];
var data = vehicle.prediction.data;
Expand Down Expand Up @@ -2393,7 +2406,7 @@ function redrawPrediction(vcallsign) {
if(vehicle.prediction_target) {
vehicle.prediction_target.setLatLng(latlng);
} else {
image_src = host_url + markers_url + "target-" + balloon_colors_name[vehicle.color_index] + ".png";
image_src = recolorSVG(host_url + markers_url + "target.svg", balloon_colors[vehicle.color_index]);
predictionIcon = new L.icon({
iconUrl: image_src,
iconSize: [20,20],
Expand Down Expand Up @@ -3023,7 +3036,7 @@ function addPosition(position) {
if(vcallsign.search(/(chase)/i) != -1) {
vehicle_type = "car";
color_index = car_index++ % car_colors.length;
image_src = host_url + markers_url + "car-" + car_colors[color_index] + ".png";
image_src = recolorSVG(host_url + markers_url + "car.svg", car_colors[color_index]);
image_src_size = [55,25];
image_src_offset = [0,-25];

Expand Down Expand Up @@ -3096,9 +3109,7 @@ function addPosition(position) {
// All the balloon are red.
color_index = 0;
}

image_src = host_url + markers_url + "balloon-" +
((vcallsign == "PIE") ? "rpi" : balloon_colors_name[color_index]) + ".png";
image_src = recolorSVG(host_url + markers_url + "balloon.svg", balloon_colors[color_index]);
image_src_size = [46,84];
image_src_offset = [-35,-46];

Expand Down Expand Up @@ -3143,7 +3154,7 @@ function addPosition(position) {
};

marker.shadow = marker_shadow;
marker.balloonColor = (vcallsign == "PIE") ? "rpi" : balloon_colors_name[color_index];
marker.balloonColor = (vcallsign == "PIE") ? "rpi" : balloon_colors[color_index];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised we still have these special case callsigns in here :/ they don't make sense for sondehub pro

marker.mode = 'balloon';
marker.setMode = function(mode) {
if(this.mode == mode) return;
Expand All @@ -3156,9 +3167,9 @@ function addPosition(position) {
map.removeLayer(vehicle.subhorizon_circle);
map.removeLayer(vehicle.horizon_circle_title);
map.removeLayer(vehicle.subhorizon_circle_title);

img_src = recolorSVG(host_url + markers_url + "payload.svg", this.balloonColor);
img = new L.icon ({
iconUrl: host_url + markers_url + "payload-" + this.balloonColor + ".png",
iconUrl: img_src,
iconSize: [17,18],
iconAnchor: [8,14],
tooltipAnchor: [0,-20],
Expand All @@ -3174,15 +3185,17 @@ function addPosition(position) {
}

if(mode == "parachute") {
img_src = recolorSVG(host_url + markers_url + "parachute.svg", this.balloonColor);
img = new L.icon ({
iconUrl: host_url + markers_url + "parachute-" + this.balloonColor + ".png",
iconUrl: img_src,
iconSize: [46,84],
tooltipAnchor: [0,-98],
iconAnchor: [23,90],
});
} else {
img_src = recolorSVG(host_url + markers_url + "balloon.svg", this.balloonColor);
img = new L.icon ({
iconUrl: host_url + markers_url + "balloon-" + this.balloonColor + ".png",
iconUrl: img_src,
iconSize: [46,84],
tooltipAnchor: [0,-98],
iconAnchor: [23,90],
Expand Down