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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. /**
  2. * @return a {@link NodeId} whose {@link NodeId#value() value} is the node's
  3. * {@link Node#bounds() bounds} {@link Envelope} or {@code null}
  4. */
  5. @Override
  6. public NodeId computeId(final Node node) {
  7. @Nullable
  8. Envelope bounds = node.bounds().orNull();
  9. return new NodeId(node.getName(), bounds);
  10. }

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

  1. /**
  2. * @return a {@link NodeId} whose {@link NodeId#value() value} is the node's
  3. * {@link Node#bounds() bounds} {@link Envelope} or {@code null}
  4. */
  5. @Override
  6. public NodeId computeId(final Node node) {
  7. @Nullable
  8. Envelope bounds = node.bounds().orNull();
  9. return new NodeId(node.getName(), bounds);
  10. }

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

  1. public static String toString(@NonNull Node node) {
  2. Envelope env = node.bounds().orNull();
  3. String bounds = env == null ? null : env.toString();
  4. return String.format("%s[%s -> %s, type: %s, md id: %s, bounds: %s]", //
  5. node.getClass().getSimpleName(), //
  6. node.getName(), //
  7. toShortString(node.getObjectId()), //
  8. node.getType(), //
  9. (node.getMetadataId().isPresent() ? toShortString(node.getMetadataId().get())
  10. : "NULL"), //
  11. bounds);
  12. }

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

  1. private Node createNode(int intId, final @Nullable Envelope bounds) {
  2. String nodeName = String.valueOf(intId);
  3. String sid = Strings.padStart(nodeName, 40, '0');
  4. ObjectId oid = RevObjectTestSupport.hashString(sid);
  5. checkState(bounds == null || (!bounds.isNull() && maxBounds.contains(bounds)));
  6. Node node = Node.create(nodeName, oid, ObjectId.NULL, TYPE.FEATURE, bounds, null);
  7. Envelope nodeBounds = node.bounds().orNull();
  8. if (bounds != null) {
  9. checkState(nodeBounds.contains(bounds));
  10. checkState(maxBounds.contains(nodeBounds));
  11. }
  12. return node;
  13. }

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

  1. private void assertNodesEqual(List<Node> l1, List<Node> l2) {
  2. assertEquals(l1, l2);
  3. for (int i = 0; i < l1.size(); i++) {
  4. Node n1 = l1.get(i);
  5. Node n2 = l2.get(i);
  6. assertEquals(n1.getExtraData(), n2.getExtraData());
  7. assertEquals(n1.getMetadataId(), n2.getMetadataId());
  8. assertEquals(n1.bounds(), n2.bounds());
  9. }
  10. }

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

  1. private void assertNodesEqual(List<Node> l1, List<Node> l2) {
  2. assertEquals(l1, l2);
  3. for (int i = 0; i < l1.size(); i++) {
  4. Node n1 = l1.get(i);
  5. Node n2 = l2.get(i);
  6. assertEquals(n1.getExtraData(), n2.getExtraData());
  7. assertEquals(n1.getMetadataId(), n2.getMetadataId());
  8. assertEquals(n1.bounds(), n2.bounds());
  9. }
  10. }

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

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

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

  1. /**
  2. * given a list of quandrants, create a node with a bounding box that JUST fits inside
  3. */
  4. public Node createNode(String name, Quadrant... quadrants) {
  5. Envelope nodeBounds = createBounds(quadrants);
  6. Node node = createNode(name, nodeBounds);
  7. if (!nodeBounds.contains(node.bounds().get())) {
  8. node = createPointNode(name, quadrants);
  9. }
  10. return node;
  11. }

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

  1. /**
  2. * given a list of quandrants, create a node with a bounding box that JUST fits inside
  3. */
  4. public Node createNode(String name, Quadrant... quadrants) {
  5. Envelope nodeBounds = createBounds(quadrants);
  6. Node node = createNode(name, nodeBounds);
  7. if (!nodeBounds.contains(node.bounds().get())) {
  8. node = createPointNode(name, quadrants);
  9. }
  10. return node;
  11. }

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

  1. private Node createNode(int intId, final @Nullable Envelope bounds) {
  2. String nodeName = String.valueOf(intId);
  3. String sid = Strings.padStart(nodeName, 40, '0');
  4. ObjectId oid = RevObjectTestSupport.hashString(sid);
  5. checkState(bounds == null || (!bounds.isNull() && maxBounds.contains(bounds)));
  6. Node node = RevObjectFactory.defaultInstance().createNode(nodeName, oid, ObjectId.NULL,
  7. TYPE.FEATURE, bounds, null);
  8. Envelope nodeBounds = node.bounds().orNull();
  9. if (bounds != null) {
  10. checkState(nodeBounds.contains(bounds));
  11. checkState(maxBounds.contains(nodeBounds));
  12. }
  13. return node;
  14. }

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

  1. public Node createNode(String name, @Nullable Envelope bounds) {
  2. ObjectId id = RevObjectTestSupport.hashString(name);
  3. Node n = RevObjectFactory.defaultInstance().createNode(name, id, ObjectId.NULL,
  4. RevObject.TYPE.FEATURE, bounds, null);
  5. if (bounds != null && !bounds.isNull()) {
  6. Envelope float32Bounds = n.bounds().get();
  7. Assert.assertTrue(float32Bounds.contains(bounds));
  8. }
  9. return n;
  10. }

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

  1. @Test
  2. public void withinFilter() throws Exception {
  3. Envelope bounds = testNode.bounds().get();
  4. bounds.expandBy(1);
  5. Polygon container = JTS.toGeometry(bounds);
  6. Within filter;
  7. Filter pre;
  8. Filter post;
  9. filter = (Within) toFilter(String.format("Within(the_geom, %s)", container));
  10. pre = ff.within(ff.property("@bounds"), ff.literal(container));
  11. post = filter;
  12. assertFilter(filter, pre, post);
  13. }

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

  1. @Test
  2. public void withinFilter() throws Exception {
  3. Envelope bounds = testNode.bounds().get();
  4. bounds.expandBy(1);
  5. Polygon container = JTS.toGeometry(bounds);
  6. Within filter;
  7. Filter pre;
  8. Filter post;
  9. filter = (Within) toFilter(String.format("Within(the_geom, %s)", container));
  10. pre = ff.within(ff.property("@bounds"), ff.literal(container));
  11. post = filter;
  12. assertFilter(filter, pre, post);
  13. }

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

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

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

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

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

  1. @Test
  2. public void touchesFilter() throws Exception {
  3. Envelope bounds = testNode.bounds().get();
  4. bounds.translate(-1 * bounds.getWidth(), 0);
  5. Polygon touching = JTS.toGeometry(bounds);
  6. // just a preflight test
  7. assertTrue(JTS.toGeometry(bounds).intersects(touching));
  8. Touches filter;
  9. Filter pre;
  10. Filter post;
  11. filter = (Touches) toFilter(String.format("Touches(the_geom, %s)", touching));
  12. pre = ff.intersects(ff.property("@bounds"), ff.literal(touching));
  13. post = filter;
  14. assertFilter(filter, pre, post);
  15. }

相关文章