Ejemplo n.º 1
0
        public IMoleculeMaterialTemplate ResolveBySymbol(string symbol)
        {
            MoleculeMaterialTemplate temp = null;

            elements.TryGetValue(symbol, out temp);
            return(temp);
        }
Ejemplo n.º 2
0
        public override void LoadModuleSettings(HashTableSettings settings)
        {
            //settings["Materials.Molecules.IMoleculeMaterialLookup"] = this;

            // load molecule settings from xml resource
            ColorConverter cc  = new ColorConverter();
            Stream         str = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.Molecule.config");
            XmlDocument    doc = new XmlDocument();

            doc.Load(str);

            // load series settings
            XmlNodeList series = doc.SelectNodes("configuration/chemicalSeries/chemicalSerie");

            foreach (XmlNode serie in series)
            {
                string id        = serie.Attributes["id"].InnerText;
                Color  baseColor = (Color)cc.ConvertFromString(serie.SelectSingleNode("color").Attributes["desc"].InnerText);

                this.series[id] = new AtomMaterial(baseColor);
            }

            // load symbols
            XmlNodeList      symbols    = doc.SelectNodes("configuration/chemicalSymbols/symbol");
            ElementPTFactory ptElements = ElementPTFactory.Instance;

            foreach (XmlNode symbol in symbols)
            {
                string id        = symbol.Attributes["id"].InnerText;
                Color  baseColor = (Color)cc.ConvertFromString(symbol.SelectSingleNode("color").Attributes["desc"].InnerText);

                PeriodicTableElement element = ptElements.getElement(id);

                IMoleculeMaterial serie = null;
                this.series.TryGetValue(element.ChemicalSerie, out serie);

                elements[id] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serie);
            }
        }
        public override void LoadModuleSettings(HashTableSettings settings)
        {
            //settings["Materials.Molecules.IMoleculeMaterialLookup"] = this;

            // load molecule settings from xml resource
            ColorConverter cc = new ColorConverter();
            Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.Molecule.config");
            XmlDocument doc = new XmlDocument();
            doc.Load(str);
            
            // load series settings
            XmlNodeList series = doc.SelectNodes("configuration/chemicalSeries/chemicalSerie");
            foreach (XmlNode serie in series)
            {
                string id = serie.Attributes["id"].InnerText;
                Color baseColor = (Color)cc.ConvertFromString(serie.SelectSingleNode("color").Attributes["desc"].InnerText);
                
                this.series[id] = new AtomMaterial(baseColor);
            }

            // load symbols
            XmlNodeList symbols = doc.SelectNodes("configuration/chemicalSymbols/symbol");
            ElementPTFactory ptElements = ElementPTFactory.Instance;
            foreach (XmlNode symbol in symbols)
            {
                string id = symbol.Attributes["id"].InnerText;
                Color baseColor = (Color)cc.ConvertFromString(symbol.SelectSingleNode("color").Attributes["desc"].InnerText);

                PeriodicTableElement element = ptElements.getElement(id);

                IMoleculeMaterial serie = null;
                this.series.TryGetValue(element.ChemicalSerie, out serie);

                elements[id] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serie);
            }
        }