コード例 #1
0
        /// <summary>
        /// Fonction pour styliser un noeuds dans un graphe provenant de la fusion de 2 graphes
        /// </summary>
        /// <param name="node">Noeuds MSAGL à styliser</param>
        /// <param name="cmap">Color map pour les noeuds ayant été visités par les 2 graphes</param>
        /// <param name="cmap_first">Color map pour les noeuds ayant été visité seulement par le premier graphe</param>
        /// <param name="cmap_second">Color map pour les noeuds ayant été visité seulement par le second graphe</param>
        public void styleNodeMerged(Node node, ColorMap cmap, ColorMap cmap_first, ColorMap cmap_second)
        {
            this.defaultNodeStyle(node, cmap);

            node.Attr.Tooltip = getTooltip();

            if (this.isVisited())
            {
                if (isVisitedBoth())
                {
                    node.LabelText      = order_visited.ToString() + "-" + order_visited_second.ToString();
                    node.Attr.FillColor = cmap.getColor(real_final_value);
                }
                else if (visited)
                {
                    node.LabelText      = order_visited.ToString();
                    node.Attr.FillColor = cmap_first.getColor(heuristic_value);
                }
                else
                {
                    node.LabelText      = order_visited_second.ToString();
                    node.Attr.FillColor = cmap_second.getColor(heuristic_value_second);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Style par default de tous les noeuds du graphe
        /// Une fois ce style par default appliqué, des surcharges peuvent être faites en fonction du type de noeuds
        /// </summary>
        /// <param name="node">Noeuds MSAGL correspondant au CustomNode dont on change le style</param>
        /// <param name="cmap">Colormap pour appliquer le stype au noeuds</param>
        protected void defaultNodeStyle(Node node, ColorMap cmap)
        {
            node.Attr.Shape       = Shape.Circle;
            node.Attr.LabelMargin = 0;
            node.Attr.LineWidth   = 0.2;
            node.LabelText        = null;

            if (visited)
            {
                node.Attr.FillColor = cmap.getColor(heuristic_value);
            }
            else
            {
                node.Attr.FillColor = Color.White;
            }
        }
コード例 #3
0
        /// <summary>
        /// Fonction pour styliser un noeuds dans un graphe provenant de la fusion de 2 graphes qui groupe plusieurs noeuds
        /// </summary>
        /// <param name="node">Noeuds MSAGL à styliser</param>
        /// <param name="cmap">Color map pour les noeuds ayant été visités par les 2 graphes</param>
        /// <param name="cmap_first">Color map pour les noeuds ayant été visité seulement par le premier graphe</param>
        /// <param name="cmap_second">Color map pour les noeuds ayant été visité seulement par le second graphe</param>
        public void styleNodeMergedGrouped(Node node, ColorMap cmap, ColorMap cmap_first, ColorMap cmap_second)
        {
            this.defaultNodeStyle(node, cmap);

            int nodeSize = getNumberChildren(new HashSet <string>()) + 1;

            string groupedTooltip = "Nombre de noeuds : " + nodeSize.ToString();

            groupedTooltip += "\nNombre de noeuds visités : " + (getNumberVisitedChildren(new HashSet <string>()) + 1).ToString();
            groupedTooltip += "\nHeuristique max : " + childsMaxHeuristic(new HashSet <string>()).ToString();
            groupedTooltip += "\nHeuristique min : " + childsMinHeuristic(new HashSet <string>()).ToString();

            node.Attr.Tooltip = groupedTooltip;

            node.LabelText        = "";
            node.Attr.LabelMargin = (int)Math.Pow(nodeSize, 0.66) + 3;


            if (this.isVisited())
            {
                if (isVisitedBoth())
                {
                    node.LabelText      = order_visited.ToString() + "-" + order_visited_second.ToString();
                    node.Attr.FillColor = cmap.getColor(real_final_value);
                }
                else if (visited)
                {
                    node.LabelText      = order_visited.ToString();
                    node.Attr.FillColor = cmap_first.getColor(heuristic_value);
                }
                else
                {
                    node.LabelText      = order_visited_second.ToString();
                    node.Attr.FillColor = cmap_second.getColor(heuristic_value_second);
                }
            }
        }