Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the NodeStyle class
        /// </summary>
        /// <param name="xmlStyle">Xml representation of the node style</param>
        /// <param name="assemblyManager">Manager for assembly/name resolution</param>
        public NodeStyle(XElement xmlStyle, ExternalAssemblyManager assemblyManager)
        {
            this.SetDefaultFieldValues();

            // set the constructor of the LinkView
            XElement constructorXml = xmlStyle.Element(xml.SettingsXmlContent.Namespace + xml.SettingsXmlContent.ClassNameElementOfNodeStyleElementName);
            if (constructorXml != null)
            {
                ConstructorInfo constructor = assemblyManager.SearchNodeViewConstructor(constructorXml.Value);
                if (constructor != null)
                {
                    this.viewConstructor = constructor;
                }
            }

            // set the drawing information to the style
            XElement drawingInformationElement = xmlStyle.Element(xml.SettingsXmlContent.Namespace + xml.SettingsXmlContent.DrawingInformationElementOfNodeStyleElementName);
            if (drawingInformationElement != null)
            {
                this.drawingInformation = drawingInformationElement;
            }

            // set the size coeficient
            XElement relativeSizeElement = xmlStyle.Element(xml.SettingsXmlContent.Namespace + xml.SettingsXmlContent.RelativeSizeElementOfNodeStyleElementName);
            if (relativeSizeElement != null)
            {
                this.relativeSize = xml.SettingsXmlContent.ParseToDouble(relativeSizeElement.Value);
            }
        }