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
26 changes: 26 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,32 @@ html.has-sticks #stickCanvas {
display:block;
}

#mapContainer.no-gps-data:before {
position: absolute;
display: block;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9999;
content: "";
background-color: gray;
opacity: .5;
}

#mapContainer.no-gps-data:after {
position: absolute;
display: block;
top: calc(30%);
right: 0;
bottom: 0;
left: 0;
z-index: 10001;
content: "No GPS Data";
text-align: center;
font-size: 3vw;
}

html.has-analyser-fullscreen.has-analyser .analyser input:not(.onlyFullScreenException) {
display:block;
}
Expand Down
29 changes: 19 additions & 10 deletions js/graph_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,27 @@ function MapGrapher() {
}

this.setFlightLogIndexs();

let { latlngs, maxAlt, minAlt } = this.getPolylinesData();

const polyline = L.polyline(latlngs, polylineOptions);
const hasGpsData = latlngs.length > 0;

const polylineC = this.createAltitudeColoredPolyline(
latlngs,
maxAlt,
minAlt
);
if (hasGpsData) {
const polyline = L.polyline(latlngs, polylineOptions);

const polylineC = this.createAltitudeColoredPolyline(
latlngs,
maxAlt,
minAlt
);

trailLayers.set(logIndex, { polyline, polylineC });
trailLayers.set(logIndex, { polyline, polylineC });

if (latlngs.length > 0) {
homePosition = this.getHomeCoordinatesFromFlightLog(flightLog);
} else {
console.debug("FlightLog has no gps data.");
}

$("#mapContainer").toggleClass("no-gps-data", !hasGpsData);
};

this.setFlightLogIndexs = function () {
Expand Down Expand Up @@ -382,7 +387,7 @@ function MapGrapher() {
const lng = frame[lngIndex];
const alt = frame[altitudeIndex];

return typeof lat == "number" || typeof lng == "number"
return this.isNumber(lat) && this.isNumber(lng)
? L.latLng(
lat / coordinateDivider,
lng / coordinateDivider,
Expand All @@ -391,6 +396,10 @@ function MapGrapher() {
: null;
};

this.isNumber = function (n) {
return typeof n === "number" && !isNaN(n);
};

this.getGroundCourseFromFrame = function (frame, groundCourseIndex) {
const gc = frame[groundCourseIndex];
return typeof gc == "number" ? gc / grounCourseDivider : 0;
Expand Down