24 #ifndef LSST_AFW_GEOM_Span_h_INCLUDED 25 #define LSST_AFW_GEOM_Span_h_INCLUDED 30 #include "boost/serialization/nvp.hpp" 38 namespace serialization {
68 Span() : _y(0), _x0(0), _x1(-1) {}
72 Span& operator=(
Span const&) =
default;
80 Iterator
end()
const {
return Iterator(
Point2I(_x1 + 1, _y)); }
82 int getX0()
const {
return _x0; }
84 int getX1()
const {
return _x1; }
86 int getY()
const {
return _y; }
96 bool contains(
int x)
const {
return (x >= _x0) && (x <= _x1); }
97 bool contains(
int x,
int y)
const {
return (x >= _x0) && (x <= _x1) && (y == _y); }
116 return other.
getY() == getY() && other.
getMinX() == getMinX() && other.
getMaxX() == getMaxX();
124 bool operator<(
const Span&
b)
const;
129 friend class boost::serialization::access;
130 template <
typename Archive>
131 void serialize(Archive& ar,
const unsigned int version) {
132 ar& boost::serialization::make_nvp(
"y", _y) & boost::serialization::make_nvp(
"x0", _x0) &
133 boost::serialization::make_nvp(
"x1", _x1);
144 #endif // LSST_AFW_GEOM_Span_h_INCLUDED An iterator that yields Point2I and increases in the x direction.
int getEndX() const
End (exclusive) x-value.
bool isEmpty() const
Return true if the span contains no pixels.
friend std::ostream & operator<<(std::ostream &os, Span const &span)
Stream output; delegates to toString().
Iterator end() const
Return an iterator to one past the last pixel in the Span.
A range of pixels within one row of an Image.
int & getX1()
Return the ending x-value.
int getWidth() const
Return the number of pixels.
int getX0() const
Return the starting x-value.
int & getY()
Return the y-value.
A base class for image defects.
void shift(int dx, int dy)
bool operator!=(Span const &other) const
bool contains(int x, int y) const
int & getX0()
Return the starting x-value.
bool operator==(Span const &other) const
int getMaxX() const
Maximum x-value.
Point2I const getMin() const
Point corresponding to minimum x.
int getX1() const
Return the ending x-value.
lsst::afw::detection::Footprint Footprint
Point2I const getMax() const
Point corresponding to maximum x.
int getY() const
Return the y-value.
bool contains(Point2I const &point) const
bool contains(int x) const
Span()
Construct an empty Span with zero width at the origin.
int getBeginX() const
Begin (inclusive) x-value.
SpanPixelIterator Iterator
An iterator over points in the Span.
std::string toString() const
Return a string-representation of a Span.
int getMinX() const
Minimum x-value.
Span(int y, int x0, int x1)
Iterator begin() const
Return an iterator to the first pixel in the Span.