private Float32Bounds boundsInternal() { return Float32Bounds.valueOf(bounds_x1, bounds_x2, bounds_y1, bounds_y2); }
public @Override Bucket createBucket(final @NonNull ObjectId bucketTree, @Nonnegative int bucketIndex, final @Nullable Envelope bounds) { if (bucketIndex < 0) { throw new IllegalArgumentException( "Bucket cannot have a negative index: " + bucketIndex); } Float32Bounds b32 = Float32Bounds.valueOf(bounds); return new BucketImpl(bucketTree, bucketIndex, b32); }
public static @Nullable Envelope makePrecise(@Nullable Envelope bounds) { Envelope float32Bounds = Float32Bounds.valueOf(bounds).asEnvelope(); return float32Bounds.isNull() ? null : float32Bounds; } }
public BaseNodeImpl(final String name, final ObjectId oid, final ObjectId metadataId, @Nullable Envelope bounds, @Nullable Map<String, Object> extraData) { checkNotNull(name); checkNotNull(oid); checkNotNull(metadataId); this.name = name; this.objectId_h1 = RevObjects.h1(oid); this.objectId_h2 = RevObjects.h2(oid); this.objectId_h3 = RevObjects.h3(oid); this.metadataId = metadataId.isNull() ? null : metadataId; this.extraData = ExtraData.of(extraData); Float32Bounds bbox = Float32Bounds.valueOf(bounds); bounds_x1 = bbox.xmin; bounds_x2 = bbox.xmax; bounds_y1 = bbox.ymin; bounds_y2 = bbox.ymax; }
public void expand(Envelope env) { if (isNull()) return; env.expandToInclude(xmin, ymin); env.expandToInclude(xmax, ymax); Float32Bounds newEnv = Float32Bounds.valueOf(env); Envelope float32Version = newEnv.asEnvelope(); env.init(float32Version); }
@Test public void testSimple() { // 1,1 is the same in float4 and float8 Coordinate coord = new Coordinate(1, 1); Float32Bounds bounds = Float32Bounds.valueOf(new Envelope(coord)); assertTrue(bounds.asEnvelope().contains(coord)); assertTrue(bounds.intersects(new Envelope(coord))); Envelope testEnvelope = new Envelope(); bounds.expand(testEnvelope); assertTrue(testEnvelope.covers(bounds.asEnvelope())); coord = new Coordinate(Math.PI, Math.E); bounds = Float32Bounds.valueOf(new Envelope(coord)); assertNotEquals(bounds, new Envelope(coord)); assertTrue(bounds.asEnvelope().contains(coord)); assertTrue(bounds.intersects(new Envelope(coord))); testEnvelope = new Envelope(); bounds.expand(testEnvelope); assertTrue(testEnvelope.covers(bounds.asEnvelope())); }