Ejemplo n.º 1
0
        private void SmartGraphPathParentChanged()
        {
            GraphVM previous = Graph;

            Graph = GraphPath?.Parent;
            if (Graph != null && Graph == previous)
            {
                return;
            }
            previous = Graph;

            Nodes.Clear();
            Edges.Clear();
            NodesNames.Clear();
            EdgesPath.Clear();
            NodesPathOrder.Clear();

            if (Graph == null)
            {
                return;
            }

            positioner = new CircleGraphPositioner(Graph);

            double actualWidth  = ActualWidth;
            double actualHeight = ActualHeight;

            foreach (var node in Graph.Nodes)
            {
                Nodes[node]      = CalculatePosition(node, NodesMargin, actualWidth, actualHeight);
                NodesNames[node] = CalculatePosition(node, NamesMargin, actualWidth, actualHeight);
            }

            foreach (var edge in Graph.Edges)
            {
                Edges.Add(edge);
            }

            ++ChangeCount;
        }
Ejemplo n.º 2
0
        private void SmartGraphPathCahnged()
        {
            EdgesPath.Clear();
            NodesPathOrder.Clear();

            if (GraphPath == null)
            {
                return;
            }

            int index = 0;

            NodesPathOrder.Add(GraphPath.Edges.First().Begin, index++);
            foreach (var edge in GraphPath.Edges)
            {
                EdgesPath.Add(edge);
                NodesPathOrder.Add(edge.End, index++);
            }
            ++ChangeCount;

            SetAnimation();
        }