Replies the bounds read from the shape file header.

@return the bounds or <code>null</code>
195486
public ESRIBounds getBoundsFromHeader() {
		try {
			readHeader();
		} catch (IOException exception) {
			return null;
		}
		return new ESRIBounds(
				this.minx, this.maxx,
				this.miny, this.maxy,
				this.minz, this.maxz,
				this.minm, this.maxm);
	}
311945
public Optional<OffsetRange<OffsetType>> clipToBounds(OffsetRange<OffsetType> bounds) {
    if (bounds.contains(this)) {
      return Optional.of(this);
    }
    if (!bounds.overlaps(this)) {
      return Optional.absent();
    }
    final OffsetType newLowerBound;
    final OffsetType newUpperBound;
    if (bounds.startInclusive().asInt() > startInclusive().asInt()) {
      newLowerBound = bounds.startInclusive();
    } else {
      newLowerBound = startInclusive();
    }
    if (bounds.endInclusive().asInt() < endInclusive().asInt()) {
      newUpperBound = bounds.endInclusive();
    } else {
      newUpperBound = endInclusive();
    }
    return Optional.of(OffsetRange.fromInclusiveEndpoints(newLowerBound, newUpperBound));
  }
793320
@javax.annotation.Nonnull
  public Bounds getBounds(@javax.annotation.Nonnull double[][] points) {
    int dim = points[0].length;
    double[] max = IntStream.range(0, dim).mapToDouble(d -> {
      return Arrays.stream(points).mapToDouble(pt -> pt[d]).filter(x -> Double.isFinite(x)).max().orElse(Double.NaN);
    }).toArray();
    double[] min = IntStream.range(0, dim).mapToDouble(d -> {
      return Arrays.stream(points).mapToDouble(pt -> pt[d]).filter(x -> Double.isFinite(x)).min().orElse(Double.NaN);
    }).toArray();
    return new Bounds(max, min);
  }
217901
public AlignedBox3d toBoundingBoxWithCtrlPoints() {
		AlignedBox3d bb = this.logicalBounds==null ? null : this.logicalBounds.get();
		if (bb==null) {
			bb = new AlignedBox3d();
			buildLogicalBoundingBox(bb);
			this.logicalBounds = new SoftReference<>(bb);
		}
		return bb;
	}
328425
public static Bbox getBounds(Geometry geometry) {
		if (geometry == null) {
			throw new IllegalArgumentException("Cannot get bounds for null geometry.");
		}
		if (isEmpty(geometry)) {
			return null;
		}
		Bbox bbox = null;
		if (geometry.getGeometries() != null) {
			bbox = getBounds(geometry.getGeometries()[0]);
			for (int i = 1; i < geometry.getGeometries().length; i++) {
				bbox = BboxService.union(bbox, getBounds(geometry.getGeometries()[i]));
			}
		}
		if (geometry.getCoordinates() != null) {
			double minX = Double.MAX_VALUE;
			double minY = Double.MAX_VALUE;
			double maxX = -Double.MAX_VALUE;
			double maxY = -Double.MAX_VALUE;

			for (Coordinate coordinate : geometry.getCoordinates()) {
				if (coordinate.getX() < minX) {
					minX = coordinate.getX();
				}
				if (coordinate.getY() < minY) {
					minY = coordinate.getY();
				}
				if (coordinate.getX() > maxX) {
					maxX = coordinate.getX();
				}
				if (coordinate.getY() > maxY) {
					maxY = coordinate.getY();
				}
			}
			if (bbox == null) {
				bbox = new Bbox(minX, minY, maxX - minX, maxY - minY);
			} else {
				bbox = BboxService.union(bbox, new Bbox(minX, minY, maxX - minX, maxY - minY));
			}
		}
		return bbox;
	}
536511
public Map<String, List<String>> getHeaders() {
        if (headers == null) {
            return null;
        }
        return headers.toMultimap();
    }
1266579
public boolean isBound()
    {
        //
        // Constrained properties are implicitly bound.  Refer to section 7.4.3 of the JavaBeans
        // spec for the rationale.
        //
        PropertyInfo propInfo = getPropertyInfo();
        return propInfo != null && (propInfo.bound() || propInfo.constrained());
    }
1183830
public com.google.cloud.datalabeling.v1beta1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() {
    if (boundedAreaCase_ == 2) {
      return (com.google.cloud.datalabeling.v1beta1.BoundingPoly) boundedArea_;
    }
    return com.google.cloud.datalabeling.v1beta1.BoundingPoly.getDefaultInstance();
  }
1153029
@SuppressWarnings("unchecked")
    public <T> T readInbound() {
        T message = (T) poll(inboundMessages);
        if (message != null) {
            ReferenceCountUtil.touch(message, "Caller of readInbound() will handle the message from this point");
        }
        return message;
    }
125772
public final Bounds intersect(Bounds b) {
		final long _min = Math.max(this.min, b.min);
		final long _max = Math.min(this.max, b.max);
		if(_min <= _max) return new Bounds(_min, _max);
		return null;
	}
885558
public String readHeader() throws IOException {
		byte[] buffer = new byte[BUFFER_SIZE];
		StringBuilder content = new StringBuilder(BUFFER_SIZE);
		while (content.indexOf(HEADER_END) == -1) {
			int amountRead = checkedRead(buffer, 0, BUFFER_SIZE);
			content.append(new String(buffer, 0, amountRead));
		}
		return content.substring(0, content.indexOf(HEADER_END));
	}
874243
public long readBoundedLong(final long max) throws IOException {
    final int bits = 0 >= max ? 0 : (int) (Math.floor(Math.log(max) / Math.log(2)) + 1);
    return 0 < bits ? this.read(bits).toLong() : 0;
  }
591494
public synchronized byte[] peek() throws IOException {
    if (isEmpty()) return null;
    int length = first.length;
    byte[] data = new byte[length];
    ringRead(first.position + Element.HEADER_LENGTH, data, 0, length);
    return data;
  }
820751
public Header getHeader() {
        List<Header> list = this.getDescendants(Header.class);
        if (list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }
189000
public Rectangle getTextBounds() {
        List<TextElement> texts = this.getText();
        if (!texts.isEmpty()) {
            return Utils.bounds(texts);
        }
        else {
            return new Rectangle();
        }
        
    }
196310
public int read() throws IOException {
    if (chunk == null || pos + 1 == chunk.length) {
      if (!fetchChunk()) {
        return -1;
      }
    }
    return chunk[pos++] & 0xff;
  }
251224
public FileDefinition read() {

		// Parse blocks
		try {
			fillIn();
			mergeContiguousRegions( this.definitionFile.getBlocks());

		} catch( IOException e ) {
			addModelError( ErrorCode.P_IO_ERROR, this.currentLineNumber, exception( e ));
		}

		// Determine file type
		boolean hasFacets = false, hasComponents = false, hasInstances = false, hasImports = false;
		int ignorableBlocksCount = 0;
		for( AbstractBlock block : this.definitionFile.getBlocks()) {

			if( block.getInstructionType() == AbstractBlock.COMPONENT )
				hasComponents = true;

			else if( block.getInstructionType() == AbstractBlock.FACET )
				hasFacets = true;

			else if( block.getInstructionType() == AbstractBlock.INSTANCEOF )
				hasInstances = true;

			else if( block.getInstructionType() == AbstractBlock.IMPORT )
				hasImports = true;

			else if( block instanceof AbstractIgnorableInstruction )
				ignorableBlocksCount ++;
		}

		if( hasInstances ) {
			if( ! hasFacets && ! hasComponents )
				this.definitionFile.setFileType( FileDefinition.INSTANCE );
			else
				addModelError( ErrorCode.P_INVALID_FILE_TYPE, 1 );

		} else if( hasFacets || hasComponents ) {
			this.definitionFile.setFileType( FileDefinition.GRAPH );

		} else if( hasImports ) {
			this.definitionFile.setFileType( FileDefinition.AGGREGATOR );

		} else if( ignorableBlocksCount == this.definitionFile.getBlocks().size()) {
			addModelError( ErrorCode.P_EMPTY_FILE, 1 );
			this.definitionFile.setFileType( FileDefinition.EMPTY );
		}

		return this.definitionFile;
	}