From 210d042c0999edcd3c20e65a3c05e007c7df49a3 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 10 Jan 2023 07:42:25 +0100 Subject: [PATCH] Filterung angefangen --- AIS/bsmd.AIS2Service/AISZoneMonitor.cs | 4 ++-- AIS/bsmd.AIS2Service/webservice/SLRController.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/AIS/bsmd.AIS2Service/AISZoneMonitor.cs b/AIS/bsmd.AIS2Service/AISZoneMonitor.cs index 9cd113eb..5eaac684 100644 --- a/AIS/bsmd.AIS2Service/AISZoneMonitor.cs +++ b/AIS/bsmd.AIS2Service/AISZoneMonitor.cs @@ -21,8 +21,8 @@ namespace bsmd.AIS2Service #region Fields - ConcurrentDictionary _sitRepDict; - AIS_SQLiteStorage _storage; + private readonly ConcurrentDictionary _sitRepDict; + private readonly AIS_SQLiteStorage _storage; private Thread _thread; private bool _stopFlag = false; private static readonly ILog _log = LogManager.GetLogger(typeof(AISZoneMonitor)); diff --git a/AIS/bsmd.AIS2Service/webservice/SLRController.cs b/AIS/bsmd.AIS2Service/webservice/SLRController.cs index 30d339a3..f0fd13a8 100644 --- a/AIS/bsmd.AIS2Service/webservice/SLRController.cs +++ b/AIS/bsmd.AIS2Service/webservice/SLRController.cs @@ -1,17 +1,25 @@ using System; using System.Collections.Generic; using System.Web.Http; +using log4net; namespace bsmd.AIS2Service { public class SLRController : ApiController { + private static readonly ILog _log = LogManager.GetLogger(typeof(SLRController)); + [HttpGet] public IEnumerable Get([FromUri] int? id) { if (!id.HasValue) return null; List result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value); + int classBReportCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && (AISManager.SitRep[x.MMSI].IsClassB ?? false)); + _log.DebugFormat("removed {0} class B SLR reports from list"); // tut des? + + // auch alles entfernen was "abgelaufen" ist und nicht im SitRep enthalten ist + Dictionary> mmsiDict = new Dictionary>(); foreach(ShipLocationReport report in result) { if (!mmsiDict.ContainsKey(report.MMSI)) mmsiDict[report.MMSI] = new List(); @@ -22,7 +30,7 @@ namespace bsmd.AIS2Service report.Name = AISManager.SitRep[report.MMSI].Name; report.NavStatus = AIS_PosReport.GetNavStatus(AISManager.SitRep[report.MMSI].NavStatus); report.IMO = AISManager.SitRep[report.MMSI].IMO; - } + } } // determine "state" of vessel through alarm comparison. Possible values are: