use of org.apache.sis.metadata.iso.content.DefaultSampleDimension in project sis by apache.
the class MetadataBuilder method addMaximumSampleValue.
/**
* 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));
}
}
}
use of org.apache.sis.metadata.iso.content.DefaultSampleDimension in project sis by apache.
the class MetadataBuilder method addMinimumSampleValue.
/**
* 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));
}
}
}
use of org.apache.sis.metadata.iso.content.DefaultSampleDimension in project sis by apache.
the class MetadataBuilder method setTransferFunction.
/**
* 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);
}
}
use of org.apache.sis.metadata.iso.content.DefaultSampleDimension in project sis by apache.
the class MetadataBuilder method addBandDescription.
/**
* Adds a description of 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/description}</li>
* </ul>
*
* @param description the band description, or {@code null} for no-operation.
*/
public final void addBandDescription(final CharSequence description) {
final InternationalString i18n = trim(description);
if (i18n != null) {
final DefaultSampleDimension sampleDimension = sampleDimension();
sampleDimension.setDescription(append(sampleDimension.getDescription(), i18n));
}
}
Aggregations