/** * Sets all ordinate values to {@linkplain Double#NaN NaN}. The {@linkplain * #getCoordinateReferenceSystem coordinate reference system} (if any) stay unchanged. * * @since 2.2 */ public void setToNull() { Arrays.fill(ordinates, Double.NaN); assert isNull() : this; }
public Element encode(Object object, Document document, Element value) throws Exception { GeneralEnvelope envelope = (GeneralEnvelope) object; if (envelope.isNull()) { value.appendChild( document.createElementNS( GML.NAMESPACE, org.geotools.gml3.GML.Null.getLocalPart())); } return null; }
/** * Determines whether or not this envelope is empty. An envelope is non-empty only if it has at * least one {@linkplain #getDimension dimension}, and the {@linkplain #getLength length} is * greater than 0 along all dimensions. Note that a non-empty envelope is always non- * {@linkplain #isNull null}, but the converse is not always true. * * @return {@code true} if this envelope is empty. */ public boolean isEmpty() { if (isEmptyOrdinates(ordinates)) { return true; } assert !isNull() : this; // JG I worry that this is circular return false; } /**
/** * Returns {@code true} if all the parameters specified by the argument are set. * * @param bitmask Any combination of {@link #CRS_BITMASK}, {@link #ENVELOPE_BITMASK}, {@link * #GRID_RANGE_BITMASK} and {@link #GRID_TO_CRS_BITMASK}. * @return {@code true} if all specified attributes are defined (i.e. invoking the corresponding * method will not thrown an {@link InvalidGridGeometryException}). * @throws IllegalArgumentException if the specified bitmask is not a combination of known * masks. * @since 2.2 * @see javax.media.jai.ImageLayout#isValid */ public boolean isDefined(final int bitmask) throws IllegalArgumentException { if ((bitmask & ~(CRS_BITMASK | ENVELOPE_BITMASK | GRID_RANGE_BITMASK | GRID_TO_CRS_BITMASK)) != 0) { throw new IllegalArgumentException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "bitmask", bitmask)); } return ((bitmask & CRS_BITMASK) == 0 || (envelope != null && envelope.getCoordinateReferenceSystem() != null)) && ((bitmask & ENVELOPE_BITMASK) == 0 || (envelope != null && !envelope.isNull())) && ((bitmask & GRID_RANGE_BITMASK) == 0 || (gridRange != null)) && ((bitmask & GRID_TO_CRS_BITMASK) == 0 || (gridToCRS != null)); }
/** * Returns the bounding box of "real world" coordinates for this grid geometry. This envelope is * the {@linkplain #getGridRange grid range} {@linkplain #getGridToCoordinateSystem transformed} * to the "real world" coordinate system. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. <code> * {@linkplain #isDefined isDefined}({@linkplain #ENVELOPE_BITMASK})</code> returned {@code * false}). * @see GridGeometry2D#getEnvelope2D */ public Envelope getEnvelope() throws InvalidGridGeometryException { if (envelope != null && !envelope.isNull()) { assert isDefined(ENVELOPE_BITMASK); return envelope.clone(); } assert !isDefined(ENVELOPE_BITMASK); throw new InvalidGridGeometryException( gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE); }
new GeneralEnvelope(renderingEnvelopeInCoverageCRS); cropEnvelope.intersect(coverageEnvelope); if (cropEnvelope.isEmpty() || cropEnvelope.isNull()) { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info(
/** * Returns the two-dimensional bounding box for the coverage domain in coordinate reference * system coordinates. If the coverage envelope has more than two dimensions, only the * dimensions used in the underlying rendered image are returned. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. <code> * {@linkplain #isDefined isDefined}({@linkplain #ENVELOPE_BITMASK ENVELOPE_BITMASK})</code> * returned {@code false}). * @see #getEnvelope */ public Envelope2D getEnvelope2D() throws InvalidGridGeometryException { if (envelope != null && !envelope.isNull()) { assert isDefined(ENVELOPE_BITMASK); return new Envelope2D( crs2D, envelope.getMinimum(axisDimensionX), envelope.getMinimum(axisDimensionY), envelope.getSpan(axisDimensionX), envelope.getSpan(axisDimensionY)); // Note: we didn't invoked reduce(Envelope) in order to make sure that // our privated 'envelope' field is not exposed to subclasses. } assert !isDefined(ENVELOPE_BITMASK); throw new InvalidGridGeometryException( gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE); }
/** * Returns {@code true} if all the parameters specified by the argument are set. * * @param bitmask Any combinaison of {@link #CRS}, {@link #ENVELOPE}, {@link #GRID_RANGE} * and {@link #GRID_TO_CRS}. * @return {@code true} if all specified attributes are defined (i.e. invoking the * corresponding method will not thrown an {@link InvalidGridGeometryException}). * @throws IllegalArgumentException if the specified bitmask is not a combinaison of known * masks. * * @since 2.2 */ public boolean isDefined(final int bitmask) throws IllegalArgumentException { if ((bitmask & ~(CRS | ENVELOPE | GRID_RANGE | GRID_TO_CRS)) != 0) { throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "bitmask", new Integer(bitmask))); } return ((bitmask & CRS) == 0 || (envelope != null && envelope.getCoordinateReferenceSystem()!=null)) && ((bitmask & ENVELOPE) == 0 || (envelope != null && !envelope.isNull())) && ((bitmask & GRID_RANGE) == 0 || (gridRange != null)) && ((bitmask & GRID_TO_CRS) == 0 || (gridToCRS != null)); }
/** * Returns {@code true} if all the parameters specified by the argument are set. * * @param bitmask Any combinaison of {@link #CRS_BITMASK}, {@link #ENVELOPE_BITMASK}, {@link #GRID_RANGE_BITMASK} * and {@link #GRID_TO_CRS_BITMASK}. * @return {@code true} if all specified attributes are defined (i.e. invoking the * corresponding method will not thrown an {@link InvalidGridGeometryException}). * @throws IllegalArgumentException if the specified bitmask is not a combinaison of known * masks. * * @since 2.2 * * @see javax.media.jai.ImageLayout#isValid */ public boolean isDefined(final int bitmask) throws IllegalArgumentException { if ((bitmask & ~(CRS_BITMASK | ENVELOPE_BITMASK | GRID_RANGE_BITMASK | GRID_TO_CRS_BITMASK)) != 0) { throw new IllegalArgumentException(Errors.format( ErrorKeys.ILLEGAL_ARGUMENT_$2, "bitmask", bitmask)); } return ((bitmask & CRS_BITMASK) == 0 || (envelope != null && envelope.getCoordinateReferenceSystem() != null)) && ((bitmask & ENVELOPE_BITMASK) == 0 || (envelope != null && !envelope.isNull())) && ((bitmask & GRID_RANGE_BITMASK) == 0 || (gridRange != null)) && ((bitmask & GRID_TO_CRS_BITMASK) == 0 || (gridToCRS != null)); }
/** * Returns the bounding box of "real world" coordinates for this grid geometry. This envelope is * the {@linkplain #getGridRange grid range} {@linkplain #getGridToCoordinateSystem transformed} * to the "real world" coordinate system. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. * <code>{@linkplain #isDefined isDefined}({@linkplain #ENVELOPE_BITMASK})</code> * returned {@code false}). * * @see GridGeometry2D#getEnvelope2D */ public Envelope getEnvelope() throws InvalidGridGeometryException { if (envelope!=null && !envelope.isNull()) { assert isDefined(ENVELOPE_BITMASK); return envelope.clone(); } assert !isDefined(ENVELOPE_BITMASK); throw new InvalidGridGeometryException(gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE); }
/** * Returns the bounding box of "real world" coordinates for this grid geometry. This envelope is * the {@linkplain #getGridRange grid range} {@linkplain #getGridToCoordinateSystem transformed} * to the "real world" coordinate system. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. * <code>{@linkplain #isDefined isDefined}({@linkplain #ENVELOPE})</code> * returned {@code false}). * * @see GridGeometry2D#getEnvelope2D */ public Envelope getEnvelope() throws InvalidGridGeometryException { if (envelope!=null && !envelope.isNull()) { assert isDefined(ENVELOPE); return (Envelope) envelope.clone(); } assert !isDefined(ENVELOPE); throw new InvalidGridGeometryException(Errors.format(gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE)); }
if (intersectionEnvelope.isEmpty()||intersectionEnvelope.isNull()) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER
/** * Returns the two-dimensional bounding box for the coverage domain in coordinate reference * system coordinates. If the coverage envelope has more than two dimensions, only the * dimensions used in the underlying rendered image are returned. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. * <code>{@linkplain #isDefined isDefined}({@linkplain #ENVELOPE_BITMASK ENVELOPE_BITMASK})</code> * returned {@code false}). * * @see #getEnvelope */ public Envelope2D getEnvelope2D() throws InvalidGridGeometryException { if (envelope!=null && !envelope.isNull()) { assert isDefined(ENVELOPE_BITMASK); return new Envelope2D(crs2D, envelope.getMinimum(axisDimensionX), envelope.getMinimum(axisDimensionY), envelope.getSpan (axisDimensionX), envelope.getSpan (axisDimensionY)); // Note: we didn't invoked reduce(Envelope) in order to make sure that // our privated 'envelope' field is not exposed to subclasses. } assert !isDefined(ENVELOPE_BITMASK); throw new InvalidGridGeometryException(gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE); }
/** * Returns the two-dimensional bounding box for the coverage domain in coordinate reference * system coordinates. If the coverage envelope has more than two dimensions, only the * dimensions used in the underlying rendered image are returned. * * @return The bounding box in "real world" coordinates (never {@code null}). * @throws InvalidGridGeometryException if this grid geometry has no envelope (i.e. * <code>{@linkplain #isDefined isDefined}({@linkplain #ENVELOPE ENVELOPE})</code> * returned {@code false}). * * @see #getEnvelope */ public Envelope2D getEnvelope2D() throws InvalidGridGeometryException { if (envelope!=null && !envelope.isNull()) { assert isDefined(ENVELOPE); return new Envelope2D(crs2D, envelope.getMinimum(axisDimensionX), envelope.getMinimum(axisDimensionY), envelope.getLength (axisDimensionX), envelope.getLength (axisDimensionY)); } assert !isDefined(ENVELOPE); throw new InvalidGridGeometryException(Errors.format(gridToCRS == null ? ErrorKeys.UNSPECIFIED_TRANSFORM : ErrorKeys.UNSPECIFIED_IMAGE_SIZE)); }
if (intersectionEnvelope.isEmpty()||intersectionEnvelope.isNull()) { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("The destination envelope does not intersect the envelope of the source coverage.");