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

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

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

Graph.getBaseGraph介绍

暂无

代码示例

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

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

private NavigableMap<Integer, Integer> findDepartureTimelineForPlatform(int platformEnterNode) {
  TreeMap<Integer, Integer> result = new TreeMap<>();
  if (platformEnterNode == -1) {
    return result;
  }
  EdgeIterator edge = graph.getBaseGraph().createEdgeExplorer(DefaultEdgeFilter.outEdges(encoder)).setBaseNode(platformEnterNode);
  while (edge.next()) {
    if (encoder.getEdgeType(edge.getFlags()) == GtfsStorage.EdgeType.ENTER_TIME_EXPANDED_NETWORK) {
      result.put((int) encoder.getTime(edge.getFlags()), edge.getAdjNode());
    }
  }
  return result;
}

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

private int findPlatformNode(int stationNode, GtfsStorageI.PlatformDescriptor platformDescriptor, GtfsStorage.EdgeType edgeType) {
  DefaultEdgeFilter filter;
  if (edgeType == GtfsStorage.EdgeType.ENTER_PT) {
    filter = DefaultEdgeFilter.outEdges(encoder);
  } else if (edgeType == GtfsStorage.EdgeType.EXIT_PT) {
    filter = DefaultEdgeFilter.inEdges(encoder);
  } else {
    throw new RuntimeException();
  }
  EdgeIterator i = graph.getBaseGraph().createEdgeExplorer(filter).setBaseNode(stationNode);
  while (i.next()) {
    if (encoder.getEdgeType(i.getFlags()) == edgeType) {
      if (platformDescriptor.equals(gtfsStorage.getRoutes().get(i.getEdge()))) {
        return i.getAdjNode();
      }
    }
  }
  return -1;
}

代码示例来源: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

private void insertOutboundTransfers(String toStopId, String toRouteId, int minimumTransferTime, NavigableMap<Integer, Integer> fromStopTimelineNodes) {
  int stationNode = gtfsStorage.getStationNodes().get(toStopId);
  EdgeIterator i = graph.getBaseGraph().createEdgeExplorer().setBaseNode(stationNode);
  while (i.next()) {
    GtfsStorage.EdgeType edgeType = encoder.getEdgeType(i.getFlags());
    if (edgeType == GtfsStorage.EdgeType.ENTER_PT) {
      GtfsStorageI.PlatformDescriptor routeId = gtfsStorage.getRoutes().get(i.getEdge());
      if (toRouteId == null || routeId instanceof GtfsStorageI.RouteTypePlatform || GtfsStorageI.PlatformDescriptor.route(toRouteId).equals(routeId)) {
        fromStopTimelineNodes.forEach((time, e) -> {
          EdgeIterator j = graph.getBaseGraph().createEdgeExplorer().setBaseNode(i.getAdjNode());
          while (j.next()) {
            GtfsStorage.EdgeType edgeType2 = encoder.getEdgeType(j.getFlags());
            if (edgeType2 == GtfsStorage.EdgeType.ENTER_TIME_EXPANDED_NETWORK) {
              int departureTime = (int) encoder.getTime(j.getFlags());
              if (departureTime < time + minimumTransferTime) {
                continue;
              }
              EdgeIteratorState edge = graph.edge(e, j.getAdjNode());
              edge.setFlags(encoder.setAccess(edge.getFlags(), true, false));
              setEdgeTypeAndClearDistance(edge, GtfsStorage.EdgeType.TRANSFER);
              edge.setFlags(encoder.setTime(edge.getFlags(), departureTime - time));
              break;
            }
          }
        });
      }
    }
  }
}

代码示例来源:origin: PGWelch/com.opendoorlogistics

public CacheablePath4CH(Graph chGraph, FlagEncoder encoder, HashMap<EdgeExpansionCacheKey, DistanceTime> expansionCache) {
  super(chGraph.getBaseGraph(), encoder);
  this.routingGraph = chGraph;
  this.expansionCache = expansionCache;
  this.encoder = encoder;
}

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

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

@Override
protected Path createAndInitPath()
{
  bestPath = new Path4CH(graph, graph.getBaseGraph(), flagEncoder);
  return bestPath;
}

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

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

@Override
protected Path createAndInitPath()
{
  bestPath = new Path4CH(graph, graph.getBaseGraph(), flagEncoder);
  return bestPath;
}

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

@Override
protected Path createAndInitPath() {
  bestPath = new Path4CH(graph, graph.getBaseGraph(), weighting);
  return bestPath;
}

代码示例来源:origin: PGWelch/com.opendoorlogistics

private DistanceTime unpackSingleEdge2DistTime(int tmpEdge, int endNode, boolean isReverseOrder) {
  Path tmpPath = unpackSingleEdge(routingGraph, routingGraph.getBaseGraph(), encoder, tmpEdge, endNode,isReverseOrder);
  DistanceTime dtTmp = new DistanceTime(tmpPath.getDistance(), tmpPath.getTime());
  return dtTmp;
}

代码示例来源: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.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

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;
    }
  };
}

相关文章