public static CChemin operator +(CChemin chemin, CPassageChemin passage) { List <CPassageChemin> lst = new List <CPassageChemin>(chemin.m_listePassages); lst.Add(passage); CChemin newChemin = new CChemin(); newChemin.m_listePassages = lst; return(newChemin); }
public List <CChemin> GetChemins(CSpvSite siteOrigine, CSpvSite siteDestination) { List <CChemin> lstFinale = new List <CChemin>(); CNoeud noeudDepart = GetNoeud(siteOrigine); CNoeud noeudFinal = GetNoeud(siteDestination); CChemin chemin = new CChemin(); FindChemins(chemin, noeudDepart, noeudFinal, lstFinale); return(lstFinale); }
private void FindChemins(CChemin chemin, CNoeud noeudDepart, CNoeud noeudObjectif, List <CChemin> cheminsTrouves) { if (noeudObjectif.Equals(noeudDepart)) { chemin += new CPassageChemin(noeudObjectif.Site, null); cheminsTrouves.Add(chemin); return; } else { foreach (CLien lien in GetSuccesseurs(noeudDepart)) { CPassageChemin passage = new CPassageChemin(noeudDepart.Site, lien.Liaison); if (!chemin.PasseParSite(lien.NoeudArrivee.Site)) { FindChemins(chemin + passage, lien.NoeudArrivee, noeudObjectif, cheminsTrouves); } } } }