LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lsst::afw::geom::Span Class Reference

A range of pixels within one row of an Image. More...

#include <Span.h>

Public Types

typedef boost::shared_ptr< SpanPtr
 
typedef boost::shared_ptr
< Span const > 
ConstPtr
 
typedef SpanPixelIterator Iterator
 An iterator over points in the Span. More...
 

Public Member Functions

 Span (int y, int x0, int x1)
 
 Span ()
 Construct an empty Span with zero width at the origin. More...
 
Iterator begin () const
 Return an iterator to the first pixel in the Span. More...
 
Iterator end () const
 Return an iterator to one past the last pixel in the Span. More...
 
int getX0 () const
 Return the starting x-value. More...
 
int & getX0 ()
 Return the starting x-value. More...
 
int getX1 () const
 Return the ending x-value. More...
 
int & getX1 ()
 Return the ending x-value. More...
 
int getY () const
 Return the y-value. More...
 
int & getY ()
 Return the y-value. More...
 
int getWidth () const
 Return the number of pixels. More...
 
int getMinX () const
 Minimum x-value. More...
 
int getMaxX () const
 Maximum x-value. More...
 
int getBeginX () const
 Begin (inclusive) x-value. More...
 
int getEndX () const
 End (exclusive) x-value. More...
 
Point2I const getMin () const
 Point corresponding to minimum x. More...
 
Point2I const getMax () const
 Point corresponding to maximum x. More...
 
bool contains (int x) const
 
bool contains (int x, int y) const
 
bool contains (Point2I const &point) const
 
bool isEmpty () const
 Return true if the span contains no pixels. More...
 
std::string toString () const
 Return a string-representation of a Span. More...
 
void shift (int dx, int dy)
 
bool operator== (Span const &other) const
 
bool operator!= (Span const &other) const
 
bool operator< (const Span &b) const
 

Private Member Functions

template<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

int _y
 Row that Span's in. More...
 
int _x0
 Starting column (inclusive) More...
 
int _x1
 Ending column (inclusive) More...
 

Friends

class detection::Footprint
 
class boost::serialization::access
 
std::ostream & operator<< (std::ostream &os, Span const &span)
 Stream output; delegates to toString(). More...
 

Detailed Description

A range of pixels within one row of an Image.

Definition at line 54 of file Span.h.

Member Typedef Documentation

typedef boost::shared_ptr<Span const> lsst::afw::geom::Span::ConstPtr

Definition at line 58 of file Span.h.

An iterator over points in the Span.

Definition at line 61 of file Span.h.

typedef boost::shared_ptr<Span> lsst::afw::geom::Span::Ptr

Definition at line 57 of file Span.h.

Constructor & Destructor Documentation

lsst::afw::geom::Span::Span ( int  y,
int  x0,
int  x1 
)
inline
Parameters
yRow that Span's in
x0Starting column (inclusive)
x1Ending column (inclusive)

Definition at line 63 of file Span.h.

66  : _y(y), _x0(x0), _x1(x1) {}
int y
int _x0
Starting column (inclusive)
Definition: Span.h:129
int const x0
Definition: saturated.cc:45
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128
lsst::afw::geom::Span::Span ( )
inline

Construct an empty Span with zero width at the origin.

Definition at line 69 of file Span.h.

69 : _y(0), _x0(0), _x1(-1) {}
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128

Member Function Documentation

Iterator lsst::afw::geom::Span::begin ( ) const
inline

Return an iterator to the first pixel in the Span.

Definition at line 72 of file Span.h.

72 { return Iterator(Point2I(_x0, _y)); }
int _x0
Starting column (inclusive)
Definition: Span.h:129
Point< int, 2 > Point2I
Definition: Point.h:283
int _y
Row that Span&#39;s in.
Definition: Span.h:128
SpanPixelIterator Iterator
An iterator over points in the Span.
Definition: Span.h:61
bool lsst::afw::geom::Span::contains ( int  x) const
inline

Definition at line 91 of file Span.h.

91 { return (x >= _x0) && (x <= _x1); }
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
double x
bool lsst::afw::geom::Span::contains ( int  x,
int  y 
) const
inline

Definition at line 92 of file Span.h.

92 { return (x >= _x0) && (x <= _x1) && (y == _y); }
int y
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128
double x
bool lsst::afw::geom::Span::contains ( Point2I const &  point) const
inline

Definition at line 93 of file Span.h.

93 { return contains(point.getX(), point.getY()); }
bool contains(int x) const
Definition: Span.h:91
Iterator lsst::afw::geom::Span::end ( ) const
inline

Return an iterator to one past the last pixel in the Span.

Definition at line 75 of file Span.h.

75 { return Iterator(Point2I(_x1+1, _y)); }
Point< int, 2 > Point2I
Definition: Point.h:283
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128
SpanPixelIterator Iterator
An iterator over points in the Span.
Definition: Span.h:61
int lsst::afw::geom::Span::getBeginX ( ) const
inline

Begin (inclusive) x-value.

Definition at line 86 of file Span.h.

int lsst::afw::geom::Span::getEndX ( ) const
inline

End (exclusive) x-value.

Definition at line 87 of file Span.h.

Point2I const lsst::afw::geom::Span::getMax ( ) const
inline

Point corresponding to maximum x.

Definition at line 89 of file Span.h.

int lsst::afw::geom::Span::getMaxX ( ) const
inline

Maximum x-value.

Definition at line 85 of file Span.h.

Point2I const lsst::afw::geom::Span::getMin ( ) const
inline

Point corresponding to minimum x.

Definition at line 88 of file Span.h.

int lsst::afw::geom::Span::getMinX ( ) const
inline

Minimum x-value.

Definition at line 84 of file Span.h.

int lsst::afw::geom::Span::getWidth ( ) const
inline

Return the number of pixels.

Definition at line 83 of file Span.h.

int lsst::afw::geom::Span::getX0 ( ) const
inline

Return the starting x-value.

Definition at line 77 of file Span.h.

int& lsst::afw::geom::Span::getX0 ( )
inline

Return the starting x-value.

Definition at line 78 of file Span.h.

int lsst::afw::geom::Span::getX1 ( ) const
inline

Return the ending x-value.

Definition at line 79 of file Span.h.

int& lsst::afw::geom::Span::getX1 ( )
inline

Return the ending x-value.

Definition at line 80 of file Span.h.

int lsst::afw::geom::Span::getY ( ) const
inline

Return the y-value.

Definition at line 81 of file Span.h.

int& lsst::afw::geom::Span::getY ( )
inline

Return the y-value.

Definition at line 82 of file Span.h.

bool lsst::afw::geom::Span::isEmpty ( ) const
inline

Return true if the span contains no pixels.

Definition at line 96 of file Span.h.

96 { return _x1 < _x0; }
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
bool lsst::afw::geom::Span::operator!= ( Span const &  other) const
inline

Definition at line 109 of file Span.h.

109 { return !(*this == other); }
bool lsst::afw::geom::Span::operator< ( const Span b) const
bool lsst::afw::geom::Span::operator== ( Span const &  other) const
inline

Definition at line 106 of file Span.h.

106  {
107  return other.getY() == getY() && other.getMinX() == getMinX() && other.getMaxX() == getMaxX();
108  }
int getMaxX() const
Maximum x-value.
Definition: Span.h:85
int getMinX() const
Minimum x-value.
Definition: Span.h:84
int getY() const
Return the y-value.
Definition: Span.h:81
template<typename Archive >
void lsst::afw::geom::Span::serialize ( Archive &  ar,
const unsigned int  version 
)
inlineprivate

Definition at line 122 of file Span.h.

122  {
123  ar & boost::serialization::make_nvp("y", _y)
124  & boost::serialization::make_nvp("x0", _x0)
125  & boost::serialization::make_nvp("x1", _x1);
126  }
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128
void lsst::afw::geom::Span::shift ( int  dx,
int  dy 
)
inline

Definition at line 101 of file Span.h.

101 { _x0 += dx; _x1 += dx; _y += dy; }
int _x0
Starting column (inclusive)
Definition: Span.h:129
int _x1
Ending column (inclusive)
Definition: Span.h:130
int _y
Row that Span&#39;s in.
Definition: Span.h:128
std::string lsst::afw::geom::Span::toString ( ) const

Return a string-representation of a Span.

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 120 of file Span.h.

friend class detection::Footprint
friend

Definition at line 117 of file Span.h.

std::ostream& operator<< ( std::ostream &  os,
Span const &  span 
)
friend

Stream output; delegates to toString().

Definition at line 104 of file Span.h.

104 { return os << span.toString(); }

Member Data Documentation

int lsst::afw::geom::Span::_x0
private

Starting column (inclusive)

Definition at line 129 of file Span.h.

int lsst::afw::geom::Span::_x1
private

Ending column (inclusive)

Definition at line 130 of file Span.h.

int lsst::afw::geom::Span::_y
private

Row that Span's in.

Definition at line 128 of file Span.h.


The documentation for this class was generated from the following file: