diff --git a/CityBIM/CityBIM.csproj b/CityBIM/CityBIM.csproj index c1f19cd..4a3ff20 100644 --- a/CityBIM/CityBIM.csproj +++ b/CityBIM/CityBIM.csproj @@ -235,5 +235,12 @@ + + + True + True + ResourcePictures.resx + + \ No newline at end of file diff --git a/CityBIM/ResourcePictures.Designer.cs b/CityBIM/ResourcePictures.Designer.cs index e14cb08..0909dac 100644 --- a/CityBIM/ResourcePictures.Designer.cs +++ b/CityBIM/ResourcePictures.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace CityBIM { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal ResourcePictures() { } /// - /// Returns the cached ResourceManager instance used by this class. + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal ResourcePictures() { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal ResourcePictures() { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap ALKIS_32px_96dpi { get { @@ -71,7 +71,7 @@ public static System.Drawing.Bitmap ALKIS_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap ALKISset_32px { get { @@ -81,7 +81,7 @@ public static System.Drawing.Bitmap ALKISset_32px { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap Attribute32 { get { @@ -91,7 +91,7 @@ public static System.Drawing.Bitmap Attribute32 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap citygml_32px_96dpi { get { @@ -101,7 +101,7 @@ public static System.Drawing.Bitmap citygml_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap citygml_set_32px { get { @@ -111,7 +111,7 @@ public static System.Drawing.Bitmap citygml_set_32px { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap DTM_32px_96dpi { get { @@ -121,7 +121,7 @@ public static System.Drawing.Bitmap DTM_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap Georef_32px_96dpi { get { @@ -131,7 +131,7 @@ public static System.Drawing.Bitmap Georef_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap Georef_96dpi { get { @@ -141,7 +141,7 @@ public static System.Drawing.Bitmap Georef_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap HelpIcon_32px { get { @@ -151,7 +151,7 @@ public static System.Drawing.Bitmap HelpIcon_32px { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap HideLayerIcon_32px_96dpi { get { @@ -161,7 +161,7 @@ public static System.Drawing.Bitmap HideLayerIcon_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap icon_georef10 { get { @@ -171,7 +171,7 @@ public static System.Drawing.Bitmap icon_georef10 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap icon_georef20 { get { @@ -181,7 +181,7 @@ public static System.Drawing.Bitmap icon_georef20 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap icon_georef50 { get { @@ -191,7 +191,7 @@ public static System.Drawing.Bitmap icon_georef50 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap IFC_32px_96dpi { get { @@ -201,7 +201,16 @@ public static System.Drawing.Bitmap IFC_32px_96dpi { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Zeichenfolge, die LoGeoRef50 is not fulfilled ähnelt. + /// + public static string LoGeoRef50IsNotFulfilled { + get { + return ResourceManager.GetString("LoGeoRef50IsNotFulfilled", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap LogIcon { get { @@ -211,7 +220,7 @@ public static System.Drawing.Bitmap LogIcon { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap loginIcon32 { get { @@ -221,7 +230,7 @@ public static System.Drawing.Bitmap loginIcon32 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap overViewIcon { get { @@ -231,7 +240,7 @@ public static System.Drawing.Bitmap overViewIcon { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap queryDataCat { get { @@ -241,7 +250,7 @@ public static System.Drawing.Bitmap queryDataCat { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap Vermesser32 { get { @@ -251,7 +260,7 @@ public static System.Drawing.Bitmap Vermesser32 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// public static System.Drawing.Bitmap XPlan_32px { get { diff --git a/CityBIM/ResourcePictures.resx b/CityBIM/ResourcePictures.resx index 415c1ef..8662c43 100644 --- a/CityBIM/ResourcePictures.resx +++ b/CityBIM/ResourcePictures.resx @@ -178,4 +178,7 @@ img\XPlan_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + LoGeoRef50 is not fulfilled + \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/IfcCheckerService.cs b/IFCGeoRefCheckerGUI/IfcCheckerService.cs index 0afbb02..5e41560 100644 --- a/IFCGeoRefCheckerGUI/IfcCheckerService.cs +++ b/IFCGeoRefCheckerGUI/IfcCheckerService.cs @@ -14,11 +14,18 @@ namespace IFCGeoRefCheckerGUI { class IfcCheckerService { + private readonly ITranslator _translator; + + public IfcCheckerService(ITranslator translator) + { + _translator = translator ?? throw new ArgumentNullException(nameof(translator)); + } public GeoRefChecker CheckIFC(string filePath) { using (var model = IfcStore.Open(filePath)) { - var checker = new GeoRefChecker(model); + //var checker = new GeoRefChecker(model); + var checker = new GeoRefChecker(model, _translator); return checker; } } diff --git a/IFCGeoRefCheckerGUI/MainWindow.xaml.cs b/IFCGeoRefCheckerGUI/MainWindow.xaml.cs index 59c1cc7..cdb5935 100644 --- a/IFCGeoRefCheckerGUI/MainWindow.xaml.cs +++ b/IFCGeoRefCheckerGUI/MainWindow.xaml.cs @@ -83,7 +83,6 @@ public void UpdateUITexts() CheckFileBtn.Content = Properties.Resources.CHECK_SELECTED_FILE; SetWorkDirGroupBox.Header = Properties.Resources.SET_WORKING_DIRECTORY; WorkingDirLabel.Content = Properties.Resources.WORKING_DIRECTORY_LABEL; - //PathTextBox.Text = Properties.Resources.PATH_TEXTBOX; InputIFCGroupBox.Header = Properties.Resources.INPUT_IFC_FILES; StatusLabel.Content = Properties.Resources.STATUS_LABEL; LoadedIFCFilesLabel.Content = Properties.Resources.LOADED_IFC_FILES; diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.Designer.cs b/IFCGeoRefCheckerGUI/Properties/Resources.Designer.cs index 2aaeca1..8a8abb6 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.Designer.cs +++ b/IFCGeoRefCheckerGUI/Properties/Resources.Designer.cs @@ -69,6 +69,15 @@ internal static string CHECK_SELECTED_FILE { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Checked on ähnelt. + /// + internal static string CheckedOn { + get { + return ResourceManager.GetString("CheckedOn", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die file(s) checked ähnelt. /// @@ -87,6 +96,24 @@ internal static string FILES_LOADED_FORMAT { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die is fullfilled ✓ ähnelt. + /// + internal static string Fulfilled { + get { + return ResourceManager.GetString("Fulfilled", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die IfcVersion ähnelt. + /// + internal static string IfcVersion { + get { + return ResourceManager.GetString("IfcVersion", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Input IFC-Files ähnelt. /// @@ -132,6 +159,51 @@ internal static string LOG_OUTPUT { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Map Conversion orthoghonal height is ähnelt. + /// + internal static string MapConversion { + get { + return ResourceManager.GetString("MapConversion", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Maximum coordinates are ähnelt. + /// + internal static string MaxCoordinates { + get { + return ResourceManager.GetString("MaxCoordinates", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die is not fulfilled ähnelt. + /// + internal static string NotFulfilled { + get { + return ResourceManager.GetString("NotFulfilled", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die not specified! ähnelt. + /// + internal static string NotSpecified { + get { + return ResourceManager.GetString("NotSpecified", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Placement Z-coordinates ähnelt. + /// + internal static string PlacementZCoordinates { + get { + return ResourceManager.GetString("PlacementZCoordinates", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Please choose path! ähnelt. /// @@ -142,11 +214,29 @@ internal static string PLEASE_CHOOSE_PATH { } /// - /// Sucht eine lokalisierte Zeichenfolge, die IFCGeoRefChecker protocoll for file ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die Postal address referenced by Entity # ähnelt. /// - internal static string PROTOCOL_HEADER { + internal static string PostalAddress { get { - return ResourceManager.GetString("PROTOCOL_HEADER", resourceCulture); + return ResourceManager.GetString("PostalAddress", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die IFCGeoRefChecker protocoll for file {0} ähnelt. + /// + internal static string ProtocolHeader { + get { + return ResourceManager.GetString("ProtocolHeader", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ref elevation and Placement Z-Values of site are ähnelt. + /// + internal static string RefElevationAndZ { + get { + return ResourceManager.GetString("RefElevationAndZ", resourceCulture); } } @@ -186,6 +276,15 @@ internal static string STATUS_REPORT { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die with ähnelt. + /// + internal static string With { + get { + return ResourceManager.GetString("With", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Working directory ähnelt. /// diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.de.resx b/IFCGeoRefCheckerGUI/Properties/Resources.de.resx index bf8ab9e..5842569 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.de.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.de.resx @@ -159,7 +159,40 @@ Datei(en) überprüft - - IFCGeoRefChecker-Protokoll für Datei + + IFCGeoRefChecker-Protokoll für Datei {0} + + + IfcVersion + + + Geprüft + + + Maximale Koordinaten sind + + + Referenzhöhe und Z-Werte des Grundstücks sind + + + nicht angegeben! + + + Z-Koordinaten des Grundstücks + + + Die orthogonale Höhe der Map Conversion beträgt + + + ist erfüllt ✓ + + + ist nicht erfüllt + + + mit + + + Postal address, referenziert durch die Entität # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.es.resx b/IFCGeoRefCheckerGUI/Properties/Resources.es.resx index 7a01233..ae92b28 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.es.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.es.resx @@ -159,7 +159,40 @@ archivo(s) comprobado(s) - - Protocolo IFCGeoRefChecker para archivo + + Protocolo IFCGeoRefChecker para el archivo {0} + + + Versión Ifc + + + Comprobado + + + Las coordenadas máximas son + + + Los valores de elevación de referencia y ubicación Z del sitio son + + + No especificado! + + + Coordenadas Z de colocación + + + La altura ortogonal de Map Conversion es + + + está cumplido ✓ + + + no se cumple + + + con + + + Dirección postal referenciada por la Entidad # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.fr.resx b/IFCGeoRefCheckerGUI/Properties/Resources.fr.resx index 18947c3..384dba6 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.fr.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.fr.resx @@ -159,7 +159,40 @@ fichier(s) vérifié(s) - - Protocole IFCGeoRefChecker pour le fichier + + Protocole IFCGeoRefChecker pour le fichier {0} + + + Version Ifc + + + Vérifié + + + Les coordonnées maximales sont + + + Les valeurs Z d'élévation de référence et de placement du site sont + + + non spécifié! + + + Coordonnées Z de placement + + + La hauteur orthogonale de Map Conversion est + + + est rempli ✓ + + + n'est pas rempli + + + avec + + + Adresse postale référencée par Entité # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.it.resx b/IFCGeoRefCheckerGUI/Properties/Resources.it.resx index 5c32cfd..d87ca34 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.it.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.it.resx @@ -159,7 +159,40 @@ file controllati - - Protocollo IFCGeoRefChecker per file + + Protocollo IFCGeoRefChecker per il file {0} + + + IfcVersione + + + Controllato + + + Le coordinate massime sono + + + I valori Z dell'elevazione del riferimento e del posizionamento del sito sono + + + non specificato! + + + Posizionamento delle coordinate Z + + + L'altezza ortogonale della Map Conversion è + + + è soddisfatto ✓ + + + non è soddisfatto + + + con + + + Indirizzo postale a cui fa riferimento l'entità # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.pt.resx b/IFCGeoRefCheckerGUI/Properties/Resources.pt.resx index 9d74b1d..84bbdf0 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.pt.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.pt.resx @@ -159,7 +159,40 @@ arquivo(s) verificado(s) - - Protocolo IFCGeoRefChecker para arquivo + + Protocolo IFCGeoRefChecker para arquivo {0} + + + Versão Ifc + + + Verificado + + + As coordenadas máximas são + + + Elevação de referência e valores Z de posicionamento do site são + + + não especificado! + + + Coordenadas Z de posicionamento + + + A altura ortogonal da Map Conversion é + + + está cumprido ✓ + + + não está cumprido + + + com + + + Endereço postal referenciado pela Entidade # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/Properties/Resources.resx b/IFCGeoRefCheckerGUI/Properties/Resources.resx index 6989409..d11f95d 100644 --- a/IFCGeoRefCheckerGUI/Properties/Resources.resx +++ b/IFCGeoRefCheckerGUI/Properties/Resources.resx @@ -159,7 +159,40 @@ file(s) checked - - IFCGeoRefChecker protocoll for file + + IFCGeoRefChecker protocoll for file {0} + + + IfcVersion + + + Checked on + + + Maximum coordinates are + + + Ref elevation and Placement Z-Values of site are + + + not specified! + + + Placement Z-coordinates + + + Map Conversion orthoghonal height is + + + is fullfilled ✓ + + + is not fulfilled + + + with + + + Postal address referenced by Entity # \ No newline at end of file diff --git a/IFCGeoRefCheckerGUI/ResxConverter.cs b/IFCGeoRefCheckerGUI/ResxConverter.cs index fdc5dca..c931c00 100644 --- a/IFCGeoRefCheckerGUI/ResxConverter.cs +++ b/IFCGeoRefCheckerGUI/ResxConverter.cs @@ -1,11 +1,12 @@ using IFCGeoRefCheckerGUI.Properties; +using IFCGeorefShared; using System; using System.Globalization; using System.Windows.Data; namespace IFCGeoRefCheckerGUI { - public class ResxConverter : IValueConverter + public class ResxConverter : IValueConverter, ITranslator { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { @@ -21,5 +22,10 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu { throw new NotImplementedException(); } + + public string Translate(string key, CultureInfo culture) + { + return Resources.ResourceManager.GetString(key, culture); + } } } diff --git a/IFCGeoRefCheckerGUI/ViewModels/CheckViewModel.cs b/IFCGeoRefCheckerGUI/ViewModels/CheckViewModel.cs index 38ab9b0..f9aeb03 100644 --- a/IFCGeoRefCheckerGUI/ViewModels/CheckViewModel.cs +++ b/IFCGeoRefCheckerGUI/ViewModels/CheckViewModel.cs @@ -19,6 +19,7 @@ public class CheckViewModel : BaseViewModel { IEventAggregator eventAggregator; List? eventSubscriptions; + ITranslator translator = new ResxConverter(); private GeoRefCheckerResult checkerResults; public GeoRefCheckerResult CheckerResults @@ -114,7 +115,7 @@ public int NrOfChecks public event EventHandler? FileNotYetChecked; public CheckViewModel(IEventAggregator eventAggregator) - { + { this.eventAggregator = eventAggregator; this.eventSubscriptions = new List @@ -171,7 +172,7 @@ private async Task IfcCheckService() Log.Information($"Starting to check {selectedPath}"); using (var model = IfcStore.Open(selectedPath)) { - var checker = new GeoRefChecker(model); + var checker = new GeoRefChecker(model, translator); CheckerResults = checker.getCheckResults(); if (CheckerDict.ContainsKey(selectedPath)) { diff --git a/IFCGeoRefCheckerGUI/ViewModels/MainWindowViewModel.cs b/IFCGeoRefCheckerGUI/ViewModels/MainWindowViewModel.cs index c466116..4587128 100644 --- a/IFCGeoRefCheckerGUI/ViewModels/MainWindowViewModel.cs +++ b/IFCGeoRefCheckerGUI/ViewModels/MainWindowViewModel.cs @@ -55,7 +55,7 @@ public MainWindowViewModel() { filePanelViewModel = new FilePanelViewModel(this.eventAggregator); checkViewModel = new CheckViewModel(this.eventAggregator); - string? value = rm.GetString("LOAD_IFC_FILES"); + //string? value = rm.GetString("LOAD_IFC_FILES"); this.eventSubscriptions = new List { diff --git a/IFCGeorefShared/GeoRefChecker.cs b/IFCGeorefShared/GeoRefChecker.cs index a1f5898..8d23a1e 100644 --- a/IFCGeorefShared/GeoRefChecker.cs +++ b/IFCGeorefShared/GeoRefChecker.cs @@ -17,11 +17,15 @@ using OSGeo.OGR; using System.ComponentModel; using Xbim.Ifc.Extensions; +using System.Resources; + namespace IFCGeorefShared { public class GeoRefChecker { + private readonly TranslationService _translationService; + public string? TimeCheckedFileCreated { get; set; } public string? TimeChecked { get; set; } @@ -89,7 +93,7 @@ public IList LoGeoRef50 private IfcStore model { get; set; } private List BuildingsAndSites = new List(); - public GeoRefChecker(IfcStore model) { + public GeoRefChecker(IfcStore model, ITranslator translator) { this.model = model; BuildingsAndSites = new IIfcSpatialStructureElement[0] .Concat(model.Instances.OfType()) @@ -105,6 +109,12 @@ public GeoRefChecker(IfcStore model) { this.TimeChecked = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"); this.ifcVersion = this.model.SchemaVersion; this.FilePath = this.model.FileName; + + if (translator == null) + { + throw new ArgumentNullException(nameof(translator)); + } + _translationService = new TranslationService(translator); } private void checkGeneralProps() @@ -486,27 +496,45 @@ public void WriteProtocoll(string WorkingDirPath) { var sb = new StringBuilder(); + sb.AppendLine($"{_translationService.Translate("ProtocolHeader", CultureInfo.CurrentCulture)} {this.model.FileName}"); + sb.AppendLine($"{_translationService.Translate("IfcVersion", CultureInfo.CurrentCulture)}: {this.model.SchemaVersion}"); + sb.AppendLine($"{_translationService.Translate("CheckedOn", CultureInfo.CurrentCulture)}: {this.TimeChecked}"); + sb.AppendLine($"{_translationService.Translate("MaxCoordinates", CultureInfo.CurrentCulture)}: X: {this.GenProps!.X} Y: {this.GenProps.Y} Z: {this.GenProps.Z}"); + sb.AppendLine(); + sb.AppendLine($"{_translationService.Translate("RefElevationAndZ", CultureInfo.CurrentCulture)}: "); + + + /* sb.AppendLine($"IFCGeoRefChecker protocoll for file {this.model.FileName}"); sb.AppendLine($"IfcVersion: {this.model.SchemaVersion}"); sb.AppendLine($"Checked on {this.TimeChecked}"); sb.AppendLine($"Maximum coordinates are X: {this.GenProps!.X} Y: {this.GenProps.Y} Z: {this.GenProps.Z}"); sb.AppendLine(); sb.AppendLine($"Ref elevation and Placement Z-Values of site are: ");//+ String.Join(' ', this.GenProps.SiteElevDict!.Values.ToList())); + */ foreach (var site in this.GenProps.SitePlcmtZDict!) { - var elevation = this.GenProps.SiteElevDict!.ContainsKey(site.Key) ? Invariant($"{GenProps.SiteElevDict[site.Key]}") : "not specified"; - sb.AppendLine($"GUID: {site.Key}\t\t RefElevation: {elevation}\t\tPlacement Z-coordinates: {site.Value}"); + var elevation = this.GenProps.SiteElevDict!.ContainsKey(site.Key) ? Invariant($"{GenProps.SiteElevDict[site.Key]}") : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture); + sb.AppendLine($"GUID: {site.Key}\t\t RefElevation: {elevation}\t\t{_translationService.Translate("PlacementZCoordinates", CultureInfo.CurrentCulture)}: {site.Value}"); + //var elevation = this.GenProps.SiteElevDict!.ContainsKey(site.Key) ? Invariant($"{GenProps.SiteElevDict[site.Key]}") : "not specified"; + //sb.AppendLine($"GUID: {site.Key}\t\t RefElevation: {elevation}\t\tPlacement Z-coordinates: {site.Value}"); } sb.AppendLine(); - sb.AppendLine($"IfcGeometricRepresentationContext placement z-coordinates are:"); // + String.Join(' ', this.GenProps.ContextPlcmtElev!.Values.ToList())); + sb.AppendLine($"IfcGeometricRepresentationContext {_translationService.Translate("PlacementZCoordinates", CultureInfo.CurrentCulture)} are:"); + //sb.AppendLine($"IfcGeometricRepresentationContext placement z-coordinates are:"); // + String.Join(' ', this.GenProps.ContextPlcmtElev!.Values.ToList())); foreach (var context in this.GenProps.ContextPlcmtElev!) { - sb.AppendLine($"Context {context.Key}\t\t Placement Z-coordinate: {context.Value}"); + sb.AppendLine($"Context {context.Key}\t\t {_translationService.Translate("PlacementZCoordinates", CultureInfo.CurrentCulture)}: {context.Value}"); + //sb.AppendLine($"Context {context.Key}\t\t Placement Z-coordinate: {context.Value}"); } sb.AppendLine(); - if (this.GenProps.mapConvHeight != null) { sb.AppendLine($"Map Conversion orthoghonal height is: {this.GenProps.mapConvHeight}"); } + if (this.GenProps.mapConvHeight != null) + { + sb.AppendLine($"{_translationService.Translate("MapConversion", CultureInfo.CurrentCulture)}: {this.GenProps.mapConvHeight}"); + //sb.AppendLine($"Map Conversion orthoghonal height is: {this.GenProps.mapConvHeight}"); + } sb.AppendLine(); @@ -538,7 +566,8 @@ private string WriteResultLvl10() var sb = new StringBuilder(); var lvl10Result = this.getCheckResults().level10Fulfilled; - var result = (lvl10Result.HasValue && lvl10Result.Value) ? $"LoGeoRef 10 is fulfilled ✓" : $"LoGeoRef 10 is not fulfilled"; + var result = (lvl10Result.HasValue && lvl10Result.Value) ? $"LoGeoRef10 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef10 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"; + //var result = (lvl10Result.HasValue && lvl10Result.Value) ? $"LoGeoRef 10 is fulfilled \u2713" : $"LoGeoRef 10 is not fulfilled"; sb.AppendLine(result); sb.AppendLine(); sb.AppendLine(dashLine); @@ -548,27 +577,28 @@ private string WriteResultLvl10() { if (lvl10.IsFullFilled) { - string header = $"Postal address referenced by Entity #{lvl10.ReferencedEntity!.EntityLabel} {lvl10.ReferencedEntity!.GetType().Name} with GUID {lvl10.ReferencedEntity.GlobalId}"; + string header = $"{_translationService.Translate("PostalAddress", CultureInfo.CurrentCulture)}{lvl10.ReferencedEntity!.EntityLabel} {lvl10.ReferencedEntity!.GetType().Name} {_translationService.Translate("With", CultureInfo.CurrentCulture)} GUID {lvl10.ReferencedEntity.GlobalId}"; + //string header = $"Postal address referenced by Entity #{lvl10.ReferencedEntity!.EntityLabel} {lvl10.ReferencedEntity!.GetType().Name} with GUID {lvl10.ReferencedEntity.GlobalId}"; sb.AppendLine(header); var PostalAddress = lvl10.PostalAddress; - string info = $"Country: {(PostalAddress!.Country != "" ? PostalAddress!.Country : "not specified!")} \t\tRegion: {(PostalAddress!.Region != "" ? PostalAddress!.Region : "not specified!")}"; - info += $"\nTown: {(PostalAddress!.Town != "" ? PostalAddress!.Town : "not specified!")} \t\tPostal Code: {(PostalAddress!.PostalCode != "" ? PostalAddress!.PostalCode : "not specified!")}"; + string info = $"Country: {(PostalAddress!.Country != "" ? PostalAddress!.Country : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))} \t\tRegion: {(PostalAddress!.Region != "" ? PostalAddress!.Region : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}"; + info += $"\nTown: {(PostalAddress!.Town != "" ? PostalAddress!.Town : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))} \t\tPostal Code: {(PostalAddress!.PostalCode != "" ? PostalAddress!.PostalCode : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}"; foreach(var line in PostalAddress.AddressLines) { - info += $"\nAddress: {(line.ToString() != "" ? line.ToString() : "not specified!")}"; + info += $"\nAddress: {(line.ToString() != "" ? line.ToString() : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}"; } sb.AppendLine(info); sb.AppendLine(); - sb.AppendLine($"LoGeoRef10 is fulfilled ✓"); + sb.AppendLine($"LoGeoRef10 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}"); } else { sb.AppendLine($"No postal address found for Entity #{lvl10.ReferencedEntity!.EntityLabel} {lvl10.ReferencedEntity!.GetType().Name} with GUID {lvl10.ReferencedEntity.GlobalId}"); sb.AppendLine(); - sb.AppendLine($"LoGeoRef10 is not fulfilled"); + sb.AppendLine($"LoGeoRef10 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"); } sb.AppendLine(); @@ -588,7 +618,8 @@ private string WriteResultLvl20() var sb = new StringBuilder(); var lvl20Result = this.getCheckResults().level20Fulfilled; - var result = (lvl20Result.HasValue && lvl20Result.Value) ? $"LoGeoRef 20 is fulfilled ✓" : $"LoGeoRef 20 is not fulfilled"; + var result = (lvl20Result.HasValue && lvl20Result.Value) ? $"LoGeoRef20 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef20 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"; + //var result = (lvl20Result.HasValue && lvl20Result.Value) ? $"LoGeoRef 20 is fulfilled \u2713" : $"LoGeoRef 20 is not fulfilled"; sb.AppendLine(result); sb.AppendLine(); @@ -600,19 +631,19 @@ private string WriteResultLvl20() if (lvl20.IsFullFilled) { sb.AppendLine($"Geographic location specified by Entity #{lvl20.ReferencedEntity!.EntityLabel} {lvl20.ReferencedEntity!.GetType().Name} with GUID {lvl20.ReferencedEntity.GlobalId}"); - sb.AppendLine(Invariant($"Latitude: {(lvl20!.Latitude != null ? lvl20!.Latitude : "not specified!")} \t\tLongitude: {(lvl20!.Longitude != null ? lvl20!.Longitude : "not specified!")}")); - sb.AppendLine(Invariant($"Elevation: {(lvl20!.Elevation != null ? lvl20!.Elevation : "not specified!")}")); + sb.AppendLine(Invariant($"Latitude: {(lvl20!.Latitude != null ? lvl20!.Latitude : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))} \t\tLongitude: {(lvl20!.Longitude != null ? lvl20!.Longitude : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}")); + sb.AppendLine(Invariant($"Elevation: {(lvl20!.Elevation != null ? lvl20!.Elevation : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}")); _ = lvl20.GeographicDescription != null ? sb.AppendLine($"According to these coordinates this {lvl20.GeographicDescription}") : null; sb.AppendLine(); - sb.AppendLine($"LoGeoRef20 is fulfilled \u2713"); + sb.AppendLine($"LoGeoRef20 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}"); } else { sb.AppendLine($"No (valid) geographic location found for Entity #{lvl20.ReferencedEntity!.EntityLabel} {lvl20.ReferencedEntity!.GetType().Name} with GUID {lvl20.ReferencedEntity.GlobalId}"); - sb.AppendLine(Invariant($"Latitude: {(lvl20!.Latitude != null ? lvl20!.Latitude : "not specified!")} \t\tLongitude: {(lvl20!.Longitude != null ? lvl20!.Longitude : "not specified!")}")); - sb.AppendLine(Invariant($"Elevation: {(lvl20!.Elevation != null ? lvl20!.Elevation : "not specified!")}")); + sb.AppendLine(Invariant($"Latitude: {(lvl20!.Latitude != null ? lvl20!.Latitude : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))} \t\tLongitude: {(lvl20!.Longitude != null ? lvl20!.Longitude : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}")); + sb.AppendLine(Invariant($"Elevation: {(lvl20!.Elevation != null ? lvl20!.Elevation : _translationService.Translate("NotSpecified", CultureInfo.CurrentCulture))}")); sb.AppendLine(); - sb.AppendLine($"LoGeoRef20 is not fulfilled"); + sb.AppendLine($"LoGeoRef20 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"); } sb.AppendLine(); @@ -641,7 +672,8 @@ private string WriteResultLvl30() var sb = new StringBuilder(); var lvl30Result = this.getCheckResults().level30Fulfilled; - var result = (lvl30Result.HasValue && lvl30Result.Value) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled"; + var result = (lvl30Result.HasValue && lvl30Result.Value) ? $"LoGeoRef30 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef30 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"; + //var result = (lvl30Result.HasValue && lvl30Result.Value) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled"; sb.AppendLine(result); sb.AppendLine(); @@ -668,8 +700,9 @@ private string WriteResultLvl30() sb.AppendLine(Invariant($"Direction of X-axis is ({plcmt.RefDirection.X} | {plcmt.RefDirection.Y})")); } sb.AppendLine(); - - sb.AppendLine((lvl30.IsFullFilled) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled"); + + sb.AppendLine((lvl30.IsFullFilled) ? $"LoGeoRef30 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef30 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"); + //sb.AppendLine((lvl30.IsFullFilled) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled"); sb.AppendLine(); sb.AppendLine(dashLine); @@ -688,7 +721,8 @@ private string WriteResultLvl40() var sb = new StringBuilder(); var lvl40Result = this.getCheckResults().level40Fulfilled; - var result = (lvl40Result.HasValue && lvl40Result.Value) ? $"LoGeoRef40 is fulfilled \u2713" : $"LoGeoRef 40 is not fulfilled"; + var result = (lvl40Result.HasValue && lvl40Result.Value) ? $"LoGeoRef40 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef40 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"; + //var result = (lvl40Result.HasValue && lvl40Result.Value) ? $"LoGeoRef40 is fulfilled \u2713" : $"LoGeoRef 40 is not fulfilled"; sb.AppendLine(result); sb.AppendLine(); @@ -713,7 +747,7 @@ private string WriteResultLvl40() //sb.AppendLine($"True North is: {lvl40.trueNorth!.X} / {lvl40.trueNorth.Y} / {lvl40.trueNorth.Z}"); //trueNorth.Z existiert nicht sb.AppendLine(); - sb.AppendLine("LoGeoRef40 is fulfilled ✓"); + sb.AppendLine($"LoGeoRef40 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}"); } else { @@ -732,7 +766,7 @@ private string WriteResultLvl40() sb.AppendLine("True North is not specified. This defaults to (0 | 1)"); } sb.AppendLine(); - sb.AppendLine("LoGeoref40 is not fulfilled"); + sb.AppendLine($"LoGeoref40 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"); } } @@ -753,7 +787,8 @@ private string WriteResultLvl50() var sb = new StringBuilder(); var lvl50Result = this.getCheckResults().level50Fulfilled; - var result = (lvl50Result.HasValue && lvl50Result.Value) ? $"LoGeoRef50 is fulfilled \u2713" : $"LoGeoRef 50 is not fulfilled"; + var result = (lvl50Result.HasValue && lvl50Result.Value) ? $"LoGeoRef50 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}" : $"LoGeoRef50 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"; + //var result = (lvl50Result.HasValue && lvl50Result.Value) ? $"LoGeoRef50 is fulfilled \u2713" : $"LoGeoRef 50 is not fulfilled"; sb.AppendLine(result); sb.AppendLine(); @@ -792,14 +827,14 @@ private string WriteResultLvl50() sb.AppendLine($"Vertical Datum: {(lvl50.MapConversion.TargetCRS.VerticalDatum.HasValue ? lvl50.MapConversion.TargetCRS.VerticalDatum : "not specified")}"); sb.AppendLine(); - sb.AppendLine("LoGeoRef50 is fulfilled ✓"); + sb.AppendLine($"LoGeoRef50 {_translationService.Translate("Fulfilled", CultureInfo.CurrentCulture)}"); } else { sb.AppendLine($"{(lvl50.context != null ? $"No IfcMapConversion specified by #{lvl50.context.EntityLabel} IfcGeometricRepresentationContext for ContextType {lvl50.context.ContextType}" : "Found no IfcGeometricRepresentationContext")}"); sb.AppendLine(); - sb.AppendLine("LoGeoRef50 is not fulfilled"); + sb.AppendLine($"LoGeoRef50 {_translationService.Translate("NotFulfilled", CultureInfo.CurrentCulture)}"); } diff --git a/IFCGeorefShared/IFCGeorefShared.projitems b/IFCGeorefShared/IFCGeorefShared.projitems index 3960de6..2ecb2e9 100644 --- a/IFCGeorefShared/IFCGeorefShared.projitems +++ b/IFCGeorefShared/IFCGeorefShared.projitems @@ -17,6 +17,7 @@ + diff --git a/IFCGeorefShared/TranslationService.cs b/IFCGeorefShared/TranslationService.cs new file mode 100644 index 0000000..a73cbbf --- /dev/null +++ b/IFCGeorefShared/TranslationService.cs @@ -0,0 +1,22 @@ +using System.Globalization; + +public class TranslationService +{ + private readonly ITranslator _translator; + + public TranslationService(ITranslator translator) + { + _translator = translator; + } + + public string Translate(string key, CultureInfo culture) + { + return _translator.Translate(key, culture); + } +} + +public interface ITranslator +{ + string Translate(string key, CultureInfo culture); +} +