Merge pull request #1839 from phl0/pastFutureSatMarker

Add markers to +/- 90 min position
This commit is contained in:
Florian (DF2ET)
2025-04-05 16:11:20 +02:00
committed by GitHub

View File

@@ -8,6 +8,18 @@ let saticon = L.divIcon({
iconSize: [30, 30],
iconAnchor: [15, 15] // Center the icon
});
let pasticon = L.divIcon({
html: '<i class="fa-solid fa-satellite" style="font-size: 24px; opacity: 0.75; color: grey; -webkit-text-stroke: 1px white;"></i>',
className: '',
iconSize: [30, 30],
iconAnchor: [15, 15]
});
let futureicon = L.divIcon({
html: '<i class="fa-solid fa-satellite" style="font-size: 24px; opacity: 0.75; color: grey; -webkit-text-stroke: 1px white;"></i>',
className: '',
iconSize: [30, 30],
iconAnchor: [15, 15]
});
let homeicon = L.icon({ iconUrl: icon_home_url, iconSize: [15, 15] });
let observerGd = {
@@ -247,8 +259,15 @@ Satellite.prototype.update = function () {
if (this._altitude < 35700 || this._altitude > 36000) {
pastmarker.remove();
futuremarker.remove();
pastmarker.addTo(leafletMap)
futuremarker.addTo(leafletMap)
// Compute paths with Antimeridian handling
let { pastSegments, futureSegments } = computePath(this._satrec, this._date, 100, 100, 10);
pastmarker.setLatLng({lat: pastSegments[0][0][0], lng: pastSegments[0][0][1]});
futuremarker.setLatLng({lat: futureSegments[(futureSegments.length - 1)][futureSegments[(futureSegments.length - 1)].length - 1][0], lng: futureSegments[(futureSegments.length - 1)][futureSegments[(futureSegments.length - 1)].length - 1][1]});
// Remove old polylines if they exist
if (this._pastTrajectories) {
@@ -430,6 +449,7 @@ function getBearing(lat1, lng1, lat2, lng2) {
svgLayer = L.svg();
leafletMap = L.map('sat_map', {
zoom: 3,
minZoom: 1,
center: [20, 0],
// attributionControl: false,
layers: [
@@ -447,6 +467,22 @@ function getBearing(lat1, lng1, lat2, lng2) {
}
).addTo(leafletMap).on('click', displayUpComingPasses);
pastmarker = L.marker(
[0, 0], {
icon: pasticon,
zIndex: 1000,
}
);
pastmarker.bindTooltip("-90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 });
futuremarker = L.marker(
[0, 0], {
icon: futureicon,
zIndex: 1000,
}
);
futuremarker.bindTooltip("+90 min", { permanent: true, offset: [15, 15], className: '', opacity: 0.65 });
// Add an always-visible label (tooltip)
satmarker.bindTooltip(satellite, {
permanent: true, // Always visible