Ejemplo n.º 1
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            this.parentSequenceAttributes.Remove(sequenceAttribute);

            this.prefix = this.prefix.Substring(0, this.prefix.Length - 2);
            this.nestingLevel--;

            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="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            if ((sequenceAttribute.Tag.GroupNumber == 0x0040) && (sequenceAttribute.Tag.ElementNumber == 0xA730))
            {
                if (this.documentRelationshipMacro != null)
                {
                    sequenceAttribute.SequenceItem.Add(this.documentRelationshipMacro);
                }
            }

            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="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            if ((sequenceAttribute.Tag.GroupNumber == 0x0040) && (sequenceAttribute.Tag.ElementNumber == 0xA730))
            {
                if (this.documentRelationshipMacro != null)
                {
                    sequenceAttribute.SequenceItem.Add(this.documentRelationshipMacro);
                }
            }

            return (true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            stringBuilder.Append(this.prefix + "Sequence Attribute\n");
            stringBuilder.Append(this.prefix + "  Tag: (" + sequenceAttribute.Tag.GroupNumber.ToString("X4") + "," + sequenceAttribute.Tag.ElementNumber.ToString("X4") + ")\n");
            stringBuilder.Append(this.prefix + "  Name: " + sequenceAttribute.Name + "\n");
            stringBuilder.Append(this.prefix + "  VR: " + sequenceAttribute.ValueRepresentations + "\n");
            stringBuilder.Append(this.prefix + "  Path\n");
            stringBuilder.Append(this.prefix + "    " + sequenceAttribute.ToString2(prefix + "    ") + "\n");

            this.prefix += "    ";

            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a Sequence Attribute instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="name">The name.</param>
        /// <param name="attributeNode">The Attribute node.</param>
        /// <param name="parent">The parent of the instance to create.</param>
        /// <returns>The created SequenceAttribute inistance.</returns>
        internal static SequenceAttribute Create(Tag tag, string name, XPathNavigator attributeNode, AttributesAndMacros parent)
        {
            SequenceAttribute sequenceAttribute = new SequenceAttribute(tag, name, parent);

            XPathNodeIterator itemNodes = attributeNode.Select("Values/Sequence/Item");

            if (itemNodes.MoveNext())
            {
                sequenceAttribute.sequenceItem = SequenceItem.Create(itemNodes.Current, sequenceAttribute);
            }
            else
            {
                throw (DefinitionFile.CreateException(attributeNode, "SequenceAttribute", "Values/Sequence/Item node not found", null));
            }

            return(sequenceAttribute);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a Sequence Item instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="sequenceItemNode">The Seuqnece Item node.</param>
        /// <param name="parent">The parent the the instance to create.</param>
        /// <returns>The created SequenceItem instance.</returns>
        public static SequenceItem Create(XPathNavigator sequenceItemNode, SequenceAttribute parent)
        {
            //
            // Construct SequenceItem instance.
            //

            SequenceItem sequenceItem = new SequenceItem(parent);

            //
            // Add attribute instances and Macros instances to created SequenceItem instance.
            //

            sequenceItem.AddAttributesAndMacros(sequenceItemNode);

            //
            // Return created instance.
            //

            return (sequenceItem);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a Sequence Item instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="sequenceItemNode">The Seuqnece Item node.</param>
        /// <param name="parent">The parent the the instance to create.</param>
        /// <returns>The created SequenceItem instance.</returns>
        public static SequenceItem Create(XPathNavigator sequenceItemNode, SequenceAttribute parent)
        {
            //
            // Construct SequenceItem instance.
            //

            SequenceItem sequenceItem = new SequenceItem(parent);


            //
            // Add attribute instances and Macros instances to created SequenceItem instance.
            //

            sequenceItem.AddAttributesAndMacros(sequenceItemNode);


            //
            // Return created instance.
            //

            return(sequenceItem);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            bool visitChilds = true;

            VisitAttribute(sequenceAttribute);

            if (this.parentSequenceAttributes.ContainsKey(sequenceAttribute))
            {
                stringBuilder.Append(this.prefix + "  Sequence Attribute has already been visited. Stopping string dump at this point to avoid infinite loop.\n");

                visitChilds = false;
            }
            else
            {
                this.parentSequenceAttributes.Add(sequenceAttribute, 0);
            }

            this.prefix += "  ";
            this.nestingLevel++;

            return(visitChilds);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            return(true);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
 /// <returns>
 /// true: traverse the children of this instance.
 /// false: do not traverse the children of this instance.
 /// </returns>
 public virtual bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
 {
     return (true);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The parent of this instance.</param>
 public SequenceItem(SequenceAttribute parent)
 {
     this.parent = parent;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The parent of this instance.</param>
 public SequenceItem(SequenceAttribute parent)
 {
     this.parent = parent;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            return (true);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
 /// <returns>
 /// true: traverse the children of this instance.
 /// false: do not traverse the children of this instance.
 /// </returns>
 public virtual bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
 {
     return(true);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Create a Sequence Attribute instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="name">The name.</param>
        /// <param name="attributeNode">The Attribute node.</param>
        /// <param name="parent">The parent of the instance to create.</param>
        /// <returns>The created SequenceAttribute inistance.</returns>
        internal static SequenceAttribute Create(Tag tag, string name, XPathNavigator attributeNode, AttributesAndMacros parent)
        {
            SequenceAttribute sequenceAttribute = new SequenceAttribute(tag, name, parent);

            XPathNodeIterator itemNodes = attributeNode.Select("Values/Sequence/Item");

            if (itemNodes.MoveNext())
            {
                sequenceAttribute.sequenceItem = SequenceItem.Create(itemNodes.Current, sequenceAttribute);
            }
            else
            {
                throw (DefinitionFile.CreateException(attributeNode, "SequenceAttribute", "Values/Sequence/Item node not found", null));
            }

            return (sequenceAttribute);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            bool visitChilds = true;

            VisitAttribute(sequenceAttribute);

            if (this.parentSequenceAttributes.ContainsKey(sequenceAttribute))
            {
                stringBuilder.Append(this.prefix + "  Sequence Attribute has already been visited. Stopping string dump at this point to avoid infinite loop.\n");

                visitChilds = false;
            }
            else
            {
                this.parentSequenceAttributes.Add(sequenceAttribute, 0);
            }

            this.prefix += "  ";
            this.nestingLevel++;

            return (visitChilds);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute 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 VisitLeaveSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            this.parentSequenceAttributes.Remove(sequenceAttribute);

            this.prefix = this.prefix.Substring(0, this.prefix.Length - 2);
            this.nestingLevel--;

            return (true);
        }
Ejemplo n.º 18
0
        /// <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);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="sequenceAttribute">The SequenceAttribute instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterSequenceAttribute(SequenceAttribute sequenceAttribute)
        {
            stringBuilder.Append(this.prefix + "Sequence Attribute\n");
            stringBuilder.Append(this.prefix + "  Tag: (" + sequenceAttribute.Tag.GroupNumber.ToString("X4") + "," + sequenceAttribute.Tag.ElementNumber.ToString("X4") + ")\n");
            stringBuilder.Append(this.prefix + "  Name: " + sequenceAttribute.Name + "\n");
            stringBuilder.Append(this.prefix + "  VR: " + sequenceAttribute.ValueRepresentations + "\n");
            stringBuilder.Append(this.prefix + "  Path\n");
            stringBuilder.Append(this.prefix + "    " + sequenceAttribute.ToString2(prefix + "    ") + "\n");

            this.prefix += "    ";

            return (true);
        }