public void SetGraphToFitness() { SetFitnessGraph(); graphDisplay = GraphDisplay.Fitness; bestFitnessSeries.pointValues = bestFitnessList; averageFitnessSeries.pointValues = averageFitnessList; bestFitnessSeries.pointValuesCountChanged(); averageFitnessSeries.pointValuesCountChanged(); }
static void Main(string[] args) { Graph g = Examples.GenericKnowledge(); /*Console.WriteLine("A person"); * foreach (Edge edge in g.Vertices["Person"].Connections) * { * Console.WriteLine(edge.Type + " " + edge.Next.Name); * }*/ GraphDisplay.Display(g); Console.ReadKey(); }
// Displays a new graph display and deletes the current private void CreateNewGraphDisplay(Genome genome) { if (graphDisplay != null) { Destroy(graphDisplay.Graph); } graphDisplay = new GraphDisplay(genome); if (!genomes.ContainsKey(graphDisplay.Graph.name)) { genomes.Add(graphDisplay.Graph.name, genome); UpdateDropdowns(graphDisplay.Graph.name); } firstGenomeDropdown.value = firstGenomeDropdown.options.FindIndex((i) => { return(i.text.Equals(graphDisplay.Graph.name)); }); }
/// <summary> /// generate a image (jpg file) for the graph /// </summary> /// <param name="myGraph"></param> /// <param name="jpgfile"></param> public static void generateImage(Graph myGraph, string jpgfile) { if (myGraph != null) { GraphDisplay GD = new GraphDisplay(); string ressource = Path.GetDirectoryName(Application.ExecutablePath) + "/ressource"; try { GD.ImageDisplay(myGraph, ressource, jpgfile); } catch (Exception e) { MessageBox.Show(e.Message); } } }
public void SetGraphToSpeciesPopulation() { SetSpeciesPopulationGraph(); graphDisplay = GraphDisplay.SpeciesPopulation; speciesSeries = new List <WMG_Series>(); foreach (SeriesList <Vector2> list in speciesPopulationList) { speciesSeries.Add(graph.addSeries()); speciesSeries[speciesSeries.Count - 1].pointColor = list.pointColor; //seriesList[seriesList.Count - 1].areaShadingType = WMG_Series.areaShadingTypes.Solid; speciesSeries[speciesSeries.Count - 1].areaShadingColor = list.pointColor; speciesSeries[speciesSeries.Count - 1].pointValues = list; speciesSeries[speciesSeries.Count - 1].seriesName = list.seriesName; speciesSeries[speciesSeries.Count - 1].pointValuesChanged(); } }
/// <summary> /// generate a html file for the graphs /// </summary> /// <param name="glpk_controller"></param> /// <param name="FileNameHTML"></param> /// <param name="NextFileNameHTML"></param> //public static void generateHTML(Glpk_Controller glpk_controller, string FileNameHTML, string NextFileNameHTML) //{ // string nameG1 = FileNameHTML + "_graphs1.jpg"; // string nameG2 = FileNameHTML + "_graphs2.jpg"; // string nameIso = FileNameHTML + "_graphIso.jpg"; // generateImage(glpk_controller.Graph1, nameG1); // generateImage(glpk_controller.Graph2, nameG2); // generateImage(glpk_controller.IsoGraph, nameIso); // string ressource = Path.GetDirectoryName(Application.ExecutablePath) + "/ressource"; // ExportHTML(glpk_controller, ressource, FileNameHTML, NextFileNameHTML); //} ///// <summary> ///// generate a html file for the graphs (from the lib Graph) ///// copy and make some changes ///// </summary> ///// <param name="glpk_controller"></param> ///// <param name="PathRessource"></param> ///// <param name="FileNameHTML"></param> ///// <param name="NextFileNameHTML"></param> //public static void ExportHTML(Glpk_Controller glpk_controller, string PathRessource, string FileNameHTML, string NextFileNameHTML) //{ // string nameG1 = FileNameHTML + "_graphs1.jpg"; // string nameG2 = FileNameHTML + "_graphs2.jpg"; // string nameIso = FileNameHTML + "_graphIso.jpg"; // TextWriter tw; // tw = new StreamWriter(FileNameHTML + ".html"); // tw.WriteLine("<html>"); // tw.WriteLine("<head>"); // tw.WriteLine("<title>Test GLPK</title>"); // tw.WriteLine("</head>"); // tw.WriteLine("<body>"); // tw.WriteLine("<div style = \"clear: right; float: right; text-align: right;\">"); // tw.WriteLine("<right><p><font face=\"Comic Sans MS\" color=\"#0000dd\" size=\"2\">Solve Graph <font color=\"#000000\">" + glpk_controller.Graph1.Id + "</font> with Graph <font color=\"#000000\">" + glpk_controller.Graph2.Id + "</font></font></p>"); // if (glpk_controller.OptimalValue == -1) // tw.WriteLine("<p><font face=\"Comic Sans MS\" color=\"#0000dd\" size=\"2\">No solution" + "</font></p>"); // else // tw.WriteLine("<p><font face=\"Comic Sans MS\" color=\"#0000dd\" size=\"2\">Optimal value: " + glpk_controller.OptimalValue + "</font></p>"); // tw.WriteLine("<p><font face=\"Comic Sans MS\" color=\"#0000dd\" size=\"2\">Execute time: " + glpk_controller.ExecuteTime + "</font></p>"); // tw.WriteLine("<a href=\"" + NextFileNameHTML + ".html\"><font face=\"Comic Sans MS\" color=\"#000000\" size=\"5\"> NEXT</font></a></right>"); // tw.WriteLine("</div>"); // tw.WriteLine("<table border cellpadding=\"10\">"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td><font size=\"2\">" + glpk_controller.Graph1.Name + " (" + glpk_controller.Graph1.Id + ") <font/></td>"); // //tw.WriteLine("<td><font size=\"2\">" + glpk_controller.Graph2.Name + " (" + glpk_controller.Graph2.Id + ") <font/></td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td bordercolor=\"blue\"><img src=\"" + System.IO.Path.GetFullPath(nameG1) + "\" alt=\" graph1 \" style=\"max-height:300px;\" /> </td>"); // //tw.WriteLine("<td bordercolor=\"blue\"><img src=\"" + System.IO.Path.GetFullPath(nameG2) + "\" alt=\" graph2 \" style=\"max-width:400px;\" /> </td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("</table>"); // tw.WriteLine("<table border cellpadding=\"10\">"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td><font size=\"2\">" + glpk_controller.Graph2.Name + " (" + glpk_controller.Graph2.Id + ") <font/></td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td bordercolor=\"blue\"><img src=\"" + System.IO.Path.GetFullPath(nameG2) + "\" alt=\" graph2 \" style=\"max-height:300px;\" /> </td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("</table>"); // tw.WriteLine("<table border cellpadding=\"10\">"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td><font size=\"2\">Graph Iso<font/></td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("<tr>"); // tw.WriteLine("<td bordercolor=\"blue\"><img src=\"" + System.IO.Path.GetFullPath(nameIso) + "\" alt= \"can't solve the two graphs\" \" /></td>"); // tw.WriteLine("</tr>"); // tw.WriteLine("</table>"); // tw.WriteLine("</body>"); // tw.WriteLine("</html>"); // tw.Close(); //} /// <summary> ///Display Touch Image (a copy from Lib Graph) /// </summary> public static void DisplayTouch(Graph myGraph, String jpgfile, ToolStripStatusLabel status) { if (myGraph != null) { GraphDisplay GD = new GraphDisplay(); string ressource = Path.GetDirectoryName(Application.ExecutablePath) + "/ressource"; try { GD.TouchDisplay(myGraph, ressource); status.Text = "Show touch graph"; } catch (Exception e) { MessageBox.Show(e.Message); } } else { Console.WriteLine("Warning : Null Graph !!"); } }
// Removes the previous graph display if there is one and creates a new graph display on screen private void CreateNewGraphDisplay(Genome genome) { RemoveGraphDisplay(); graphDisplay = new GraphDisplay(genome); genomeDropdown.value = genomeDropdown.options.FindIndex((i) => { return(i.text.Equals(graphDisplay.Graph.name)); }); }