Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing Labels node in Topic node for compliancy to BCF2.1 #6

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Xbim.BCF/MarkupXMLFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public MarkupXMLFile(XDocument xdoc)
{
Comments = new List<BCFComment>();
Viewpoints = new List<BCFViewpoint>();

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")))
{
Expand Down
3 changes: 2 additions & 1 deletion Xbim.BCF/VisualizationXMLFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion Xbim.BCF/XMLNodes/BCFComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions Xbim.BCF/XMLNodes/BCFPerspectiveCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
33 changes: 22 additions & 11 deletions Xbim.BCF/XMLNodes/BCFTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,20 @@ public bool ShouldSerializeIndex()
{
return Index != null;
}
/// <summary>
/// Topic Labels. Tags for grouping Topics. The list of possible values are defined in the extension schema.
/// </summary>
[XmlElement(Order = 6)]
public String Labels { get; set; }
public bool ShouldSerializeLabels()
{
return !string.IsNullOrEmpty(Labels);
}
private DateTime? _creationDate;
/// <summary>
/// Date when the topic was created
/// </summary>
[XmlElement(Order = 6)]
[XmlElement(Order = 7)]
public DateTime? CreationDate
{
get { return _creationDate; }
Expand All @@ -117,15 +126,16 @@ public DateTime? CreationDate
/// <summary>
/// User who created the topic
/// </summary>
[XmlElement(Order = 7)]
[XmlElement(Order = 8)]
public String CreationAuthor
{
get { return _creationAuthor; }
set
{
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
{
Expand All @@ -135,7 +145,7 @@ public String CreationAuthor
}
/// Date when the topic was last modified
/// </summary>
[XmlElement(Order = 8)]
[XmlElement(Order = 9)]
public DateTime? ModifiedDate { get; set; }
public bool ShouldSerializeModifiedDate()
{
Expand All @@ -144,7 +154,7 @@ public bool ShouldSerializeModifiedDate()
/// <summary>
/// User who modified the topic
/// </summary>
[XmlElement(Order = 9)]
[XmlElement(Order = 10)]
public String ModifiedAuthor { get; set; }
public bool ShouldSerializeModifiedAuthor()
{
Expand All @@ -153,7 +163,7 @@ public bool ShouldSerializeModifiedAuthor()
/// <summary>
/// Due date
/// </summary>
[XmlElement(Order = 10)]
[XmlElement(Order = 11)]
public DateTime? DueDate { get; set; }
public bool ShouldSerializeDueDate()
{
Expand All @@ -162,7 +172,7 @@ public bool ShouldSerializeDueDate()
/// <summary>
/// The user to whom this topic is assigned to
/// </summary>
[XmlElement(Order = 11)]
[XmlElement(Order = 12)]
public String AssignedTo { get; set; }
public bool ShouldSerializeAssignedTo()
{
Expand All @@ -171,7 +181,7 @@ public bool ShouldSerializeAssignedTo()
/// <summary>
/// Stage
/// </summary>
[XmlElement(Order = 12)]
[XmlElement(Order = 13)]
public String Stage { get; set; }
public bool ShouldSerializeStage()
{
Expand All @@ -189,7 +199,7 @@ public bool ShouldSerializeTopicStatus()
/// <summary>
/// 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.
/// </summary>
[XmlElement(Order = 13)]
[XmlElement(Order = 14)]
public BCFBimSnippet BimSnippet { get; set; }
public bool ShouldSerializeBimSnippet()
{
Expand All @@ -198,7 +208,7 @@ public bool ShouldSerializeBimSnippet()
/// <summary>
/// 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.
/// </summary>
[XmlElement(ElementName = "DocumentReference", Order = 14)]
[XmlElement(ElementName = "DocumentReference", Order = 15)]
public List<BCFDocumentReference> DocumentReferences;
public bool ShouldSerializeDocumentReferences()
{
Expand All @@ -207,7 +217,7 @@ public bool ShouldSerializeDocumentReferences()
/// <summary>
/// Relation between topics (Clash -> PfV -> Opening)
/// </summary>
[XmlElement(ElementName = "RelatedTopic", Order = 15)]
[XmlElement(ElementName = "RelatedTopic", Order = 16)]
public List<BCFRelatedTopic> RelatedTopics;
public bool ShouldSerializeRelatedTopics()
{
Expand Down Expand Up @@ -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;
Expand Down