protected override void AddWayToEdges(IWay way) { double distance = 0; long startId = -1, lastId = -1; var ndsCounter = 0; foreach (var edge in way.NdsList) { ndsCounter += 1; if (startId == -1) { startId = lastId = edge; continue; } if (!_nodes.ContainsKey(edge)) { continue; // data error } if (_nodes.ContainsKey(lastId) && _nodes.ContainsKey(edge)) { distance += DistanceCalculator.GetDistance(_nodes[lastId], _nodes[edge]); } // on intermediate edges go ahead (OR) on last edge, go ahead s.t. the edge will be added after the loop if (_nodes[edge].Counter <= 1 || ndsCounter >= way.NdsList.Count) { lastId = edge; continue; } // The node got used more than once, edge complete, open new edge AddEdge(startId, edge, distance, way.OneWay); startId = lastId = edge; distance = 0; } // Add last edge in way AddEdge(startId, lastId, distance, way.OneWay); }
public void Remove(IWay way) { _ways.Remove(way); }
public void Add(IWay way) { _ways.Add(way); }
public void SetWay(IWay _way) { way = _way; }
public FindTime(IWay _way) { way = _way; }
protected abstract void AddWayToEdges(IWay way);