本文整理了Java中it.geosolutions.jaiext.range.Range
类的一些代码示例,展示了Range
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range
类的具体详情如下:
包路径:it.geosolutions.jaiext.range.Range
类名称:Range
[英]Abstract class used for checking if a selected value is inside the selected Range. All the methods throw an UnsupportedOperationExceptionbut for every subclass one of these methods is overridden with the correct functionality. These 6 methods are different only for the data type used. In this way it is possible to reach a better performance by using primitive variables than generic. All the subclasses can contain a Range composed by a minimum and a maximum or a single-point Range. For Double and Float data type the NaN data can be used only with a single-point Range.
[中]用于检查选定值是否在选定范围内的抽象类。所有方法都会抛出一个UnsupportedOperationException,但对于每个子类,其中一个方法都会被正确的功能覆盖。这6种方法仅在使用的数据类型上有所不同。通过这种方式,使用原始变量比使用泛型变量可以获得更好的性能。所有子类都可以包含一个由最小值和最大值组成的范围或一个单点范围。对于双精度和浮点数据类型,NaN数据只能用于单点范围。
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
public boolean intersects(Range other) {
// Check if one of them is contained into the other
if (this.contains(other) || other.contains(this)) {
return true;
}
double min1 = this.getMin().doubleValue();
double max1 = this.getMax().doubleValue();
double min2 = other.getMin().doubleValue();
double max2 = other.getMax().doubleValue();
// Check the bounds
boolean minCheck = this.isMinIncluded() && other.isMaxIncluded() ? min1 <= max2
: min1 < max2;
boolean maxCheck = this.isMaxIncluded() && other.isMinIncluded() ? max1 >= min2
: max1 > min2;
return minCheck && maxCheck;
}
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
@Override
public int hashCode() {
int result = 37;
result += getDataType().getClass().hashCode();
result = hash(isMaxIncluded, result);
result = hash(isMinIncluded, result);
result = hash(getMax().doubleValue(), result);
result = hash(getMin().doubleValue(), result);
return result;
}
代码示例来源:origin: it.geosolutions.jaiext.piecewise/jt-piecewise
public static boolean equals(Range outputRange, Range outputRange2) {
return outputRange.equals(outputRange2);
}
}
代码示例来源:origin: stackoverflow.com
public void clauseMinMax(String format, Range r) {
if (r != null) {
builder.clause(String.format(format, r.getMin(), r.getMax()));
}
}
代码示例来源:origin: geotools/geotools
double sampleDouble = iter.getSampleDouble(band);
if (hasNoData && !nodata.contains(sampleDouble)) {
nodLine[i] = true;
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
@Override
public Range intersection(Range other) {
if (other.getDataType() == getDataType()) {
if (other.contains(this)) {
return this;
} else if (this.contains(other)) {
float minOther = other.getMin().floatValue();
float maxOther = other.getMax().floatValue();
return new RangeFloat(minOther, other.isMinIncluded, maxOther, other.isMaxIncluded, other.isNanIncluded());
minIncluded = other.isMinIncluded();
} else if (minOther == minValue) {
minIncluded &= other.isMinIncluded();
maxIncluded = other.isMaxIncluded();
} else if (maxOther == maxValue) {
maxIncluded &= other.isMaxIncluded();
boolean isNaNIncluded = this.isNaN() && other.isNaN() && this.isNanIncluded()
&& other.isNanIncluded();
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
/** Method for checking if a Generic value is contained inside the Range */
public <T extends Number> boolean containsN(T value) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Wrong data type tested: Input: " + value.getClass()
+ ", output: " + this.getDataType().getClassValue());
}
int dataType = this.getDataType().getDataType();
switch (dataType) {
case DataBuffer.TYPE_BYTE:
return contains(value.byteValue());
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
return contains(value.shortValue());
case DataBuffer.TYPE_INT:
return contains(value.intValue());
case DataBuffer.TYPE_FLOAT:
return contains(value.floatValue());
case DataBuffer.TYPE_DOUBLE:
return contains(value.doubleValue());
case DataBuffer.TYPE_DOUBLE + 1:
return contains(value.longValue());
default:
throw new IllegalArgumentException("Wrong data type");
}
}
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
if (r1.getDataType() != this.getDataType()) {
return false;
if (r1.isPoint() != this.isPoint()) {
return false;
if (r1.isMaxIncluded() != this.isMaxIncluded()) {
return false;
if (r1.isPoint() != this.isMinIncluded()) {
return false;
if (r1.getMin().doubleValue() != this.getMin().doubleValue()) {
return false;
if (r1.getMax().doubleValue() != this.getMax().doubleValue()) {
return false;
if (r1.isNanIncluded() != this.isNanIncluded()) {
return false;
代码示例来源:origin: it.geosolutions.jaiext.classifier/jt-classifier
/**
* This method is responsible for performing a few checks on the provided range in order to make sure we are talking about a valid range for
* building an {@link IndexColorModel}.
*
* @param numberRange the range to use for mapping values to colors.
* @return the input {@link NumberRange} if everything goes well.
* @see IndexColorModel
*/
private static Range checkSampleRange(Range numberRange) {
if (numberRange == null)
throw new IllegalArgumentException();
final Class<?> elementClass = numberRange.getDataType().getClassValue();
if (!elementClass.equals(Integer.class) && !elementClass.equals(Byte.class)
&& !elementClass.equals(Short.class))
throw new IllegalArgumentException(
"The following Range cannot be used for mapping value to colours");
if (numberRange.getMin().intValue() < 0 || numberRange.getMax().intValue() > 65535)
throw new IndexOutOfBoundsException(
"Input Range bounds are outside the available color representation");
return numberRange;
}
代码示例来源:origin: geotools/geotools
double destinationNoData =
nodata != null
? nodata.getMin().doubleValue()
: (background != null && background.length > 0)
? background[0]
代码示例来源:origin: it.geosolutions.jaiext.piecewise/jt-piecewise
public Range getApproximateDomainRange() {
synchronized (elements) {
// @todo TODO should I include the NaN value?
if (range == null) {
Range range = null;
for (E element : elements) {
final Range extent = element.getRange();
if (!Double.isNaN(extent.getMin().doubleValue())
&& !Double.isNaN(extent.getMax().doubleValue())) {
if (range != null) {// TODO FIXME ADD RANGE UNION
range = range.union(extent);
} else {
range = extent;
}
}
}
this.range = range;
}
return range;
}
}
代码示例来源:origin: geotools/geotools
|| (oldNoData != null
&& nodata != null
&& oldNoData.equals(nodata));
if (((property == null)
|| property.equals(java.awt.Image.UndefinedProperty)
&& sBgValues.length > 0
&& sBgValues[0]
== this.nodata.getMin().doubleValue());
&& this.nodata != null
&& sBgValues.length > 0
&& sBgValues[0] == this.nodata.getMin().doubleValue());
代码示例来源:origin: geotools/geotools
lastColorValue,
RangeFactory.create(
previous.getRange().getMax().doubleValue(),
true,
Double.POSITIVE_INFINITY,
false),
previous.getOutputRange().getMax().intValue());
this.colormapElements.add(last);
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
public static Range convert(Range input, int dataType) {
if (input == null) {
return null;
}
// If already double do nothing
if (input.getDataType().getDataType() == dataType) {
return input;
}
switch (dataType) {
case DataBuffer.TYPE_BYTE:
return RangeByte.FULL_RANGE.intersection(input);
case DataBuffer.TYPE_USHORT:
return RangeUshort.FULL_RANGE.intersection(input);
case DataBuffer.TYPE_SHORT:
return RangeShort.FULL_RANGE.intersection(input);
case DataBuffer.TYPE_INT:
return RangeInt.FULL_RANGE.intersection(input);
case DataBuffer.TYPE_FLOAT:
return RangeFloat.FULL_RANGE.intersection(input);
case DataBuffer.TYPE_DOUBLE:
return RangeDouble.FULL_RANGE.intersection(input);
default:
return null;
}
}
代码示例来源:origin: geotools/geotools
float sampleFloat = iter.getSampleFloat(band);
if (hasNoData && !nodata.contains(sampleFloat)) {
nodLine[i] = true;
代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities
@Override
public Range intersection(Range other) {
if (other.getDataType() == getDataType()) {
if (other.contains(this)) {
return this;
} else if (this.contains(other)) {
double minOther = other.getMin().doubleValue();
double maxOther = other.getMax().doubleValue();
return new RangeDouble(minOther, other.isMinIncluded, maxOther, other.isMaxIncluded, other.isNanIncluded());
minIncluded = other.isMinIncluded();
} else if (minOther == minValue) {
minIncluded &= other.isMinIncluded();
maxIncluded = other.isMaxIncluded();
} else if (maxOther == maxValue) {
maxIncluded &= other.isMaxIncluded();
boolean isNaNIncluded = this.isNaN() && other.isNaN() && this.isNanIncluded()
&& other.isNanIncluded();
代码示例来源:origin: geosolutions-it/jai-ext
/** Method for checking if a Generic value is contained inside the Range */
public <T extends Number> boolean containsN(T value) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Wrong data type tested: Input: " + value.getClass()
+ ", output: " + this.getDataType().getClassValue());
}
int dataType = this.getDataType().getDataType();
switch (dataType) {
case DataBuffer.TYPE_BYTE:
return contains(value.byteValue());
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
return contains(value.shortValue());
case DataBuffer.TYPE_INT:
return contains(value.intValue());
case DataBuffer.TYPE_FLOAT:
return contains(value.floatValue());
case DataBuffer.TYPE_DOUBLE:
return contains(value.doubleValue());
case DataBuffer.TYPE_DOUBLE + 1:
return contains(value.longValue());
default:
throw new IllegalArgumentException("Wrong data type");
}
}
代码示例来源:origin: geosolutions-it/jai-ext
if (r1.getDataType() != this.getDataType()) {
return false;
if (r1.isPoint() != this.isPoint()) {
return false;
if (r1.isMaxIncluded() != this.isMaxIncluded()) {
return false;
if (r1.isPoint() != this.isMinIncluded()) {
return false;
if (r1.getMin().doubleValue() != this.getMin().doubleValue()) {
return false;
if (r1.getMax().doubleValue() != this.getMax().doubleValue()) {
return false;
if (r1.isNanIncluded() != this.isNanIncluded()) {
return false;
代码示例来源:origin: geotools/geotools
new DefaultPiecewiseTransform1DElement[] {p0}, 11);
Assert.assertEquals(piecewise.getApproximateDomainRange().getMin().doubleValue(), 0.0, 0.0);
Assert.assertEquals(piecewise.getApproximateDomainRange().getMax().doubleValue(), 1.0, 0.0);
Assert.assertEquals(piecewise.transform(0.5), 0.5, 0.0);
Assert.assertEquals(
代码示例来源:origin: geosolutions-it/jai-ext
/**
* This method is responsible for performing a few checks on the provided range in order to make sure we are talking about a valid range for
* building an {@link IndexColorModel}.
*
* @param numberRange the range to use for mapping values to colors.
* @return the input {@link NumberRange} if everything goes well.
* @see IndexColorModel
*/
private static Range checkSampleRange(Range numberRange) {
if (numberRange == null)
throw new IllegalArgumentException();
final Class<?> elementClass = numberRange.getDataType().getClassValue();
if (!elementClass.equals(Integer.class) && !elementClass.equals(Byte.class)
&& !elementClass.equals(Short.class))
throw new IllegalArgumentException(
"The following Range cannot be used for mapping value to colours");
if (numberRange.getMin().intValue() < 0 || numberRange.getMax().intValue() > 65535)
throw new IndexOutOfBoundsException(
"Input Range bounds are outside the available color representation");
return numberRange;
}
内容来源于网络,如有侵权,请联系作者删除!