diff --git a/AIS/bsmd.AIS2Service/AISZoneMonitor.cs b/AIS/bsmd.AIS2Service/AISZoneMonitor.cs
index d9e2a0d8..9cd113eb 100644
--- a/AIS/bsmd.AIS2Service/AISZoneMonitor.cs
+++ b/AIS/bsmd.AIS2Service/AISZoneMonitor.cs
@@ -72,6 +72,7 @@ namespace bsmd.AIS2Service
{
if(testDict.ContainsKey(mmsi))
{
+ if (!_sitRepDict.ContainsKey(mmsi)) continue;
AIS_Target target = _sitRepDict[mmsi];
foreach(AlarmAssignmentZone aazone in testDict[mmsi]) {
if(aazone.Zone.IsPointInPolygon4(target.Position))
diff --git a/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs b/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs
index 4065abbe..0efb605a 100644
--- a/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs
+++ b/AIS/bsmd.AIS2Service/AIS_SQLiteStorage.cs
@@ -400,7 +400,7 @@ namespace bsmd.AIS2Service
string loadSLRString = "SELECT a.timestamp_first, a.timestamp_last, za.mmsi, mz.id FROM alarm a " +
"INNER JOIN zone_assignment za ON a.zone_assignment_id = za.id " +
"INNER JOIN monitor_zone mz ON za.monitor_zone_id = mz.id " +
- $"WHERE mz.monitor_group_id = {groupId}";
+ $"WHERE mz.monitor_group_id = {groupId} ORDER BY mz.sequence";
SQLiteCommand laCmd = new SQLiteCommand(loadSLRString, _connection);
SQLiteDataReader reader = laCmd.ExecuteReader();
diff --git a/AIS/bsmd.AIS2Service/App.config b/AIS/bsmd.AIS2Service/App.config
index 01211684..da7c04e3 100644
--- a/AIS/bsmd.AIS2Service/App.config
+++ b/AIS/bsmd.AIS2Service/App.config
@@ -70,6 +70,9 @@
60
+
+ 24
+
diff --git a/AIS/bsmd.AIS2Service/Properties/Settings.Designer.cs b/AIS/bsmd.AIS2Service/Properties/Settings.Designer.cs
index 8ea7f200..a5128f39 100644
--- a/AIS/bsmd.AIS2Service/Properties/Settings.Designer.cs
+++ b/AIS/bsmd.AIS2Service/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace bsmd.AIS2Service.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -130,5 +130,14 @@ namespace bsmd.AIS2Service.Properties {
return ((int)(this["MinAlarmIntervalMins"]));
}
}
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("24")]
+ public int AutoAlarmExpiryHours {
+ get {
+ return ((int)(this["AutoAlarmExpiryHours"]));
+ }
+ }
}
}
diff --git a/AIS/bsmd.AIS2Service/Properties/Settings.settings b/AIS/bsmd.AIS2Service/Properties/Settings.settings
index 33f3e9aa..3f43ac8f 100644
--- a/AIS/bsmd.AIS2Service/Properties/Settings.settings
+++ b/AIS/bsmd.AIS2Service/Properties/Settings.settings
@@ -38,5 +38,8 @@
60
+
+ 24
+
\ No newline at end of file
diff --git a/AIS/bsmd.AIS2Service/img/arrow_down_red.png b/AIS/bsmd.AIS2Service/img/arrow_down_red.png
new file mode 100644
index 00000000..a76e2f2a
Binary files /dev/null and b/AIS/bsmd.AIS2Service/img/arrow_down_red.png differ
diff --git a/AIS/bsmd.AIS2Service/img/arrow_up_green.png b/AIS/bsmd.AIS2Service/img/arrow_up_green.png
new file mode 100644
index 00000000..a0532067
Binary files /dev/null and b/AIS/bsmd.AIS2Service/img/arrow_up_green.png differ
diff --git a/AIS/bsmd.AIS2Service/img/bullet_square_yellow.png b/AIS/bsmd.AIS2Service/img/bullet_square_yellow.png
new file mode 100644
index 00000000..19623882
Binary files /dev/null and b/AIS/bsmd.AIS2Service/img/bullet_square_yellow.png differ
diff --git a/AIS/bsmd.AIS2Service/img/clock.png b/AIS/bsmd.AIS2Service/img/clock.png
new file mode 100644
index 00000000..84f277fd
Binary files /dev/null and b/AIS/bsmd.AIS2Service/img/clock.png differ
diff --git a/AIS/bsmd.AIS2Service/webservice/SLRController.cs b/AIS/bsmd.AIS2Service/webservice/SLRController.cs
index 7c26b1ab..30d339a3 100644
--- a/AIS/bsmd.AIS2Service/webservice/SLRController.cs
+++ b/AIS/bsmd.AIS2Service/webservice/SLRController.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Web.Http;
namespace bsmd.AIS2Service
@@ -11,7 +12,10 @@ namespace bsmd.AIS2Service
if (!id.HasValue) return null;
List result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value);
+ Dictionary> mmsiDict = new Dictionary>();
foreach(ShipLocationReport report in result) {
+ if (!mmsiDict.ContainsKey(report.MMSI)) mmsiDict[report.MMSI] = new List();
+ mmsiDict[report.MMSI].Add(report);
if (AISManager.SitRep.ContainsKey(report.MMSI))
{
report.Destination = AISManager.SitRep[report.MMSI].Destination;
@@ -21,6 +25,51 @@ namespace bsmd.AIS2Service
}
}
+ // determine "state" of vessel through alarm comparison. Possible values are:
+ // 0 = stationary (= equals)
+ // 1 = incoming
+ // 2 = outgoing
+ // 3 = expired
+
+ foreach(int key in mmsiDict.Keys)
+ {
+ bool expired = true;
+ DateTime? lastDate= null;
+ bool? incoming = null;
+
+ // first run through alarm list to determine state
+ foreach(ShipLocationReport slr in mmsiDict[key])
+ {
+ if((DateTime.Now - slr.Timestamp_Last).TotalHours < Properties.Settings.Default.AutoAlarmExpiryHours) expired = false;
+ if (lastDate == null)
+ {
+ lastDate = slr.Timestamp_Last;
+ }
+ else
+ {
+ incoming = slr.Timestamp_Last < lastDate;
+ }
+ }
+
+ // second run through alarm list to set state flag in all entries
+ foreach (ShipLocationReport slr in mmsiDict[key])
+ {
+ if (expired)
+ {
+ slr.VoyageDirection = 3;
+ }
+ else if (incoming.HasValue)
+ {
+ if (incoming.Value) { slr.VoyageDirection = 1; }
+ else { slr.VoyageDirection = 2; }
+ }
+ else
+ {
+ slr.VoyageDirection = 0; // stationary / no comparison value
+ }
+ }
+ }
+
return result;
}
}
diff --git a/AIS/bsmd.AIS2Service/webservice/ShipLocationReport.cs b/AIS/bsmd.AIS2Service/webservice/ShipLocationReport.cs
index 25d813f6..ac33e176 100644
--- a/AIS/bsmd.AIS2Service/webservice/ShipLocationReport.cs
+++ b/AIS/bsmd.AIS2Service/webservice/ShipLocationReport.cs
@@ -23,5 +23,6 @@ namespace bsmd.AIS2Service
public string NavStatus { get; set; }
+ public int VoyageDirection { get; set; }
}
}
diff --git a/AIS/bsmd.AIS2Service/zonen.js b/AIS/bsmd.AIS2Service/zonen.js
index af32799e..9d3cb0b3 100644
--- a/AIS/bsmd.AIS2Service/zonen.js
+++ b/AIS/bsmd.AIS2Service/zonen.js
@@ -62,7 +62,10 @@ function updateData(data, groupId) {
const colCount = row.childNodes.length;
row.childNodes[0].innerHTML = data[i].Name;
- // TODO: incoming/outgoing symbol
+ if(data[i].VoyageDirection == 0) row.childNodes[1].innerHTML = '
';
+ if(data[i].VoyageDirection == 1) row.childNodes[1].innerHTML = '
';
+ if(data[i].VoyageDirection == 2) row.childNodes[1].innerHTML = '
';
+ if(data[i].VoyageDirection == 3) row.childNodes[1].innerHTML = '
';
row.childNodes[2].innerHTML = data[i].IMO;
// find alarm cell and set value