/** * Initializes this sample dimension to the values of the given object. */ private void init(final DefaultSampleDimension object) { minValue = object.getMinValue(); maxValue = object.getMaxValue(); meanValue = object.getMeanValue(); numberOfValues = object.getNumberOfValues(); standardDeviation = object.getStandardDeviation(); units = object.getUnits(); scaleFactor = object.getScaleFactor(); offset = object.getOffset(); transferFunctionType = object.getTransferFunctionType(); bitsPerValue = object.getBitsPerValue(); nominalSpatialResolution = object.getNominalSpatialResolution(); otherPropertyType = object.getOtherPropertyType(); otherProperty = object.getOtherProperty(); }
/** * {@inheritDoc} */ @Override public void setBitsPerValue(final Integer newValue) { super.setBitsPerValue(newValue); }
/** * {@inheritDoc} */ @Override public void setOffset(final Double newValue) { super.setOffset(newValue); }
/** * Sets the scale factor and offset which have been applied to the cell value. * The transfer function type is declared {@linkplain TransferFunctionType#LINEAR linear} * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/scale}</li> * <li>{@code metadata/contentInfo/attributeGroup/attribute/offset}</li> * <li>{@code metadata/contentInfo/attributeGroup/attribute/transferFunctionType}</li> * </ul> * * @param scale the scale factor which has been applied to the cell value. * @param offset the physical value corresponding to a cell value of zero. */ public final void setTransferFunction(final double scale, final double offset) { if (!Double.isNaN(scale) || !Double.isNaN(offset)) { final DefaultSampleDimension sd = sampleDimension(); if (!Double.isNaN(scale)) sd.setScaleFactor(scale); if (!Double.isNaN(offset)) sd.setOffset(offset); sd.setTransferFunctionType(TransferFunctionType.LINEAR); } }
/** * Sets the scale factor which has been applied to the cell value. * * @param newValue the new scale factor which has been applied to the cell value. */ public void setScaleFactor(final Double newValue) { checkWritePermission(); scaleFactor = newValue; }
/** * Adds a minimal value for the current sample dimension. If a minimal value was already defined, then * the new value will be set only if it is smaller than the existing one. {@code NaN} values are ignored. * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/minValue}</li> * </ul> * * @param value the minimal value to add to the existing range of sample values, or {@code NaN} for no-operation. */ public final void addMinimumSampleValue(final double value) { if (!Double.isNaN(value)) { final DefaultSampleDimension sampleDimension = sampleDimension(); final Double current = sampleDimension.getMinValue(); if (current == null || value < current) { sampleDimension.setMinValue(shared(value)); } } }
/** * Adds a maximal value for the current sample dimension. If a maximal value was already defined, then * the new value will be set only if it is greater than the existing one. {@code NaN} values are ignored. * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/maxValue}</li> * </ul> * * @param value the maximal value to add to the existing range of sample values, or {@code NaN} for no-operation. */ public final void addMaximumSampleValue(final double value) { if (!Double.isNaN(value)) { final DefaultSampleDimension sampleDimension = sampleDimension(); final Double current = sampleDimension.getMaxValue(); if (current == null || value > current) { sampleDimension.setMaxValue(shared(value)); } } }
/** * Sets the units of data in the current band. * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/unit}</li> * </ul> * * @param unit units of measurement of sample values. */ public final void setSampleUnits(final Unit<?> unit) { if (unit != null) { sampleDimension().setUnits(unit); } }
/** * {@inheritDoc} */ @Override public void setTransferFunctionType(final TransferFunctionType newValue) { super.setTransferFunctionType(newValue); }
/** * {@inheritDoc} */ @Override public void setScaleFactor(final Double newValue) { super.setScaleFactor(newValue); }
/** * Creates the sample dimension object if it does not already exists, then returns it. * * @return the sample dimension (never {@code null}). * @see #newSampleDimension() */ private DefaultSampleDimension sampleDimension() { if (sampleDimension == null) { sampleDimension = new DefaultSampleDimension(); } return sampleDimension; }
/** * {@inheritDoc} */ @Override @ValueRange(minimum = 1) @XmlElement(name = "bitsPerValue") public Integer getBitsPerValue() { return super.getBitsPerValue(); }
/** * Sets the scale factor and offset which have been applied to the cell value. * The transfer function type is declared {@linkplain TransferFunctionType#LINEAR linear} * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/scale}</li> * <li>{@code metadata/contentInfo/attributeGroup/attribute/offset}</li> * <li>{@code metadata/contentInfo/attributeGroup/attribute/transferFunctionType}</li> * </ul> * * @param scale the scale factor which has been applied to the cell value. * @param offset the physical value corresponding to a cell value of zero. */ public final void setTransferFunction(final double scale, final double offset) { if (!Double.isNaN(scale) || !Double.isNaN(offset)) { final DefaultSampleDimension sd = sampleDimension(); if (!Double.isNaN(scale)) sd.setScaleFactor(scale); if (!Double.isNaN(offset)) sd.setOffset(offset); sd.setTransferFunctionType(TransferFunctionType.LINEAR); } }
/** * Sets the type of transfer function to be used when scaling a physical value for a given element. * * @param newValue the new transfer function value. */ public void setTransferFunctionType(final TransferFunctionType newValue) { checkWritePermission(); transferFunctionType = newValue; }
/** * Adds a minimal value for the current sample dimension. If a minimal value was already defined, then * the new value will be set only if it is smaller than the existing one. {@code NaN} values are ignored. * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/minValue}</li> * </ul> * * @param value the minimal value to add to the existing range of sample values, or {@code NaN} for no-operation. */ public final void addMinimumSampleValue(final double value) { if (!Double.isNaN(value)) { final DefaultSampleDimension sampleDimension = sampleDimension(); final Double current = sampleDimension.getMinValue(); if (current == null || value < current) { sampleDimension.setMinValue(shared(value)); } } }
/** * Adds a maximal value for the current sample dimension. If a maximal value was already defined, then * the new value will be set only if it is greater than the existing one. {@code NaN} values are ignored. * If a coverage contains more than one band, additional bands can be created by calling * {@link #newSampleDimension()} before to call this method. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/attribute/maxValue}</li> * </ul> * * @param value the maximal value to add to the existing range of sample values, or {@code NaN} for no-operation. */ public final void addMaximumSampleValue(final double value) { if (!Double.isNaN(value)) { final DefaultSampleDimension sampleDimension = sampleDimension(); final Double current = sampleDimension.getMaxValue(); if (current == null || value > current) { sampleDimension.setMaxValue(shared(value)); } } }
/** * Sets the units of data as a unit of length. * * <div class="warning"><b>Upcoming precondition change — relaxation</b><br> * The current implementation requires the unit to be an instance of {@code Unit<Length>}, * otherwise a {@link ClassCastException} is thrown. This is because the value returned by * {@link #getUnits()} was restricted by ISO 19115:2003 to units of length. * However this restriction may be relaxed in GeoAPI 4.0. * </div> * * @param newValue The new units of data as an instance of {@code Unit<Length>}. */ @Override public void setUnits(final Unit<?> newValue) { super.setUnits(newValue.asType(Length.class)); }
/** * {@inheritDoc} */ @Override public void setTransferFunctionType(final TransferFunctionType newValue) { super.setTransferFunctionType(newValue); }
/** * Creates the sample dimension object if it does not already exists, then returns it. * * @return the sample dimension (never {@code null}). * @see #newSampleDimension() */ private DefaultSampleDimension sampleDimension() { if (sampleDimension == null) { sampleDimension = new DefaultSampleDimension(); } return sampleDimension; }
/** * Initializes this sample dimension to the values of the given object. */ private void init(final DefaultSampleDimension object) { minValue = object.getMinValue(); maxValue = object.getMaxValue(); meanValue = object.getMeanValue(); numberOfValues = object.getNumberOfValues(); standardDeviation = object.getStandardDeviation(); units = object.getUnits(); scaleFactor = object.getScaleFactor(); offset = object.getOffset(); transferFunctionType = object.getTransferFunctionType(); bitsPerValue = object.getBitsPerValue(); nominalSpatialResolution = object.getNominalSpatialResolution(); otherPropertyType = object.getOtherPropertyType(); otherProperty = object.getOtherProperty(); }