Example #1
0
        /// <summary>
        /// Generates a new <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </summary>
        /// <param name="node">
        /// The <see cref="XmlElement">XmlElement</see> node for which to generate
        /// a new <see cref="RenderingNode">RenderingNode</see> object.
        /// </param>
        /// <returns>
        /// The generated <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </returns>
        public RenderingNode GetRenderingNode(
            ISvgElement node)
        {
            SvgElement    svgNode = (SvgElement)node;
            string        name    = svgNode.NamespaceURI + ":" + svgNode.LocalName;
            RenderingNode result;

            if (nodeByTagName.ContainsKey(name))
            {
                object[] args = new object[] { svgNode };
                result = (RenderingNode)nodeByTagName.CreateInstance(name, args);
            }
            else if (node is ISharpGDIPath)
            {
                result = new GDIPathGraphicsNode(svgNode);
            }
            else
            {
                result = new GraphicsNode(svgNode);
            }

            return(result);
        }
Example #2
0
        /// <summary>
        /// Generates a new <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </summary>
        /// <param name="node">
        /// The <see cref="XmlElement">XmlElement</see> node for which to generate
        /// a new <see cref="RenderingNode">RenderingNode</see> object.
        /// </param>
        /// <returns>
        /// The generated <see cref="RenderingNode">RenderingNode</see> that
        /// corresponds to the given <see cref="XmlElement">XmlElement</see>.
        /// </returns>
        public RenderingNode GetRenderingNode(
        ISvgElement node)
        {
            SvgElement svgNode = (SvgElement)node;
            string name = svgNode.NamespaceURI + ":" + svgNode.LocalName;
            RenderingNode result;

            if (nodeByTagName.ContainsKey(name))
            {
            object[] args = new object[] {svgNode};
            result = (RenderingNode) nodeByTagName.CreateInstance(name, args);
            }
            else if (node is ISharpGDIPath)
            {
            result = new GDIPathGraphicsNode(svgNode);
            }
            else
            {
            result = new GraphicsNode(svgNode);
            }

            return result;
        }