Alternate blue/red coloring of rings in Piaware 3.1.0 / dump1090-fa
This is achieved by modifying files config.js and script.js, but first make backup copies of these files before attempting modification.
cd ~
#change to the directory where required files reside
cd /usr/share/dump1090-fa/html
#now make backup copies
sudo cp script.js orig-script.js
sudo cp config.js orig-config.js
#check to make sure that copies are actually made
dir
#following files/folders will be listed
config.js flags-tiny jquery orig-config.js script.js upintheair.json
db formatter.js layers.js orig-script.js spinny.gif
dbloader.js images markers.js planeObject.js style.css
flags.js index.html ol3 registrations.js test
(1) TO ADD RINGS
sudo nano /usr/share/dump1090-fa/html/config.js
Press ctrl+w keys, then type (or copy-paste) “SiteCirclesDistances” (without " "), press Enter key.
The cursor will jump to line: SiteCirclesDistances = new Array(100,150,200);
Add more rings by adding their radius as shown below for additional rings with radius 250 and 300
SiteCirclesDistances = new Array(100,150,200,250,300);
Save (ctrl+o) and exit nano (ctrl+x)
Clear browser cache and reload the browser. You should now see the extra circles also.
(2) TO CHANGE COLOR OF RINGS TO ALTERNATE RED/BLUE
sudo nano /usr/share/dump1090-fa/html/script.js
Press ctrl+w keys, then type (or copy-paste) “function createSiteCircle” (without " "), press Enter key.
The cursor will jump to line: function createSiteCircleFeatures() {
Now modify the code in this function as shown in red below.
Save (ctrl+o) and exit nano (ctrl+x)
Clear browser cache and reload the browser. You should now see alternate red/blue circles.
function createSiteCircleFeatures() {
// Clear existing circles first SiteCircleFeatures.forEach(function(circleFeature) { StaticFeatures.remove(circleFeature); }); SiteCircleFeatures.clear();
//Seven lines below were commented out for blue/red coloring of rings
// var circleStyle = new ol.style.Style({
// fill: null,
// stroke: new ol.style.Stroke({
// color: ‘#000000’,
// width: 1
// })
// });
//Seven lines above were commented out for blue/red coloring of rings
var conversionFactor = 1000.0; if (DisplayUnits === "nautical") { conversionFactor = 1852.0; } else if (DisplayUnits === "imperial") { conversionFactor = 1609.0; }
for (var i=0; i < SiteCirclesDistances.length; ++i) { var distance = SiteCirclesDistances* * conversionFactor; var circle = make_geodesic_circle(SitePosition, distance, 360); circle.transform('EPSG:4326', 'EPSG:3857'); var feature = new ol.Feature(circle);
//Eight ilnes below were added for blue/red coloring of rings
var circleColor = ‘#FF0000’, ‘#0000FF’];
var circleStyle = new ol.style.Style({
fill: null,
stroke: new ol.style.Stroke({
color:circleColor*,
width: 1
})
});
//Eight lines above were added for blue/red coloring of rings
**
feature.setStyle(circleStyle);
StaticFeatures.push(feature);
SiteCircleFeatures.push(feature);
}
}