public void ReplaceLayer(LayerViewModel viewModel, int position) { Layers.RemoveAt(position); Layers.Insert(position, viewModel); structure.ReplaceLayer(viewModel.Material, position); }
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); }
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); } }
public void DeleteLayer(LayerViewModel viewModel) { structure.RemoveLayer(viewModel.Material); Layers.Remove(viewModel); }
public void MoveLayer(LayerViewModel viewModel, int position) { structure.MoveLayer(viewModel.Material, position); Layers.Move(Layers.IndexOf(viewModel), position); }