Skip to content

Commit

Permalink
fix protocoll output and equals comparison on level20
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Kaiser committed Mar 28, 2023
1 parent c29ef47 commit 0d0bd10
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 138 deletions.
53 changes: 28 additions & 25 deletions IFCGeorefShared/GeoRefChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public IList<Level50> LoGeoRef50
}
}

public string FilePath { get; }
private IfcStore model { get; set; }
private List<IIfcSpatialStructureElement> BuildingsAndSites = new List<IIfcSpatialStructureElement>();

Expand All @@ -98,22 +99,22 @@ 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;
}

private void checkForLevel10()
{

foreach (var entity in BuildingsAndSites)
{
IIfcPostalAddress address = null;
IIfcPostalAddress address = null!;
if (entity is IIfcSite)
{
address = (entity as IIfcSite).SiteAddress;
address = ((IIfcSite)entity).SiteAddress;
}
else if (entity is IIfcBuilding)
{
address = (entity as IIfcBuilding).BuildingAddress;
address = ((IIfcBuilding)entity).BuildingAddress;
}

var level10 = new Level10();
Expand Down Expand Up @@ -259,12 +260,7 @@ private void checkForLevel40And50()
this.LoGeoRef50.Add(lvl50);
}
}

private void updateAddress()
{

}

public GeoRefCheckerResult getCheckResults()
{
var results = new GeoRefCheckerResult();
Expand Down Expand Up @@ -316,7 +312,7 @@ private string WriteResultLvl10()
var sb = new StringBuilder();

var lvl10Result = this.getCheckResults().level10Fulfilled;
var result = (lvl10Result.HasValue && lvl10Result.Value) ? $"LoGeoRef 10 is fullfilled ✓" : $"LoGeoRef 10 is not fullfilled";
var result = (lvl10Result.HasValue && lvl10Result.Value) ? $"LoGeoRef 10 is fulfilled ✓" : $"LoGeoRef 10 is not fulfilled";
sb.AppendLine(result);
sb.AppendLine();
sb.AppendLine(dashLine);
Expand All @@ -340,13 +336,13 @@ private string WriteResultLvl10()
sb.AppendLine(info);

sb.AppendLine();
sb.AppendLine($"LoGeoRef10 is fullfilled ✓");
sb.AppendLine($"LoGeoRef10 is fulfilled ✓");
}
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 fullfilled");
sb.AppendLine($"LoGeoRef10 is not fulfilled");
}

sb.AppendLine();
Expand All @@ -366,7 +362,7 @@ private string WriteResultLvl20()
var sb = new StringBuilder();

var lvl20Result = this.getCheckResults().level20Fulfilled;
var result = (lvl20Result.HasValue && lvl20Result.Value) ? $"LoGeoRef 20 is fullfilled ✓" : $"LoGeoRef 20 is not fullfilled";
var result = (lvl20Result.HasValue && lvl20Result.Value) ? $"LoGeoRef 20 is fulfilled ✓" : $"LoGeoRef 20 is not fulfilled";

sb.AppendLine(result);
sb.AppendLine();
Expand All @@ -381,13 +377,13 @@ private string WriteResultLvl20()
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();
sb.AppendLine($"LoGeoRef20 is fullfilled \u2713");
sb.AppendLine($"LoGeoRef20 is fulfilled \u2713");
}
else
{
sb.AppendLine($"No geographic location found for Entity #{lvl20.ReferencedEntity!.EntityLabel} {lvl20.ReferencedEntity!.GetType().Name} with GUID {lvl20.ReferencedEntity.GlobalId}");
sb.AppendLine();
sb.AppendLine($"LoGeoRef20 is not fullfilled");
sb.AppendLine($"LoGeoRef20 is not fulfilled");
}
}

Expand All @@ -410,7 +406,7 @@ private string WriteResultLvl30()
var sb = new StringBuilder();

var lvl30Result = this.getCheckResults().level30Fulfilled;
var result = (lvl30Result.HasValue && lvl30Result.Value) ? $"LoGeoRef30 is fullfilled \u2713" : $"LoGeoRef30 is not fullfilled";
var result = (lvl30Result.HasValue && lvl30Result.Value) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled";

sb.AppendLine(result);
sb.AppendLine();
Expand Down Expand Up @@ -438,7 +434,7 @@ private string WriteResultLvl30()
}
sb.AppendLine();

sb.AppendLine((lvl30.IsFullFilled) ? $"LoGeoRef30 is fullfilled \u2713" : $"LoGeoRef30 is not fullfilled");
sb.AppendLine((lvl30.IsFullFilled) ? $"LoGeoRef30 is fulfilled \u2713" : $"LoGeoRef30 is not fulfilled");

sb.AppendLine();
sb.AppendLine(dashLine);
Expand All @@ -457,7 +453,7 @@ private string WriteResultLvl40()
var sb = new StringBuilder();

var lvl40Result = this.getCheckResults().level40Fulfilled;
var result = (lvl40Result.HasValue && lvl40Result.Value) ? $"LoGeoRef40 is fullfilled \u2713" : $"LoGeoRef 40 is not fullfilled";
var result = (lvl40Result.HasValue && lvl40Result.Value) ? $"LoGeoRef40 is fulfilled \u2713" : $"LoGeoRef 40 is not fulfilled";

sb.AppendLine(result);
sb.AppendLine();
Expand All @@ -468,7 +464,7 @@ private string WriteResultLvl40()
{
if (lvl40.context != null)
{
sb.AppendLine($"IfcProject (#{lvl40.project!.EntityLabel}, {lvl40.project!.GlobalId}) references IfcGeometricRepresentationContext (Identifier: {lvl40.context.EntityLabel}) and type: {lvl40.context.ContextType}");
sb.AppendLine($"IfcProject (#{lvl40.project!.EntityLabel}, {lvl40.project!.GlobalId}) references IfcGeometricRepresentationContext (#{lvl40.context.EntityLabel}) of type: {lvl40.context.ContextType}");

if (lvl40.IsFullFilled)
{
Expand All @@ -479,17 +475,21 @@ private string WriteResultLvl40()
sb.AppendLine($"Z: {lvl40.wcs.Location.Z}");
sb.AppendLine();
sb.AppendLine($"True North is: {lvl40.trueNorth!.X} / {lvl40.trueNorth.Y} / {lvl40.trueNorth.Z}");

sb.AppendLine();
sb.AppendLine("LoGeoRef40 is fulfilled ✓");
}
else
{
sb.AppendLine($"World Coordinate System is not properly specified");
sb.AppendLine($"Attribute World Coordinate System of IfcGeometricRepresentationContext is not properly specified");
sb.AppendLine();
sb.AppendLine("LoGeoref40 is not fullfilled");
sb.AppendLine("LoGeoref40 is not fulfilled");
}
}

sb.AppendLine();
sb.AppendLine(dashLine);
sb.AppendLine();
}

sb.AppendLine();
Expand All @@ -504,7 +504,7 @@ private string WriteResultLvl50()
var sb = new StringBuilder();

var lvl50Result = this.getCheckResults().level50Fulfilled;
var result = (lvl50Result.HasValue && lvl50Result.Value) ? $"LoGeoRef50 is fullfilled \u2713" : $"LoGeoRef 50 is not fullfilled";
var result = (lvl50Result.HasValue && lvl50Result.Value) ? $"LoGeoRef50 is fulfilled \u2713" : $"LoGeoRef 50 is not fulfilled";

sb.AppendLine(result);
sb.AppendLine();
Expand All @@ -522,7 +522,7 @@ private string WriteResultLvl50()
var xAxisAbscissa = lvl50.MapConversion.XAxisAbscissa;
var XaxisOrdinate = lvl50.MapConversion.XAxisOrdinate;

sb.AppendLine($"IfcMapConversion defined in #{lvl50.MapConversion.EntityLabel}");
sb.AppendLine($"IfcMapConversion defined in #{lvl50.MapConversion.EntityLabel} for {lvl50.context!.GetType().Name} (#{lvl50.context.EntityLabel}) for ContextType {lvl50.context.ContextType}");
sb.AppendLine($"Translation Eastings: {lvl50.MapConversion.Eastings}");
sb.AppendLine($"Translation Northings: {lvl50.MapConversion.Northings}");
sb.AppendLine($"Translation Height: {lvl50.MapConversion.OrthogonalHeight}");
Expand All @@ -537,12 +537,15 @@ private string WriteResultLvl50()
sb.AppendLine($"Geodetic Datum: {(lvl50.MapConversion.TargetCRS.GeodeticDatum.HasValue ? lvl50.MapConversion.TargetCRS.GeodeticDatum : "not specified")}");
sb.AppendLine($"Vertical Datum: {(lvl50.MapConversion.TargetCRS.VerticalDatum.HasValue ? lvl50.MapConversion.TargetCRS.VerticalDatum : "not specified")}");

sb.AppendLine();
sb.AppendLine("LoGeoRef50 is fulfilled ✓");

}
else
{
sb.AppendLine($"{(lvl50.context != null ? $"No IfcMapConversion specified by #{lvl50.context.EntityLabel} IfcGeometricRepresentationContext {lvl50.context.ContextType}" : "Found no IfcGeometricRepresentationContext")}");
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 fullfilled");
sb.AppendLine("LoGeoRef50 is not fulfilled");

}

Expand Down
1 change: 0 additions & 1 deletion IFCGeorefShared/IFCGeorefShared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
<Compile Include="$(MSBuildThisFileDirectory)Levels\Level30.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Levels\Level40.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Levels\Level50.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PlacementXYZ.cs" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion IFCGeorefShared/Levels/Level20.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Level20 : Level00, IEquatable<Level20>

public double? Elevation { get; set; }

public bool Equals(Level20 other)
public bool Equals(Level20? other)
{
if (other == null || this == null)
return false;
Expand Down
111 changes: 0 additions & 111 deletions IFCGeorefShared/PlacementXYZ.cs

This file was deleted.

0 comments on commit 0d0bd10

Please sign in to comment.