Search in sources :

Example 1 with GenericWeighting

use of com.graphhopper.routing.weighting.GenericWeighting in project graphhopper by graphhopper.

the class CHAlgoFactoryDecorator method createPreparations.

public void createPreparations(GraphHopperStorage ghStorage, TraversalMode traversalMode) {
    if (!isEnabled() || !preparations.isEmpty())
        return;
    if (weightings.isEmpty())
        throw new IllegalStateException("No CH weightings found");
    traversalMode = getNodeBase();
    for (Weighting weighting : getWeightings()) {
        if (weighting instanceof GenericWeighting) {
            ((GenericWeighting) weighting).setGraph(ghStorage);
        }
        PrepareContractionHierarchies tmpPrepareCH = new PrepareContractionHierarchies(new GHDirectory("", DAType.RAM_INT), ghStorage, ghStorage.getGraph(CHGraph.class, weighting), weighting, traversalMode);
        tmpPrepareCH.setPeriodicUpdates(preparationPeriodicUpdates).setLazyUpdates(preparationLazyUpdates).setNeighborUpdates(preparationNeighborUpdates).setLogMessages(preparationLogMessages);
        addPreparation(tmpPrepareCH);
    }
}
Also used : Weighting(com.graphhopper.routing.weighting.Weighting) AbstractWeighting(com.graphhopper.routing.weighting.AbstractWeighting) GenericWeighting(com.graphhopper.routing.weighting.GenericWeighting) GenericWeighting(com.graphhopper.routing.weighting.GenericWeighting)

Aggregations

AbstractWeighting (com.graphhopper.routing.weighting.AbstractWeighting)1 GenericWeighting (com.graphhopper.routing.weighting.GenericWeighting)1 Weighting (com.graphhopper.routing.weighting.Weighting)1