private string Get_shape_code(Visualization_of_nw_node_line node_line) { string shape_code; Shape_enum node_shape = Options.Node_shape; if ((!String.IsNullOrEmpty(node_line.Label)) && (Options.NodeLabel_nodeShape_dict.ContainsKey(node_line.Label))) { node_shape = Options.NodeLabel_nodeShape_dict[node_line.Label]; } switch (node_shape) { case Shape_enum.Ellipse: shape_code = "ellipse"; break; case Shape_enum.Rectangle: shape_code = "rectangle"; break; case Shape_enum.Diamond: shape_code = "diamond"; break; default: throw new Exception("Shape type is not considered"); } return(shape_code); }
private Visualization_of_nw_node_line Generate_individual_node(string nodeName) { Visualization_of_nw_node_line node_line = new Visualization_of_nw_node_line(); node_line.Fill_color = Hexadecimal_color_class.Get_hexadecimial_code_for_color(Options.Node_fill_color); node_line.Shape_type = Get_shape_code(node_line); node_line.Id = nodeName; node_line.Label = nodeName; return(node_line); }
private void Write_individual_node(Visualization_of_nw_node_line node) { StringBuilder sb_spaces = new StringBuilder(); string spaces = Get_spaces_string(); StringBuilder node_label = new StringBuilder(); string[] nodeLabel_words = node.Label.Split(' '); string current_nodeLabel_word; int nodeLabel_words_length = nodeLabel_words.Length; node_label.AppendFormat("{0}", nodeLabel_words[0]); if (nodeLabel_words_length > 1) { int length_of_current_line = node_label.Length; for (int indexNW = 1; indexNW < nodeLabel_words_length; indexNW++) { current_nodeLabel_word = nodeLabel_words[indexNW]; if (length_of_current_line + 1 + current_nodeLabel_word.Length <= this.Options.Max_signs_per_line_in_nodeName) { node_label.AppendFormat(" {0}", (string)current_nodeLabel_word.Clone()); length_of_current_line += 1 + current_nodeLabel_word.Length; } else { node_label.AppendFormat("\n{0}", (string)current_nodeLabel_word.Clone()); length_of_current_line = current_nodeLabel_word.Length; } } } string text_node = spaces + "<node id=\"" + node.Id + "\">\n" + spaces + " <data key=\"" + Key.Node_url + "\"/>\n" + spaces + " <data key=\"" + Key.Node_graphics + "\">\n" + spaces + " <y:ShapeNode>\n" + spaces + " <y:Geometry height=\"" + node.Geometry_heigth + "\" width=\"" + node.Geometry_width + "\" x=\"94.3427734375\" y=\"208.0\"/>\n" + spaces + " <y:Fill color=\"" + node.Fill_color + "\" transparent=\"" + node.Transparent + "\"/>\n" + spaces + " <y:BorderStyle color=\"" + node.Border_style_color + "\" type=\"line\" width=\"" + node.Border_style_width + "\"/>\n" + spaces + " <y:NodeLabel alignment=\"" + node.Label_alignement + "\" autoSizePolicy=\"content\" fontFamily=\"Dialog\" fontSize=\"" + node.FontSize + "\" fontStyle=\"" + node.FontStyle + "\" hasBackgroundColor=\"false\" hasLineColor=\"" + node.LabelHasLineColor + "\" height=\"18.701171875\" modelName=\"" + node.Model_name + "\" modelPosition=\"" + node.Model_position + "\" textColor=\"" + node.TextColor + "\" visible=\"true\" width=\"64.703125\" x=\"-17.3515625\" y=\"5.6494140625\">" + node_label.ToString() + "</y:NodeLabel>\n" + spaces + " <y:Shape type=\"" + node.Shape_type + "\"/>\n" + spaces + " </y:ShapeNode>\n" + spaces + " </data>\n" + spaces + "</node>"; Writer.WriteLine(text_node); }
private Visualization_of_nw_node_line[] Generate_nodes(NetworkNode_line_class[] input_nodes) { NetworkNode_line_class input_node; int input_nodes_length = input_nodes.Length; Visualization_of_nw_node_line[] nodes = new Visualization_of_nw_node_line[input_nodes_length]; Visualization_of_nw_node_line node; for (int indexI = 0; indexI < input_nodes_length; indexI++) { input_node = input_nodes[indexI]; node = new Visualization_of_nw_node_line(); node.Id = (string)input_node.Name.Clone(); node.Label = (string)input_node.Name.Clone(); node.Shape_type = Get_shape_code(node); node.Box_label = "Level " + input_node.Level; nodes[indexI] = node; } return(nodes); }
public Visualization_of_nw_node_line Deep_copy() { Visualization_of_nw_node_line copy = (Visualization_of_nw_node_line)this.MemberwiseClone(); copy.Id = (string)this.Id.Clone(); copy.Label = (string)this.Label.Clone(); copy.Geometry_heigth = (string)this.Geometry_heigth.Clone(); copy.Geometry_width = (string)this.Geometry_width.Clone(); copy.Fill_color = (string)this.Fill_color.Clone(); copy.FontSize = (string)this.FontSize.Clone(); copy.FontStyle = (string)this.FontStyle.Clone(); copy.LabelHasLineColor = (string)this.LabelHasLineColor.Clone(); copy.TextColor = (string)this.TextColor.Clone(); copy.Model_name = (string)this.Model_name.Clone(); copy.Shape_type = (string)this.Shape_type.Clone(); copy.Transparent = (string)this.Transparent.Clone(); copy.Border_style_color = (string)this.Border_style_color.Clone(); copy.Border_style_width = (string)this.Border_style_width.Clone(); copy.Label_alignement = (string)this.Label_alignement.Clone(); return(copy); }
private Visualization_of_nw_node_line[] Generate_legend(yed_node_color_line_class[] legend_node_colors) { int legend_length = legend_node_colors.Length; yed_node_color_line_class legend_node_color; Visualization_of_nw_node_line legend_visualization_line; List <Visualization_of_nw_node_line> legend_visualization_list = new List <Visualization_of_nw_node_line>(); for (int indexL = 0; indexL < legend_length; indexL++) { legend_node_color = legend_node_colors[indexL]; legend_visualization_line = new Visualization_of_nw_node_line(); legend_visualization_line.Fill_color = (string)legend_node_color.Hexadecimal_color.Clone(); legend_visualization_line.Shape_type = Get_shape_code(legend_visualization_line); legend_visualization_line.Label_alignement = "center"; legend_visualization_line.Model_name = "sides"; legend_visualization_line.Model_position = "e"; legend_visualization_line.Id = (string)legend_node_color.NodeName.Clone(); legend_visualization_line.Label = (string)legend_node_color.NodeName.Clone(); legend_visualization_list.Add(legend_visualization_line); } return(legend_visualization_list.ToArray()); }