2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00

Explorer: Show data for the current system only ()

Resolves 

This behavior is suppressed during batch reads.
This commit is contained in:
F K 2022-05-28 09:03:36 -04:00 committed by GitHub
parent 6616b54852
commit 8106fbd0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

@ -20,6 +20,7 @@ namespace Observatory.Explorer
private Dictionary<ulong, Dictionary<int, ScanBaryCentre>> BarycentreHistory;
private CustomCriteriaManager CustomCriteriaManager;
private DateTime CriteriaLastModified;
private string currentSystem = string.Empty;
internal Explorer(ExplorerWorker explorerWorker, IObservatoryCore core, ObservableCollection<object> results)
{
@ -109,12 +110,24 @@ namespace Observatory.Explorer
return barycentreScan;
}
public void SetSystem(string potentialNewSystem)
{
if (string.IsNullOrEmpty(currentSystem) || currentSystem != potentialNewSystem)
{
currentSystem = potentialNewSystem;
if (ExplorerWorker.settings.OnlyShowCurrentSystem && !ObservatoryCore.IsLogMonitorBatchReading)
{
ObservatoryCore.ClearGrid(ExplorerWorker, new ExplorerUIResults());
Clear();
}
}
}
public void ProcessScan(Scan scanEvent, bool readAll)
{
if (!readAll)
{
string criteriaFilePath = ((ExplorerSettings)ExplorerWorker.Settings).CustomCriteriaFile;
string criteriaFilePath = ExplorerWorker.settings.CustomCriteriaFile;
if (File.Exists(criteriaFilePath))
{
@ -136,7 +149,7 @@ namespace Observatory.Explorer
Details = e.OriginalScript
};
ObservatoryCore.AddGridItem(ExplorerWorker, exceptionResult);
((ExplorerSettings)ExplorerWorker.Settings).EnableCustomCriteria = false;
ExplorerWorker.settings.EnableCustomCriteria = false;
}
CriteriaLastModified = fileModified;
@ -175,15 +188,15 @@ namespace Observatory.Explorer
if (scanEvent.SystemAddress != 0 && !systemBodies.ContainsKey(scanEvent.BodyID))
systemBodies.Add(scanEvent.BodyID, scanEvent);
var results = DefaultCriteria.CheckInterest(scanEvent, SystemBodyHistory, BodySignalHistory, (ExplorerSettings)ExplorerWorker.Settings);
var results = DefaultCriteria.CheckInterest(scanEvent, SystemBodyHistory, BodySignalHistory, ExplorerWorker.settings);
if (BarycentreHistory.ContainsKey(scanEvent.SystemAddress) && scanEvent.Parent != null && BarycentreHistory[scanEvent.SystemAddress].ContainsKey(scanEvent.Parent[0].Body))
{
ProcessScan(ConvertBarycentre(BarycentreHistory[scanEvent.SystemAddress][scanEvent.Parent[0].Body], scanEvent), readAll);
}
if (((ExplorerSettings)ExplorerWorker.Settings).EnableCustomCriteria)
results.AddRange(CustomCriteriaManager.CheckInterest(scanEvent, SystemBodyHistory, BodySignalHistory, (ExplorerSettings)ExplorerWorker.Settings));
if (ExplorerWorker.settings.EnableCustomCriteria)
results.AddRange(CustomCriteriaManager.CheckInterest(scanEvent, SystemBodyHistory, BodySignalHistory, ExplorerWorker.settings));
if (results.Count > 0)
{

@ -86,6 +86,9 @@ namespace Observatory.Explorer
[SettingDisplayName("Enable Custom Criteria")]
public bool EnableCustomCriteria { get; set; }
[SettingDisplayName("Only Show Current System")]
public bool OnlyShowCurrentSystem { get; set; }
[SettingDisplayName("Custom Criteria File")]
[System.Text.Json.Serialization.JsonIgnore]
public System.IO.FileInfo CustomCriteria {get => new System.IO.FileInfo(CustomCriteriaFile); set => CustomCriteriaFile = value.FullName;}

@ -69,6 +69,14 @@ namespace Observatory.Explorer
case ScanBaryCentre barycentre:
explorer.RecordBarycentre(barycentre);
break;
case FSDJump fsdjump:
if (fsdjump is CarrierJump && !((CarrierJump)fsdjump).Docked)
break;
explorer.SetSystem(fsdjump.StarSystem);
break;
case Location location:
explorer.SetSystem(location.StarSystem);
break;
case DiscoveryScan discoveryScan:
break;
case FSSDiscoveryScan discoveryScan:
@ -95,7 +103,6 @@ namespace Observatory.Explorer
explorer.Clear();
}
}
public object Settings
{
@ -103,6 +110,6 @@ namespace Observatory.Explorer
set => settings = (ExplorerSettings)value;
}
private ExplorerSettings settings;
internal ExplorerSettings settings;
}
}