/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public override bool VisitSingleAttribute(SingleAttribute singleAttribute) { stringBuilder.Append(this.prefix + "Single Attribute\n"); stringBuilder.Append(this.prefix + " Tag: (" + singleAttribute.Tag.GroupNumber.ToString("X4") + "," + singleAttribute.Tag.ElementNumber.ToString("X4") + ")\n"); stringBuilder.Append(this.prefix + " Name: " + singleAttribute.Name + "\n"); stringBuilder.Append(this.prefix + " VR: " + singleAttribute.ValueRepresentations + "\n"); stringBuilder.Append(this.prefix + " Path\n"); stringBuilder.Append(this.prefix + " " + singleAttribute.ToString2(prefix + " ") + "\n"); return(true); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public override bool VisitSingleAttribute(SingleAttribute singleAttribute) { VisitAttribute(singleAttribute); return(true); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public virtual bool VisitSingleAttribute(SingleAttribute singleAttribute) { return (true); }
/// <summary> /// Create an (single or sequence) Attribute instance using a raw xml file (that is generated by the ODD). /// </summary> /// <param name="attributeNode">An Attribute node.</param> /// <returns>The created Attribute instance.</returns> public static Attribute Create(XPathNavigator attributeNode, AttributesAndMacros parent) { Attribute attribute = null; // Return value; string name = string.Empty; Tag tag = new Tag(); // // Determine attribute name. // try { name = attributeNode.GetAttribute("Name", ""); } catch (Exception exception) { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "Unable to determine Name", exception)); } // // Determine tag. // tag = Tag.Create(attributeNode); // // Construct a single attribute or a sequence attribute. // VR valueRepresentations = VR.None; XPathNodeIterator vRNodes = attributeNode.Select("VR"); if (vRNodes.MoveNext()) { try { valueRepresentations = (VR)System.Enum.Parse(typeof(VR), vRNodes.Current.Value.Replace('/', ',')); } catch { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node does not contain a valid VR.", null)); } } else { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node not found.", null)); } if (valueRepresentations == VR.SQ) { attribute = SequenceAttribute.Create(tag, name, attributeNode, parent); } else { attribute = new SingleAttribute(tag, valueRepresentations, name, parent); } // // Return the constructed attribute. // return(attribute); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public virtual bool VisitSingleAttribute(SingleAttribute singleAttribute) { return(true); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public override bool VisitSingleAttribute(SingleAttribute singleAttribute) { VisitAttribute(singleAttribute); return (true); }
/// <summary> /// Create an (single or sequence) Attribute instance using a raw xml file (that is generated by the ODD). /// </summary> /// <param name="attributeNode">An Attribute node.</param> /// <returns>The created Attribute instance.</returns> public static Attribute Create(XPathNavigator attributeNode, AttributesAndMacros parent) { Attribute attribute = null; // Return value; string name = string.Empty; Tag tag = new Tag(); // // Determine attribute name. // try { name = attributeNode.GetAttribute("Name", ""); } catch (Exception exception) { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "Unable to determine Name", exception)); } // // Determine tag. // tag = Tag.Create(attributeNode); // // Construct a single attribute or a sequence attribute. // VR valueRepresentations = VR.None; XPathNodeIterator vRNodes = attributeNode.Select("VR"); if (vRNodes.MoveNext()) { try { valueRepresentations = (VR)System.Enum.Parse(typeof(VR), vRNodes.Current.Value.Replace('/', ',')); } catch { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node does not contain a valid VR.", null)); } } else { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node not found.", null)); } if (valueRepresentations == VR.SQ) { attribute = SequenceAttribute.Create(tag, name, attributeNode, parent); } else { attribute = new SingleAttribute(tag, valueRepresentations, name, parent); } // // Return the constructed attribute. // return (attribute); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="singleAttribute">The SingleAttribute instance to visit.</param> /// <returns> /// true: continue traversing the siblings of the supplied instance. /// false: stop traversing the siblings of the supplied instance. /// </returns> public override bool VisitSingleAttribute(SingleAttribute singleAttribute) { stringBuilder.Append(this.prefix + "Single Attribute\n"); stringBuilder.Append(this.prefix + " Tag: (" + singleAttribute.Tag.GroupNumber.ToString("X4") + "," + singleAttribute.Tag.ElementNumber.ToString("X4") + ")\n"); stringBuilder.Append(this.prefix + " Name: " + singleAttribute.Name + "\n"); stringBuilder.Append(this.prefix + " VR: " + singleAttribute.ValueRepresentations + "\n"); stringBuilder.Append(this.prefix + " Path\n"); stringBuilder.Append(this.prefix + " " + singleAttribute.ToString2(prefix + " ") + "\n"); return (true); }