From 3a87ef285a844561286d49981fb165b4f6d1fa24 Mon Sep 17 00:00:00 2001 From: Daniel Lepold Date: Mon, 9 Sep 2024 11:32:11 +0200 Subject: [PATCH] Feature/bmspt 299 super bcf file (#22) * [BMSPT-299] generation of superbcf file * [BMSPT-299] test file fix * [BMSPT-299] more realistic bcf files --- .../VisualizationInfoBuilderExtension.cs | 8 +- .../Builder/Bcf30/MarkupBuilderExensions.cs | 5 + .../OrthogonalCameraBuilderExtensions.cs | 33 ++ .../PerspectiveCameraBuilderExtensions.cs | 31 ++ .../Builder/Bcf30/ViewPointBuilder.cs | 2 +- .../Bcf30/ViewPointBuilderExtensions.cs | 11 + .../VisualizationInfoBuilderExtensions.cs | 15 + src/tests/Builder/Bcf21/BcfBuilderTests.cs | 18 +- src/tests/Builder/Bcf21/SuperBcfFile.cs | 260 +++++++++++++++ src/tests/Builder/Bcf30/BcfBuilderTests.cs | 2 +- src/tests/Builder/Bcf30/SuperBcfFile.cs | 297 ++++++++++++++++++ src/tests/Resources/Bcf/v2.1/super21.bcfzip | Bin 0 -> 2848 bytes src/tests/Resources/Bcf/v3.0/super30.bcfzip | Bin 0 -> 3148 bytes 13 files changed, 669 insertions(+), 13 deletions(-) create mode 100644 src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs create mode 100644 src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs create mode 100644 src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs create mode 100644 src/tests/Builder/Bcf21/SuperBcfFile.cs create mode 100644 src/tests/Builder/Bcf30/SuperBcfFile.cs create mode 100644 src/tests/Resources/Bcf/v2.1/super21.bcfzip create mode 100644 src/tests/Resources/Bcf/v3.0/super30.bcfzip diff --git a/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs b/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs index e66e3a6..054aa18 100644 --- a/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs +++ b/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using BcfToolkit.Model; using BcfToolkit.Model.Bcf21; namespace BcfToolkit.Builder.Bcf21; @@ -51,6 +49,12 @@ public VisualizationInfoBuilder SetPerspectiveCamera( return this; } + public VisualizationInfoBuilder SetViewSetupHints( + ViewSetupHints? viewSetupHints) { + _visualizationInfo.GetComponentsInstance().ViewSetupHints = viewSetupHints; + return this; + } + } \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs b/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs index 89d4ef1..a9de83f 100644 --- a/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs +++ b/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs @@ -44,4 +44,9 @@ public MarkupBuilder AddDocumentReferences( documentReferences.ForEach(_markup.Topic.DocumentReferences.Add); return this; } + + public MarkupBuilder SetBimSnippet(BimSnippet bimSnippet) { + _markup.Topic.BimSnippet = bimSnippet; + return this; + } } \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs new file mode 100644 index 0000000..5835184 --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs @@ -0,0 +1,33 @@ +using BcfToolkit.Model.Bcf30; + +namespace BcfToolkit.Builder.Bcf30; + +public partial class OrthogonalCameraBuilder { + public OrthogonalCameraBuilder SetCameraViewPoint(double x, double y, double z) { + _camera.CameraViewPoint = new Point { + X = x, + Y = y, + Z = z + }; + return this; + } + + public OrthogonalCameraBuilder SetCameraDirection(double x, double y, double z) { + _camera.CameraDirection = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + + public OrthogonalCameraBuilder SetCameraUpVector(double x, double y, double z) { + _camera.CameraUpVector = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs new file mode 100644 index 0000000..b36a081 --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs @@ -0,0 +1,31 @@ +using BcfToolkit.Model.Bcf30; +namespace BcfToolkit.Builder.Bcf30; + +public partial class PerspectiveCameraBuilder { + public PerspectiveCameraBuilder SetCameraViewPoint(double x, double y, double z) { + _camera.CameraViewPoint = new Point { + X = x, + Y = y, + Z = z + }; + return this; + } + + public PerspectiveCameraBuilder SetCameraDirection(double x, double y, double z) { + _camera.CameraDirection = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + + public PerspectiveCameraBuilder SetCameraUpVector(double x, double y, double z) { + _camera.CameraUpVector = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs index c92c444..400b0ff 100644 --- a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs +++ b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs @@ -6,7 +6,7 @@ namespace BcfToolkit.Builder.Bcf30; -public class ViewPointBuilder : IViewPointBuilder< +public partial class ViewPointBuilder : IViewPointBuilder< ViewPointBuilder, VisualizationInfoBuilder> { private readonly ViewPoint _viewPoint = new(); diff --git a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs new file mode 100644 index 0000000..64509ff --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs @@ -0,0 +1,11 @@ +using BcfToolkit.Model.Bcf30; + +namespace BcfToolkit.Builder.Bcf30; + +public partial class ViewPointBuilder { + + public ViewPointBuilder SetVisualizationInfo(VisualizationInfo visualizationInfo) { + _viewPoint.VisualizationInfo = visualizationInfo; + return this; + } +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs index 0d1c2e9..fdfd26a 100644 --- a/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs +++ b/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs @@ -30,4 +30,19 @@ public VisualizationInfoBuilder AddBitmaps(List? bitmaps) { bitmaps?.ForEach(_visualizationInfo.Bitmaps.Add); return this; } + + public VisualizationInfoBuilder SetOrthogonalCamera(OrthogonalCamera orthogonalCamera) { + _visualizationInfo.OrthogonalCamera = orthogonalCamera; + return this; + } + + public VisualizationInfoBuilder SetPerspectiveCamera(PerspectiveCamera perspectiveCamera) { + _visualizationInfo.PerspectiveCamera = perspectiveCamera; + return this; + } + + public VisualizationInfoBuilder SetVisibility(ComponentVisibility visibility) { + _visualizationInfo.GetComponentsInstance().Visibility = visibility; + return this; + } } \ No newline at end of file diff --git a/src/tests/Builder/Bcf21/BcfBuilderTests.cs b/src/tests/Builder/Bcf21/BcfBuilderTests.cs index 855845b..8179a80 100644 --- a/src/tests/Builder/Bcf21/BcfBuilderTests.cs +++ b/src/tests/Builder/Bcf21/BcfBuilderTests.cs @@ -35,9 +35,9 @@ public void EmptyFieldsConversationTest() { headerBuilder .SetDate(DateTime.Now) .SetReference(string.Empty) - .SetFileName("Filename") - .SetIfcProject("1234567890123456789012") - .SetIfcSpatialStructureElement("1234567890123456789012") + .SetFileName("StructuralModel.ifc") + .SetIfcProject("1g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("2g8GxLEzP459ZWW6_RGsez") .SetIsExternal(true) .Build(); var headers = new List { header }; @@ -62,8 +62,8 @@ public void EmptyFieldsConversationTest() { .SetModifiedAuthor(string.Empty) .SetDate(DateTime.Today) .SetModifiedDate(DateTime.Today) - .SetAuthor("author1") - .SetCommentProperty("commProp1") + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("Pls changes the wall thickness to 8cm") .Build(); var commentPropCanBeEmpty = commentBuilder2 @@ -71,8 +71,8 @@ public void EmptyFieldsConversationTest() { .SetModifiedAuthor(string.Empty) .SetDate(DateTime.Today) .SetModifiedDate(DateTime.Today) - .SetAuthor("author2") - .SetViewPointGuid("111b4df2-0187-49a9-8a4a-23992696bafd") + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("444b4df2-0187-49a9-8a4a-23992696bafd") .SetCommentProperty(string.Empty) .Build(); var comments = new List { commentPropMustHaveValue, commentPropCanBeEmpty }; @@ -83,7 +83,7 @@ public void EmptyFieldsConversationTest() { var componentBuilder = new ComponentBuilder(); var component = componentBuilder - .SetIfcGuid("1234567890123456789012") + .SetIfcGuid("3g8GxLEzP459ZWW6_RGsez") .SetOriginatingSystem(string.Empty) .SetAuthoringToolId(string.Empty) .Build(); @@ -104,7 +104,7 @@ public void EmptyFieldsConversationTest() { var viewPoint = viewPointBuilder .SetGuid("444b4df2-0187-49a9-8a4a-23992696bafd") - .SetIndex(5) + .SetIndex(0) .SetSnapshot(string.Empty) .SetSnapshotData(new FileData { Data = "snapshotdata1" diff --git a/src/tests/Builder/Bcf21/SuperBcfFile.cs b/src/tests/Builder/Bcf21/SuperBcfFile.cs new file mode 100644 index 0000000..96989c7 --- /dev/null +++ b/src/tests/Builder/Bcf21/SuperBcfFile.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using BcfToolkit; +using BcfToolkit.Builder.Bcf21; +using BcfToolkit.Converter; +using BcfToolkit.Model; +using BcfToolkit.Model.Bcf21; +using NUnit.Framework; + +namespace tests.Builder.Bcf21; + + +public class SuperBcfFile { + private BcfBuilder _builder = null!; + private IConverter _converter = null!; + private Worker _worker; + + [SetUp] + public void Setup() { + _builder = new BcfBuilder(); + _converter = new BcfToolkit.Converter.Bcf21.Converter(); + _worker = new Worker(); + } + + [Test] + public async Task CreateSuperBcf21File() { + + var labels = new List { "label1", "label2", }; + var referenceLinks = new List { "http://www.buildingsmart-tech.org", "www.google.com" }; + + + // Header + var headerBuilder = new HeaderFileBuilder(); + var header = + headerBuilder + .SetDate(DateTime.Now) + .SetReference("reference") + .SetFileName("Bauprojekt1.ifc") + .SetIfcProject("4g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("128GxLEzP459ZWW6_RGsez") + .SetIsExternal(true) + .Build(); + var headers = new List { header }; + + // DocumentReference + var topicDocumentReferenceBuilder = new DocumentReferenceBuilder(); + var topicDocumentReference = + topicDocumentReferenceBuilder + .SetDescription("This is a document ref") + .SetIsExternal(false) + .SetGuid("000b4df2-0187-49a9-8a4a-23992696bafd") + .SetReferencedDocument("ref_document.png") + .Build(); + + var topicDocumentReferenceExternal = + topicDocumentReferenceBuilder + .SetDescription("BCFv1 Markup Schema") + .SetIsExternal(true) + .SetReferencedDocument("http://www.buildingsmart-tech.org/specifications/bcf-releases/bcfxml-v1/markup.xsd/at_download/file<") + .Build(); + + topicDocumentReference.DocumentData = new FileData { + Mime = "image/png", + Data = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=" + }; + var topicDocumentReferences = new List + {topicDocumentReference, topicDocumentReferenceExternal}; + + // Comments + var commentBuilder1 = new CommentBuilder(); + var commentBuilder2 = new CommentBuilder(); + var comment1 = + commentBuilder1 + .SetGuid("998b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("This wall should be moved 1cm left.") + .Build(); + var comment2 = + commentBuilder2 + .SetGuid("997b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("jim.carry@jim.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("444b4df2-0187-49a9-8a4a-23992696bafd") + .SetCommentProperty("This wall should be moved 2cm left.") + .Build(); + var comments = new List + {comment1, comment2}; + + // Viewpoint + var visualizationInfoBuilder = new VisualizationInfoBuilder(); + + var componentBuilder = new ComponentBuilder(); + var component = + componentBuilder + .SetIfcGuid("0g8GxLEzP459ZWW6_RGsez") + .SetOriginatingSystem("originatingSystem") + .SetAuthoringToolId("authoringToolId") + .Build(); + var components = new List { component }; + + var visibilityBuilder = new VisibilityBuilder(); + var compVis = + visibilityBuilder + .SetDefaultVisibility(true) + .AddExceptions(components) + .Build(); + + var orthoBuilder = new OrthogonalCameraBuilder(); + var ortho = + orthoBuilder + .SetCameraDirection(1.2, 2.4, 3.6) + .SetCameraUpVector(11.2, 21.4, 31.6) + .SetCameraViewPoint(11.2, 12.4, 13.6) + .SetViewToWorldScale(1.0) + .Build(); + + var vsHintBuilder = new ViewSetupHintsBuilder(); + var vsHint = + vsHintBuilder + .SetOpeningVisible(true) + .SetSpaceVisible(true) + .SetSpaceBoundariesVisible(true) + .Build(); + + + var bitmapBuilder = new BitmapBuilder(); + var bitmap = + bitmapBuilder + .SetReference("reference") + .SetUp(41.2, 24.4, 43.6) + .SetFormat("Png") + .SetHeight(3.2) + .SetLocation(13.2, 23.4, 33.6) + .SetNormal(31.2, 32.4, 33.6) + .Build(); + var visBitmaps = new List { bitmap, bitmap }; + + var coloringBuilder = new ComponentColoringColorBuilder(); + var coloring = + coloringBuilder + .SetColor("40E0D0") + .AddComponents(components) + .Build(); + var colorings = new List { coloring, coloring }; + + var clippingPlaneBuilder = new ClippingPlaneBuilder(); + + var clippingPlane = + clippingPlaneBuilder + .SetLocation(15.2, 2.4, 3.6) + .SetDirection(1.2, 52.4, 3.6) + .Build(); + var clippingPlanes = new List { clippingPlane, clippingPlane }; + + var visualizationInfo = + visualizationInfoBuilder + .SetGuid("333b4df2-0187-49a9-8a4a-23992696bafd") + .SetOrthogonalCamera(ortho) + .SetViewSetupHints(vsHint) + .AddBitmaps(visBitmaps) + .AddColorings(colorings) + .AddSelections(components) + .AddClippingPlanes(clippingPlanes) + .SetVisibility(compVis) + .AddSelections(components) + .Build(); + + var viewPointBuilder = new ViewPointBuilder(); + var viewPoint = + viewPointBuilder + .SetGuid("444b4df2-0187-49a9-8a4a-23992696bafd") + .SetIndex(0) + .SetSnapshot("snapshot.png") + .SetSnapshotData(new FileData { + Mime = "data:image/png;base64", + Data = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=" + }) + .SetViewPoint("viewpoint.bcfv") + .SetVisualizationInfo(visualizationInfo) + .Build(); + + var viewPoints = new List { viewPoint }; + + var bimSnippetBuilder = new BimSnippetBuilder(); + var bimSnippet = + bimSnippetBuilder + .SetReference("https://.../snippetExample.ifc") + .SetIsExternal(true) + .SetSnippetType("snippetType") + .SetReferenceSchema("refSchema") + .Build(); + + var topicRelatedTopic1 = new TopicRelatedTopic(); + topicRelatedTopic1.Guid = "4ffb4df2-0187-49a9-8a4a-23992696bafd"; + + var topicRelatedTopic2 = new TopicRelatedTopic(); + topicRelatedTopic2.Guid = "5ffb4df2-0187-49a9-8a4a-23992696bafd"; + + var relatedTopics = new List + {topicRelatedTopic1, topicRelatedTopic2}; + + var bcf = _builder + .AddMarkup(m => m + .AddHeaderFiles(headers) + .SetTitle("Wall reposition issue") + .SetPriority("Low") + .SetGuid("3ffb4df2-0187-49a9-8a4a-23992696bafd") + .SetCreationAuthor("john.wick@johnwick.com") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetAssignedTo("jim.carry@jim.com") + .SetStage("PreDesign") + .SetTopicType("Warning") + .SetTopicStatus("Closed") + .SetDescription("Give me more details") + .AddLabels(labels) + .AddReferenceLinks(referenceLinks) + .AddDocumentReferences(topicDocumentReferences) + .AddComments(comments) + .AddViewPoints(viewPoints) + .SetIndex(0) + .SetCreationDate(DateTime.Today) + .SetDueDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetBimSnippet(bimSnippet) + .AddRelatedTopics(relatedTopics)) + .SetProject(p => p + .SetProjectId("3ZSh2muKX7S8MCESk95seC") + .SetProjectName("projectName") + .SetExtensionSchema("extensionSchema")) + // .SetDocumentData(docData) + .Build(); + + await _converter.ToBcf(bcf, + "Resources/Bcf/v2.1/super21.bcfzip"); + } + + + public async Task ReadBcf21FileTest() { + var samples = new List { + "Resources/Bcf/v2.1/super21.bcfzip" + }; + + var tasks = samples.Select(async path => { + await using var stream = + new FileStream(path, FileMode.Open, FileAccess.Read); + var bcf = await _worker.BcfFromStream(stream); + Assert.That(bcf.Version.VersionId, Is.EqualTo("3.0")); + }).ToArray(); + + await Task.WhenAll(tasks); + } +} \ No newline at end of file diff --git a/src/tests/Builder/Bcf30/BcfBuilderTests.cs b/src/tests/Builder/Bcf30/BcfBuilderTests.cs index 81385db..4693054 100644 --- a/src/tests/Builder/Bcf30/BcfBuilderTests.cs +++ b/src/tests/Builder/Bcf30/BcfBuilderTests.cs @@ -24,7 +24,7 @@ public void BuildBcfWithComplexFields() { .SetTopicType("Issue") .SetTopicStatus("Open")) .SetExtensions(e => e - .AddTopicType("ERROR") + .AddTopicType("Error") .AddTopicStatus("OPEN") .AddPriority("HIGH")) .SetProject(p => p diff --git a/src/tests/Builder/Bcf30/SuperBcfFile.cs b/src/tests/Builder/Bcf30/SuperBcfFile.cs new file mode 100644 index 0000000..2d8e940 --- /dev/null +++ b/src/tests/Builder/Bcf30/SuperBcfFile.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using BcfToolkit; +using BcfToolkit.Builder.Bcf30; +using BcfToolkit.Converter; +using BcfToolkit.Model; +using BcfToolkit.Model.Bcf30; +using NUnit.Framework; +using BcfBuilder = BcfToolkit.Builder.Bcf30.BcfBuilder; +using File = BcfToolkit.Model.Bcf30.File; + +namespace tests.Builder.Bcf30; + + +public class SuperBcfFile { + private BcfBuilder _builder = null!; + private IConverter _converter = null!; + private Worker _worker; + + [SetUp] + public void Setup() { + _builder = new BcfBuilder(); + _converter = new BcfToolkit.Converter.Bcf30.Converter(); + _worker = new Worker(); + } + + [Test] + public async Task CreateSuperBcf30File() { + + var labels = new List { "label1", "label2", }; + var referenceLinks = new List { "http://www.buildingsmart-tech.org", "www.google.com" }; + + // Header + var fileBuilder = new FileBuilder(); + var headerFile = + fileBuilder + .SetReference("reference") + .SetIsExternal(true) + .SetFileName("StructuralModel.ifc") + .SetDate(DateTime.Today) + .SetIfcProject("5g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("138GxLEzP459ZWW6_RGsez") + .Build(); + var headers = new List { headerFile }; + + // DocumentReference + var topicDocumentReferenceBuilder = new DocumentReferenceBuilder(); + var topicDocumentReference = + topicDocumentReferenceBuilder + .SetDescription("description") + .SetGuid("000b4df2-0187-49a9-8a4a-23992696bafd") + .SetDocumentGuid("447b4df2-0187-49a9-8a4a-23992696bafd") + .Build(); + + var topicDocumentReferenceExternal = + topicDocumentReferenceBuilder + .SetDescription("BCF 3.0 Markup Schema") + .SetUrl("http://www.buildingsmart-tech.org/specifications/bcf-releases/bcfxml-v1/markup.xsd/at_download/file<") + .Build(); + var topicDocumentReferences = new List { topicDocumentReference, topicDocumentReferenceExternal }; + + // Comments + var commentBuilder1 = new CommentBuilder(); + var commentBuilder2 = new CommentBuilder(); + var comment1 = + commentBuilder1 + .SetGuid("999b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("Pls changes the wall thickness to 8cm") + .Build(); + var comment2 = + commentBuilder2 + .SetGuid("998b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("jim.carry@jim.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("445b4df2-0187-49a9-8a4a-23992696bafd") + .SetCommentProperty("Pls changes the wall thickness to 8cm") + .Build(); + var comments = new List { comment1, comment2 }; + + // Viewpoint + var visualizationInfoBuilder = new VisualizationInfoBuilder(); + var componentBuilder = new ComponentBuilder(); + var component = + componentBuilder + .SetIfcGuid("118GxLEzP459ZWW6_RGsez") + .SetOriginatingSystem("originatingSystem") + .SetAuthoringToolId("authoringToolId") + .Build(); + var components = new List { component }; + + var visibilityBuilder = new VisibilityBuilder(); + var compVis = + visibilityBuilder + .SetDefaultVisibility(true) + .AddExceptions(components) + .Build(); + + var persBuilder = new PerspectiveCameraBuilder(); + var pers = + persBuilder + .SetCameraDirection(51.2, 2.4, 3.6) + .SetCameraUpVector(16.2, 2.4, 3.6) + .SetCameraViewPoint(71.2, 2.4, 3.6) + .SetFieldOfView(2.0) + .Build(); + + var vsHintBuilder = new ViewSetupHintsBuilder(); + var vsHint = + vsHintBuilder + .SetOpeningVisible(true) + .SetSpaceVisible(true) + .SetSpaceBoundariesVisible(true) + .Build(); + + var bitmapBuilder = new BitmapBuilder(); + var bitmap = + bitmapBuilder + .SetReference("reference") + .SetUp(19.2, 2.4, 3.6) + .SetFormat("Png") + .SetHeight(3.2) + .SetLocation(91.2, 2.4, 3.6) + .SetNormal(17.2, 2.4, 3.6) + .Build(); + var bitmaps = new List { bitmap, bitmap }; + + var coloringBuilder = new ComponentColoringColorBuilder(); + var coloring = + coloringBuilder + .SetColor("40E0D0") + .AddComponents(components) + .Build(); + var colorings = new List { coloring, coloring }; + + var clippingPlaneBuilder = new ClippingPlaneBuilder(); + var clippingPlane = + clippingPlaneBuilder + .SetLocation(1.22, 2.4, 3.6) + .SetDirection(1.32, 2.4, 3.6) + .Build(); + var clippingPlanes = new List { clippingPlane, clippingPlane }; + + var lineBuilder1 = new LineBuilder(); + var lineBuilder2 = new LineBuilder(); + + var line1 = + lineBuilder1 + .SetEndPoint(1.42, 2.4, 3.6) + .SetStartPoint(1.42, 4.4, 3.6) + .Build(); + + var line2 = + lineBuilder2 + .SetEndPoint(3.2, 2.4, 3.6) + .SetStartPoint(3.2, 4.4, 3.6) + .Build(); + + var lines = new List { line1, line2 }; + + var visualizationInfo = + visualizationInfoBuilder + .SetGuid("334b4df2-0187-49a9-8a4a-23992696bafd") + .SetPerspectiveCamera(pers) + .AddBitmaps(bitmaps) + .AddColorings(colorings) + .AddClippingPlanes(clippingPlanes) + .SetVisibility(compVis) + .AddSelections(components) + .AddLines(lines) + .Build(); + + var viewPointBuilder = new ViewPointBuilder(); + var viewPoint = + viewPointBuilder + .SetGuid("445b4df2-0187-49a9-8a4a-23992696bafd") + .SetIndex(0) + .SetSnapshot("snapshot") + .SetSnapshotData(new FileData { + Data = "aGVsbG8=" + }) + .SetViewPoint("viewpoint.bcfv") + .SetVisualizationInfo(visualizationInfo) + .Build(); + + var viewPoints = new List { viewPoint }; + + var bimSnippetBuilder = new BimSnippetBuilder(); + var bimSnippet = + bimSnippetBuilder + .SetReference("https://.../snippetExample.ifc") + .SetIsExternal(true) + .SetSnippetType("snippetType") + .SetReferenceSchema("refSchema") + .Build(); + + var projectInfoBuilder = new ProjectInfoBuilder(); + var project = + projectInfoBuilder + .SetProjectId("446b4df2-0187-49a9-8a4a-23992696bafd") + .SetProjectName("Test project") + .Build(); + + var documentBuilder = new DocumentBuilder(); + var documentData = new FileData { + Data = "aGVsbG8=" + }; + var doc = + documentBuilder + .SetDescription("desc") + .SetGuid("447b4df2-0187-49a9-8a4a-23992696bafd") + .SetFileName("NewIfc.ifc") + .SetDocumentData(documentData) + .Build(); + var docList = new List { doc }; + var docBuilder = new DocumentInfoBuilder(); + + var docInfo = + docBuilder + .AddDocuments(docList) + .Build(); + + var priorities = new List { "Low", "Critical", "High" }; + var users = new List { "john.wick@johnwick.com", "jim.carry@jim.com" }; + var stages = new List { "PreDesign", "Design" }; + var snippetTypes = new List { "snippetType1", "snippetType2" }; + var topicLabels = new List { "ARC", "STR" }; + var topicStatuses = new List { "Open", "Closed" }; + var topicTypes = new List { "Issue", "Warning", "Error" }; + + var extensionsBuilder = new ExtensionsBuilder(); + var extensions = + extensionsBuilder + .AddPriorities(priorities) + .AddUsers(users) + .AddStages(stages) + .AddSnippetTypes(snippetTypes) + .AddTopicLabels(topicLabels) + .AddTopicStatuses(topicStatuses) + .AddTopicTypes(topicTypes) + .Build(); + + var bcf = _builder + .SetProject(project) + .SetDocument(docInfo) + .SetExtensions(extensions) + .AddMarkup(m => m + .AddDocumentReferences(topicDocumentReferences) + .AddHeaderFiles(headers) + .AddReferenceLinks(referenceLinks) + .AddLabels(labels) + .AddComments(comments) + .AddViewPoints(viewPoints) + .SetTitle("Wall reposition issue") + .SetPriority("Critical") + .SetGuid("3ffb4df2-0187-49a9-8a4a-23992696bafd") + .SetCreationAuthor("john.wick@johnwick.com") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetAssignedTo("jim.carry@jim.com") + .SetStage("Design") + .SetTopicType("Error") + .SetTopicStatus("Open") + .SetDescription("description") + .SetIndex(0) + .SetCreationDate(DateTime.Today) + .SetDueDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetBimSnippet(bimSnippet)) + .Build(); + + await _converter.ToBcf(bcf, + "Resources/Bcf/v3.0/super30.bcfzip"); + } + + public async Task ReadBcf30FileTest() { + var samples = new List { + "Resources/Bcf/v3.0/super30.bcfzip" + }; + + var tasks = samples.Select(async path => { + await using var stream = + new FileStream(path, FileMode.Open, FileAccess.Read); + var bcf = await _worker.BcfFromStream(stream); + Assert.That(bcf.Version.VersionId, Is.EqualTo("3.0")); + }).ToArray(); + + await Task.WhenAll(tasks); + } +} \ No newline at end of file diff --git a/src/tests/Resources/Bcf/v2.1/super21.bcfzip b/src/tests/Resources/Bcf/v2.1/super21.bcfzip new file mode 100644 index 0000000000000000000000000000000000000000..c42334fb3ddeb4fa1f40e0a00c847f41308e7e35 GIT binary patch literal 2848 zcmcImc{J307auc5_H1P@#xmK)7(7{GMD{gFnvj`ckZl;kAjVSm%9^#3NLpkGBWp2? z%9a|5>`M~~QA+bp&wDygdCz-J?;r2|oqN8&?;rQ`z4xBGeC#YitU>?)fE|#Dk~ujc z!D~!r-t<`j0B+`q4+=QrfenUXusD3eMcv)8aG`|IbH+oGR2dTuJGKrtA#8`?8?#2B zVnRRUTV%L-Ny<=E(T7533cVLfJS>x(+(hdSPK~KiR0*4#avXOMk8lWtS%>VBk8=g? zzvp`~=4yEV19dlDST|uPU&!KGv5riri0y|8t9*jT zyws#VtJdop?dIKU;Mfw7XWcxf_Gvp+gB`2_HtJTY(<4uehQ> zcE82A%Vsenl^NSBrgAZr85``ZM-ag~z&|0anX>~fV!V0C`18hGIm|xe>>^}AHqpln zBkm>WU9vbWUZvB};IgcDL5UnvyfOqE0IQM&*=R(`)U~*HQ}XeM1(Yl-04V&Lf=jdM zxH8y$U1Q#AH9g+rnkKf;)s|ATZ|RQWJl5Xz)MwOOD>$r4N2ozw0u}#Y!Oz~m8aMhH z!M=40av1p${JYay>#m#*OlMCrRg9_b0oV{f5C33-YLEx+^v@d%@9#ijQxn&uWFSJ=oX~0NBX9k1O8qN6L`P?JNfM4HMn8KG%??H;780>iX zf*PFRQkWOYf8g=N;=B3k=L*+30KfavDR}taS0DiJhywsnW%{Cy!(lYsaR?Q-n$|%T z4Q;fxiWXV}t%6Y3)<*oL{TBv}b65342l<5He-u)k+2IN!Oqr_r+^V6{nZ&U-|^ zdi%?_!FMLlm!NRHf)Yj9{(G`azE{60&zVw(Q@F}vUN~MV_$VncdG-By?`mb|Jw2n=8{-J`yo<$%GRs%H9}i2h z7x6AzcNLK=$DYUYdQlde?x_cvDv7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