public void Get2(Graph graph, List <Node> path, Node s, Node t) { int frame = 50; file = new StreamWriter("C:/Users/L/Desktop/minGraph/3/finBi.svg"); WriteHeader(s, t, 50, graph.nodes.Count); List <Node> one = new List <Node>(); foreach (Node n1 in graph.nodes.Values) { n1.SetData2(graph.maxLat, graph.minLon); n1.Resize(graph.resizePar); string color = "black"; if (n1.state == 10) { color = "red"; } double x = n1.coordinates.pictureCrd1; double y = n1.coordinates.pictureCrd2; } foreach (Node n1 in graph.nodes.Values) { foreach (Node.weightedEdge edge in n1.neighbourList) { double size = 0.9; Node n2 = edge.neighbour; int state = n1.state1 + n1.state2; string color; switch (state) { case 1: if (n1.distance1 < n1.distance2) { color = "blue"; } else { color = "yellow"; } break; case 2: if (n1.distance1 < n1.distance2) { color = "blue"; } else { color = "yellow"; } break; case 3: if (n1.distance1 < n1.distance2) { color = "blue"; } else { color = "yellow"; } break; case 4: if (n1.distance1 < n1.distance2) { color = "blue"; } else { color = "yellow"; }; break; case 10: color = "red"; break; case 200: color = "red"; size = 0.8; break; default: color = "black"; size = 0.3; break; } n2.SetData2(graph.maxLat, graph.minLon); n2.Resize(graph.resizePar); if ((n1.coordinates.pictureCrd1 > frame && n1.coordinates.pictureCrd1 < (width - frame) && (n1.coordinates.pictureCrd2 > frame && n1.coordinates.pictureCrd2 < (height - frame) && (n2.coordinates.pictureCrd1 > frame && n2.coordinates.pictureCrd1 < (width - frame) && (n2.coordinates.pictureCrd2 > frame && n2.coordinates.pictureCrd2 < (height - frame)))))) { AddLine(n1.coordinates.pictureCrd1, n1.coordinates.pictureCrd2, n2.coordinates.pictureCrd1, n2.coordinates.pictureCrd2, color, size); } } } int count = path.Count; for (int i = 0; i < count - 1; i++) { Node n1 = path[i]; Node n2 = path[i + 1]; n1.SetData2(graph.maxLat, graph.minLon); n1.Resize(graph.resizePar); n2.SetData2(graph.maxLat, graph.minLon); n2.Resize(graph.resizePar); AddLine(n1.coordinates.pictureCrd1, n1.coordinates.pictureCrd2, n2.coordinates.pictureCrd1, n2.coordinates.pictureCrd2, "yellow", 2); } AddPoint(s.coordinates.pictureCrd2, s.coordinates.pictureCrd1, "green", 3); AddPoint(t.coordinates.pictureCrd2, t.coordinates.pictureCrd1, "red", 3); WriteLastTagAndClose(); }
public void GetImageFile(Graph graph, List <Node> path, Node s, Node t) { // return; height = 800; //800 width = 1700; //1700 width = (int)(graph.resizePar * graph.lonDiff); int frame = 50; WriteHeader(s, t, frame, graph.nodes.Count); List <Node> one = new List <Node>(); foreach (Node n1 in graph.nodes.Values) { n1.SetData2(graph.maxLat, graph.minLon); n1.Resize(graph.resizePar); string color = "black"; if (n1.state == 10) { color = "red"; } double x = n1.coordinates.pictureCrd1; double y = n1.coordinates.pictureCrd2; if (!n1.inside) { AddPoint(y, x, color, 0.8); } // else if (n1.state==-100) // AddPoint(y, x, "blue", 5); } double size = 0.9; int cE = 0; foreach (Node n1 in graph.nodes.Values) { if (true)// (n1.inside) { foreach (Node.weightedEdge edge in n1.neighbourList) { Node n2 = edge.neighbour; int state = n1.state + n2.state; string color; switch (state) { case 0: color = "black"; size = 0.4; break; case 1: color = "red"; size = 1; break; case 2: color = "red"; cE++; break; case 3: color = "blue"; size = 1; break; case 4: color = "blue"; size = 0.7; break; default: color = "blue"; size = 0.7; break; } if (((state == 16) && (edge.weight > 0)) | (color == "red")) { AddLine(n1.coordinates.pictureCrd1, n1.coordinates.pictureCrd2, n2.coordinates.pictureCrd1, n2.coordinates.pictureCrd2, color, size); } else if (((state == 36) && (edge.weight > 0)) | (color == "red")) { AddLine(n1.coordinates.pictureCrd1, n1.coordinates.pictureCrd2, n2.coordinates.pictureCrd1, n2.coordinates.pictureCrd2, "red", size); } } } } int count = path.Count; for (int i = 0; i < count - 1; i++) { Node n1 = path[i]; Node n2 = path[i + 1]; n1.SetData2(graph.maxLat, graph.minLon); n1.Resize(graph.resizePar); n2.SetData2(graph.maxLat, graph.minLon); n2.Resize(graph.resizePar); AddLine(n1.coordinates.pictureCrd1, n1.coordinates.pictureCrd2, n2.coordinates.pictureCrd1, n2.coordinates.pictureCrd2, "yellow", 2.3); } // AddPoint(s.coordinates.pictureCrd2, s.coordinates.pictureCrd1, "green", 5); // AddPoint(t.coordinates.pictureCrd2, t.coordinates.pictureCrd1, "red", 5); WriteLastTagAndClose(); }