diff --git a/Xbim.BCF/MarkupXMLFile.cs b/Xbim.BCF/MarkupXMLFile.cs index 2bc8fb3..3aeaaa5 100644 --- a/Xbim.BCF/MarkupXMLFile.cs +++ b/Xbim.BCF/MarkupXMLFile.cs @@ -27,8 +27,8 @@ public MarkupXMLFile(XDocument xdoc) { Comments = new List(); Viewpoints = new List(); - - Header = new BCFHeader(xdoc.Root.Element("Header")); + if (xdoc.Root.Element("Header") != null) + Header = new BCFHeader(xdoc.Root.Element("Header")); Topic = new BCFTopic(xdoc.Root.Element("Topic")); foreach (var comment in (xdoc.Root.Elements("Comment"))) { diff --git a/Xbim.BCF/VisualizationXMLFile.cs b/Xbim.BCF/VisualizationXMLFile.cs index d3644a9..bfed31a 100644 --- a/Xbim.BCF/VisualizationXMLFile.cs +++ b/Xbim.BCF/VisualizationXMLFile.cs @@ -19,7 +19,8 @@ public Guid Guid { if (value == null || value == System.Guid.Empty) { - throw new ArgumentException(this.GetType().Name + " - Guid attribute is mandatory and must contain a valid Guid value"); + // don't stop if Guid is missing + // throw new ArgumentException(this.GetType().Name + " - Guid attribute is mandatory and must contain a valid Guid value"); } else { diff --git a/Xbim.BCF/XMLNodes/BCFComponents.cs b/Xbim.BCF/XMLNodes/BCFComponents.cs index ca89947..a9199b5 100644 --- a/Xbim.BCF/XMLNodes/BCFComponents.cs +++ b/Xbim.BCF/XMLNodes/BCFComponents.cs @@ -32,7 +32,8 @@ public BCFComponentVisibility Visibility { if (ReferenceEquals(value, null)) { - throw new ArgumentException(this.GetType().Name + " - Visibility is mandatory"); + // don't stop if Visibility is missing + // throw new ArgumentException(this.GetType().Name + " - Visibility is mandatory"); } else { diff --git a/Xbim.BCF/XMLNodes/BCFPerspectiveCamera.cs b/Xbim.BCF/XMLNodes/BCFPerspectiveCamera.cs index 4620118..174336c 100644 --- a/Xbim.BCF/XMLNodes/BCFPerspectiveCamera.cs +++ b/Xbim.BCF/XMLNodes/BCFPerspectiveCamera.cs @@ -71,9 +71,9 @@ public double FieldOfView get { return _fieldOfView; } set { - if (value == double.NaN || value < 45 || value > 60) + if (value == double.NaN || value < 0 || value > 360) { - throw new ArgumentException(this.GetType().Name + " - FieldOfView - must be a valid 64-bit floating-point value between 45 and 60"); + throw new ArgumentException(this.GetType().Name + " - FieldOfView - must be a valid 64-bit floating-point value between 0 and 360"); } else { diff --git a/Xbim.BCF/XMLNodes/BCFTopic.cs b/Xbim.BCF/XMLNodes/BCFTopic.cs index 3f9bf4a..68fc76d 100644 --- a/Xbim.BCF/XMLNodes/BCFTopic.cs +++ b/Xbim.BCF/XMLNodes/BCFTopic.cs @@ -93,11 +93,20 @@ public bool ShouldSerializeIndex() { return Index != null; } + /// + /// Topic Labels. Tags for grouping Topics. The list of possible values are defined in the extension schema. + /// + [XmlElement(Order = 6)] + public String Labels { get; set; } + public bool ShouldSerializeLabels() + { + return !string.IsNullOrEmpty(Labels); + } private DateTime? _creationDate; /// /// Date when the topic was created /// - [XmlElement(Order = 6)] + [XmlElement(Order = 7)] public DateTime? CreationDate { get { return _creationDate; } @@ -117,7 +126,7 @@ public DateTime? CreationDate /// /// User who created the topic /// - [XmlElement(Order = 7)] + [XmlElement(Order = 8)] public String CreationAuthor { get { return _creationAuthor; } @@ -125,7 +134,8 @@ public String CreationAuthor { if (String.IsNullOrEmpty(value)) { - throw new ArgumentException(this.GetType().Name + " - CreationAuthor is mandatory"); + // don't stop if CreationAuthor is missing + // throw new ArgumentException(this.GetType().Name + " - CreationAuthor is mandatory"); } else { @@ -135,7 +145,7 @@ public String CreationAuthor } /// Date when the topic was last modified /// - [XmlElement(Order = 8)] + [XmlElement(Order = 9)] public DateTime? ModifiedDate { get; set; } public bool ShouldSerializeModifiedDate() { @@ -144,7 +154,7 @@ public bool ShouldSerializeModifiedDate() /// /// User who modified the topic /// - [XmlElement(Order = 9)] + [XmlElement(Order = 10)] public String ModifiedAuthor { get; set; } public bool ShouldSerializeModifiedAuthor() { @@ -153,7 +163,7 @@ public bool ShouldSerializeModifiedAuthor() /// /// Due date /// - [XmlElement(Order = 10)] + [XmlElement(Order = 11)] public DateTime? DueDate { get; set; } public bool ShouldSerializeDueDate() { @@ -162,7 +172,7 @@ public bool ShouldSerializeDueDate() /// /// The user to whom this topic is assigned to /// - [XmlElement(Order = 11)] + [XmlElement(Order = 12)] public String AssignedTo { get; set; } public bool ShouldSerializeAssignedTo() { @@ -171,7 +181,7 @@ public bool ShouldSerializeAssignedTo() /// /// Stage /// - [XmlElement(Order = 12)] + [XmlElement(Order = 13)] public String Stage { get; set; } public bool ShouldSerializeStage() { @@ -189,7 +199,7 @@ public bool ShouldSerializeTopicStatus() /// /// BimSnippet is an additional file containing information related to one or multiple topics. For example, it can be an IFC file containing provisions for voids. /// - [XmlElement(Order = 13)] + [XmlElement(Order = 14)] public BCFBimSnippet BimSnippet { get; set; } public bool ShouldSerializeBimSnippet() { @@ -198,7 +208,7 @@ public bool ShouldSerializeBimSnippet() /// /// DocumentReference provides a means to associate additional payloads or links with topics. The references may point to a file within the .bcfzip or to an external location. /// - [XmlElement(ElementName = "DocumentReference", Order = 14)] + [XmlElement(ElementName = "DocumentReference", Order = 15)] public List DocumentReferences; public bool ShouldSerializeDocumentReferences() { @@ -207,7 +217,7 @@ public bool ShouldSerializeDocumentReferences() /// /// Relation between topics (Clash -> PfV -> Opening) /// - [XmlElement(ElementName = "RelatedTopic", Order = 15)] + [XmlElement(ElementName = "RelatedTopic", Order = 16)] public List RelatedTopics; public bool ShouldSerializeRelatedTopics() { @@ -241,6 +251,7 @@ public BCFTopic(XElement node) Description = (String)node.Element("Description") ?? ""; Priority = (String)node.Element("Priority") ?? ""; Index = (int?)node.Element("Index") ?? null; + Labels = (String)node.Element("Labels") ?? ""; CreationDate = (DateTime?)node.Element("CreationDate") ?? null; CreationAuthor = (String)node.Element("CreationAuthor") ?? ""; ModifiedDate = (DateTime?)node.Element("ModifiedDate") ?? null;