Exemplo n.º 1
0
        private void GetMarkupComment(BCFv21.Schemas.Markup markup, BCFv2.BCFTopic sourceTopic)
        {
            if (!sourceTopic.Markup.ShouldSerializeComment())
            {
                return;
            }

            markup.Comment = sourceTopic.Markup.Comment
                             .Select(source => new BCFv21.Schemas.Comment
            {
                Author         = source.Author,
                Comment1       = source.Comment1,
                Date           = source.Date,
                Guid           = source.Guid,
                ModifiedAuthor = source.ModifiedAuthor,
                ModifiedDate   = source.ModifiedDate,
                Viewpoint      = source.Viewpoint == null
                                ? null
                                : new BCFv21.Schemas.CommentViewpoint
                {
                    Guid = source.Viewpoint.Guid
                }
            })
                             .ToList();
        }
Exemplo n.º 2
0
        private void GetTopicViewpoints(BCFv2.BCFTopic topic, BCFv21.BCFTopic sourceTopic)
        {
            if (sourceTopic.Viewpoints?.Any() != true)
            {
                return;
            }

            foreach (var sourceViewpoint in sourceTopic.Viewpoints)
            {
                GetSingleTopicViewpoint(topic, sourceViewpoint);
            }

            if (sourceTopic.ViewpointBitmaps.Any())
            {
                foreach (var sourceBitmap in sourceTopic.ViewpointBitmaps)
                {
                    topic.ViewpointBitmaps.Add(topic.Viewpoints.Single(vp => vp.GUID == sourceBitmap.Key.Guid), sourceBitmap.Value.ToList());
                }
            }

            if (sourceTopic.ViewpointSnapshots.Any())
            {
                foreach (var sourceSnapshot in sourceTopic.ViewpointSnapshots)
                {
                    topic.AddOrUpdateSnapshot(sourceSnapshot.Key, sourceSnapshot.Value);
                }
            }
        }
Exemplo n.º 3
0
        private void GetSingleTopic(BCFv21.BCFTopic sourceTopic)
        {
            var topic = new BCFv2.BCFTopic();

            topic.SnippetData = sourceTopic.SnippetData;

            topic.Markup = GetMarkup(sourceTopic);

            GetTopicViewpoints(topic, sourceTopic);

            _destination.Topics.Add(topic);
        }
Exemplo n.º 4
0
        private BCFv21.Schemas.Markup GetMarkup(BCFv2.BCFTopic sourceTopic)
        {
            if (sourceTopic.Markup == null)
            {
                return(null);
            }

            var markup = new BCFv21.Schemas.Markup();

            GetMarkupHeader(markup, sourceTopic);
            GetMarkupComment(markup, sourceTopic);
            GetMarkupTopic(markup, sourceTopic);
            GetMarkupViewpoints(markup, sourceTopic);

            return(markup);
        }
Exemplo n.º 5
0
        private void GetMarkupViewpoints(BCFv21.Schemas.Markup markup, BCFv2.BCFTopic sourceTopic)
        {
            if (!sourceTopic.Markup.ShouldSerializeViewpoints())
            {
                return;
            }

            markup.Viewpoints = sourceTopic.Markup.Viewpoints
                                .Select((source, index) => new BCFv21.Schemas.ViewPoint
            {
                Guid      = source.Guid,
                Index     = index,
                Snapshot  = source.Snapshot,
                Viewpoint = source.Viewpoint
            })
                                .ToList();
        }
Exemplo n.º 6
0
        private void GetMarkupHeader(BCFv21.Schemas.Markup markup, BCFv2.BCFTopic sourceTopic)
        {
            if (!sourceTopic.Markup.ShouldSerializeHeader())
            {
                return;
            }

            markup.Header = sourceTopic.Markup.Header
                            .Select(source => new BCFv21.Schemas.HeaderFile
            {
                Date       = source.Date,
                Filename   = source.Filename,
                IfcProject = source.IfcProject,
                IfcSpatialStructureElement = source.IfcSpatialStructureElement,
                isExternal = source.isExternal,
                Reference  = source.Reference
            })
                            .ToList();
        }
Exemplo n.º 7
0
        private void GetSingleTopicViewpoint(BCFv2.BCFTopic topic, BCFv21.Schemas.VisualizationInfo sourceViewpoint)
        {
            var viewpoint = new BCFv2.Schemas.VisualizationInfo();

            if (sourceViewpoint.ShouldSerializeBitmap())
            {
                viewpoint.Bitmaps = sourceViewpoint.Bitmap
                                    .Select(bitmap => new BCFv2.Schemas.VisualizationInfoBitmaps
                {
                    Height    = bitmap.Height,
                    Location  = GetV2PointFromV21(bitmap.Location),
                    Normal    = GetV2DirectionFromV21(bitmap.Normal),
                    Up        = GetV2DirectionFromV21(bitmap.Up),
                    Reference = bitmap.Reference,
                    Bitmap    = bitmap.Bitmap == BCFv21.Schemas.BitmapFormat.JPG
                                ? BCFv2.Schemas.BitmapFormat.JPG
                                : BCFv2.Schemas.BitmapFormat.PNG
                })
                                    .ToList();
            }

            if (sourceViewpoint.ShouldSerializeClippingPlanes())
            {
                viewpoint.ClippingPlanes = sourceViewpoint.ClippingPlanes
                                           .Select(plane => new BCFv2.Schemas.ClippingPlane
                {
                    Direction = GetV2DirectionFromV21(plane.Direction),
                    Location  = GetV2PointFromV21(plane.Location)
                })
                                           .ToList();
            }

            if (sourceViewpoint.ShouldSerializeComponents())
            {
                viewpoint.Components = GetComponentsForViewpoint(sourceViewpoint);
            }

            if (sourceViewpoint.ShouldSerializeLines())
            {
                viewpoint.Lines = sourceViewpoint.Lines
                                  .Select(line => new BCFv2.Schemas.Line
                {
                    EndPoint   = GetV2PointFromV21(line.EndPoint),
                    StartPoint = GetV2PointFromV21(line.StartPoint)
                })
                                  .ToList();
            }

            if (sourceViewpoint.ShouldSerializeOrthogonalCamera())
            {
                viewpoint.OrthogonalCamera = new BCFv2.Schemas.OrthogonalCamera
                {
                    CameraDirection  = GetV2DirectionFromV21(sourceViewpoint.OrthogonalCamera.CameraDirection),
                    CameraUpVector   = GetV2DirectionFromV21(sourceViewpoint.OrthogonalCamera.CameraUpVector),
                    CameraViewPoint  = GetV2PointFromV21(sourceViewpoint.OrthogonalCamera.CameraViewPoint),
                    ViewToWorldScale = sourceViewpoint.OrthogonalCamera.ViewToWorldScale
                };
            }

            if (sourceViewpoint.ShouldSerializePerspectiveCamera())
            {
                viewpoint.PerspectiveCamera = new BCFv2.Schemas.PerspectiveCamera
                {
                    CameraDirection = GetV2DirectionFromV21(sourceViewpoint.PerspectiveCamera.CameraDirection),
                    CameraUpVector  = GetV2DirectionFromV21(sourceViewpoint.PerspectiveCamera.CameraUpVector),
                    CameraViewPoint = GetV2PointFromV21(sourceViewpoint.PerspectiveCamera.CameraViewPoint),
                    FieldOfView     = sourceViewpoint.PerspectiveCamera.FieldOfView
                };
            }

            viewpoint.GUID = sourceViewpoint.Guid;

            topic.Viewpoints.Add(viewpoint);
        }
Exemplo n.º 8
0
        private void GetMarkupTopic(BCFv21.Schemas.Markup markup, BCFv2.BCFTopic sourceTopic)
        {
            if (!sourceTopic.Markup.ShouldSerializeTopic())
            {
                return;
            }

            var srcTopic = sourceTopic.Markup.Topic;

            markup.Topic = new BCFv21.Schemas.Topic();

            {
                if (srcTopic.ShouldSerializeAssignedTo())
                {
                    markup.Topic.AssignedTo = srcTopic.AssignedTo;
                }
                if (srcTopic.ShouldSerializeBimSnippet())
                {
                    markup.Topic.BimSnippet = srcTopic.BimSnippet == null
                        ? null
                        : new BCFv21.Schemas.BimSnippet
                    {
                        isExternal      = srcTopic.BimSnippet.isExternal,
                        Reference       = srcTopic.BimSnippet.Reference,
                        ReferenceSchema = srcTopic.BimSnippet.ReferenceSchema,
                        SnippetType     = srcTopic.BimSnippet.SnippetType
                    };
                }
                if (srcTopic.ShouldSerializeCreationAuthor())
                {
                    markup.Topic.CreationAuthor = srcTopic.CreationAuthor;
                }
                if (srcTopic.ShouldSerializeCreationDate())
                {
                    markup.Topic.CreationDate = srcTopic.CreationDate;
                }
                if (srcTopic.ShouldSerializeDescription())
                {
                    markup.Topic.Description = srcTopic.Description;
                }
                if (srcTopic.ShouldSerializeDocumentReferences())
                {
                    markup.Topic.DocumentReference = srcTopic.DocumentReferences?
                                                     .Select(src => new BCFv21.Schemas.TopicDocumentReference
                    {
                        Description        = src.Description,
                        Guid               = src.Guid,
                        isExternal         = src.isExternal,
                        ReferencedDocument = src.ReferencedDocument
                    })
                                                     .ToList();
                }
                if (srcTopic.ShouldSerializeGuid())
                {
                    markup.Topic.Guid = srcTopic.Guid;
                }
                if (srcTopic.ShouldSerializeLabels())
                {
                    markup.Topic.Labels = srcTopic.Labels?.ToList();
                }
                if (srcTopic.ShouldSerializeModifiedAuthor())
                {
                    markup.Topic.ModifiedAuthor = srcTopic.ModifiedAuthor;
                }
                if (srcTopic.ShouldSerializeModifiedDate())
                {
                    markup.Topic.ModifiedDate = srcTopic.ModifiedDate;
                }
                if (srcTopic.ShouldSerializePriority())
                {
                    markup.Topic.Priority = srcTopic.Priority;
                }
                if (srcTopic.ShouldSerializeReferenceLink())
                {
                    markup.Topic.ReferenceLink = srcTopic.ReferenceLink == null ? null : new List <string> {
                        srcTopic.ReferenceLink
                    };
                }
                if (srcTopic.ShouldSerializeTitle())
                {
                    markup.Topic.Title = srcTopic.Title;
                }
                if (srcTopic.ShouldSerializeRelatedTopics())
                {
                    markup.Topic.RelatedTopic = srcTopic.RelatedTopics?
                                                .Select(src => new BCFv21.Schemas.TopicRelatedTopic
                    {
                        Guid = src.Guid
                    })
                                                .ToList();
                }
                if (srcTopic.ShouldSerializeTopicStatus())
                {
                    markup.Topic.TopicStatus = srcTopic.TopicStatus;
                }
                if (srcTopic.ShouldSerializeTopicType())
                {
                    markup.Topic.TopicType = srcTopic.TopicType;
                }
            };
        }