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

Add Elevation Column #189

Open
wants to merge 11 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
42 changes: 42 additions & 0 deletions public_html/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,48 @@ var UnitLabels = {

// formatting helpers


////
function format_elevation(siteAltFeet, siteDistMetres, altitudeFeet) {

var ftHeight = 'ground' == altitudeFeet ? 0 : altitudeFeet;

if( ftHeight < 0 ) {

return 93; // it happens
}

if( null == siteDistMetres) {

return 92; // invalid angle
}

if( null == altitudeFeet ) {

return 91; // invalid angle
}

if( 0 == siteDistMetres ) { // craft overhead

return 90;
}

var ftDistance = siteDistMetres*3.28084;
var ftDiff = ftHeight - siteAltFeet;

// make approximation for 2 * Earth radius in ft

var radiansAngularDrop = ftDistance / 41784593;
var radians = ftDiff / ftDistance;
var elevAngleRadians = Math.atan( radians - radiansAngularDrop);
var elevAngleDegrees = 57.29577951308232 * elevAngleRadians;
var result = Math.round( 1000*elevAngleDegrees) / 1000;
var result3dp = Number.parseFloat(result).toFixed(3);
return result3dp;
}
////


function get_unit_label(quantity, systemOfMeasurement) {
var labels = UnitLabels[quantity];
if (labels !== undefined && labels[systemOfMeasurement] !== undefined) {
Expand Down
61 changes: 54 additions & 7 deletions public_html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,39 @@

<div id="settings_infoblock">
<div id="settings_close" class="settingsCloseBox"></div>
<div id="units_container">
<label for="units_selector"><span class="infoBlockTitleText">Units:</span></label>
<select name="units_selector" id="units_selector">
<option value="nautical">Aeronautical</option>
<option value="metric">Metric</option>
<option value="imperial">Imperial</option>
</select>
<div>
<div class="settingsColumn">
<div id="units_container">
<label for="units_selector"><span class="infoBlockTitleText">Units:</span></label>
<select name="units_selector" id="units_selector">
<option value="nautical">Aeronautical</option>
<option value="metric">Metric</option>
<option value="imperial">Imperial</option>
</select>
</div>
</div>
<div class="settingsColumn">
<div id="elevation_container">
<form id="elevation_form">
<div class="elevationOptions">
<label><span>Elevation ASL:</span></label>
<input id="elevation_asl" name="elevationAsl" type="text" class="elevationAslInput" maxlength="4">
</div>
<div class="set_elevation_asl_button">
<button id="elevation_asl_button" type="button">Set Site Elevation</button>
</div>
</form>
<form id="threshold_form">
<div class="thresholdOptions">
<label><span>Highlight below negative angle</span></label>
<input id="negative_angle" name="negativeAngle" type="text" class="negativeAngleInput" maxlength="6">
</div>
<div class="set_negative_angle_button">
<button id="negative_angle_button" type="button">Set Negative Angle</button>
</div>
</form>
</div>
</div>
</div>
<div class="settingsColumn">
<div class="settingsOptionContainer">
Expand Down Expand Up @@ -157,6 +183,8 @@
<div class="settingsText">Show Aircraft Labels</div>
</div>
</div>


<div id="range_ring_column" class="settingsOptionContainer">
<div class="infoBlockTitleText">Range Rings</div>
<form id="range_ring_form">
Expand Down Expand Up @@ -360,6 +388,19 @@
<div class="columnSelectCheckbox" id="fa_photo_link_checkbox"></div>
<div class="columnOptionText">Photos</div>
</div>



<div class="columnOptionContainer">

<div class="columnSelectCheckbox" id="elevation_col_checkbox"></div>

<div class="columnOptionText">Elevation</div>

</div>



</div>
</div>

Expand Down Expand Up @@ -388,6 +429,9 @@
<td id="airframes_mode_s_link">Airframes.org</td>
<td id="flightaware_mode_s_link">FlightAware</td>
<td id="flightaware_photo_link">Photos</td>

<td id="elevation" onclick="sortByElevation();">Elevation</td>

</tr>
</thead>
<tbody>
Expand All @@ -412,6 +456,9 @@
<td style="text-align: center">AIRFRAMES_MODE_S_LINK</td>
<td style="text-align: center">FLIGHTAWARE_MODE_S_LINK</td>
<td style="text-align: center">FLIGHTAWARE_PHOTO_LINK</td>

<td style="text-align: right">ELEVATION</td>

</tr>
</tbody>
</table>
Expand Down
22 changes: 22 additions & 0 deletions public_html/planeObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

function PlaneObject(icao) {
// Info about the plane

this.count = 0; ////

this.icao = icao;
this.icaorange = findICAORange(icao);
this.flight = null;
Expand Down Expand Up @@ -348,6 +351,25 @@ PlaneObject.prototype.getMarkerColor = function() {
if (this.squawk in SpecialSquawks)
return SpecialSquawks[this.squawk].markerColor;

////
this.count ++;

if( this.elevation < SiteNegativeAngle ) {

for( let index=0; index < SpecialElevations.length; index++) {

if( this.elevation < SpecialElevations[index].exceptional ) {

if( 0 == parseInt(this.count)%2 ) {

return SpecialElevations[index].markerColor;
}
break;
}
}
}
////

var h, s, l;

var colorArr = this.getAltitudeColor();
Expand Down
Loading