本文整理了Java中it.geosolutions.jaiext.range.RangeFactory
类的一些代码示例,展示了RangeFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RangeFactory
类的具体详情如下:
包路径:it.geosolutions.jaiext.range.RangeFactory
类名称:RangeFactory
[英]This class is a factory class which creates a Range object for the specific data type. This Range can have 2 bounds or be a single-point range. If the 2 bound values are equal and almost one of them is included, then a single-point range is created, else an exception is thrown. If the minimum bound value is bigger than the maximum value, then the 2 numbers are inverted at the Range creation time.
[中]这个类是一个工厂类,它为特定的数据类型创建一个范围对象。该范围可以有两个边界,也可以是单点范围。如果两个边界值相等,并且几乎包含其中一个,则会创建一个单点范围,否则会引发异常。如果最小界限值大于最大值,则在创建范围时,这两个数字会反转。
代码示例来源:origin: geotools/geotools
private Range[] handleMosaicThresholds(double[][] thresholds, int srcNum) {
Range[] nodata = new Range[srcNum];
int minSrcNum = Math.min(srcNum, thresholds.length);
for (int i = 0; i < minSrcNum; i++) {
double maxValue = Double.NEGATIVE_INFINITY;
int numBands = thresholds[i].length;
for (int b = 0; b < numBands; b++) {
double bandValue = thresholds[i][b];
if (bandValue > maxValue) {
maxValue = bandValue;
}
}
nodata[i] = RangeFactory.create(Double.NEGATIVE_INFINITY, true, maxValue, false);
}
if (minSrcNum < srcNum) {
for (int i = minSrcNum; i < srcNum; i++) {
nodata[i] = nodata[0];
}
}
return nodata;
}
代码示例来源:origin: geotools/geotools
/**
* Method for creating the nodata range associated to each coverage
*
* @param cov
* @param dataType
* @return
*/
private Range createNoDataRange(GridCoverage2D cov, int dataType) {
// Extract NoData property from gridCoverage
NoDataContainer container = CoverageUtilities.getNoDataProperty(cov);
if (container != null) {
return container.getAsRange();
}
// No property set, use the input NoData Range
double[] nodatas = CoverageUtilities.getBackgroundValues(cov);
if (nodatas != null && nodatas.length > 0) {
Range noData =
RangeFactory.convert(RangeFactory.create(nodatas[0], nodatas[0]), dataType);
return noData;
}
return null;
}
代码示例来源:origin: geosolutions-it/jai-ext
arrayL = new long[] { -10, 0, 5, 50, 100 };
rangeB2bounds = RangeFactory.create((byte) 2, true, (byte) 60, true);
rangeBpoint = RangeFactory.create(arrayB[2],true,arrayB[2],true);
rangeU2bounds = RangeFactory.createU((short) 2, true, (short) 60, true);
rangeUpoint = RangeFactory.createU(arrayUS[2],true,arrayUS[2],true);
rangeS2bounds = RangeFactory.create((short) 1, true, (short) 60, true);
rangeSpoint = RangeFactory.create(arrayS[2],true,arrayS[2],true);
rangeI2bounds = RangeFactory.create(1, true, 60, true);
rangeIpoint = RangeFactory.create(arrayI[2],true,arrayI[2],true);
rangeF2bounds = RangeFactory.create(0.5f, true, 60.5f, true,false);
rangeFpoint = RangeFactory.create(arrayF[2],true,arrayF[2],true,false);
rangeD2bounds = RangeFactory.create(1.5d, true, 60.5d, true,false);
rangeDpoint = RangeFactory.create(arrayD[2],true,arrayD[2],true,false);
rangeL2bounds = RangeFactory.create(1L, true, 60L, true);
rangeLpoint = RangeFactory.create(arrayL[2],true,arrayL[2],true);
代码示例来源:origin: geotools/geotools
/**
* Formats the underlying image to the provided data type.
*
* @param dataType to be used for this {@link FormatDescriptor} operation.
* @return this {@link ImageWorker}
*/
public final ImageWorker format(final int dataType) {
ParameterBlock pb = new ParameterBlock();
pb.setSource(image, 0); // The source image.
pb.set(dataType, 0);
image = JAI.create("Format", pb, getRenderingHints());
setNoData(RangeFactory.convert(nodata, dataType));
// All post conditions for this method contract.
assert image.getSampleModel().getDataType() == dataType;
return this;
}
代码示例来源:origin: it.geosolutions.jaiext.piecewise/jt-piecewise
this.outputRange = RangeFactory.convertToDoubleRange(outRange);
RangeFactory.create(outputMinimum, true, outputMaximum, true, true));
setTransform(transform);
代码示例来源:origin: it.geosolutions.jaiext.piecewise/jt-piecewise
this.range = RangeFactory.convertToDoubleRange(inputRange);
Class<? extends Number> type = inputRange.getDataType().getClassValue();
boolean minInc = inputRange.isMinIncluded();
代码示例来源:origin: geosolutions-it/jai-ext
@Test
public void testConvert() {
checkRangeConversion(RangeFactory.create((byte) 255, (byte) 255));
checkRangeConversion(RangeFactory.create(255d, 255d));
checkRangeConversion(RangeFactory.create(255f, 255f));
checkRangeConversion(RangeFactory.create(255, 255));
checkRangeConversion(RangeFactory.create((short) 255, (short) 255));
checkRangeConversion(RangeFactory.createU((short) 255, (short) 255));
}
代码示例来源:origin: geotools/geotools
setNoData(RangeFactory.convert(nodata, image.getSampleModel().getDataType()));
invalidateStatistics();
return this;
代码示例来源:origin: geosolutions-it/jai-ext
this.outputRange = RangeFactory.convertToDoubleRange(outRange);
RangeFactory.create(outputMinimum, true, outputMaximum, true, true));
setTransform(transform);
代码示例来源:origin: geosolutions-it/jai-ext
this.range = RangeFactory.convertToDoubleRange(inputRange);
Class<? extends Number> type = inputRange.getDataType().getClassValue();
boolean minInc = inputRange.isMinIncluded();
代码示例来源:origin: geotools/geotools
public Range extractNoDataProperty(final RenderedImage image) {
Object property = image.getProperty(NoDataContainer.GC_NODATA);
if (property != null) {
if (property instanceof NoDataContainer) {
return ((NoDataContainer) property).getAsRange();
} else if (property instanceof Double) {
return RangeFactory.create((Double) property, (Double) property);
}
}
return null;
}
代码示例来源:origin: geosolutions-it/jai-ext
boolean maxIncluded = true;
noDataByte = RangeFactory.create(noDataB, minIncluded, noDataB, maxIncluded);
noDataUShort = RangeFactory.createU(noDataS, minIncluded, noDataS, maxIncluded);
noDataShort = RangeFactory.create(noDataS, minIncluded, noDataS, maxIncluded);
noDataInt = RangeFactory.create(noDataI, minIncluded, noDataI, maxIncluded);
noDataFloat = RangeFactory.create(noDataF, minIncluded, noDataF, maxIncluded, true);
noDataDouble = RangeFactory.create(noDataD, minIncluded, noDataD, maxIncluded, true);
代码示例来源:origin: geotools/geotools
RangeFactory.convert(
RangeFactory.create(
range.getMin().doubleValue(),
range.isMinIncluded(),
RangeFactory.convert(
RangeFactory.create(
getClassMinimum(widestClass).doubleValue(),
getClassMaximum(widestClass).doubleValue()),
代码示例来源:origin: geotools/geotools
/** Performs Lookup on the underlying image */
public ImageWorker lookup(LookupTable table) {
// ParameterBlock definition
ParameterBlock pb = new ParameterBlock();
pb.setSource(image, 0);
pb.set(table, 0);
pb.set(roi, 2);
// Convert the NoData
if (nodata != null) {
nodata = RangeFactory.convert(nodata, image.getSampleModel().getDataType());
}
pb.set(nodata, 3);
if (isNoDataNeeded()) {
if (background != null && background.length > 0) {
pb.set(background[0], 1);
}
}
image = JAI.create("Lookup", pb, getRenderingHints());
return this;
}
代码示例来源:origin: it.geosolutions.jaiext.piecewise/jt-piecewise
this.nodata = RangeFactory.convertToDoubleRange(nodata);
代码示例来源:origin: geotools/geotools
/**
* Return a Piecewise transform doing clamping outside the central range
*
* @param minimum minimum valid value of the central range
* @param maximum maximum valid value of the central range
* @param minValue minValue to be returned from values outside (below) the central range
* @param maxValue maxValue to be returned from values outside (above) the central range
* @return
*/
private static PiecewiseTransform1D<DefaultPiecewiseTransform1DElement>
generateClampingPiecewise(
double minimum, double maximum, double minValue, double maxValue) {
final DefaultPiecewiseTransform1DElement zeroElement =
DefaultPiecewiseTransform1DElement.create(
"clamp-to-min", RangeFactory.create(0, true, minimum, false), minValue);
final DefaultPiecewiseTransform1DElement mainElement =
DefaultPiecewiseTransform1DElement.create(
"passthrough", RangeFactory.create(minimum, maximum));
final DefaultPiecewiseTransform1DElement maxElement =
DefaultPiecewiseTransform1DElement.create(
"clamp-to-max",
RangeFactory.create(maximum, false, Double.POSITIVE_INFINITY, true),
maxValue);
return new DefaultPiecewiseTransform1D<DefaultPiecewiseTransform1DElement>(
new DefaultPiecewiseTransform1DElement[] {zeroElement, mainElement, maxElement}, 0);
}
代码示例来源:origin: geosolutions-it/jai-ext
boolean maxIncluded = true;
noDataByte = RangeFactory.create(noDataB, minIncluded, noDataB, maxIncluded);
noDataUShort = RangeFactory.createU(noDataS, minIncluded, noDataS, maxIncluded);
noDataShort = RangeFactory.create(noDataS, minIncluded, noDataS, maxIncluded);
noDataInt = RangeFactory.create(noDataI, minIncluded, noDataI, maxIncluded);
noDataFloat = RangeFactory.create(noDataF, minIncluded, noDataF, maxIncluded, true);
noDataDouble = RangeFactory.create(noDataD, minIncluded, noDataD, maxIncluded, true);
代码示例来源:origin: geotools/geotools
setNoData(RangeFactory.create((byte) destNodata, DataBuffer.TYPE_BYTE));
pb.set(DataBuffer.TYPE_BYTE, 0); // The destination image data type (BYTE)
image = JAI.create("Format", pb, hints);
setNoData(RangeFactory.convert(nodata, DataBuffer.TYPE_BYTE));
代码示例来源:origin: geotools/geotools
/**
* If the was not already tiled, tile it. Note that no tiling will be done if
* 'getRenderingHints()' failed to suggest a tile size. This method is for internal use by
* {@link #write} methods only.
*
* @return this {@link ImageWorker}.
*/
public final ImageWorker tile() {
final RenderingHints hints = getRenderingHints();
final ImageLayout layout = getImageLayout(hints);
if (layout.isValid(ImageLayout.TILE_WIDTH_MASK)
|| layout.isValid(ImageLayout.TILE_HEIGHT_MASK)) {
final int type = image.getSampleModel().getDataType();
// ParameterBlock definition
ParameterBlock pb = new ParameterBlock();
pb.setSource(image, 0); // The source image.
pb.set(type, 0);
image = JAI.create("Format", pb, hints);
setNoData(RangeFactory.convert(nodata, type));
}
return this;
}
代码示例来源:origin: geosolutions-it/jai-ext
this.nodata = RangeFactory.convertToDoubleRange(nodata);
内容来源于网络,如有侵权,请联系作者删除!