24#ifndef LSST_AFW_GEOM_Span_h_INCLUDED
25#define LSST_AFW_GEOM_Span_h_INCLUDED
31#include "lsst/utils/hashCombine.h"
57 : _y(
y), _x0(x0), _x1(x1) {}
62 Span() noexcept : _y(0), _x0(0), _x1(-1) {}
66 Span& operator=(
Span const&) noexcept = default;
68 ~
Span() noexcept = default;
76 int getX0() const noexcept {
return _x0; }
77 int&
getX0() noexcept {
return _x0; }
78 int getX1() const noexcept {
return _x1; }
79 int&
getX1() noexcept {
return _x1; }
81 int getY() const noexcept {
return _y; }
82 int&
getY() noexcept {
return _y; }
83 int getWidth() const noexcept {
return _x1 - _x0 + 1; }
84 int getMinX() const noexcept {
return _x0; }
85 int getMaxX() const noexcept {
return _x1; }
87 int getEndX() const noexcept {
return _x1 + 1; }
95 bool contains(
int x)
const noexcept {
return (
x >= _x0) && (
x <= _x1); }
96 bool contains(
int x,
int y)
const noexcept {
return (
x >= _x0) && (
x <= _x1) && (
y == _y); }
98 return contains(point.getX(), point.getY());
102 bool isEmpty() const noexcept {
return _x1 < _x0; }
107 void shift(
int dx,
int dy)
noexcept {
117 return other.getY() ==
getY() && other.getMinX() ==
getMinX() && other.getMaxX() ==
getMaxX();
A range of pixels within one row of an Image.
bool isEmpty() const noexcept
Return true if the span contains no pixels.
int getBeginX() const noexcept
Begin (inclusive) x-value.
bool operator==(Span const &other) const noexcept
int getMinX() const noexcept
Minimum x-value.
int getMaxX() const noexcept
Maximum x-value.
SpanPixelIterator Iterator
An iterator over points in the Span.
lsst::geom::Point2I const getMax() const noexcept
Point corresponding to maximum x.
lsst::geom::Point2I const getMin() const noexcept
Point corresponding to minimum x.
Span() noexcept
Construct an empty Span with zero width at the origin.
int & getX0() noexcept
Return the starting x-value.
Span(Span &&) noexcept=default
bool operator!=(Span const &other) const noexcept
int getEndX() const noexcept
End (exclusive) x-value.
int & getY() noexcept
Return the y-value.
std::size_t hash_value() const noexcept
Return a hash of this object.
Span(int y, int x0, int x1)
Iterator begin() const noexcept
Return an iterator to the first pixel in the Span.
Interval getX() const noexcept
bool contains(int x) const noexcept
bool operator<(const Span &b) const noexcept
std::string toString() const
Return a string-representation of a Span.
int getY() const noexcept
Return the y-value.
int getX0() const noexcept
Return the starting x-value.
bool contains(int x, int y) const noexcept
bool contains(lsst::geom::Point2I const &point) const noexcept
Iterator end() const noexcept
Return an iterator to one past the last pixel in the Span.
int getWidth() const noexcept
Return the number of pixels.
Span(Span const &) noexcept=default
void shift(int dx, int dy) noexcept
Span(Interval const &x, int y)
int getX1() const noexcept
Return the ending x-value.
int & getX1() noexcept
Return the ending x-value.
friend std::ostream & operator<<(std::ostream &os, Span const &span)
Stream output; delegates to toString().
An iterator that yields lsst::geom::Point2I and increases in the x direction.
static IntervalI fromMinMax(Element min, Element max)
class[[deprecated("Removed with no replacement (but see lsst::afw::image::TransmissionCurve). Will be " "removed after v22.")]] FilterProperty final
Describe the properties of a Filter (e.g.
lsst::afw::detection::Footprint Footprint
A base class for image defects.
result_type operator()(argument_type const &obj) const noexcept