Filterung angefangen

This commit is contained in:
Daniel Schick 2023-01-10 07:42:25 +01:00
parent bdff064992
commit 24f0400ab0
2 changed files with 11 additions and 3 deletions

View File

@ -21,8 +21,8 @@ namespace bsmd.AIS2Service
#region Fields
ConcurrentDictionary<int, AIS_Target> _sitRepDict;
AIS_SQLiteStorage _storage;
private readonly ConcurrentDictionary<int, AIS_Target> _sitRepDict;
private readonly AIS_SQLiteStorage _storage;
private Thread _thread;
private bool _stopFlag = false;
private static readonly ILog _log = LogManager.GetLogger(typeof(AISZoneMonitor));

View File

@ -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<ShipLocationReport> Get([FromUri] int? id)
{
if (!id.HasValue) return null;
List<ShipLocationReport> 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<int, List<ShipLocationReport>> mmsiDict = new Dictionary<int, List<ShipLocationReport>>();
foreach(ShipLocationReport report in result) {
if (!mmsiDict.ContainsKey(report.MMSI)) mmsiDict[report.MMSI] = new List<ShipLocationReport>();
@ -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: