Пример #1
0
        public static Assembly operator *(Assembly first, double factor)
        {
            Assembly assembly = new Assembly();

            foreach (Layer layer in first.Layers)
            {
                Layer lay = new Layer(layer.Material, layer.Width * factor, layer.isPercentual);
                assembly.Layers.Add(lay);
            }

            return assembly;
        }
Пример #2
0
        public static Assembly operator +(Assembly first, Assembly second)
        {
            Assembly assembly = new Assembly();

            foreach (Layer layer in first.Layers) assembly.Layers.Add(layer);
            foreach (Layer layer in second.Layers) assembly.Layers.Add(layer);

            return assembly;
        }
Пример #3
0
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            MaterialSelector = new ListView();
            materialSelection.Children.Add(MaterialSelector);
            MaterialSelector.Background = Brushes.WhiteSmoke;
            MaterialSelector.BorderBrush = Brushes.WhiteSmoke;
            MaterialSelector.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            MaterialSelector.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            if (System.IO.File.Exists(this.alternativeDataSourcePath))
            {
                string[] data = System.IO.File.ReadAllLines(this.alternativeDataSourcePath);

                for(int i = 1; i < data.Length; i++)
                {
                    string[] fields = data[i].Split(',');

                    if (fields.Length == 7)
                    {
                        Tortuga.Types.Material material = new Material()
                        {
                            Name = fields[0],

                            GlobalWarmingPotential = new UnitDouble<Types.LCA.CO2e>(double.Parse(fields[1])),
                            Acidification = new UnitDouble<Types.LCA.kgSO2>(double.Parse(fields[2])),
                            DepletionOfNonrenewbles = new UnitDouble<Types.LCA.MJ>(double.Parse(fields[3])),
                            DepletionOfOzoneLayer = new UnitDouble<Types.LCA.kgCFC11>(double.Parse(fields[4])),
                            Eutrophication = new UnitDouble<Types.LCA.kgPhostphate>(double.Parse(fields[5])),
                            FormationTroposphericOzone = new UnitDouble<Types.LCA.kgNOx>(double.Parse(fields[6])),
                        };

                        MaterialSelector.Items.Add(material.Draw());

                    }
                }

            }

            Tortuga.Types.Material material1 = new Material()
            {
                Name = "TestMaterial",
                GlobalWarmingPotential = new UnitDouble<Types.LCA.CO2e>(1),
                Acidification = new UnitDouble<Types.LCA.kgSO2>(2),
                DepletionOfNonrenewbles = new UnitDouble<Types.LCA.MJ>(3),
                DepletionOfOzoneLayer = new UnitDouble<Types.LCA.kgCFC11>(4),
                Eutrophication = new UnitDouble<Types.LCA.kgPhostphate>(5),
                FormationTroposphericOzone = new UnitDouble<Types.LCA.kgNOx>(6)
            };

            MaterialSelector.Items.Add(material1.Draw());

            MaterialSelector.Height = 500;

            materialComposer = new ListView();
            materialAssemblyHost.Children.Add(materialComposer);
            materialComposer.Height = 500;

            materialComposer.SelectionChanged += materialComposer_SelectionChanged;
            materialComposer.Background = Brushes.WhiteSmoke;
            materialComposer.BorderBrush = Brushes.WhiteSmoke;
            materialComposer.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            materialComposer.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            //infoScreen = new TextBlock();
            //infoScreen.Margin = new Thickness(5);
            //materialAssemblyHost.Children.Add(infoScreen);

            if (this.assembly == null) this.assembly = new Assembly();
            else this.assembly.Draw(this.materialComposer);
        }