Example #1
0
        public void WriteReadAgainAndCompare()
        {
            using (var memStream = new MemoryStream())
            {
                CreatedContainer.WriteStream(memStream);
                memStream.Position = 0;

                var readContainer = BCFv2Container.ReadStream(memStream);

                var readMemStream = new MemoryStream();
                readContainer.WriteStream(readMemStream);
                var writtenZipArchive = new ZipArchive(readMemStream);

                CompareTool.CompareContainers(CreatedContainer, readContainer, CreatedArchive, writtenZipArchive);
            }
        }
Example #2
0
            public void AppendSnapshotInfoToMarkup()
            {
                var instance = new BCFv2Container();

                instance.Topics.Add(new BCFTopic());
                instance.Topics.First().Viewpoints.Add(new VisualizationInfo());
                instance.Topics.First().AddOrUpdateSnapshot(instance.Topics.First().Viewpoints.First().GUID, new byte[] { 15, 15, 15, 15, 15, 15 });

                using (var memStream = new MemoryStream())
                {
                    instance.WriteStream(memStream);
                    memStream.Position = 0;
                    var readAgain = BCFv2Container.ReadStream(memStream);
                    Assert.False(string.IsNullOrWhiteSpace(readAgain.Topics.First().Markup.Viewpoints.First().Viewpoint));
                    Assert.True(readAgain.Topics.First().ViewpointSnapshots.Any());
                }
            }
Example #3
0
        /// <summary>
        ///     Will create an <see cref="BCFv2Container" /> instance from a <see cref="APIContainer" />
        /// </summary>
        public static BCFv2Container Convert(APIContainer apiContainer)
        {
            var bcfContainer = new BCFv2Container();

            // Get file attachments
            foreach (var fileAttachment in apiContainer.FileAttachments)
            {
                bcfContainer.FileAttachments.Add(fileAttachment.Key, fileAttachment.Value);
            }
            if (apiContainer.Project != null)
            {
                bcfContainer.BcfProject                   = new ProjectExtension();
                bcfContainer.BcfProject.Project           = new Project();
                bcfContainer.BcfProject.Project.Name      = apiContainer.Project.name;
                bcfContainer.BcfProject.Project.ProjectId = apiContainer.Project.project_id;
            }
            if (apiContainer.Extensions != null && !apiContainer.Extensions.IsEmpty())
            {
                if (bcfContainer.BcfProject == null)
                {
                    bcfContainer.BcfProject = new ProjectExtension();
                }
                bcfContainer.BcfProject.ExtensionSchema    = "extensions.xsd";
                bcfContainer.ProjectExtensions             = new ProjectExtensions();
                bcfContainer.ProjectExtensions.Priority    = apiContainer.Extensions.priority;
                bcfContainer.ProjectExtensions.SnippetType = apiContainer.Extensions.snippet_type;
                bcfContainer.ProjectExtensions.TopicLabel  = apiContainer.Extensions.topic_label;
                bcfContainer.ProjectExtensions.TopicStatus = apiContainer.Extensions.topic_status;
                bcfContainer.ProjectExtensions.TopicType   = apiContainer.Extensions.topic_type;
                bcfContainer.ProjectExtensions.UserIdType  = apiContainer.Extensions.user_id_type;
            }
            if (apiContainer.Topics.Count > 0)
            {
                foreach (var topic in apiContainer.Topics)
                {
                    bcfContainer.Topics.Add(GetPhysicalTopicFromApi(topic, apiContainer));
                }
            }
            return(bcfContainer);
        }
Example #4
0
        /// <summary>
        ///     Will create an <see cref="APIContainer" /> instance from a <see cref="BCFv2Container" />. Internal document references will not be output currently.
        /// </summary>
        public static APIContainer Convert(BCFv2Container Input)
        {
            if (Input == null)
            {
                throw new ArgumentNullException("Input");
            }
            var ReturnObject = new APIContainer();

            // Get the project info
            if (Input.BcfProject != null && Input.BcfProject.Project != null)
            {
                ReturnObject.Project            = new project_GET();
                ReturnObject.Project.name       = Input.BcfProject.Project.Name;
                ReturnObject.Project.project_id = Input.BcfProject.Project.ProjectId;
            }
            // Get the extensions
            if (Input.ProjectExtensions != null)
            {
                ReturnObject.Extensions              = new extensions_GET();
                ReturnObject.Extensions.priority     = Input.ProjectExtensions.Priority;
                ReturnObject.Extensions.snippet_type = Input.ProjectExtensions.SnippetType;
                ReturnObject.Extensions.topic_label  = Input.ProjectExtensions.TopicLabel;
                ReturnObject.Extensions.topic_status = Input.ProjectExtensions.TopicStatus;
                ReturnObject.Extensions.topic_type   = Input.ProjectExtensions.TopicType;
                ReturnObject.Extensions.user_id_type = Input.ProjectExtensions.UserIdType;
            }
            ReturnObject.Topics = new List <TopicContainer>();
            for (var i = 0; i < Input.Topics.Count; i++)
            {
                ReturnObject.Topics.Add(GetAPITopicFromPhysicalBCF(Input.Topics[i]));
            }
            // Get file attachments
            foreach (var CurrentAttachment in Input.FileAttachments)
            {
                ReturnObject.FileAttachments.Add(CurrentAttachment.Key, CurrentAttachment.Value);
            }
            return(ReturnObject);
        }
        public static BCFv2Container CreateContainer()
        {
            var container = new BCFv2Container();

            // Set the project
            container.BcfProject                   = new ProjectExtension();
            container.BcfProject.Project           = new Project();
            container.BcfProject.Project.Name      = "BCF API Implementation";
            container.BcfProject.Project.ProjectId = "F338B6F0-A93E-40FF-A4D6-6117CD21EC2A";

            // Set extensions
            container.ProjectExtensions = CreateExtensions();

            // Set Topics
            container.Topics.Add(CreateSimpleTopicToActAsReference());
            container.Topics.Add(CreateTopic());

            container.FileAttachments.Add("IfcPile_01.ifc", TestCaseResourceFactory.GetIfcFile(IfcFiles.IfcPile));

            container.FileAttachments.Add("markup.xsd", TestCaseResourceFactory.GetFileAttachment(FileAttachments.MarkupSchemaV2));

            return(container);
        }
Example #6
0
            public void Simple_WriteSingleTopic_Extensions()
            {
                var testContainerInstance = new BCFv2Container();

                testContainerInstance.ProjectExtensions = MockExtensions();

                testContainerInstance.Topics.Add(new BCFTopic());
                testContainerInstance.Topics[0].Markup             = new Markup();
                testContainerInstance.Topics[0].Markup.Topic       = new Topic();
                testContainerInstance.Topics[0].Markup.Topic.Title = "Sample with extensions.";
                testContainerInstance.Topics[0].Markup.Topic.Guid  = Guid.NewGuid().ToString();

                using (var memStream = new MemoryStream())
                {
                    testContainerInstance.WriteStream(memStream);
                    Assert.True(memStream.Length > 0);

                    memStream.Position = 0;
                    var archive         = new ZipArchive(memStream);
                    var extensionsEntry = archive.Entries.FirstOrDefault(e => e.FullName == "extensions.xsd");
                    Assert.NotNull(extensionsEntry);
                }
            }
Example #7
0
        /// <summary>
        /// </summary>
        /// <param name="expectedContainer"></param>
        /// <param name="actualContainer"></param>
        /// <param name="expectedArchive"></param>
        /// <param name="actualArchive"></param>
        /// <param name="originatesFromApiConversion">If true, Bitmaps are not compared since the API does not support them</param>
        public static void CompareContainers(BCFv2Container expectedContainer, BCFv2Container actualContainer, ZipArchive expectedArchive = null, ZipArchive actualArchive = null, bool originatesFromApiConversion = false)
        {
            CompareProjectAndVersion(expectedContainer, actualContainer);
            CompareFileAttachments(expectedContainer, actualContainer);
            CompareProjectExtensions(expectedContainer, actualContainer);

            if (expectedArchive == null && actualArchive == null)
            {
                using (var memStream01 = new MemoryStream())
                {
                    expectedContainer.WriteStream(memStream01);
                    expectedArchive = new ZipArchive(memStream01);
                    using (var memStream02 = new MemoryStream())
                    {
                        expectedContainer.WriteStream(memStream02);
                        actualArchive = new ZipArchive(memStream02);
                        TopicsCompareTool.CompareAllTopics(expectedContainer, actualContainer, expectedArchive, actualArchive, originatesFromApiConversion);
                        return;
                    }
                }
            }

            TopicsCompareTool.CompareAllTopics(expectedContainer, actualContainer, expectedArchive, actualArchive, originatesFromApiConversion);
        }
Example #8
0
        public static BCFv2Container CreateContainer()
        {
            var container = new BCFv2Container();

            container.ProjectExtensions = new ProjectExtensions();
            container.ProjectExtensions.Priority.Add("Low");
            container.ProjectExtensions.Priority.Add("Medium");
            container.ProjectExtensions.Priority.Add("High");
            container.ProjectExtensions.SnippetType.Add("IFC2X3");
            container.ProjectExtensions.SnippetType.Add("IFC4");
            container.ProjectExtensions.SnippetType.Add("JSON");
            container.ProjectExtensions.TopicLabel.Add("Development");
            container.ProjectExtensions.TopicLabel.Add("Architecture");
            container.ProjectExtensions.TopicLabel.Add("MEP");
            container.ProjectExtensions.TopicStatus.Add("Open");
            container.ProjectExtensions.TopicStatus.Add("Closed");
            container.ProjectExtensions.TopicStatus.Add("Reopened");
            container.ProjectExtensions.TopicType.Add("Information");
            container.ProjectExtensions.TopicType.Add("Warning");
            container.ProjectExtensions.TopicType.Add("Error");
            container.ProjectExtensions.TopicType.Add("Request");
            container.ProjectExtensions.UserIdType.Add("*****@*****.**");
            container.ProjectExtensions.UserIdType.Add("*****@*****.**");
            container.ProjectExtensions.UserIdType.Add("*****@*****.**");
            // Add a single topic
            container.Topics.Add(new BCFTopic());
            container.Topics[0].Markup                      = new Markup();
            container.Topics[0].Markup.Topic                = new Topic();
            container.Topics[0].Markup.Topic.Guid           = BcFv2TestCaseData.EXTENSION_SCHEMA_TOPIC_GUID;
            container.Topics[0].Markup.Topic.CreationAuthor = "*****@*****.**";
            container.Topics[0].Markup.Topic.CreationDate   = DateTime.UtcNow;
            container.Topics[0].Markup.Topic.Title          = "Test case for checking extension schema within the BCFZip container.";
            container.Topics[0].Markup.Topic.TopicStatus    = "Open";
            container.Topics[0].Markup.Topic.TopicType      = "Information";
            return(container);
        }
Example #9
0
        private static BCFTopic GetPhysicalTopicFromApi(TopicContainer apiTopicContainer, APIContainer apiContainer)
        {
            if (apiTopicContainer.Topic == null)
            {
                throw new ArgumentNullException(nameof(apiTopicContainer.Topic));
            }
            var bcfTopic = new BCFTopic();

            bcfTopic.Markup = new Markup();
            {
                bcfTopic.Markup.Topic = new Topic();

                if (apiTopicContainer.Files.Any())
                {
                    foreach (var file in apiTopicContainer.Files)
                    {
                        bcfTopic.Markup.Header.Add(new HeaderFile
                        {
                            Date       = file.date,
                            Filename   = file.file_name,
                            IfcProject = file.ifc_project,
                            IfcSpatialStructureElement = file.ifc_spatial_structure_element,
                            isExternal = !apiContainer.FileAttachments.ContainsKey(BCFv2Container.GetFilenameFromReference(file.reference)),
                            Reference  = file.reference
                        });
                    }
                }
                if (!string.IsNullOrWhiteSpace(apiTopicContainer.Topic.assigned_to))
                {
                    bcfTopic.Markup.Topic.AssignedTo = apiTopicContainer.Topic.assigned_to;
                }
                if (apiTopicContainer.Topic.bim_snippet != null && apiTopicContainer.Topic.bim_snippet.HasValues())
                {
                    bcfTopic.Markup.Topic.BimSnippet = new BimSnippet();

                    if (apiTopicContainer.SnippetData != null)
                    {
                        bcfTopic.SnippetData = apiTopicContainer.SnippetData;
                        bcfTopic.Markup.Topic.BimSnippet.isExternal = false;
                        bcfTopic.Markup.Topic.BimSnippet.Reference  = BCFv2Container.GetFilenameFromReference(apiTopicContainer.Topic.bim_snippet.reference);
                    }
                    else
                    {
                        bcfTopic.Markup.Topic.BimSnippet.isExternal = true;
                        bcfTopic.Markup.Topic.BimSnippet.Reference  = apiTopicContainer.Topic.bim_snippet.reference;
                    }
                    bcfTopic.Markup.Topic.BimSnippet.ReferenceSchema = apiTopicContainer.Topic.bim_snippet.reference_schema;
                    bcfTopic.Markup.Topic.BimSnippet.SnippetType     = apiTopicContainer.Topic.bim_snippet.snippet_type;
                }
                bcfTopic.Markup.Topic.CreationAuthor = apiTopicContainer.Topic.creation_author;
                bcfTopic.Markup.Topic.CreationDate   = apiTopicContainer.Topic.creation_date;
                bcfTopic.Markup.Topic.Description    = apiTopicContainer.Topic.description;
                bcfTopic.Markup.Topic.Guid           = apiTopicContainer.Topic.guid;
                bcfTopic.Markup.Topic.Index          = apiTopicContainer.Topic.index.ToString();
                if (apiTopicContainer.Topic.labels != null && apiTopicContainer.Topic.labels.Count > 0)
                {
                    bcfTopic.Markup.Topic.Labels = apiTopicContainer.Topic.labels;
                }
                if (!string.IsNullOrWhiteSpace(apiTopicContainer.Topic.modified_author) || (apiTopicContainer.Topic.modified_date != null && default(DateTime) != apiTopicContainer.Topic.modified_date))
                {
                    bcfTopic.Markup.Topic.ModifiedAuthor = apiTopicContainer.Topic.modified_author;
                    if (apiTopicContainer.Topic.modified_date != null)
                    {
                        bcfTopic.Markup.Topic.ModifiedDate = (DateTime)apiTopicContainer.Topic.modified_date;
                    }
                }
                bcfTopic.Markup.Topic.Priority      = apiTopicContainer.Topic.priority;
                bcfTopic.Markup.Topic.ReferenceLink = apiTopicContainer.Topic.reference_link;
                bcfTopic.Markup.Topic.Title         = apiTopicContainer.Topic.title;
                bcfTopic.Markup.Topic.TopicStatus   = apiTopicContainer.Topic.topic_status;
                bcfTopic.Markup.Topic.TopicType     = apiTopicContainer.Topic.topic_type;
                if (apiTopicContainer.RelatedTopics.Count > 0)
                {
                    bcfTopic.Markup.Topic.RelatedTopics = new List <TopicRelatedTopics>();
                    foreach (var relatedTopic in apiTopicContainer.RelatedTopics)
                    {
                        bcfTopic.Markup.Topic.RelatedTopics.Add(new TopicRelatedTopics());
                        bcfTopic.Markup.Topic.RelatedTopics[bcfTopic.Markup.Topic.RelatedTopics.Count - 1].Guid = relatedTopic.related_topic_guid;
                    }
                }
                if (apiTopicContainer.ReferencedDocuments.Count > 0)
                {
                    bcfTopic.Markup.Topic.DocumentReferences = new List <TopicDocumentReferences>();
                    foreach (var referencedDocument in apiTopicContainer.ReferencedDocuments)
                    {
                        bcfTopic.Markup.Topic.DocumentReferences.Add(new TopicDocumentReferences());
                        bcfTopic.Markup.Topic.DocumentReferences.Last().Description        = referencedDocument.description;
                        bcfTopic.Markup.Topic.DocumentReferences.Last().Guid               = referencedDocument.guid;
                        bcfTopic.Markup.Topic.DocumentReferences.Last().isExternal         = !apiContainer.FileAttachments.ContainsKey(BCFv2Container.GetFilenameFromReference(referencedDocument.referenced_document));
                        bcfTopic.Markup.Topic.DocumentReferences.Last().ReferencedDocument = referencedDocument.referenced_document;
                    }
                }
            }
            {
                if (apiTopicContainer.Comments.Count > 0)
                {
                    bcfTopic.Markup.Comment = new List <Comment>();
                    foreach (var comment in apiTopicContainer.Comments)
                    {
                        bcfTopic.Markup.Comment.Add(new Comment());
                        bcfTopic.Markup.Comment.Last().Author   = comment.author;
                        bcfTopic.Markup.Comment.Last().Comment1 = comment.comment;
                        bcfTopic.Markup.Comment.Last().Date     = comment.date;
                        bcfTopic.Markup.Comment.Last().Guid     = comment.guid;
                        if (!string.IsNullOrWhiteSpace(comment.modified_author) || (comment.modified_date != null && default(DateTime) != comment.modified_date))
                        {
                            bcfTopic.Markup.Comment.Last().ModifiedAuthor = comment.modified_author;
                            if (comment.modified_date != null)
                            {
                                bcfTopic.Markup.Comment.Last().ModifiedDate = (DateTime)comment.modified_date;
                            }
                        }
                        bcfTopic.Markup.Comment.Last().ReplyToComment = new CommentReplyToComment();
                        bcfTopic.Markup.Comment.Last().ReplyToComment.Guid = comment.reply_to_comment_guid;
                        bcfTopic.Markup.Comment.Last().Status = comment.status;
                        bcfTopic.Markup.Comment.Last().VerbalStatus = comment.verbal_status;
                        bcfTopic.Markup.Comment.Last().Viewpoint = new CommentViewpoint();
                        bcfTopic.Markup.Comment.Last().Viewpoint.Guid = comment.viewpoint_guid;
                    }
                }
            }
            {
                if (apiTopicContainer.Viewpoints.Count > 0)
                {
                    foreach (var viewpoint in apiTopicContainer.Viewpoints)
                    {
                        bcfTopic.Viewpoints.Add(new VisualizationInfo
                        {
                            GUID = viewpoint.Viewpoint.guid
                        });
                        if (viewpoint.Snapshot != null)
                        {
                            bcfTopic.AddOrUpdateSnapshot(viewpoint.Viewpoint.guid, viewpoint.Snapshot);
                        }
                        if (viewpoint.Viewpoint.lines != null && viewpoint.Viewpoint.lines.line.Count > 0)
                        {
                            bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines = new List <Line>();
                            foreach (var line in viewpoint.Viewpoint.lines.line)
                            {
                                bcfTopic.Viewpoints.Last().Lines.Add(new Line());
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].EndPoint     = new Point();
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].EndPoint.X   = line.end_point.x;
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].EndPoint.Y   = line.end_point.y;
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].EndPoint.Z   = line.end_point.z;
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].StartPoint   = new Point();
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].StartPoint.X = line.start_point.x;
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].StartPoint.Y = line.start_point.y;
                                bcfTopic.Viewpoints.Last().Lines[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Lines.Count - 1].StartPoint.Z = line.start_point.z;
                            }
                        }
                        if (viewpoint.Viewpoint.clipping_planes != null && viewpoint.Viewpoint.clipping_planes.clipping_plane.Count > 0)
                        {
                            bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes = new List <ClippingPlane>();
                            foreach (var clippingPlane in viewpoint.Viewpoint.clipping_planes.clipping_plane)
                            {
                                bcfTopic.Viewpoints.Last().ClippingPlanes.Add(new ClippingPlane());
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Direction   = new Direction();
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Direction.X = clippingPlane.direction.x;
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Direction.Y = clippingPlane.direction.y;
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Direction.Z = clippingPlane.direction.z;
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Location    = new Point();
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Location.X  = clippingPlane.location.x;
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Location.Y  = clippingPlane.location.y;
                                bcfTopic.Viewpoints.Last().ClippingPlanes[bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].ClippingPlanes.Count - 1].Location.Z  = clippingPlane.location.z;
                            }
                        }
                        if (viewpoint.Components != null && viewpoint.Components.Count > 0)
                        {
                            bcfTopic.Viewpoints[bcfTopic.Viewpoints.Count - 1].Components = new List <Component>();
                            foreach (var component in viewpoint.Components)
                            {
                                bcfTopic.Viewpoints.Last().Components.Add(new Component());
                                bcfTopic.Viewpoints.Last().Components.Last().AuthoringToolId = component.authoring_tool_id;
                                bcfTopic.Viewpoints.Last().Components.Last().Color = component.color == null ? null : Enumerable.Range(0, component.color.Length)
                                                                                     .Where(x => x % 2 == 0)
                                                                                     .Select(x => System.Convert.ToByte(component.color.Substring(x, 2), 16))
                                                                                     .ToArray();
                                bcfTopic.Viewpoints.Last().Components.Last().IfcGuid = component.ifc_guid;
                                bcfTopic.Viewpoints.Last().Components.Last().OriginatingSystem = component.originating_system;
                                if (component.selected)
                                {
                                    bcfTopic.Viewpoints.Last().Components.Last().Selected = component.selected;
                                }
                                bcfTopic.Viewpoints.Last().Components.Last().Visible = component.visible;
                            }
                        }
                        if (viewpoint.Viewpoint.orthogonal_camera != null)
                        {
                            bcfTopic.Viewpoints.Last().OrthogonalCamera = new OrthogonalCamera();
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraDirection = new Direction();
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraDirection.X = viewpoint.Viewpoint.orthogonal_camera.camera_direction.x;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraDirection.Y = viewpoint.Viewpoint.orthogonal_camera.camera_direction.y;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraDirection.Z = viewpoint.Viewpoint.orthogonal_camera.camera_direction.z;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraUpVector = new Direction();
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraUpVector.X = viewpoint.Viewpoint.orthogonal_camera.camera_up_vector.x;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraUpVector.Y = viewpoint.Viewpoint.orthogonal_camera.camera_up_vector.y;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraUpVector.Z = viewpoint.Viewpoint.orthogonal_camera.camera_up_vector.z;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraViewPoint = new Point();
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraViewPoint.X = viewpoint.Viewpoint.orthogonal_camera.camera_view_point.x;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraViewPoint.Y = viewpoint.Viewpoint.orthogonal_camera.camera_view_point.y;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.CameraViewPoint.Z = viewpoint.Viewpoint.orthogonal_camera.camera_view_point.z;
                            bcfTopic.Viewpoints.Last().OrthogonalCamera.ViewToWorldScale = viewpoint.Viewpoint.orthogonal_camera.view_to_world_scale;
                        }
                        if (viewpoint.Viewpoint.perspective_camera != null)
                        {
                            bcfTopic.Viewpoints.Last().PerspectiveCamera = new PerspectiveCamera();
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraDirection = new Direction();
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraDirection.X = viewpoint.Viewpoint.perspective_camera.camera_direction.x;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraDirection.Y = viewpoint.Viewpoint.perspective_camera.camera_direction.y;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraDirection.Z = viewpoint.Viewpoint.perspective_camera.camera_direction.z;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraUpVector = new Direction();
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraUpVector.X = viewpoint.Viewpoint.perspective_camera.camera_up_vector.x;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraUpVector.Y = viewpoint.Viewpoint.perspective_camera.camera_up_vector.y;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraUpVector.Z = viewpoint.Viewpoint.perspective_camera.camera_up_vector.z;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraViewPoint = new Point();
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraViewPoint.X = viewpoint.Viewpoint.perspective_camera.camera_view_point.x;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraViewPoint.Y = viewpoint.Viewpoint.perspective_camera.camera_view_point.y;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.CameraViewPoint.Z = viewpoint.Viewpoint.perspective_camera.camera_view_point.z;
                            bcfTopic.Viewpoints.Last().PerspectiveCamera.FieldOfView = viewpoint.Viewpoint.perspective_camera.field_of_view;
                        }
                    }
                }
            }
            return(bcfTopic);
        }
Example #10
0
 public DefaultComponentVisibility()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.DefaultComponentVisibility);
 }
Example #11
0
 public SelectedComponent()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.SelectedComponent);
 }
Example #12
0
 public Lines()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.Lines);
 }
Example #13
0
 public void EmptyOnEmptyInput()
 {
     Assert.True(string.IsNullOrWhiteSpace(BCFv2Container.GetFilenameFromReference(string.Empty)));
 }
Example #14
0
 public static void CompareProjectExtensions(BCFv2Container expectedContainer, BCFv2Container actualContainer)
 {
     if (TestCompareUtilities.BothNotNull(expectedContainer.ProjectExtensions, actualContainer.ProjectExtensions, "ProjectExtensions"))
     {
         CompareStringList(expectedContainer.ProjectExtensions.SnippetType, actualContainer.ProjectExtensions.SnippetType, "SnippetType");
         CompareStringList(expectedContainer.ProjectExtensions.Priority, actualContainer.ProjectExtensions.Priority, "Priority");
         CompareStringList(expectedContainer.ProjectExtensions.TopicStatus, actualContainer.ProjectExtensions.TopicStatus, "TopicStatus");
         CompareStringList(expectedContainer.ProjectExtensions.TopicType, actualContainer.ProjectExtensions.TopicType, "TopicType");
         CompareStringList(expectedContainer.ProjectExtensions.UserIdType, actualContainer.ProjectExtensions.UserIdType, "UserIdType");
         CompareStringList(expectedContainer.ProjectExtensions.TopicLabel, actualContainer.ProjectExtensions.TopicLabel, "TopicLabel");
     }
 }
Example #15
0
        /// <summary>
        ///     Will compare the project and version descriptions within the file
        /// </summary>
        /// <param name="expectedContainer"></param>
        /// <param name="actualContainer"></param>
        public static void CompareProjectAndVersion(BCFv2Container expectedContainer, BCFv2Container actualContainer)
        {
            // Compare project
            if (TestCompareUtilities.BothNotNull(expectedContainer.BcfProject, actualContainer.BcfProject, "BCFProject"))
            {
                if (TestCompareUtilities.BothNotNull(expectedContainer.BcfProject.Project, actualContainer.BcfProject.Project, "BCFProject.Project"))
                {
                    Assert.Equal(expectedContainer.BcfProject.Project.Name, actualContainer.BcfProject.Project.Name);
                    Assert.Equal(expectedContainer.BcfProject.Project.ProjectId, actualContainer.BcfProject.Project.ProjectId);
                }
                Assert.Equal(expectedContainer.BcfProject.ExtensionSchema, actualContainer.BcfProject.ExtensionSchema);
            }

            // Compare version
            if (TestCompareUtilities.BothNotNull(expectedContainer.BcfVersionInfo, actualContainer.BcfVersionInfo, "BCFVersionInfo"))
            {
                if (expectedContainer.BcfVersionInfo.VersionId.Contains("2.0"))
                {
                    Assert.Contains("2.0", actualContainer.BcfVersionInfo.VersionId);
                }
                else
                {
                    Assert.True(false, "Unrecognized VersionId");
                }
            }
        }
Example #16
0
 public HeaderWithSingleFile()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.HeaderWithSingleFile);
 }
Example #17
0
 public RelatedTopicWithOtherTopicMissing()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.RelatedTopicsWithOtherTopicMissing);
 }
Example #18
0
 public VisibleSpaceAndRestOfModelVisible()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.VisibleSpaceAndRestOfModelVisible);
 }
Example #19
0
 public UserAssignment()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.UserAssignment);
 }
Example #20
0
 public PerspectiveView()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.PerspectiveView);
 }
Example #21
0
 public MultipleTopics()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.MultipleTopics);
 }
Example #22
0
 public MultipleViewpointsWithoutComments()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.MultipleViewpointsWithoutComments);
 }
Example #23
0
 public SingleVisibleWall()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.SingleVisibleWall);
 }
Example #24
0
 public HeaderWithNoFiles()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.HeaderWithNoFiles);
 }
Example #25
0
 public DecomposedObjectsWithParentGuid()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.DecomposedObjectsWithParentGuid);
 }
Example #26
0
 public MultipleFilesInHeader()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.MultipleFilesInHeader);
 }
Example #27
0
 public Clippingplane()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.Clippingplane);
 }
Example #28
0
 public DecomposedObjects()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.DecomposedObjects);
 }
Example #29
0
 public ComponentColoring()
 {
     ReadContainer = TestCaseResourceFactory.GetImportTestCaseContainer(BCFv2ImportTestCases.ComponentColoring);
 }
Example #30
0
            public void Combine_07()
            {
                var created = BCFv2Container.GetAbsolutePath("123456", "789/example.jpg");

                Assert.Equal("123456/789/example.jpg", created);
            }