Skip to content

Commit

Permalink
feat: ✨ add scc num and time to polar plots
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Aug 4, 2024
1 parent 5e35216 commit a165f6e
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 17 deletions.
94 changes: 78 additions & 16 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@
"__dirname": "readonly",
"settingsManager": "writable"
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2021
},
"plugins": ["@typescript-eslint", "jest"],
"plugins": [
"@typescript-eslint",
"jest"
],
"rules": {
"accessor-pairs": "error",
"array-bracket-newline": "error",
Expand All @@ -37,10 +43,18 @@
"camelcase": "error",
"capitalized-comments": "off",
"class-methods-use-this": "off",
"comma-dangle": ["error", "always-multiline"],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": "error",
"comma-style": "error",
"complexity": ["error", { "max": 40 }], // TODO: change to error
"complexity": [
"error",
{
"max": 40
}
], // TODO: change to error
"computed-property-spacing": "error",
"consistent-return": "error",
"consistent-this": "error",
Expand Down Expand Up @@ -68,25 +82,65 @@
"id-length": "off",
"id-match": "error",
"implicit-arrow-linebreak": "off",
"indent": ["error", 2, { "SwitchCase": 1 }],
"indent-legacy": ["error", 2, { "SwitchCase": 1 }],
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
"indent-legacy": [
"error",
2,
{
"SwitchCase": 1
}
],
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"keyword-spacing": "off",
"line-comment-position": "off",
"linebreak-style": ["error", "unix"],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": "off",
"lines-around-directive": "error",
"lines-between-class-members": "off",
"max-classes-per-file": "error",
"max-depth": "warn", // TODO: change to error
"max-len": ["warn", { "code": 180 }], // TODO: change to error
"max-lines": ["warn", { "max": 1000 }], // TODO: change to error
"max-lines-per-function": ["error", { "max": 300 }],
"max-len": [
"warn",
{
"code": 180
}
], // TODO: change to error
"max-lines": [
"warn",
{
"max": 1000
}
], // TODO: change to error
"max-lines-per-function": [
"error",
{
"max": 300
}
],
"max-nested-callbacks": "error",
"max-params": ["warn", { "max": 8 }], // TODO: change to error
"max-statements": ["warn", { "max": 85 }], // TODO: change to error
"max-params": [
"warn",
{
"max": 8
}
], // TODO: change to error
"max-statements": [
"warn",
{
"max": 85
}
], // TODO: change to error
"max-statements-per-line": "error",
"multiline-comment-style": "warn", // TODO: change to error
"multiline-ternary": "off",
Expand Down Expand Up @@ -172,7 +226,12 @@
"no-template-curly-in-string": "error",
"no-ternary": "off",
"no-throw-literal": "error",
"no-trailing-spaces": ["error", { "ignoreComments": true }],
"no-trailing-spaces": [
"error",
{
"ignoreComments": true
}
],
"no-undef-init": "error",
"no-undefined": "error",
"no-underscore-dangle": "off",
Expand Down Expand Up @@ -218,7 +277,10 @@
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": "off",
"quotes": ["error", "single"],
"quotes": [
"error",
"single"
],
"radix": "off",
"require-atomic-updates": "error",
"require-await": "warn", // TODO: change to errors
Expand Down Expand Up @@ -251,4 +313,4 @@
"yoda": "error",
"@typescript-eslint/no-explicit-any": "warn"
}
}
}
24 changes: 23 additions & 1 deletion src/plugins/polar-plot/polar-plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class PolarPlotPlugin extends KeepTrackPlugin {
static readonly PLUGIN_NAME = 'Polar Plot';
dependencies = [SelectSatManager.PLUGIN_NAME];
private selectSatManager_: SelectSatManager;
passStartTime_: Date;
passStopTime_: Date;

constructor() {
super(PolarPlotPlugin.PLUGIN_NAME);
Expand Down Expand Up @@ -120,16 +122,24 @@ export class PolarPlotPlugin extends KeepTrackPlugin {
}

private generatePlotData_(): boolean {
this.passStartTime_ = null;
this.passStopTime_ = null;

const sensor = keepTrackApi.getSensorManager().getSensor();
const sat = this.selectSatManager_.getSelectedSat() as DetailedSatellite;
let isSomethingInView = false;

this.plotData_ = [];
let now: Date = null;

for (let i = 0; i < secondsPerDay * 3; i++) {
const now = keepTrackApi.getTimeManager().getOffsetTimeObj(i * MILLISECONDS_PER_SECOND);
now = keepTrackApi.getTimeManager().getOffsetTimeObj(i * MILLISECONDS_PER_SECOND);
const inView = sensor.isSatInFov(sat, now);

if (inView) {
if (!this.passStartTime_) {
this.passStartTime_ = now;
}
const rae = sensor.rae(sat, now);

this.plotData_.push([rae.az, rae.el]);
Expand All @@ -139,6 +149,8 @@ export class PolarPlotPlugin extends KeepTrackPlugin {
}
}

this.passStopTime_ = now;

return isSomethingInView;
}

Expand All @@ -147,6 +159,16 @@ export class PolarPlotPlugin extends KeepTrackPlugin {
this.drawPlotBackground_();
this.drawOrbitLine_();
this.drawStartAndEnd_();
this.drawTitle_();
}

private drawTitle_(): void {
this.ctx_.font = `${this.canvasSize_ * 0.035}px consolas`;
this.ctx_.fillStyle = 'rgb(255, 255, 255)';
this.ctx_.textAlign = 'center';
this.ctx_.textBaseline = 'top';
this.ctx_.fillText(`Satellite ${(<DetailedSatellite>this.selectSatManager_.getSelectedSat()).sccNum}: ` +
`${this.passStartTime_.toISOString().slice(11, 19)} - ${this.passStopTime_.toISOString().slice(11, 19)}`, this.centerX_, 0);
}

private setupCanvas_() {
Expand Down

0 comments on commit a165f6e

Please sign in to comment.