Skip to content

Conversation

@thkruz
Copy link
Owner

@thkruz thkruz commented Nov 17, 2025

…tering

  • Add satellite and sensor list support to scenario files
  • Collect visible satellites (DetailedSatellites and OemSatellites) when saving
  • Collect active sensors when saving scenarios
  • Filter satellites using ObjectGroup system when loading scenarios
  • Filter/activate sensors when loading scenarios
  • Support both DetailedSatellite (TLE-based) and OemSatellite (ephemeris-based) satellites
  • Add toast notifications for save/load operations showing counts

This implements STK-style scenario management where scenario files contain lists of satellites and sensors that should be visible when loaded.

…tering

- Add satellite and sensor list support to scenario files
- Collect visible satellites (DetailedSatellites and OemSatellites) when saving
- Collect active sensors when saving scenarios
- Filter satellites using ObjectGroup system when loading scenarios
- Filter/activate sensors when loading scenarios
- Support both DetailedSatellite (TLE-based) and OemSatellite (ephemeris-based) satellites
- Add toast notifications for save/load operations showing counts

This implements STK-style scenario management where scenario files contain
lists of satellites and sensors that should be visible when loaded.
Copilot AI review requested due to automatic review settings November 17, 2025 10:25
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +539 to +541
// Clear current sensors
sensorManager.currentSensors = [];
sensorManager.secondarySensors = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load scenario sensors without clearing lookup lists first

applySensorFilter_ zeroes out currentSensors/secondarySensors (lines 539-541) and then relies on getSensorByObjName in the subsequent loop to resolve each scenario sensor name, but that lookup only searches those same arrays plus stfSensors. Once they are emptied no normal sensor can be found, so loading a scenario with sensors always warns “Sensor not found” and leaves sensors inactive instead of restoring them from the file.

Useful? React with 👍 / 👎.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR expands the Scenario Management Plugin to support STK-style scenario management by adding satellite and sensor persistence to scenario files. When saving scenarios, the plugin now captures which satellites and sensors are currently visible/active, and when loading scenarios, it restores that selection state.

Key Changes:

  • Extended scenario file format to include satellite and sensor lists
  • Added collection methods to capture visible satellites (both DetailedSatellite and OemSatellite types) and active sensors when saving
  • Implemented filtering logic to restore satellite visibility and sensor activation when loading scenarios using the ObjectGroup system

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +539 to +545
// Clear current sensors
sensorManager.currentSensors = [];
sensorManager.secondarySensors = [];

// Set sensors from the scenario
for (const sensorName of sensorNames) {
const sensor = sensorManager.getSensorByObjName(sensorName);
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sensors are cleared before attempting to look them up, which will cause getSensorByObjName to always return null. The method getSensorByObjName only searches through currently active sensors (currentSensors, secondarySensors, stfSensors), not the full sensor catalog.

Instead, sensors should be looked up from the imported sensors catalog object before clearing, or the lookup should be done from the catalog directly. For example:

// Import sensors at the top
import { sensors } from '@app/app/data/catalogs/sensors';

// In applySensorFilter_:
const sensorsToActivate: DetailedSensor[] = [];
for (const sensorName of sensorNames) {
  // Look through the catalog
  let found = false;
  for (const sensorKey in sensors) {
    if (sensors[sensorKey].objName === sensorName) {
      sensorsToActivate.push(sensors[sensorKey]);
      found = true;
      break;
    }
  }
  if (!found) {
    errorManagerInstance.warn(`Sensor ${sensorName} not found in catalog`);
  }
}

// Clear current sensors
sensorManager.currentSensors = [];
sensorManager.secondarySensors = [];

// Add the sensors
for (const sensor of sensorsToActivate) {
  sensorManager.addSecondarySensor(sensor);
}

Copilot uses AI. Check for mistakes.
Comment on lines +544 to +556
for (const sensorName of sensorNames) {
const sensor = sensorManager.getSensorByObjName(sensorName);

if (sensor) {
sensorManager.addSecondarySensor(sensor);
} else {
errorManagerInstance.warn(`Sensor ${sensorName} not found in catalog`);
}
}

if (sensorNames.length > 0) {
ServiceLocator.getUiManager().toast(
`Loaded ${sensorNames.length} sensor(s)`,
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toast message shows sensorNames.length sensors were loaded, but this count includes sensors that may not have been found in the catalog (since getSensorByObjName will return null for sensors that aren't currently active, which they won't be after clearing). Additionally, the condition if (sensorNames.length > 0) should check the actual number of successfully loaded sensors. Consider tracking the actual count of successfully loaded sensors and displaying that instead.

Suggested change
for (const sensorName of sensorNames) {
const sensor = sensorManager.getSensorByObjName(sensorName);
if (sensor) {
sensorManager.addSecondarySensor(sensor);
} else {
errorManagerInstance.warn(`Sensor ${sensorName} not found in catalog`);
}
}
if (sensorNames.length > 0) {
ServiceLocator.getUiManager().toast(
`Loaded ${sensorNames.length} sensor(s)`,
let loadedCount = 0;
for (const sensorName of sensorNames) {
const sensor = sensorManager.getSensorByObjName(sensorName);
if (sensor) {
sensorManager.addSecondarySensor(sensor);
loadedCount++;
} else {
errorManagerInstance.warn(`Sensor ${sensorName} not found in catalog`);
}
}
if (loadedCount > 0) {
ServiceLocator.getUiManager().toast(
`Loaded ${loadedCount} sensor(s)`,

Copilot uses AI. Check for mistakes.
Comment on lines +450 to +466
const sensors: string[] = [];

// Collect all current sensors
for (const sensor of sensorManager.currentSensors) {
if (sensor?.objName) {
sensors.push(sensor.objName);
}
}

// Collect all secondary sensors
for (const sensor of sensorManager.secondarySensors) {
if (sensor?.objName) {
sensors.push(sensor.objName);
}
}

return sensors;
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method may include duplicate sensors if a sensor appears in both currentSensors and secondarySensors. Consider using a Set to ensure uniqueness:

private collectActiveSensors_(): string[] {
  const sensorManager = ServiceLocator.getSensorManager();
  const sensorNames = new Set<string>();

  // Collect all current sensors
  for (const sensor of sensorManager.currentSensors) {
    if (sensor?.objName) {
      sensorNames.add(sensor.objName);
    }
  }

  // Collect all secondary sensors
  for (const sensor of sensorManager.secondarySensors) {
    if (sensor?.objName) {
      sensorNames.add(sensor.objName);
    }
  }

  return Array.from(sensorNames);
}
Suggested change
const sensors: string[] = [];
// Collect all current sensors
for (const sensor of sensorManager.currentSensors) {
if (sensor?.objName) {
sensors.push(sensor.objName);
}
}
// Collect all secondary sensors
for (const sensor of sensorManager.secondarySensors) {
if (sensor?.objName) {
sensors.push(sensor.objName);
}
}
return sensors;
const sensorNames = new Set<string>();
// Collect all current sensors
for (const sensor of sensorManager.currentSensors) {
if (sensor?.objName) {
sensorNames.add(sensor.objName);
}
}
// Collect all secondary sensors
for (const sensor of sensorManager.secondarySensors) {
if (sensor?.objName) {
sensorNames.add(sensor.objName);
}
}
return Array.from(sensorNames);

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants