public double LengteGraaf() { double lengte = 0; foreach (KeyValuePair <Knoop, List <Segment> > mapitem in map) { foreach (Segment segment in mapitem.Value) { for (int i = 0; i < segment.vertices.Count - 1; i++) { Punt punt1 = segment.vertices[i]; Punt punt2 = segment.vertices[i + 1]; lengte += Math.Sqrt(Math.Pow((punt2.x - punt1.x), 2) + Math.Pow((punt2.y - punt1.y), 2)); } } } return(lengte); }
/// <summary> /// Deserializing constructor /// = remove object data from file /// </summary> /// <param name="info">key value pair of stored data</param> /// <param name="context">meta-data</param> public Knoop(SerializationInfo info, StreamingContext context) { //get values from info and assign them to properties knoopId = (int)info.GetValue("knoopId", typeof(int)); punt = (Punt)info.GetValue("punt", typeof(Punt)); }
public Knoop(int knoopID, Punt punt) { this.knoopId = knoopID; this.punt = punt; }