From 02ea7cfa35898fefe50a43b72fe1c610580d9afd Mon Sep 17 00:00:00 2001 From: Husky Date: Sat, 21 Jul 2018 19:53:06 +0200 Subject: [PATCH] Schnittstelle erweitert. Die lage wird jetzt mit aufgezeichnet --- SanSystem/frmMain.cs | 2 +- .../{Import.cs => I2006XML.cs} | 4 +- SchnittstelleImporter/ImportBuilder.cs | 39 +++++++++++++++++++ .../SchnittstelleImporter.csproj | 3 +- SchnittstelleImporterTests/ImportTests.cs | 2 +- 5 files changed, 46 insertions(+), 4 deletions(-) rename SchnittstelleImporter/{Import.cs => I2006XML.cs} (94%) create mode 100644 SchnittstelleImporter/ImportBuilder.cs diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index 913f918..042cab8 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -117,7 +117,7 @@ namespace SanSystem private void stammdatenImportierenToolStripMenuItem_Click(object sender, EventArgs e) { - IImportedObjekte importedObjekte = new Import(); + IImportedObjekte importedObjekte = SchnittstelleImporter.ImportBuilder.Import(ImportSchnittstellen.XML2006); importedObjekte.XMLFile = @"C:\Users\Damian\Desktop\XML\3_Zustandsdaten\ISYBAU_XML-2006-Zustandsdaten_DIN_EN_13508-2.xml"; importedObjekte.Projektnummer = Global.Instance.ProjektNummer; Datenbank.Instance.loadedProjekt.Objekte.AddRange(importedObjekte.GetInspektionsobjekte()); diff --git a/SchnittstelleImporter/Import.cs b/SchnittstelleImporter/I2006XML.cs similarity index 94% rename from SchnittstelleImporter/Import.cs rename to SchnittstelleImporter/I2006XML.cs index dd081d3..9a7939a 100644 --- a/SchnittstelleImporter/Import.cs +++ b/SchnittstelleImporter/I2006XML.cs @@ -11,7 +11,7 @@ namespace SchnittstelleImporter /// /// /// - public class Import : IImportedObjekte + public class I2006XML : IImportedObjekte { string xmlFile; string projektnummer; @@ -78,6 +78,8 @@ namespace SchnittstelleImporter inspektionskuerzeln.Charakterisierung1 = zustand.Charakterisierung1; inspektionskuerzeln.Charakterisierung2 = zustand.Charakterisierung2; inspektionskuerzeln.ImVerbindung = zustand.Verbindung; + inspektionskuerzeln.LageAmUmfangStart = Convert.ToUInt32(zustand.PositionVon); + inspektionskuerzeln.LageAmUmfangEnde = Convert.ToUInt32(zustand.PositionBis); Quantifizierung quant1 = zustand.Quantifizierung1; Quantifizierung quant2 = zustand.Quantifizierung2; diff --git a/SchnittstelleImporter/ImportBuilder.cs b/SchnittstelleImporter/ImportBuilder.cs new file mode 100644 index 0000000..f14f3ed --- /dev/null +++ b/SchnittstelleImporter/ImportBuilder.cs @@ -0,0 +1,39 @@ +using KlassenBIB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter +{ + /// + /// Definiert die Importierbare Schnittstellen + /// + public enum ImportSchnittstellen + { + /// + /// Euronorm XML 2006 + /// + XML2006 + } + /// + /// + /// + public static class ImportBuilder + { + /// + /// + /// + public static IImportedObjekte Import(ImportSchnittstellen importSchnittstellen) + { + switch (importSchnittstellen) + { + case ImportSchnittstellen.XML2006: return new I2006XML(); + default: throw new Exception("Gewünschte Schnittstelle nicht implementiert"); + } + + } + } + +} diff --git a/SchnittstelleImporter/SchnittstelleImporter.csproj b/SchnittstelleImporter/SchnittstelleImporter.csproj index 5c2237a..b69a83f 100644 --- a/SchnittstelleImporter/SchnittstelleImporter.csproj +++ b/SchnittstelleImporter/SchnittstelleImporter.csproj @@ -41,7 +41,8 @@ - + + diff --git a/SchnittstelleImporterTests/ImportTests.cs b/SchnittstelleImporterTests/ImportTests.cs index 04b733d..831394d 100644 --- a/SchnittstelleImporterTests/ImportTests.cs +++ b/SchnittstelleImporterTests/ImportTests.cs @@ -14,7 +14,7 @@ namespace SchnittstelleImporter.Tests [TestMethod()] public void GetInspektionsobjekteTest() { - Import import = new Import(); + XML2006 import = new XML2006(); import.XMLFile = @"C:\Users\Damian\Desktop\XML\3_Zustandsdaten\ISYBAU_XML-2006-Zustandsdaten_DIN_EN_13508-2.xml"; import.GetInspektionsobjekte();