No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LabelStar.java 981B

1234567891011121314151617181920212223242526272829
  1. package org.insa.graphs.algorithm.utils;
  2. import org.insa.graphs.model.Node;
  3. import org.insa.graphs.model.Point;
  4. import org.insa.graphs.algorithm.AbstractInputData;
  5. import org.insa.graphs.algorithm.shortestpath.ShortestPathData;
  6. public class LabelStar extends Label {
  7. private float inf;
  8. public LabelStar(Node sommet_courant, Node node_dest, ShortestPathData data) {
  9. super(sommet_courant);
  10. if (data.getMode() == AbstractInputData.Mode.LENGTH) {
  11. this.inf = (float)Point.distance(sommet_courant.getPoint(),data.getDestination().getPoint());
  12. }
  13. else {
  14. int vitesse = Math.max(data.getMaximumSpeed(), data.getGraph().getGraphInformation().getMaximumSpeed());
  15. this.inf = (float)Point.distance(sommet_courant.getPoint(),data.getDestination().getPoint())/(vitesse*1000.0f/3600.0f);
  16. }
  17. }
  18. /* Renvoie le coût de l'origine jusqu'au noeud + coût à vol d'oiseau du noeud jusqu'à la destination */
  19. public double getTotalCost() {
  20. return this.inf+this.cout;
  21. }
  22. }