com.graphhopper.storage.Graph.getExtension()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.graphhopper.storage.Graph.getExtension()方法的一些代码示例,展示了Graph.getExtension()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getExtension()方法的具体详情如下:
包路径:com.graphhopper.storage.Graph
类名称:Graph
方法名:getExtension

Graph.getExtension介绍

暂无

代码示例

代码示例来源:origin: graphhopper/graphhopper

@Override
  public GraphExtension getExtension() {
    return baseGraph.getExtension();
  }
}

代码示例来源:origin: graphhopper/graphhopper

public QueryGraphTurnExt() {
  this.mainTurnExtension = (TurnCostExtension) mainGraph.getExtension();
}

代码示例来源:origin: graphhopper/graphhopper

/**
 * Potentially wraps the specified weighting into a TurnWeighting instance.
 */
public Weighting createTurnWeighting(Graph graph, Weighting weighting, TraversalMode tMode) {
  FlagEncoder encoder = weighting.getFlagEncoder();
  if (encoder.supports(TurnWeighting.class) && !tMode.equals(TraversalMode.NODE_BASED))
    return new TurnWeighting(weighting, (TurnCostExtension) graph.getExtension());
  return weighting;
}

代码示例来源:origin: graphhopper/graphhopper

public QueryGraph(Graph graph) {
  mainGraph = graph;
  mainNodeAccess = graph.getNodeAccess();
  mainNodes = graph.getNodes();
  mainEdges = graph.getAllEdges().length();
  if (mainGraph.getExtension() instanceof TurnCostExtension)
    wrappedExtension = new QueryGraphTurnExt();
  else
    wrappedExtension = mainGraph.getExtension();
  // create very lightweight QueryGraph which uses variables from this QueryGraph (same virtual edges)
  baseGraph = new QueryGraph(graph.getBaseGraph(), this) {
    // override method to avoid stackoverflow
    @Override
    public QueryGraph setUseEdgeExplorerCache(boolean useEECache) {
      baseGraph.useEdgeExplorerCache = useEECache;
      return baseGraph;
    }
  };
}

代码示例来源:origin: graphhopper/graphhopper

public void processRelation(ReaderRelation relation) throws XMLStreamException {
  if (relation.hasTag("type", "restriction")) {
    OSMTurnRelation turnRelation = createTurnRelation(relation);
    if (turnRelation != null) {
      GraphExtension extendedStorage = graph.getExtension();
      if (extendedStorage instanceof TurnCostExtension) {
        TurnCostExtension tcs = (TurnCostExtension) extendedStorage;
        Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation);
        for (TurnCostTableEntry entry : entries) {
          tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags);
        }
      }
    }
  }
}

代码示例来源:origin: com.rgi-corp/graphhopper

public QueryGraphTurnExt() {
  this.mainTurnExtension = (TurnCostExtension) mainGraph.getExtension();
}

代码示例来源:origin: com.graphhopper/graphhopper

public QueryGraphTurnExt()
{
  this.mainTurnExtension = (TurnCostExtension) mainGraph.getExtension();
}

代码示例来源:origin: com.graphhopper/graphhopper-core

public QueryGraphTurnExt() {
  this.mainTurnExtension = (TurnCostExtension) mainGraph.getExtension();
}

代码示例来源:origin: com.graphhopper/graphhopper

/**
 * Potentially wraps the specified weighting into a TurnWeighting instance.
 */
public Weighting createTurnWeighting( Graph graph, FlagEncoder encoder, Weighting weighting, TraversalMode tMode )
{
  if (encoder.supports(TurnWeighting.class) && !tMode.equals(TraversalMode.NODE_BASED))
    return new TurnWeighting(weighting, encoder, (TurnCostExtension) graph.getExtension());
  return weighting;
}

代码示例来源:origin: com.graphhopper/graphhopper

public QueryGraph( Graph graph )
{
  mainGraph = graph;
  mainNodeAccess = graph.getNodeAccess();
  mainNodes = graph.getNodes();
  mainEdges = graph.getAllEdges().getMaxId();
  if (mainGraph.getExtension() instanceof TurnCostExtension)
    wrappedExtension = new QueryGraphTurnExt();
  else
    wrappedExtension = mainGraph.getExtension();
  // create very lightweight QueryGraph which uses variables from this QueryGraph (same virtual edges)
  baseGraph = new QueryGraph(graph.getBaseGraph(), this);
}

代码示例来源:origin: com.rgi-corp/graphhopper

/**
 * Potentially wraps the specified weighting into a TurnWeighting instance.
 */
public Weighting createTurnWeighting(Graph graph, Weighting weighting, TraversalMode tMode) {
  FlagEncoder encoder = weighting.getFlagEncoder();
  if (encoder.supports(TurnWeighting.class) && !tMode.equals(TraversalMode.NODE_BASED))
    return new TurnWeighting(weighting, (TurnCostExtension) graph.getExtension());
  return weighting;
}

代码示例来源:origin: com.graphhopper/graphhopper-core

/**
 * Potentially wraps the specified weighting into a TurnWeighting instance.
 */
public Weighting createTurnWeighting(Graph graph, Weighting weighting, TraversalMode tMode) {
  FlagEncoder encoder = weighting.getFlagEncoder();
  if (encoder.supports(TurnWeighting.class) && !tMode.equals(TraversalMode.NODE_BASED))
    return new TurnWeighting(weighting, (TurnCostExtension) graph.getExtension());
  return weighting;
}

代码示例来源:origin: com.rgi-corp/graphhopper

public QueryGraph(Graph graph) {
  mainGraph = graph;
  mainNodeAccess = graph.getNodeAccess();
  mainNodes = graph.getNodes();
  mainEdges = graph.getAllEdges().getMaxId();
  if (mainGraph.getExtension() instanceof TurnCostExtension)
    wrappedExtension = new QueryGraphTurnExt();
  else
    wrappedExtension = mainGraph.getExtension();
  // create very lightweight QueryGraph which uses variables from this QueryGraph (same virtual edges)
  baseGraph = new QueryGraph(graph.getBaseGraph(), this) {
    // override method to avoid stackoverflow
    @Override
    public QueryGraph setUseEdgeExplorerCache(boolean useEECache) {
      baseGraph.useEdgeExplorerCache = useEECache;
      return baseGraph;
    }
  };
}

代码示例来源:origin: com.rgi-corp/graphhopper-reader-osm

public void processRelation(ReaderRelation relation) throws XMLStreamException {
  if (relation.hasTag("type", "restriction")) {
    OSMTurnRelation turnRelation = createTurnRelation(relation);
    if (turnRelation != null) {
      GraphExtension extendedStorage = graph.getExtension();
      if (extendedStorage instanceof TurnCostExtension) {
        TurnCostExtension tcs = (TurnCostExtension) extendedStorage;
        Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation);
        for (TurnCostTableEntry entry : entries) {
          tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags);
        }
      }
    }
  }
}

代码示例来源:origin: com.graphhopper/graphhopper-core

public QueryGraph(Graph graph) {
  mainGraph = graph;
  mainNodeAccess = graph.getNodeAccess();
  mainNodes = graph.getNodes();
  mainEdges = graph.getAllEdges().length();
  if (mainGraph.getExtension() instanceof TurnCostExtension)
    wrappedExtension = new QueryGraphTurnExt();
  else
    wrappedExtension = mainGraph.getExtension();
  // create very lightweight QueryGraph which uses variables from this QueryGraph (same virtual edges)
  baseGraph = new QueryGraph(graph.getBaseGraph(), this) {
    // override method to avoid stackoverflow
    @Override
    public QueryGraph setUseEdgeExplorerCache(boolean useEECache) {
      baseGraph.useEdgeExplorerCache = useEECache;
      return baseGraph;
    }
  };
}

代码示例来源:origin: com.rgi-corp/graphhopper-reader-osm

public void processRelation(ReaderRelation relation) throws XMLStreamException {
  if (relation.hasTag("type", "restriction")) {
    OSMTurnRelation turnRelation = createTurnRelation(relation);
    if (turnRelation != null) {
      GraphExtension extendedStorage = graph.getExtension();
      if (extendedStorage instanceof TurnCostExtension) {
        TurnCostExtension tcs = (TurnCostExtension) extendedStorage;
        Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation);
        for (TurnCostTableEntry entry : entries) {
          tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags);
        }
      }
    }
  }
}

代码示例来源:origin: com.graphhopper/graphhopper

public void processRelation( OSMRelation relation ) throws XMLStreamException
{
  if (relation.hasTag("type", "restriction"))
  {
    OSMTurnRelation turnRelation = createTurnRelation(relation);
    if (turnRelation != null)
    {
      GraphExtension extendedStorage = graph.getExtension();
      if (extendedStorage instanceof TurnCostExtension)
      {
        TurnCostExtension tcs = (TurnCostExtension) extendedStorage;
        Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation);
        for (TurnCostTableEntry entry : entries)
        {
          tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags);
        }
      }
    }
  }
}

相关文章