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