// dessin et affichage d'un chemin depuis l'origine à partir de l'origine vers un sommet en // particulier public void print_chemin(Sommet dest) { if (maplabel.containsKey(dest)) { boolean var = true; Label lab = maplabel.get(dest); while (var) { // dessin du chemin. on n'affiche pas le chemin noeud par noeud car ca prend trop de place // dans la console if (lab.getCourant() == this.graphe.sommets.get(origine)) { break; } this.graphe.getDessin().setColor(Color.GREEN); this.graphe.getDessin().setWidth(3); this.graphe .getDessin() .drawLine( lab.getCourant().getlon(), lab.getCourant().getlat(), lab.getPere().getlon(), lab.getPere().getlat()); this.graphe.getDessin().setWidth(1); if (lab.getPere() == this.graphe.sommets.get(origine)) { break; } lab = maplabel.get(lab.getPere()); } // affichage du cout final if (this.getdist() && (this.getcovoit() == 0)) { System.out.println( maplabel.get(dest).getCout() / 1000.0 + " kilomètres et " + maplabel.get(dest).getCoutSec() + " min"); } else if (this.getcovoit() == 0) { System.out.println( maplabel.get(dest).getCout() + " min et " + maplabel.get(dest).getCoutSec() / 1000.0 + " kilomètres"); } } else { // le sommet destination n'est pas dans la hashmap->cout infini System.out.println("Cout infini"); } }