From 5a524797969dd8df7133c96412ef86ebb9c6269d Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 09:36:07 -0400 Subject: [PATCH 1/9] feat: :sparkles: add clear message when no lookangles correctly displayed --- src/plugins/sensor/look-angles-plugin.ts | 13 +++++++++++-- src/plugins/sensor/multi-site-look-angles-plugin.ts | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/plugins/sensor/look-angles-plugin.ts b/src/plugins/sensor/look-angles-plugin.ts index 049bd413..21a4b217 100644 --- a/src/plugins/sensor/look-angles-plugin.ts +++ b/src/plugins/sensor/look-angles-plugin.ts @@ -258,12 +258,12 @@ export class LookAnglesPlugin extends KeepTrackPlugin { this.lastlooksArray_ = looksArray; // Populate the Side Menu - LookAnglesPlugin.populateSideMenuTable_(looksArray, timeManagerInstance); + this.populateSideMenuTable_(looksArray, timeManagerInstance); return looksArray; } - private static populateSideMenuTable_(lookAngleData: TearrData[], timeManagerInstance: TimeManager) { + private populateSideMenuTable_(lookAngleData: TearrData[], timeManagerInstance: TimeManager) { const tbl = getEl('looks'); // Identify the table to update tbl.innerHTML = ''; // Clear the table from old object data @@ -299,6 +299,15 @@ export class LookAnglesPlugin extends KeepTrackPlugin { for (const lookAngleRow of lookAngleData) { LookAnglesPlugin.populateSideMenuRow_({ tbl, tdT, lookAngleRow, timeManagerInstance, tdE, tdA, tdR, tdType }); } + + if (lookAngleData.length === 0) { + const tr = tbl.insertRow(); + const td = tr.insertCell(); + const searchLength = (this.lengthOfLookAngles_ * 24).toFixed(1); + + td.colSpan = 4; + td.appendChild(document.createTextNode(`Satellite is not visible for the next ${searchLength} hours.`)); + } } private static populateSideMenuRow_( diff --git a/src/plugins/sensor/multi-site-look-angles-plugin.ts b/src/plugins/sensor/multi-site-look-angles-plugin.ts index 76c05068..cf451307 100644 --- a/src/plugins/sensor/multi-site-look-angles-plugin.ts +++ b/src/plugins/sensor/multi-site-look-angles-plugin.ts @@ -259,7 +259,7 @@ export class MultiSiteLookAnglesPlugin extends KeepTrackPlugin { // eslint-disable-next-line no-unused-expressions isResetToDefault ? sensorManagerInstance.setCurrentSensor(null) : sensorManagerInstance.setCurrentSensor(tempSensor); - MultiSiteLookAnglesPlugin.populateMultiSiteTable_(multiSiteArray); + this.populateMultiSiteTable_(multiSiteArray); } private static propagateMultiSite_(now: Date, satrec: SatelliteRecord, sensor: DetailedSensor): TearrData { @@ -286,7 +286,7 @@ export class MultiSiteLookAnglesPlugin extends KeepTrackPlugin { } - private static populateMultiSiteTable_(multiSiteArray: TearrData[]) { + private populateMultiSiteTable_(multiSiteArray: TearrData[]) { const sensorManagerInstance = keepTrackApi.getSensorManager(); const staticSet = keepTrackApi.getCatalogManager().staticSet; @@ -341,5 +341,14 @@ export class MultiSiteLookAnglesPlugin extends KeepTrackPlugin { sensorManagerInstance.setSensor(sensor, sensor.sensorId); }); } + + if (multiSiteArray.length === 0) { + const tr = tbl.insertRow(); + const td = tr.insertCell(); + const searchLength = (this.lengthOfLookAngles_ * 24).toFixed(1); + + td.colSpan = 4; + td.appendChild(document.createTextNode(`Satellite is not visible for the next ${searchLength} hours.`)); + } } } From e6c0225164ac976a48e7d6ccf83d7861e94cd112 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 09:36:41 -0400 Subject: [PATCH 2/9] fix: :bug: fix color of buttons in multi-site lookangles settings --- .../sensor/multi-site-look-angles-plugin.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/sensor/multi-site-look-angles-plugin.ts b/src/plugins/sensor/multi-site-look-angles-plugin.ts index cf451307..95d3a32b 100644 --- a/src/plugins/sensor/multi-site-look-angles-plugin.ts +++ b/src/plugins/sensor/multi-site-look-angles-plugin.ts @@ -169,21 +169,25 @@ export class MultiSiteLookAnglesPlugin extends KeepTrackPlugin { const sensorButton = document.createElement('button'); - sensorButton.classList.add('btn', 'btn-ui', 'waves-effect', 'waves-light'); + sensorButton.classList.add('btn', 'darken-3', 'btn-ui', 'waves-effect', 'waves-light'); if (this.disabledSensors_.includes(sensor)) { - sensorButton.classList.add('btn-red'); + sensorButton.classList.add('red'); + } else { + sensorButton.classList.add('green'); } allSensors.push(sensor); sensorButton.innerText = sensor.uiName ?? sensor.shortName ?? sensor.objName; sensorButton.addEventListener('click', () => { - if (sensorButton.classList.contains('btn-red')) { - sensorButton.classList.remove('btn-red'); + if (sensorButton.classList.contains('red')) { + sensorButton.classList.remove('red'); + sensorButton.classList.add('green'); this.disabledSensors_.splice(this.disabledSensors_.indexOf(sensor), 1); keepTrackApi.getSoundManager().play(SoundNames.TOGGLE_ON); } else { - sensorButton.classList.add('btn-red'); + sensorButton.classList.add('red'); + sensorButton.classList.remove('green'); this.disabledSensors_.push(sensor); keepTrackApi.getSoundManager().play(SoundNames.TOGGLE_OFF); } From e25de70828b50f083d791471267b7ae7674122b3 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 09:37:18 -0400 Subject: [PATCH 3/9] fix: :lipstick: fix ui issues caused by input-field not having margin --- public/css/materialize-local.css | 3 +- src/plugins/sensor/custom-sensor-plugin.ts | 169 +++++++++------------ src/settings/versionDate.js | 2 +- 3 files changed, 74 insertions(+), 100 deletions(-) diff --git a/public/css/materialize-local.css b/public/css/materialize-local.css index 731eb340..c18094f1 100644 --- a/public/css/materialize-local.css +++ b/public/css/materialize-local.css @@ -69,8 +69,7 @@ textarea.materialize-textarea { } .input-field { - margin-top: 0 !important; - margin-bottom: 0 !important; + margin: 1rem 1rem 0 1rem; } .input-field.col label { diff --git a/src/plugins/sensor/custom-sensor-plugin.ts b/src/plugins/sensor/custom-sensor-plugin.ts index c2a51c66..da2628a1 100644 --- a/src/plugins/sensor/custom-sensor-plugin.ts +++ b/src/plugins/sensor/custom-sensor-plugin.ts @@ -42,104 +42,79 @@ export class CustomSensorPlugin extends KeepTrackPlugin { sideMenuElementName: string = 'custom-sensor-menu'; sideMenuElementHtml: string = keepTrackApi.html` -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
-
- -
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
- -
-
- -
-
- + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
- -
`; +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+ + `; sideMenuSettingsHtml: string = keepTrackApi.html`
diff --git a/src/settings/versionDate.js b/src/settings/versionDate.js index 9aa3bebd..511b49bd 100644 --- a/src/settings/versionDate.js +++ b/src/settings/versionDate.js @@ -1,2 +1,2 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -export const VERSION_DATE = 'September 28, 2024'; +export const VERSION_DATE = 'September 29, 2024'; From 30cf58d9bb8a72531a71a600e43734de8f386f9e Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 09:50:01 -0400 Subject: [PATCH 4/9] fix: :lipstick: fix stf menu ui --- public/css/materialize-local.css | 8 ++- .../short-term-fences/short-term-fences.ts | 54 ++++++++----------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/public/css/materialize-local.css b/public/css/materialize-local.css index c18094f1..8ef010bb 100644 --- a/public/css/materialize-local.css +++ b/public/css/materialize-local.css @@ -68,8 +68,14 @@ textarea.materialize-textarea { line-height: 2rem !important; } +.row { + margin-bottom: 1rem; +} + .input-field { - margin: 1rem 1rem 0 1rem; + margin-top: 1rem 0 0 0; + padding-left: 1rem; + padding-right: 1rem; } .input-field.col label { diff --git a/src/plugins/short-term-fences/short-term-fences.ts b/src/plugins/short-term-fences/short-term-fences.ts index b0e6d357..8982c5f5 100644 --- a/src/plugins/short-term-fences/short-term-fences.ts +++ b/src/plugins/short-term-fences/short-term-fences.ts @@ -6,7 +6,7 @@ import searchPng from '@public/img/icons/search.png'; import { errorManagerInstance } from '@app/singletons/errorManager'; import { BaseObject, DEG2RAD, Degrees, DetailedSensor, EpochUTC, Kilometers, RAE, Radians, SpaceObjectType, ZoomValue, eci2rae } from 'ootk'; -import { KeepTrackPlugin } from '../KeepTrackPlugin'; +import { clickDragOptions, KeepTrackPlugin } from '../KeepTrackPlugin'; import { SatInfoBox } from '../select-sat-manager/sat-info-box'; import { SelectSatManager } from '../select-sat-manager/select-sat-manager'; import { SoundNames } from '../sounds/SoundNames'; @@ -14,7 +14,7 @@ import { SoundNames } from '../sounds/SoundNames'; export class ShortTermFences extends KeepTrackPlugin { readonly id = 'ShortTermFences'; dependencies_: string[] = [SatInfoBox.name, SelectSatManager.name]; - private selectSatManager_: SelectSatManager; + private readonly selectSatManager_: SelectSatManager; constructor() { super(); @@ -25,6 +25,12 @@ export class ShortTermFences extends KeepTrackPlugin { isRequireSensorSelected = true; isAddStfLinksOnce = false; + dragOptions: clickDragOptions = { + minWidth: 600, + maxWidth: 1000, + isDraggable: true, + }; + sideMenuElementName = 'stf-menu'; sideMenuElementHtml: string = keepTrackApi.html`
@@ -33,69 +39,51 @@ export class ShortTermFences extends KeepTrackPlugin {
Short Term Fence
-
+
-
-
-
+
-
-
-
-
+
-
-
-
+
-
-
-
+
-
+
-
-
-
+
-
-
- -
+
+ + +
-
-
- -
-
-
- -
`; From 65ee21142ea970f20feb3f9fed1d8abd62e0dd82 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 09:57:51 -0400 Subject: [PATCH 5/9] fix: :bug: fix bug caused by satellite that propagates into the earth --- .../tracking-impact-predict.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/tracking-impact-predict/tracking-impact-predict.ts b/src/plugins/tracking-impact-predict/tracking-impact-predict.ts index 2bc7a3cb..5b0229d8 100644 --- a/src/plugins/tracking-impact-predict/tracking-impact-predict.ts +++ b/src/plugins/tracking-impact-predict/tracking-impact-predict.ts @@ -168,7 +168,7 @@ export class TrackingImpactPredict extends KeepTrackPlugin { this.createBody_(tbl); } catch (e) { - errorManagerInstance.warn('Error processing SOCRATES data!'); + errorManagerInstance.warn('Error processing reentry data!'); } } @@ -211,11 +211,22 @@ export class TrackingImpactPredict extends KeepTrackPlugin { if (sat) { // Get Flight path angle at terminal point const decayEpochDate = new Date(this.tipList_[i].DECAY_EPOCH); - const nu = sat.toClassicalElements(decayEpochDate).trueAnomaly; - const sinNu = Math.sin(nu); - const gamma = Math.atan((sat.eccentricity * sinNu) / (1 + sat.eccentricity * Math.cos(nu))); + let nu: number | null = null; - gammaDegrees = `${Math.abs(gamma * RAD2DEG).toFixed(2)}°`; + try { + nu = sat.toClassicalElements(decayEpochDate)?.trueAnomaly; + } catch { + // This is expected to fail for some satellites since they are rentries + } + + if (nu !== null) { + const sinNu = Math.sin(nu); + const gamma = Math.atan((sat.eccentricity * sinNu) / (1 + sat.eccentricity * Math.cos(nu))); + + gammaDegrees = `${Math.abs(gamma * RAD2DEG).toFixed(2)}°`; + } else { + gammaDegrees = 'Unknown'; + } if (sat?.rcs) { rcs = `${sat.rcs}`; From 020d6866f2d320e6c7631343842e2497eb220b40 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 10:13:20 -0400 Subject: [PATCH 6/9] feat: :sparkles: update screenshot to use new logo instead of text --- src/plugins/screenshot/screenshot.ts | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/plugins/screenshot/screenshot.ts b/src/plugins/screenshot/screenshot.ts index 0ede88db..30c2736c 100644 --- a/src/plugins/screenshot/screenshot.ts +++ b/src/plugins/screenshot/screenshot.ts @@ -27,6 +27,7 @@ import { KeepTrackApiEvents } from '@app/interfaces'; import { keepTrackApi } from '@app/keepTrackApi'; import { Classification } from '@app/static/classification'; import cameraPng from '@public/img/icons/camera.png'; +import logoPng from '@public/img/kts-text-logo.png'; import { KeepTrackPlugin } from '../KeepTrackPlugin'; export class Screenshot extends KeepTrackPlugin { @@ -36,6 +37,13 @@ export class Screenshot extends KeepTrackPlugin { this.saveHiResPhoto('4k'); }; + logo: HTMLImageElement; + constructor() { + super(); + this.logo = new Image(); + this.logo.src = logoPng; + } + // This is 'disabled' since it does not turn green after being clicked like other buttons. isIconDisabled = true; @@ -127,33 +135,28 @@ export class Screenshot extends KeepTrackPlugin { link.download = 'keeptrack.png'; - const d = new Date(); - const n = d.getUTCFullYear(); - const copyrightStr = !settingsManager.copyrightOveride ? `©${n} KEEPTRACK.SPACE` : ''; - - link.href = Screenshot.watermarkedDataUrl_(copyrightStr); + link.href = this.watermarkedDataUrl_(); link.click(); this.queuedScreenshot_ = false; } - private static watermarkedDataUrl_(text: string) { + private watermarkedDataUrl_() { const canvas = keepTrackApi.getRenderer().domElement; const tempCanvas = document.createElement('canvas'); const tempCtx = tempCanvas.getContext('2d'); const cw = tempCanvas.width; const ch = tempCanvas.height; + const logoWidth = 200; + const logoHeight = 200; + const logoX = canvas.width - logoWidth - 50; + const logoY = canvas.height - logoHeight - 50; tempCanvas.width = canvas.width; tempCanvas.height = canvas.height; tempCtx.drawImage(canvas, 0, 0); - tempCtx.font = '24px nasalization'; - let textWidth = tempCtx.measureText(text).width; - - tempCtx.globalAlpha = 1.0; - tempCtx.fillStyle = 'white'; - tempCtx.fillText(text, cw - textWidth - 30, ch - 30); + tempCtx.drawImage(this.logo, logoX, logoY, logoWidth, logoHeight); const { classificationstr, classificationColor } = Screenshot.calculateClassificationText_(); @@ -163,7 +166,8 @@ export class Screenshot extends KeepTrackPlugin { tempCtx.fillStyle = classificationColor; - textWidth = tempCtx.measureText(classificationstr).width; + const textWidth = tempCtx.measureText(classificationstr).width; + tempCtx.fillText(classificationstr, cw / 2 - textWidth, ch - 20); tempCtx.fillText(classificationstr, cw / 2 - textWidth, 34); } From c1799bd47dd6816debf93ee97ab2343363818e59 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 10:18:52 -0400 Subject: [PATCH 7/9] fix: :bug: fix search bar being clipped when sat-infobox moved --- src/plugins/select-sat-manager/sat-info-box.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/select-sat-manager/sat-info-box.ts b/src/plugins/select-sat-manager/sat-info-box.ts index 5de5cd6c..00b915b4 100644 --- a/src/plugins/select-sat-manager/sat-info-box.ts +++ b/src/plugins/select-sat-manager/sat-info-box.ts @@ -1087,6 +1087,8 @@ export class SatInfoBox extends KeepTrackPlugin { getEl(SatInfoBox.containerId_).style.maxHeight = '80%'; document.documentElement.style.setProperty('--search-box-bottom', '0px'); getEl(SatInfoBox.containerId_).classList.remove('satinfo-fixed'); + + getEl('search-results').style.maxHeight = '80%'; }); } @@ -1096,6 +1098,7 @@ export class SatInfoBox extends KeepTrackPlugin { satInfobox.addEventListener('mousedown', (e: any) => { if (e.button === 2) { SatInfoBox.resetMenuLocation(satInfobox); + getEl('search-results').style.maxHeight = ''; } }); } From a2a18c09b6c8a57f4f55c3ba78ce86a9133dd9f2 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 10:27:59 -0400 Subject: [PATCH 8/9] fix: :bug: fix export function of transponders plugin --- .../transponder-channel-data.ts | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/plugins/transponder-channel-data/transponder-channel-data.ts b/src/plugins/transponder-channel-data/transponder-channel-data.ts index 9d85b29c..d42b5b04 100644 --- a/src/plugins/transponder-channel-data/transponder-channel-data.ts +++ b/src/plugins/transponder-channel-data/transponder-channel-data.ts @@ -8,6 +8,7 @@ import { BaseObject, DetailedSatellite } from 'ootk'; import { clickDragOptions, KeepTrackPlugin } from '../KeepTrackPlugin'; import { SatConstellations } from '../sat-constellations/sat-constellations'; import { SelectSatManager } from '../select-sat-manager/select-sat-manager'; +import { saveCsv } from '@app/lib/saveVariable'; interface ChannelInfo { satellite: string; @@ -54,6 +55,7 @@ export class TransponderChannelData extends KeepTrackPlugin { isIconDisabled = true; private lastLoadedSat_ = -1; + dataCache: ChannelInfo[]; addHtml(): void { super.addHtml(); @@ -65,6 +67,20 @@ export class TransponderChannelData extends KeepTrackPlugin { keepTrackApi.getPlugin(SatConstellations)?.addConstellation('TV Satellites', GroupType.SCC_NUM, this.satsWithChannels_.map((sccNum) => parseInt(sccNum))); }, }); + + keepTrackApi.register({ + event: KeepTrackApiEvents.uiManagerFinal, + cbName: this.id, + cb: () => { + const exportLaunchInfo = getEl('export-channel-info'); + + if (exportLaunchInfo) { + exportLaunchInfo.addEventListener('click', () => { + this.exportData(); + }); + } + }, + }); } addJs(): void { @@ -117,7 +133,7 @@ export class TransponderChannelData extends KeepTrackPlugin {
- +
@@ -130,6 +146,8 @@ export class TransponderChannelData extends KeepTrackPlugin { .then(async (resp) => { const data = await resp.json() as ChannelInfo[]; + this.dataCache = data; + const tbl: HTMLTableElement = getEl('transponderChannelData-table'); if (!tbl) { @@ -164,4 +182,18 @@ export class TransponderChannelData extends KeepTrackPlugin { }) .catch(() => errorManagerInstance.warn(`Failed to fetch channel info for ${selectedSat.name}`)); } + + exportData() { + const data = this.dataCache.map((info) => { + const obj: Record = {}; + + Object.keys(info).forEach((key) => { + obj[key] = info[key]; + }); + + return obj; + }); + + saveCsv(data, 'channel-info.csv'); + } } From ba1d98c833693cdf33d8eb113185bf359cf06893 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Sun, 29 Sep 2024 10:48:52 -0400 Subject: [PATCH 9/9] fix: :bug: fix new launch showing error even when it works --- src/plugins/new-launch/new-launch.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/new-launch/new-launch.ts b/src/plugins/new-launch/new-launch.ts index 7a011949..615acf67 100644 --- a/src/plugins/new-launch/new-launch.ts +++ b/src/plugins/new-launch/new-launch.ts @@ -258,10 +258,16 @@ export class NewLaunch extends KeepTrackPlugin { }, validationFunc: (data: any) => typeof data.satPos !== 'undefined', error: () => { + if (!this.isDoingCalculations) { + // If we are not doing calculations, then it must have finished already. + return; + } + this.isDoingCalculations = false; hideLoading(); uiManagerInstance.toast('Cruncher failed to meet requirement after multiple tries! Is this launch even possible?', ToastMsgType.critical); }, + maxRetries: 50, }); };