From c69f446171ad6088d919787b9fcfa9c3f1f0bb8b Mon Sep 17 00:00:00 2001
From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at>
Date: Wed, 5 May 2021 18:57:24 +0200
Subject: [PATCH] Added LegislativeCategory to PrimaryVehicle Output reader

---
 VECTO/Input Files/Engine.vb                            |  1 +
 VECTO/Input Files/Gearbox.vb                           |  1 +
 VECTO/Input Files/MockVehicleInputData.vb              |  1 +
 VECTO/Input Files/Vehicle.vb                           |  2 ++
 .../VectoCommon/InputData/DeclarationInputData.cs      |  2 ++
 .../InputData/FileIO/JSON/JSONComponentInputData.cs    |  5 +++++
 .../VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs |  5 +++++
 .../DataProvider/XMLDeclarationVehicleDataProvider.cs  | 10 ++++++++++
 .../Reader/Impl/XMLDeclarationMultistageInputReader.cs |  5 +++++
 .../DataProvider/XMLEngineeringVehicleDataProvider.cs  |  5 +++++
 .../Utils/MockDeclarationVehicleInputData.cs           |  2 ++
 .../VectoCoreTest/XML/XMLMultistageBusDataTest.cs      |  1 +
 12 files changed, 40 insertions(+)

diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb
index 9bc9ac0499..6e168b0210 100644
--- a/VECTO/Input Files/Engine.vb	
+++ b/VECTO/Input Files/Engine.vb	
@@ -619,6 +619,7 @@ Public Class DummyVehicle
 	Public Property Identifier As String Implements IVehicleDeclarationInputData.Identifier
 	Public Property ExemptedVehicle As Boolean Implements IVehicleDeclarationInputData.ExemptedVehicle
 	Public Property VIN As String Implements IVehicleDeclarationInputData.VIN
+	Public ReadOnly Property LegislativeCategory As String Implements IVehicleDeclarationInputData.LegislativeCategory
 	Public Property LegislativeClass As LegislativeClass? Implements IVehicleDeclarationInputData.LegislativeClass
 	Public Property VehicleCategory As VehicleCategory Implements IVehicleDeclarationInputData.VehicleCategory
 	Public Property AxleConfiguration As AxleConfiguration Implements IVehicleDeclarationInputData.AxleConfiguration
diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb
index 70a4c0d266..b934593d01 100644
--- a/VECTO/Input Files/Gearbox.vb	
+++ b/VECTO/Input Files/Gearbox.vb	
@@ -801,6 +801,7 @@ Public Class MockEngineeringVehicle
     Public Property Identifier As String Implements IVehicleDeclarationInputData.Identifier
     Public Property ExemptedVehicle As Boolean Implements IVehicleDeclarationInputData.ExemptedVehicle
     Public Property VIN As String Implements IVehicleDeclarationInputData.VIN
+    Public ReadOnly Property LegislativeCategory As String Implements IVehicleDeclarationInputData.LegislativeCategory
     Public Property LegislativeClass As LegislativeClass? Implements IVehicleDeclarationInputData.LegislativeClass
     Public Property VehicleCategory As VehicleCategory Implements IVehicleDeclarationInputData.VehicleCategory
     Public Property AxleConfiguration As AxleConfiguration Implements IVehicleDeclarationInputData.AxleConfiguration
diff --git a/VECTO/Input Files/MockVehicleInputData.vb b/VECTO/Input Files/MockVehicleInputData.vb
index ecc845ec7e..1f7a3f1295 100644
--- a/VECTO/Input Files/MockVehicleInputData.vb	
+++ b/VECTO/Input Files/MockVehicleInputData.vb	
@@ -19,6 +19,7 @@ Public Class MockVehicleInputData
     Public Property Identifier As String Implements IVehicleDeclarationInputData.Identifier
     Public Property ExemptedVehicle As Boolean Implements IVehicleDeclarationInputData.ExemptedVehicle
     Public Property VIN As String Implements IVehicleDeclarationInputData.VIN
+    Public ReadOnly Property LegislativeCategory As String Implements IVehicleDeclarationInputData.LegislativeCategory
     Public Property LegislativeClass As LegislativeClass? Implements IVehicleDeclarationInputData.LegislativeClass
     Public Property VehicleCategory As VehicleCategory Implements IVehicleDeclarationInputData.VehicleCategory
     Public Property AxleConfiguration As AxleConfiguration Implements IVehicleDeclarationInputData.AxleConfiguration
diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb
index bd5eeabb6c..f50cc3639d 100644
--- a/VECTO/Input Files/Vehicle.vb	
+++ b/VECTO/Input Files/Vehicle.vb	
@@ -362,6 +362,8 @@ Public Class Vehicle
 		End Get
 	End Property
 
+	Public ReadOnly Property LegislativeCategory As String Implements IVehicleDeclarationInputData.LegislativeCategory
+
 	Public ReadOnly Property LegislativeClass As LegislativeClass? Implements IVehicleEngineeringInputData.LegislativeClass
 		Get
 			Return legClass
diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
index 292639d551..f62b7a4410 100644
--- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
+++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs
@@ -99,6 +99,8 @@ namespace TUGraz.VectoCommon.InputData
 
 		string VIN { get; }
 
+		string LegislativeCategory { get; }
+
 		LegislativeClass? LegislativeClass { get; }
 
 		/// <summary>
diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
index 28afea7f46..67281ae54e 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs
@@ -223,6 +223,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 			get { return VehicleData.VIN; }
 		}
 
+		public string LegislativeCategory
+		{
+			get { return null; }
+		}
+
 		public LegislativeClass? LegislativeClass
 		{
 			get { return VehicleData.LegislativeClass; }
diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
index efe1a7b47f..c7355a1d53 100644
--- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs
@@ -238,6 +238,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
 			get { return Constants.NOT_AVailABLE; }
 		}
 
+		public string LegislativeCategory
+		{
+			get { return null; }
+		}
+
 		public virtual LegislativeClass? LegislativeClass
 		{
 			get {
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
index c71f4ab540..4df6b512fe 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationVehicleDataProvider.cs
@@ -120,6 +120,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 			get { return GetString(XMLNames.Vehicle_VIN); }
 		}
 
+		public virtual string LegislativeCategory
+		{
+			get { return null; }
+		}
+
 		public virtual LegislativeClass? LegislativeClass
 		{
 			get { return GetString(XMLNames.Vehicle_LegislativeClass).ParseEnum<LegislativeClass>(); }
@@ -956,6 +961,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider
 			get { return GetString(XMLNames.Vehicle_VIN); }
 		}
 
+		public string LegislativeCategory
+		{
+			get { return GetString(XMLNames.Bus_LegislativeCategory); }
+		}
+
 		public VehicleCategory VehicleCategory
 		{
 			get { return VehicleCategoryHelper.Parse(GetString(XMLNames.Vehicle_VehicleCategory)); }
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
index 097c8f28bc..c979d66bbd 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/Reader/Impl/XMLDeclarationMultistageInputReader.cs
@@ -444,6 +444,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.Reader.Impl
 			get { return _manufacturingStages.First().Vehicle.VIN; }
 		}
 
+		public string LegislativeCategory
+		{
+			get { return null; }
+		}
+
 		public VehicleDeclarationType VehicleDeclarationType
 		{
 			get { return _manufacturingStages.First().Vehicle.VehicleDeclarationType; }
diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
index 76017cff2d..fa6b7d5740 100644
--- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
+++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/DataProvider/XMLEngineeringVehicleDataProvider.cs
@@ -76,6 +76,11 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Engineering.DataProvider
 			get { return GetString(XMLNames.Vehicle_VIN); }
 		}
 
+		public string LegislativeCategory
+		{
+			get { return null; }
+		}
+
 		public virtual LegislativeClass? LegislativeClass
 		{
 			get { return GetString(XMLNames.Vehicle_LegislativeClass).ParseEnum<LegislativeClass>(); }
diff --git a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
index 5ffc35e5e1..5d9655268b 100644
--- a/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
+++ b/VectoCore/VectoCoreTest/Utils/MockDeclarationVehicleInputData.cs
@@ -28,6 +28,7 @@ namespace TUGraz.VectoCore.Tests.Utils {
 		public string Identifier { get; }
 		public bool ExemptedVehicle { get; }
 		public string VIN { get; }
+		public string LegislativeCategory { get; }
 		public LegislativeClass? LegislativeClass { get; }
 		public VehicleCategory VehicleCategory { get; }
 		public AxleConfiguration AxleConfiguration { get; }
@@ -133,6 +134,7 @@ namespace TUGraz.VectoCore.Tests.Utils {
 		public string Identifier { get; }
 		public bool ExemptedVehicle { get; }
 		public string VIN { get; }
+		public string LegislativeCategory { get; }
 		public LegislativeClass? LegislativeClass { get; }
 		public VehicleCategory VehicleCategory { get; }
 		public AxleConfiguration AxleConfiguration { get; }
diff --git a/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs b/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs
index 195d6e7683..563e081172 100644
--- a/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs
+++ b/VectoCore/VectoCoreTest/XML/XMLMultistageBusDataTest.cs
@@ -71,6 +71,7 @@ namespace TUGraz.VectoCore.Tests.XML
 			Assert.AreEqual("Generic Model", vehicleData.Model);
 			Assert.AreEqual("VEH-1234567890_nonSmart-ESS", vehicleData.VIN);
 			Assert.AreEqual(DateTime.Parse("2017-02-15T11:00:00Z").ToUniversalTime(), vehicleData.Date);
+			Assert.AreEqual("M3", vehicleData.LegislativeCategory);
 			Assert.AreEqual("Bus", vehicleData.VehicleCategory.ToXMLFormat());
 			Assert.AreEqual(AxleConfiguration.AxleConfig_8x2, vehicleData.AxleConfiguration);
 			Assert.AreEqual(true, vehicleData.Articulated);
-- 
GitLab