org.locationtech.geogig.model.Node.bounds()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(87)

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

Node.bounds介绍

暂无

代码示例

代码示例来源:origin: locationtech/geogig

/**
 * @return and {@link Optional} containing the bounds of the {@code Node} this object points to,
 *         or {@link Optional#absent()} if the {@code Node} has no bounds
 */
@Override
public Optional<Envelope> bounds() {
  return node.bounds();
}

代码示例来源:origin: org.locationtech.geogig/geogig-api

/**
 * @return and {@link Optional} containing the bounds of the {@code Node} this object points to,
 *         or {@link Optional#absent()} if the {@code Node} has no bounds
 */
@Override
public Optional<Envelope> bounds() {
  return node.bounds();
}

代码示例来源:origin: locationtech/geogig

public Node update(final ObjectId newId) {
  return update(newId, bounds().orNull());
}

代码示例来源:origin: org.locationtech.geogig/geogig-api

public Node update(final ObjectId newId) {
  return update(newId, bounds().orNull());
}

代码示例来源:origin: locationtech/geogig

/**
 * @return a {@link NodeId} whose {@link NodeId#value() value} is the node's
 *         {@link Node#bounds() bounds} {@link Envelope} or {@code null}
 */
@Override
public NodeId computeId(final Node node) {
  @Nullable
  Envelope bounds = node.bounds().orNull();
  return new NodeId(node.getName(), bounds);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

/**
 * @return a {@link NodeId} whose {@link NodeId#value() value} is the node's
 *         {@link Node#bounds() bounds} {@link Envelope} or {@code null}
 */
@Override
public NodeId computeId(final Node node) {
  @Nullable
  Envelope bounds = node.bounds().orNull();
  return new NodeId(node.getName(), bounds);
}

代码示例来源:origin: locationtech/geogig

public static String toString(@NonNull Node node) {
  Envelope env = node.bounds().orNull();
  String bounds = env == null ? null : env.toString();
  return String.format("%s[%s -> %s, type: %s, md id: %s, bounds: %s]", //
      node.getClass().getSimpleName(), //
      node.getName(), //
      toShortString(node.getObjectId()), //
      node.getType(), //
      (node.getMetadataId().isPresent() ? toShortString(node.getMetadataId().get())
          : "NULL"), //
      bounds);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

private Node createNode(int intId, final @Nullable Envelope bounds) {
  String nodeName = String.valueOf(intId);
  String sid = Strings.padStart(nodeName, 40, '0');
  ObjectId oid = RevObjectTestSupport.hashString(sid);
  checkState(bounds == null || (!bounds.isNull() && maxBounds.contains(bounds)));
  Node node = Node.create(nodeName, oid, ObjectId.NULL, TYPE.FEATURE, bounds, null);
  Envelope nodeBounds = node.bounds().orNull();
  if (bounds != null) {
    checkState(nodeBounds.contains(bounds));
    checkState(maxBounds.contains(nodeBounds));
  }
  return node;
}

代码示例来源:origin: locationtech/geogig

private void assertNodesEqual(List<Node> l1, List<Node> l2) {
  assertEquals(l1, l2);
  for (int i = 0; i < l1.size(); i++) {
    Node n1 = l1.get(i);
    Node n2 = l2.get(i);
    assertEquals(n1.getExtraData(), n2.getExtraData());
    assertEquals(n1.getMetadataId(), n2.getMetadataId());
    assertEquals(n1.bounds(), n2.bounds());
  }
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

private void assertNodesEqual(List<Node> l1, List<Node> l2) {
  assertEquals(l1, l2);
  for (int i = 0; i < l1.size(); i++) {
    Node n1 = l1.get(i);
    Node n2 = l2.get(i);
    assertEquals(n1.getExtraData(), n2.getExtraData());
    assertEquals(n1.getMetadataId(), n2.getMetadataId());
    assertEquals(n1.bounds(), n2.bounds());
  }
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

public Node createNode(String name, @Nullable Envelope bounds) {
  ObjectId id = RevObjectTestSupport.hashString(name);
  Node n = Node.create(name, id, ObjectId.NULL, RevObject.TYPE.FEATURE, bounds);
  if (bounds != null && !bounds.isNull()) {
    Envelope float32Bounds = n.bounds().get();
    Assert.assertTrue(float32Bounds.contains(bounds));
  }
  return n;
}

代码示例来源:origin: locationtech/geogig

/**
 * given a list of quandrants, create a node with a bounding box that JUST fits inside
 */
public Node createNode(String name, Quadrant... quadrants) {
  Envelope nodeBounds = createBounds(quadrants);
  Node node = createNode(name, nodeBounds);
  if (!nodeBounds.contains(node.bounds().get())) {
    node = createPointNode(name, quadrants);
  }
  return node;
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

/**
 * given a list of quandrants, create a node with a bounding box that JUST fits inside
 */
public Node createNode(String name, Quadrant... quadrants) {
  Envelope nodeBounds = createBounds(quadrants);
  Node node = createNode(name, nodeBounds);
  if (!nodeBounds.contains(node.bounds().get())) {
    node = createPointNode(name, quadrants);
  }
  return node;
}

代码示例来源:origin: locationtech/geogig

private Node createNode(int intId, final @Nullable Envelope bounds) {
  String nodeName = String.valueOf(intId);
  String sid = Strings.padStart(nodeName, 40, '0');
  ObjectId oid = RevObjectTestSupport.hashString(sid);
  checkState(bounds == null || (!bounds.isNull() && maxBounds.contains(bounds)));
  Node node = RevObjectFactory.defaultInstance().createNode(nodeName, oid, ObjectId.NULL,
      TYPE.FEATURE, bounds, null);
  Envelope nodeBounds = node.bounds().orNull();
  if (bounds != null) {
    checkState(nodeBounds.contains(bounds));
    checkState(maxBounds.contains(nodeBounds));
  }
  return node;
}

代码示例来源:origin: locationtech/geogig

public Node createNode(String name, @Nullable Envelope bounds) {
  ObjectId id = RevObjectTestSupport.hashString(name);
  Node n = RevObjectFactory.defaultInstance().createNode(name, id, ObjectId.NULL,
      RevObject.TYPE.FEATURE, bounds, null);
  if (bounds != null && !bounds.isNull()) {
    Envelope float32Bounds = n.bounds().get();
    Assert.assertTrue(float32Bounds.contains(bounds));
  }
  return n;
}

代码示例来源:origin: locationtech/geogig

@Test
public void withinFilter() throws Exception {
  Envelope bounds = testNode.bounds().get();
  bounds.expandBy(1);
  Polygon container = JTS.toGeometry(bounds);
  Within filter;
  Filter pre;
  Filter post;
  filter = (Within) toFilter(String.format("Within(the_geom, %s)", container));
  pre = ff.within(ff.property("@bounds"), ff.literal(container));
  post = filter;
  assertFilter(filter, pre, post);
}

代码示例来源:origin: org.locationtech.geogig/geogig-datastore

@Test
public void withinFilter() throws Exception {
  Envelope bounds = testNode.bounds().get();
  bounds.expandBy(1);
  Polygon container = JTS.toGeometry(bounds);
  Within filter;
  Filter pre;
  Filter post;
  filter = (Within) toFilter(String.format("Within(the_geom, %s)", container));
  pre = ff.within(ff.property("@bounds"), ff.literal(container));
  post = filter;
  assertFilter(filter, pre, post);
}

代码示例来源:origin: locationtech/geogig

@Test
public void disjointFilter() throws Exception {
  Envelope bounds = testNode.bounds().get();
  bounds.expandBy(1);
  Polygon container = JTS.toGeometry(bounds);
  Geometry containerBounds = JTS.toGeometry(container.getEnvelopeInternal());
  Disjoint filter;
  filter = (Disjoint) toFilter(String.format("Disjoint(the_geom, %s)", container));
  Filter pre = ff.intersects(ff.property("@bounds"), ff.literal(containerBounds));
  Filter post = filter;
  assertFilter(filter, pre, post);
}

代码示例来源:origin: org.locationtech.geogig/geogig-datastore

@Test
public void disjointFilter() throws Exception {
  Envelope bounds = testNode.bounds().get();
  bounds.expandBy(1);
  Polygon container = JTS.toGeometry(bounds);
  Geometry containerBounds = JTS.toGeometry(container.getEnvelopeInternal());
  Disjoint filter;
  filter = (Disjoint) toFilter(String.format("Disjoint(the_geom, %s)", container));
  Filter pre = ff.intersects(ff.property("@bounds"), ff.literal(containerBounds));
  Filter post = filter;
  assertFilter(filter, pre, post);
}

代码示例来源:origin: locationtech/geogig

@Test
public void touchesFilter() throws Exception {
  Envelope bounds = testNode.bounds().get();
  bounds.translate(-1 * bounds.getWidth(), 0);
  Polygon touching = JTS.toGeometry(bounds);
  // just a preflight test
  assertTrue(JTS.toGeometry(bounds).intersects(touching));
  Touches filter;
  Filter pre;
  Filter post;
  filter = (Touches) toFilter(String.format("Touches(the_geom, %s)", touching));
  pre = ff.intersects(ff.property("@bounds"), ff.literal(touching));
  post = filter;
  assertFilter(filter, pre, post);
}

相关文章