org.geotools.util.Range.intersects()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(326)

本文整理了Java中org.geotools.util.Range.intersects方法的一些代码示例,展示了Range.intersects的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.intersects方法的具体详情如下:
包路径:org.geotools.util.Range
类名称:Range
方法名:intersects

Range.intersects介绍

[英]Returns true if this range intersects the given range.
[中]如果此范围与给定范围相交,则返回true。

代码示例

代码示例来源:origin: geotools/geotools

private List<Range<T>> getOverlappingRanges(Range<T> range) {
  List<Range<T>> overlapping = new ArrayList<>();
  for (Range r : ranges) {
    if (r.intersects(range) || contiguous(r, range)) {
      overlapping.add(r);
    }
  }
  return overlapping;
}

代码示例来源:origin: geotools/geotools

public MultiRange<T> intersect(MultiRange<T> other) {
  List<Range<T>> intersections = new ArrayList<>();
  for (Range<T> r1 : ranges) {
    for (Range<T> r2 : other.ranges) {
      if (r1.intersects(r2)) {
        intersections.add((Range<T>) r1.intersect(r2));
      }
    }
  }
  return new MultiRange<>(intersections);
}

代码示例来源:origin: geotools/geotools

/**
 * Implementation of {@link #intersect(Range)} to be invoked directly by subclasses. "NC" stands
 * for "No Cast" - this method do not try to cast the value to a compatible type.
 */
final Range<? extends T> intersectNC(final Range<? extends T> range)
    throws IllegalArgumentException {
  final Range<? extends T> intersect, min, max;
  min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) < 0 ? range : this;
  max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) > 0 ? range : this;
  if (min == max) {
    intersect = min;
  } else {
    intersect = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded);
  }
  assert intersect.isEmpty() == !intersects(range) : intersect;
  return intersect;
}

代码示例来源:origin: geotools/geotools

if (!intersects(range)) {
  subtract = this;
} else {
assert !subtract.intersects(range) : subtract;
final Range<T>[] array = newArray(1);
array[0] = subtract;

代码示例来源:origin: org.geoserver/gs-wms

private boolean rangeFilterAccepts(Range rangeFilter, Object domainValue) {
  if (rangeFilter == null) {
    return true;
  }
  if (domainValue instanceof Range) {
    return rangeFilter.intersects((Range) domainValue);
  } else {
    return rangeFilter.contains((Comparable) domainValue);
  }
}

代码示例来源:origin: org.geoserver/gs-wms

Range rb = (Range) b;
if (ra.intersects(rb)) {
  return 0;
} else if (ra.getMinValue().compareTo(rb.getMaxValue()) >= 0) {

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Implementation of {@link #intersect(Range)} to be invoked directly by subclasses.
 * "NC" stands for "No Cast" - this method do not try to cast the value to a compatible type.
 */
final Range<? extends T> intersectNC(final Range<? extends T> range)
    throws IllegalArgumentException
{
  final Range<? extends T> intersect, min, max;
  min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) < 0 ? range : this;
  max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) > 0 ? range : this;
  if (min == max) {
    intersect = min;
  } else {
    intersect = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded);
  }
  assert intersect.isEmpty() == !intersects(range) : intersect;
  return intersect;
}

代码示例来源:origin: org.geotools/gt-metadata

if (!intersects(range)) {
  subtract = this;
} else {
assert !subtract.intersects(range) : subtract;
final Range<T>[] array = newArray(1);
array[0] = subtract;

相关文章