Exemple #1
0
        // complement and update ViewModel from PkModel and couple ViewModel and PkModel
        protected override void UpdateDiagramModel(IMoBiSimulation simulation, IDiagramModel diagramModel, bool coupleAll)
        {
            // create neighborhoodsContainerNode, because entities are only added
            // for available parentContainerNodes
            IContainerNode neighborhoodsContainerNode = AddAndCoupleNode <IContainer, MultiPortContainerNode>(diagramModel, simulation.Model.Neighborhoods, coupleAll);

            foreach (var baseNode in neighborhoodsContainerNode.GetAllChildren <IBaseNode>())
            {
                baseNode.IsVisible = false;
            }

            neighborhoodsContainerNode.IsVisible = false;

            foreach (var topContainer in simulation.Model.Root.GetAllContainersAndSelf <IContainer>())
            {
                if (topContainer.ContainerType == ContainerType.Organism ||
                    topContainer.ContainerType == ContainerType.Organ ||
                    topContainer.ContainerType == ContainerType.Compartment)
                {
                    AddObjectBase(diagramModel, topContainer, true, coupleAll);
                }
            }

            foreach (var neighborhood in simulation.Model.Neighborhoods.GetAllChildren <INeighborhood>())
            {
                AddNeighborhood(neighborhood);
            }

            DiagramModel.ClearUndoStack();
        }