public override void DisConnectAll() { try { Matrix.Close(); Vertexs.ForEach(v => v.Close()); CalBoxToMatrix.Close(); CalBoxToVertex.Close(); CalBoxWhole.Close(); VNA.Close(); } catch (Exception ex) { Log.log.ErrorFormat("{0}", ex); throw ex; } }
public void AddCountur(Contour cnt) { Conturs.Add(cnt); cnt.Points.ForEach(x => { if (Vertexs.FindIndex(y => y.X == x.X && y.Y == x.Y) == -1) { Vertexs.Add(cnt.Points.FindAll(y => y.X == x.X && y.Y == x.Y).First()); } }); //Все ребра кроме последнего for (int i = 0; i < cnt.Points.Count - 1; i++) { int pointFirst = Vertexs.FindIndex(y => y.X == cnt.Points[i].X && y.Y == cnt.Points[i].Y); int pointSecond = Vertexs.FindIndex(y => y.X == cnt.Points[i + 1].X && y.Y == cnt.Points[i + 1].Y); Edges.Add(new Edge(pointFirst, pointSecond)); } //Последнее ребро из конца в начало Edges.Add(new Edge( Vertexs.FindIndex(y => y.X == cnt.Points[0].X && y.Y == cnt.Points[0].Y), Vertexs.FindIndex(y => y.X == cnt.Points[cnt.Points.Count - 1].X && y.Y == cnt.Points[cnt.Points.Count - 1].Y))); //Перекраиваем карту навигации CurrentNodesMap = InitNavMap(); }
public override void main() { IKVPairInstance <IString, IIterator <IString> > input = (IKVPairInstance <IString, IIterator <IString> >)Input_values.Instance; IStringInstance k = (IStringInstance)input.Key; IIteratorInstance <IString> v = (IIteratorInstance <IString>)input.Value; int k_int = int.Parse(k.Value); if (!neighbours.ContainsKey(k_int)) { neighbours [k_int] = new Dictionary <int, double> (); Di[k_int] = int.MaxValue; Dmin[k_int] = int.MaxValue; Vertexs.Add(k_int); } double di = Di[k_int]; double dmin = Dmin[k_int]; int done = 1; object o; while (v.fetch_next(out o)) { IStringInstance item = (IStringInstance)o; string[] values = item.Value.Split(' '); switch (values[0][0]) { case 'c': double tmp = double.Parse(values [1]); dmin = min(dmin, tmp); break; case 'i': break; case 'd': di = double.Parse(values [1]); break; default: IDictionary <int, double> output_neibours = neighbours [k_int]; int n = int.Parse(values [0]); double d = 0.0; if (!output_neibours.TryGetValue(n, out d)) { output_neibours [n] = double.Parse(values [1]); } else if (double.Parse(values [1]) < d) { output_neibours[n] = double.Parse(values [1]); } break; } } dmin = min(dmin, di); if (dmin != di) { di = dmin; foreach (KeyValuePair <int, double> kv in neighbours[k_int]) { int dest = Math.Abs((kv.Key + "").GetHashCode()) % this.Communicator.Size; CandidatesBuffer[dest] = CandidatesBuffer[dest] + kv.Key + " " + (kv.Value + dmin) + System.Environment.NewLine; } done = 0; } Active = done; Di[k_int] = di; Dmin [k_int] = dmin; }
public void Add(BulgeVertex2D bulgeVertex) { Vertexs.Add(bulgeVertex); }
public void Add(Point2D vertex, double bulge) { Vertexs.Add(new BulgeVertex2D(vertex, bulge)); }
public void Add(Point2D vertex, double bulge, double startWidth, double endWidth) { Vertexs.Add(new BulgeVertex2D(vertex, bulge, startWidth, endWidth)); }
public Polygons() { InitializeComponent(); Vertexs.Add(new Vertex { Edges = 2, Id = 1, Position = new Point(389, 420) }); Vertexs.Add(new Vertex { Edges = 2, Id = 2, Position = new Point(448, 79) }); Vertexs.Add(new Vertex { Edges = 2, Id = 3, Position = new Point(675, 97) }); Vertexs.Add(new Vertex { Edges = 2, Id = 4, Position = new Point(568, 352) }); Vertexs.Add(new Vertex { Edges = 2, Id = 5, Position = new Point(886, 407) }); Vertexs.Add(new Vertex { Edges = 2, Id = 6, Position = new Point(498, 591) }); Vertexs.Add(new Vertex { Edges = 2, Id = 7, Position = new Point(274, 631) }); Vertexs.Add(new Vertex { Edges = 2, Id = 8, Position = new Point(175, 382) }); Line l1 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.None, P1 = Vertexs[0], P2 = Vertexs[1] }; Line l2 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.Equal, P1 = Vertexs[1], P2 = Vertexs[2] }; Line l3 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.None, P1 = Vertexs[2], P2 = Vertexs[3] }; Line l4 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.Parallel, P1 = Vertexs[3], P2 = Vertexs[4] }; Line l5 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.None, P1 = Vertexs[4], P2 = Vertexs[5] }; Line l6 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.Equal, P1 = Vertexs[5], P2 = Vertexs[6] }; Line l7 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.None, P1 = Vertexs[6], P2 = Vertexs[7] }; Line l8 = new Line { Color = Brushes.Black, Marked = false, Relation = Relation.Parallel, P1 = Vertexs[7], P2 = Vertexs[0] }; lines.Add(l1); lines.Add(l2); lines.Add(l3); lines.Add(l4); lines.Add(l5); lines.Add(l6); lines.Add(l7); lines.Add(l8); foreach (var l in lines) { l.RecolorLine(); } relations.Add((l2, l6)); relations.Add((l4, l8)); polygons.Add(new Polygon { Vertices = new List <Vertex>(Vertexs), Lines = new List <Line>(lines) }); }