Example #1
0
        public sub_line(DestinationAlgorithms _dest_alg, horizontal_line _horiz_line, double startY, int from_id, int to_id)
        {
            this._dest_alg = _dest_alg;
            this._horiz_line = _horiz_line;
            this.from_id = from_id;
            this.to_id = to_id;

            SubLineHorizontal = new Line();
            SubLineHorizontal.Stroke = Brushes.Blue;
            SubLineHorizontal.StrokeThickness = 0.2;
            ((Line)SubLineHorizontal).X1 = 50;
            ((Line)SubLineHorizontal).Y1 = startY;
            ((Line)SubLineHorizontal).X2 = 9950;
            ((Line)SubLineHorizontal).Y2 = startY;
            posY = startY;
            if (_horiz_line.SubLinesHorizontal == null)
                _horiz_line.SubLinesHorizontal = new List<sub_line>();

            _horiz_line.SubLinesHorizontal.Add(this);
            label_horizontal = new Label();
            label_horizontal.HorizontalContentAlignment = HorizontalAlignment.Center;
            label_horizontal.HorizontalContentAlignment = HorizontalAlignment.Center;
            label_horizontal.FontSize = 8;
            label_horizontal.Content = from_id + "-" + to_id;
            label_horizontal.Width = 30;

            _dest_alg.GantCanvas.Children.Add(SubLineHorizontal);
            _dest_alg.GantCanvas.Children.Add(label_horizontal);
            Canvas.SetZIndex(SubLineHorizontal, 0);
            Canvas.SetZIndex(label_horizontal, 2);

            Canvas.SetLeft(label_horizontal, 25);
            Canvas.SetTop(label_horizontal, startY - 12);           
        }
Example #2
0
        public sub_line(DestinationAlgorithms _dest_alg, horizontal_line _horiz_line, double startY, int from_id, int to_id)
        {
            this._dest_alg   = _dest_alg;
            this._horiz_line = _horiz_line;
            this.from_id     = from_id;
            this.to_id       = to_id;

            SubLineHorizontal                 = new Line();
            SubLineHorizontal.Stroke          = Brushes.Blue;
            SubLineHorizontal.StrokeThickness = 0.2;
            ((Line)SubLineHorizontal).X1      = 50;
            ((Line)SubLineHorizontal).Y1      = startY;
            ((Line)SubLineHorizontal).X2      = 9950;
            ((Line)SubLineHorizontal).Y2      = startY;
            posY = startY;
            if (_horiz_line.SubLinesHorizontal == null)
            {
                _horiz_line.SubLinesHorizontal = new List <sub_line>();
            }

            _horiz_line.SubLinesHorizontal.Add(this);
            label_horizontal = new Label();
            label_horizontal.HorizontalContentAlignment = HorizontalAlignment.Center;
            label_horizontal.HorizontalContentAlignment = HorizontalAlignment.Center;
            label_horizontal.FontSize = 8;
            label_horizontal.Content  = from_id + "-" + to_id;
            label_horizontal.Width    = 30;

            _dest_alg.GantCanvas.Children.Add(SubLineHorizontal);
            _dest_alg.GantCanvas.Children.Add(label_horizontal);
            Canvas.SetZIndex(SubLineHorizontal, 0);
            Canvas.SetZIndex(label_horizontal, 2);

            Canvas.SetLeft(label_horizontal, 25);
            Canvas.SetTop(label_horizontal, startY - 12);
        }
Example #3
0
        public void AddHorizontalLines(int count)
        {
            this.interval_horizontal = 570 / count;
            double startY = 30 + interval_horizontal;

            for (int i = 0; i < count; i++)
            {
                List <int> to_id = new List <int>();
                foreach (labs.GraphCS.edge_view edge in _graph_viewCS.edgeList)
                {
                    if (edge.From.id == _graph_viewCS.TopList[i].id)
                    {
                        to_id.Add(edge.To.id);
                    }
                    else if (edge.To.id == _graph_viewCS.TopList[i].id)
                    {
                        to_id.Add(edge.From.id);
                    }
                }

                horizontal_line horiz_line = new horizontal_line(this, startY, count, _graph_viewCS.TopList[i].id, to_id);
                startY += interval_horizontal;
            }
        }
        public void AddHorizontalLines(int count)
        {
            this.interval_horizontal = 570 / count;
            double startY = 30 + interval_horizontal;

            for (int i = 0; i < count; i++)
            {
                List<int> to_id = new List<int>();
                foreach (labs.GraphCS.edge_view edge in _graph_viewCS.edgeList)
                {
                    if (edge.From.id == _graph_viewCS.TopList[i].id)
                        to_id.Add(edge.To.id);
                    else if (edge.To.id == _graph_viewCS.TopList[i].id)
                        to_id.Add(edge.From.id);
                }

                horizontal_line horiz_line = new horizontal_line(this, startY, count, _graph_viewCS.TopList[i].id, to_id);
                startY += interval_horizontal;
            }
        }
Example #5
0
        public void DrawSubWorks(int alg, int j, int need_proc_id, List <work_view> dependWorkList)
        {
            double          start_sub_point  = 0;
            List <sub_line> list_sub_duplex  = new List <sub_line>();
            sub_line        _sub_line_duplex = LinesHorizontal[0].SubLinesHorizontal[0];
            horizontal_line horiz_line       = LinesHorizontal[0];
            sub_line        _sub_line        = LinesHorizontal[0].SubLinesHorizontal[0];

            if (alg == 4)
            {
                for (int i = 0; i < dependWorkList.Count; i++)
                {
                    if (dependWorkList[i].end_x > start_sub_point)
                    {
                        start_sub_point = dependWorkList[i].end_x;
                    }
                }
            }

            for (int k = 0; k < dependWorkList.Count; k++)
            {
                list_sub_duplex.Clear();
                if (alg == 6 || alg == 5)
                {
                    start_sub_point = dependWorkList[k].end_x;
                }

                if (dependWorkList[k].proc_id != need_proc_id)
                {
                    NodeMinList(dependWorkList[k].proc_id, need_proc_id);
                    double start_sub_point_next = start_sub_point;
                    for (int i = 0; i < node_min_list.Count - 1; i++)
                    {
                        if (node_min_list.Count <= 2)
                        {
                            horiz_line = LinesHorizontal.Find(x => x.id.Equals(dependWorkList[k].proc_id));
                            _sub_line  = horiz_line.SubLinesHorizontal.Find(x => x.to_id.Equals(need_proc_id));
                        }
                        else
                        {
                            horiz_line = LinesHorizontal.Find(x => x.id.Equals(node_min_list[i]));
                            _sub_line  = horiz_line.SubLinesHorizontal.Find(x => x.to_id.Equals(node_min_list[i + 1]));
                        }

                        double weight = edge_weight[new KeyValuePair <int, int>(dependWorkList[k].rect_id, TopListNew[j].id)] *
                                        interval_vertical;

                        for (int m = 0; m < LinesHorizontal.Count; m++)
                        {
                            if (LinesHorizontal[m] != horiz_line)
                            {
                                for (int tt = 0; tt < horiz_line.SubLinesHorizontal.Count; tt++)
                                {
                                    for (int u = 0; u < LinesHorizontal[m].SubLinesHorizontal.Count; u++)
                                    {
                                        if (                                                                                               //LinesHorizontal[m].SubLinesHorizontal[u].to_id == horiz_line.id || //LinesHorizontal[m].SubLinesHorizontal[u].from_id == horiz_line.id ||
                                            (LinesHorizontal[m].SubLinesHorizontal[u].to_id == horiz_line.SubLinesHorizontal[tt].to_id ||
                                             LinesHorizontal[m].SubLinesHorizontal[u].from_id == horiz_line.SubLinesHorizontal[tt].to_id)) // &&
                                        {
                                            list_sub_duplex.Add(LinesHorizontal[m].SubLinesHorizontal[u]);
                                        }
                                    }
                                }
                            }
                        }

                        List <sub_work_view> _sub_work_new = new List <sub_work_view>();
                        Dictionary <sub_work_view, double> _dict_sub_work = new Dictionary <sub_work_view, double>();

                        for (int m = 0; m < SubWorkList.Count; m++)
                        {
                            if (SubWorkList[m].end_y == _sub_line.posY)
                            {
                                _dict_sub_work.Add(SubWorkList[m], SubWorkList[m].end_x);
                            }
                        }

                        _dict_sub_work = _dict_sub_work.OrderBy(pair => pair.Value).ToDictionary(pair => pair.Key, pair => pair.Value);

                        foreach (var n_c in _dict_sub_work)
                        {
                            _sub_work_new.Add(n_c.Key);
                        }

                        List <sub_work_view> _sub_work_other_links             = new List <sub_work_view>();
                        Dictionary <sub_work_view, double> _dict_sub_work_link = new Dictionary <sub_work_view, double>();

                        for (int s = 0; s < horiz_line.SubLinesHorizontal.Count; s++)
                        {
                            if (horiz_line.SubLinesHorizontal[s].to_id != _sub_line.to_id)
                            {
                                for (int l = 0; l < SubWorkList.Count; l++)
                                {
                                    if (SubWorkList[l].end_y == horiz_line.SubLinesHorizontal[s].posY)
                                    {
                                        _dict_sub_work_link.Add(SubWorkList[l], SubWorkList[l].end_x);
                                    }
                                }
                            }
                        }

                        for (int m = 0; m < SubWorkList.Count; m++)
                        {
                            for (int u = 0; u < list_sub_duplex.Count; u++)
                            {
                                if (SubWorkList[m].end_y == list_sub_duplex[u].posY)
                                {
                                    try
                                    {
                                        _dict_sub_work_link.Add(SubWorkList[m], SubWorkList[m].end_x);
                                    }
                                    catch (Exception ex) { }
                                }
                            }
                        }


                        _dict_sub_work_link = _dict_sub_work_link.OrderBy(pair => pair.Value).ToDictionary(pair => pair.Key, pair => pair.Value);

                        foreach (var n_c in _dict_sub_work_link)
                        {
                            _sub_work_other_links.Add(n_c.Key);
                        }
                        List <sub_work_view> _sub_work_test_links = _sub_work_other_links;

                        for (int lol = 0; lol < SubWorkList.Count; lol++)
                        {
                            for (int m = 0; m < _sub_work_new.Count; m++)
                            {
                                double other_sub_start_x = _sub_work_new[m].end_x - _sub_work_new[m].rect_width;

                                if ((start_sub_point_next < other_sub_start_x && (start_sub_point_next + weight) > other_sub_start_x) ||
                                    (start_sub_point_next < _sub_work_new[m].end_x && (start_sub_point_next + weight) > other_sub_start_x) ||
                                    start_sub_point_next == other_sub_start_x || (start_sub_point_next + weight == _sub_work_new[m].end_x))
                                {
                                    start_sub_point_next = _sub_work_new[m].end_x;
                                }

                                start_sub_point_next = ShiftLinks(_sub_work_other_links, start_sub_point_next, weight);
                            }
                        }

                        if (_sub_work_new.Count == 0)
                        {
                            start_sub_point_next = ShiftLinks(_sub_work_other_links, start_sub_point_next, weight);
                        }


                        sub_work_view _sub_work = new sub_work_view(this, dependWorkList[k].rect_id, TopListNew[j].id,
                                                                    weight, start_sub_point_next, _sub_line.posY - 10, maxSubID() + 1);

                        start_sub_point_next += weight;
                    }
                }
            }
        }