Codota Logo
PrepareContractionHierarchies.getWeighting
Code IndexAdd Codota to your IDE (free)

How to use
getWeighting
method
in
com.graphhopper.routing.ch.PrepareContractionHierarchies

Best Java code snippets using com.graphhopper.routing.ch.PrepareContractionHierarchies.getWeighting (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: graphhopper/graphhopper

public CHAlgoFactoryDecorator addPreparation(PrepareContractionHierarchies pch) {
  preparations.add(pch);
  int lastIndex = preparations.size() - 1;
  if (lastIndex >= weightings.size())
    throw new IllegalStateException("Cannot access weighting for PrepareContractionHierarchies with " + pch.getWeighting()
        + ". Call add(Weighting) before");
  if (preparations.get(lastIndex).getWeighting() != weightings.get(lastIndex))
    throw new IllegalArgumentException("Weighting of PrepareContractionHierarchies " + preparations.get(lastIndex).getWeighting()
        + " needs to be identical to previously added " + weightings.get(lastIndex));
  return this;
}
origin: graphhopper/graphhopper

@Override
public RoutingAlgorithmFactory getDecoratedAlgorithmFactory(RoutingAlgorithmFactory defaultAlgoFactory, HintsMap map) {
  boolean disableCH = map.getBool(DISABLE, false);
  if (!isEnabled() || disablingAllowed && disableCH)
    return defaultAlgoFactory;
  if (preparations.isEmpty())
    throw new IllegalStateException("No preparations added to this decorator");
  if (map.getWeighting().isEmpty())
    map.setWeighting(getDefaultWeighting());
  String entriesStr = "";
  for (PrepareContractionHierarchies p : preparations) {
    if (p.getWeighting().matches(map))
      return p;
    entriesStr += p.getWeighting() + ", ";
  }
  throw new IllegalArgumentException("Cannot find CH RoutingAlgorithmFactory for weighting map " + map + " in entries " + entriesStr);
}
origin: graphhopper/graphhopper

public void prepare(final StorableProperties properties) {
  ExecutorCompletionService completionService = new ExecutorCompletionService<>(threadPool);
  int counter = 0;
  for (final PrepareContractionHierarchies prepare : getPreparations()) {
    LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + getMemInfo() + ")");
    final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting());
    completionService.submit(new Runnable() {
      @Override
      public void run() {
        // toString is not taken into account so we need to cheat, see http://stackoverflow.com/q/6113746/194609 for other options
        Thread.currentThread().setName(name);
        prepare.doWork();
        properties.put(CH.PREPARE + "date." + name, createFormatter().format(new Date()));
      }
    }, name);
  }
  threadPool.shutdown();
  try {
    for (int i = 0; i < getPreparations().size(); i++) {
      completionService.take().get();
    }
  } catch (Exception e) {
    threadPool.shutdownNow();
    throw new RuntimeException(e);
  }
}
origin: graphhopper/graphhopper

  @Override
  public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) {
    // doable but ugly
    Weighting w = ((PrepareContractionHierarchies) tmpFactory).getWeighting();
    return new TmpAlgo(g, new PreparationWeighting(w), TraversalMode.NODE_BASED, mg).
        setEdgeFilter(new LevelEdgeFilter((CHGraph) routingGraph));
  }
};
origin: graphhopper/graphhopper

@Test
public void testReturnsCorrectWeighting() {
  GraphHopperStorage g = createGHStorage();
  CHGraph lg = g.getGraph(CHGraph.class);
  PrepareContractionHierarchies prepare = createPrepareContractionHierarchies(g, lg);
  assertSame(weighting, prepare.getWeighting());
}

origin: graphhopper/graphhopper

  weighting = ((PrepareContractionHierarchies) chAlgoFactory).getWeighting();
else
  throw new IllegalStateException("Although CH was enabled a non-CH algorithm factory was returned " + tmpAlgoFactory);
origin: com.graphhopper/graphhopper

public CHAlgoFactoryDecorator addPreparation( PrepareContractionHierarchies pch )
{
  preparations.add(pch);
  int lastIndex = preparations.size() - 1;
  if (lastIndex >= weightings.size())
    throw new IllegalStateException("Cannot access weighting for PrepareContractionHierarchies with " + pch.getWeighting()
        + ". Call add(Weighting) before");
  if (preparations.get(lastIndex).getWeighting() != weightings.get(lastIndex))
    throw new IllegalArgumentException("Weighting of PrepareContractionHierarchies " + preparations.get(lastIndex).getWeighting()
        + " needs to be identical to previously added " + weightings.get(lastIndex));
  return this;
}
origin: com.graphhopper/graphhopper-core

public CHAlgoFactoryDecorator addPreparation(PrepareContractionHierarchies pch) {
  preparations.add(pch);
  int lastIndex = preparations.size() - 1;
  if (lastIndex >= weightings.size())
    throw new IllegalStateException("Cannot access weighting for PrepareContractionHierarchies with " + pch.getWeighting()
        + ". Call add(Weighting) before");
  if (preparations.get(lastIndex).getWeighting() != weightings.get(lastIndex))
    throw new IllegalArgumentException("Weighting of PrepareContractionHierarchies " + preparations.get(lastIndex).getWeighting()
        + " needs to be identical to previously added " + weightings.get(lastIndex));
  return this;
}
origin: com.rgi-corp/graphhopper

public CHAlgoFactoryDecorator addPreparation(PrepareContractionHierarchies pch) {
  preparations.add(pch);
  int lastIndex = preparations.size() - 1;
  if (lastIndex >= weightings.size())
    throw new IllegalStateException("Cannot access weighting for PrepareContractionHierarchies with " + pch.getWeighting()
        + ". Call add(Weighting) before");
  if (preparations.get(lastIndex).getWeighting() != weightings.get(lastIndex))
    throw new IllegalArgumentException("Weighting of PrepareContractionHierarchies " + preparations.get(lastIndex).getWeighting()
        + " needs to be identical to previously added " + weightings.get(lastIndex));
  return this;
}
origin: com.rgi-corp/graphhopper

public void prepare(final StorableProperties properties) {
  int counter = 0;
  for (final PrepareContractionHierarchies prepare : getPreparations()) {
    LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + Helper.getMemInfo() + ")");
    final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting());
    threadPool.execute(new Runnable() {
      @Override
origin: com.graphhopper/graphhopper-core

@Override
public RoutingAlgorithmFactory getDecoratedAlgorithmFactory(RoutingAlgorithmFactory defaultAlgoFactory, HintsMap map) {
  boolean disableCH = map.getBool(DISABLE, false);
  if (!isEnabled() || disablingAllowed && disableCH)
    return defaultAlgoFactory;
  if (preparations.isEmpty())
    throw new IllegalStateException("No preparations added to this decorator");
  if (map.getWeighting().isEmpty())
    map.setWeighting(getDefaultWeighting());
  String entriesStr = "";
  for (PrepareContractionHierarchies p : preparations) {
    if (p.getWeighting().matches(map))
      return p;
    entriesStr += p.getWeighting() + ", ";
  }
  throw new IllegalArgumentException("Cannot find CH RoutingAlgorithmFactory for weighting map " + map + " in entries " + entriesStr);
}
origin: com.rgi-corp/graphhopper

@Override
public RoutingAlgorithmFactory getDecoratedAlgorithmFactory(RoutingAlgorithmFactory defaultAlgoFactory, HintsMap map) {
  boolean forceFlexMode = map.getBool(DISABLE, false);
  if (!isEnabled() || forceFlexMode)
    return defaultAlgoFactory;
  if (preparations.isEmpty())
    throw new IllegalStateException("No preparations added to this decorator");
  if (map.getWeighting().isEmpty())
    map.setWeighting(getDefaultWeighting());
  String entriesStr = "";
  for (PrepareContractionHierarchies p : preparations) {
    if (p.getWeighting().matches(map))
      return p;
    entriesStr += p.getWeighting() + ", ";
  }
  throw new IllegalArgumentException("Cannot find CH RoutingAlgorithmFactory for weighting map " + map + " in entries " + entriesStr);
}
origin: com.graphhopper/graphhopper

for (final PrepareContractionHierarchies prepare : getPreparations())
  logger.info((++counter) + "/" + getPreparations().size() + " calling prepare.doWork for " + prepare.getWeighting() + " ... (" + Helper.getMemInfo() + ")");
  final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting());
  chPreparePool.execute(new Runnable()
origin: com.graphhopper/graphhopper-core

public void prepare(final StorableProperties properties) {
  ExecutorCompletionService completionService = new ExecutorCompletionService<>(threadPool);
  int counter = 0;
  for (final PrepareContractionHierarchies prepare : getPreparations()) {
    LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + getMemInfo() + ")");
    final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting());
    completionService.submit(new Runnable() {
      @Override
      public void run() {
        // toString is not taken into account so we need to cheat, see http://stackoverflow.com/q/6113746/194609 for other options
        Thread.currentThread().setName(name);
        prepare.doWork();
        properties.put(CH.PREPARE + "date." + name, createFormatter().format(new Date()));
      }
    }, name);
  }
  threadPool.shutdown();
  try {
    for (int i = 0; i < getPreparations().size(); i++) {
      completionService.take().get();
    }
  } catch (Exception e) {
    threadPool.shutdownNow();
    throw new RuntimeException(e);
  }
}
origin: com.graphhopper/graphhopper

@Override
public RoutingAlgorithmFactory getDecoratedAlgorithmFactory( RoutingAlgorithmFactory defaultAlgoFactory, HintsMap map )
{
  boolean forceFlexMode = map.getBool(DISABLE, false);
  if (!isEnabled() || forceFlexMode)
    return defaultAlgoFactory;
  if (preparations.isEmpty())
    throw new IllegalStateException("No preparations added to this decorator");
  if (map.getWeighting().isEmpty())
    map.setWeighting(getDefaultWeighting());
  for (PrepareContractionHierarchies p : preparations)
  {
    if (p.getWeighting().matches(map))
      return p;
  }
  throw new IllegalArgumentException("Cannot find RoutingAlgorithmFactory for weighting map " + map);
}
origin: graphhopper/map-matching

  routingGraph = graphHopper.getGraphHopperStorage().getGraph(CHGraph.class, ((PrepareContractionHierarchies) routingAlgorithmFactory).getWeighting());
} else {
  ch = false;
origin: com.graphhopper/graphhopper-map-matching-core

  routingGraph = graphHopper.getGraphHopperStorage().getGraph(CHGraph.class, ((PrepareContractionHierarchies) routingAlgorithmFactory).getWeighting());
} else {
  ch = false;
origin: com.graphhopper/graphhopper-core

  weighting = ((PrepareContractionHierarchies) chAlgoFactory).getWeighting();
else
  throw new IllegalStateException("Although CH was enabled a non-CH algorithm factory was returned " + tmpAlgoFactory);
origin: com.rgi-corp/graphhopper

  weighting = ((PrepareContractionHierarchies) chAlgoFactory).getWeighting();
else
  throw new IllegalStateException("Although CH was enabled a non-CH algorithm factory was returned " + tmpAlgoFactory);
origin: com.graphhopper/graphhopper

weighting = ((PrepareContractionHierarchies) tmpAlgoFactory).getWeighting();
routingGraph = ghStorage.getGraph(CHGraph.class, weighting);
com.graphhopper.routing.chPrepareContractionHierarchiesgetWeighting

Popular methods of PrepareContractionHierarchies

  • <init>
  • doWork
  • calculatePriority
    Calculates the priority of adjNode v without changing the graph. Warning: the calculated priority mu
  • close
  • contractNodes
  • getTimesAsString
  • initFromGraph
  • prepareNodes
  • addShortcuts
    Introduces the necessary shortcuts for adjNode v in the graph.
  • findShortcuts
    Finds shortcuts, does not change the underlying graph.
  • fromGraphHopperStorage
  • getCoords
  • fromGraphHopperStorage,
  • getCoords,
  • getOrigEdgeCount,
  • setLazyUpdates,
  • setLogMessages,
  • setNeighborUpdates,
  • setOrigEdgeCount,
  • setPeriodicUpdates,
  • createAStarBidirection

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Reference (javax.naming)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now