예제 #1
0
        private void btnHide_Click(object sender, EventArgs e)
        {
            hideOtherEdges = !hideOtherEdges;
            int[]            cycle = Helper.GetRandomCycle(Vertices.Count);
            DataEdge[]       edges = new DataEdge[Vertices.Count];
            DataEdge         edge;
            Tuple <int, int> nodes;

            if (hideOtherEdges)
            {
                for (int i = 0; i < Vertices.Count - 1; i++)
                {
                    nodes = Helper.OrderNodes(cycle[i], cycle[i + 1]);
                    _gArea.LogicCore.Graph.TryGetEdge(Vertices[nodes.Item1], Vertices[nodes.Item2], out edge);
                    edge.EdgeColor = Colors.Green;
                    edges[i]       = edge;
                }
                nodes = Helper.OrderNodes(cycle[0], cycle[Vertices.Count - 1]);
                _gArea.LogicCore.Graph.TryGetEdge(Vertices[nodes.Item1], Vertices[nodes.Item2], out edge);
                edge.EdgeColor            = Colors.Green;
                edges[Vertices.Count - 1] = edge;

                _gArea.GenerateAllEdges();
            }

            foreach (var item in _gArea.EdgesList)
            {
                if (!edges.Contains(item.Key))
                {
                    item.Value.ShowLabel = !hideOtherEdges;
                    item.Key.IsVisible   = !hideOtherEdges;
                    if (item.Key.EdgeColor != Colors.Red)
                    {
                        item.Key.EdgeColor = changeEdgeColor(comboBox1.Text);
                    }
                    if (hideOtherEdges)
                    {
                        item.Value.Visibility = Visibility.Hidden;
                    }
                    else
                    {
                        item.Value.Visibility = Visibility.Visible;
                    }
                }
            }

            TestMut();
            TestSplit();
            TestTourney();
        }
예제 #2
0
        private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            DataEdge[] edges = new DataEdge[Vertices.Count];

            foreach (var item in _gArea.EdgesList)
            {
                if (!edges.Contains(item.Key))
                {
                    if (item.Key.EdgeColor == Colors.Red)
                    {
                        item.Key.EdgeColor = Colors.Red;
                    }
                    else
                    {
                        item.Key.EdgeColor = changeEdgeColor(comboBox1.Text);
                    }
                }
            }
            _gArea.GenerateAllEdges();

            TestMut();
            TestSplit();
            TestTourney();
        }