Exemple #1
0
        public void ReplaceLayer(LayerViewModel viewModel, int position)
        {
            Layers.RemoveAt(position);
            Layers.Insert(position, viewModel);

            structure.ReplaceLayer(viewModel.Material, position);
        }
Exemple #2
0
        public void DuplicateLayer(LayerViewModel viewModel)
        {
            var duplicateMaterial = viewModel.Material.DeepClone();
            var newIndex          = Layers.IndexOf(viewModel);
            var newViewModel      = new LayerViewModel(duplicateMaterial);

            structure.InsertLayer(newIndex + 1, duplicateMaterial);
            Layers.Insert(newIndex + 1, newViewModel);
        }
Exemple #3
0
        public void AddLayer(LayerViewModel viewModel)
        {
            structure.AddLayer(viewModel.Material);

            // If the bottom layer is a semiconductor or metal, then there's no point
            // in adding this material below that, because it's not valid.
            if (Layers.Count > 0 && Layers[Layers.Count - 1].Material.MaterialType != MaterialType.Dielectric)
            {
                Layers.Insert(Layers.Count - 1, viewModel);
            }
            else
            {
                Layers.Add(viewModel);
            }
        }
Exemple #4
0
 public void DeleteLayer(LayerViewModel viewModel)
 {
     structure.RemoveLayer(viewModel.Material);
     Layers.Remove(viewModel);
 }
Exemple #5
0
 public void MoveLayer(LayerViewModel viewModel, int position)
 {
     structure.MoveLayer(viewModel.Material, position);
     Layers.Move(Layers.IndexOf(viewModel), position);
 }