/** * Computes the weight of the edge considering the usage, external objects and the maximum object * speed. The class of the actual moving object must be set before by setActualObjectClass! * * @return directed weight * @param edge the edge * @param edgeLength the length of the edge */ private double getWeight(Edge edge, double edgeLength) { double objWeight = computeWeight(edgeLength, objClasses.getMaxSpeed(actObjClass)); double edgeWeight = computeWeight( edgeLength, edgeClasses.deceleratedSpeed(edge.getEdgeClass(), edge.getUsage())); if (extObjects != null) { int decFactor = extObjects.computeDecrease(edge); if (decFactor < 100) { double newEdgeWeight = computeWeight( edgeLength, edgeClasses.getMaxSpeed(edge.getEdgeClass()) * decFactor / 100); if (newEdgeWeight > edgeWeight) edgeWeight = newEdgeWeight; } } if (edgeWeight > objWeight) return edgeWeight; else return objWeight; }
/** * Computes the weight for a distance assuming edge class 0. The class of the actual moving object * must be set before by setActualObjectClass! * * @return weight * @param distance distance */ public double computeWeight(double distance) { return computeWeight(distance, objClasses.getMaxSpeed(0)); }