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

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

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

Graph.getBounds介绍

[英]Returns the implicit bounds of this graph calculated from the lat,lon input of setNode
[中]返回从setNode的lat,lon输入计算的此图的隐式边界

代码示例

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

@Override
public BBox getBounds() {
  return mainGraph.getBounds();
}

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

@Override
public BBox getBounds() {
  return baseGraph.getBounds();
}

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

public GraphicsWrapper(Graph g) {
  this.na = g.getNodeAccess();
  BBox b = g.getBounds();
  scaleX = scaleY = 0.002 * (b.maxLat - b.minLat);
  offsetY = b.maxLat - 90;
  offsetX = -b.minLon;
}

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

void addNode(final int nodeA, final int nodeB,
       final double lat1, final double lon1,
       final double lat2, final double lon2) {
  PointEmitter pointEmitter = new PointEmitter() {
    @Override
    public void set(double lat, double lon) {
      long key = keyAlgo.encode(lat, lon);
      long keyPart = createReverseKey(key);
      // no need to feed both nodes as we search neighbors in fillIDs
      addNode(root, nodeA, 0, keyPart, key);
    }
  };
  if (!distCalc.isCrossBoundary(lon1, lon2)) {
    BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter,
        graph.getBounds().minLat, graph.getBounds().minLon,
        deltaLat, deltaLon);
  }
}

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

private void printLocationIndexQuery(Graph g, final LocationIndex idx, int count) {
    count *= 2;
    final BBox bbox = g.getBounds();
    final double latDelta = bbox.maxLat - bbox.minLat;
    final double lonDelta = bbox.maxLon - bbox.minLon;
    final Random rand = new Random(seed);
    MiniPerfTest miniPerf = new MiniPerfTest() {
      @Override
      public int doCalc(boolean warmup, int run) {
        double lat = rand.nextDouble() * latDelta + bbox.minLat;
        double lon = rand.nextDouble() * lonDelta + bbox.minLon;
        int val = idx.findClosest(lat, lon, EdgeFilter.ALL_EDGES).getClosestNode();
//                if (!warmup && val >= 0)
//                    list.add(val);

        return val;
      }
    }.setIterations(count).start();

    print("location_index", miniPerf);
  }

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

void initAlgo(int lat, int lon) {
  this.latSize = lat;
  this.lonSize = lon;
  BBox b = graph.getBounds();
  keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b);
  double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon),
      distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon));
  maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2);
  // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real
  // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0)
}

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

BBox bounds = graph.getBounds();
if (graph.getNodes() == 0)
  throw new IllegalStateException("Cannot create location index of empty graph!");

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

@Test
public void testClone() {
  graph = createGHStorage();
  graph.edge(1, 2, 10, true);
  NodeAccess na = graph.getNodeAccess();
  na.setNode(0, 12, 23);
  na.setNode(1, 8, 13);
  na.setNode(2, 2, 10);
  na.setNode(3, 5, 9);
  graph.edge(1, 3, 10, true);
  Graph cloneGraph = graph.copyTo(AbstractGraphStorageTester.this.createGHStorage(locationParent + "/clone", false));
  assertEquals(graph.getNodes(), cloneGraph.getNodes());
  assertEquals(count(carOutExplorer.setBaseNode(1)), count(cloneGraph.createEdgeExplorer(carOutFilter).setBaseNode(1)));
  cloneGraph.edge(1, 4, 10, true);
  assertEquals(3, count(cloneGraph.createEdgeExplorer(carOutFilter).setBaseNode(1)));
  assertEquals(graph.getBounds(), cloneGraph.getBounds());
  Helper.close((Closeable) cloneGraph);
}

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

protected void checkGraph(Graph g) {
  NodeAccess na = g.getNodeAccess();
  assertTrue(na.is3D());
  assertTrue(g.getBounds().isValid());
  assertEquals(new BBox(10, 20, 10, 12, 0, 1), g.getBounds());
  assertEquals(10, na.getLatitude(0), 1e-2);
  assertEquals(10, na.getLongitude(0), 1e-2);

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

@Override
public BBox getBounds()
{
  return mainGraph.getBounds();
}

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

@Override
public BBox getBounds() {
  return mainGraph.getBounds();
}

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

@Override
public BBox getBounds() {
  return mainGraph.getBounds();
}

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

void addNode(final int nodeA, final int nodeB,
       final double lat1, final double lon1,
       final double lat2, final double lon2) {
  PointEmitter pointEmitter = new PointEmitter() {
    @Override
    public void set(double lat, double lon) {
      long key = keyAlgo.encode(lat, lon);
      long keyPart = createReverseKey(key);
      // no need to feed both nodes as we search neighbors in fillIDs
      addNode(root, nodeA, 0, keyPart, key);
    }
  };
  if (!distCalc.isCrossBoundary(lon1, lon2)) {
    BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter,
        graph.getBounds().minLat, graph.getBounds().minLon,
        deltaLat, deltaLon);
  }
}

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

void addNode(final int nodeA, final int nodeB,
       final double lat1, final double lon1,
       final double lat2, final double lon2) {
  PointEmitter pointEmitter = new PointEmitter() {
    @Override
    public void set(double lat, double lon) {
      long key = keyAlgo.encode(lat, lon);
      long keyPart = createReverseKey(key);
      // no need to feed both nodes as we search neighbors in fillIDs
      addNode(root, nodeA, 0, keyPart, key);
    }
  };
  if (!distCalc.isCrossBoundary(lon1, lon2)) {
    BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter,
        graph.getBounds().minLat, graph.getBounds().minLon,
        deltaLat, deltaLon);
  }
}

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

void addNode( final int nodeA, final int nodeB,
       final double lat1, final double lon1,
       final double lat2, final double lon2 )
{
  PointEmitter pointEmitter = new PointEmitter()
  {
    @Override
    public void set( double lat, double lon )
    {
      long key = keyAlgo.encode(lat, lon);
      long keyPart = createReverseKey(key);
      // no need to feed both nodes as we search neighbors in fillIDs
      addNode(root, nodeA, 0, keyPart, key);
    }
  };
  if (!distCalc.isCrossBoundary(lon1, lon2))
  {
    BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter,
        graph.getBounds().minLat, graph.getBounds().minLon,
        deltaLat, deltaLon);
  }
}

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

void initAlgo(int lat, int lon) {
  this.latSize = lat;
  this.lonSize = lon;
  BBox b = graph.getBounds();
  keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b);
  double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon),
      distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon));
  maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2);
  // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real
  // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0)
}

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

void initAlgo( int lat, int lon )
{
  this.latSize = lat;
  this.lonSize = lon;
  BBox b = graph.getBounds();
  keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b);
  double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon),
      distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon));
  maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2);
  // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real
  // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0)
}

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

void initAlgo(int lat, int lon) {
  this.latSize = lat;
  this.lonSize = lon;
  BBox b = graph.getBounds();
  keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b);
  double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon),
      distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon));
  maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2);
  // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real
  // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0)
}

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

BBox bounds = graph.getBounds();
if (graph.getNodes() == 0)
  throw new IllegalStateException("Cannot create location index of empty graph!");

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

BBox bounds = graph.getBounds();
if (graph.getNodes() == 0)
  throw new IllegalStateException("Cannot create location index of empty graph!");

相关文章