LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Public Types | Public Member Functions | List of all members
RelativeSpanIterator Class Reference

This is a convenience class used in symmetrizeFootprint, wrapping the idea of iterating through a SpanList either forward or backward, and looking at dx,dy coordinates relative to a center cx,cy coordinate. More...

Public Types

using SpanSet = afwGeom::SpanSet
 

Public Member Functions

 RelativeSpanIterator ()
 
 RelativeSpanIterator (SpanSet::const_iterator const &real, SpanSet const &arr, int cx, int cy, bool forward=true)
 
bool operator== (const SpanSet::const_iterator &other)
 
bool operator!= (const SpanSet::const_iterator &other)
 
bool operator<= (const SpanSet::const_iterator &other)
 
bool operator< (const SpanSet::const_iterator &other)
 
bool operator>= (const SpanSet::const_iterator &other)
 
bool operator> (const SpanSet::const_iterator &other)
 
bool operator== (RelativeSpanIterator &other)
 
bool operator!= (RelativeSpanIterator &other)
 
RelativeSpanIterator operator++ ()
 
RelativeSpanIterator operator++ (int dummy)
 
bool notDone ()
 
int dxlo ()
 
int dxhi ()
 
int dy ()
 
int x0 ()
 
int x1 ()
 
int y ()
 

Detailed Description

This is a convenience class used in symmetrizeFootprint, wrapping the idea of iterating through a SpanList either forward or backward, and looking at dx,dy coordinates relative to a center cx,cy coordinate.

This makes the symmetrizeFootprint code much tidier and more symmetric-looking; the operations on the forward and backward iterators are mostly the same.

Definition at line 817 of file BaselineUtils.cc.

Member Typedef Documentation

◆ SpanSet

Definition at line 819 of file BaselineUtils.cc.

Constructor & Destructor Documentation

◆ RelativeSpanIterator() [1/2]

RelativeSpanIterator::RelativeSpanIterator ( )
inline

Definition at line 821 of file BaselineUtils.cc.

821 {}

◆ RelativeSpanIterator() [2/2]

RelativeSpanIterator::RelativeSpanIterator ( SpanSet::const_iterator const &  real,
SpanSet const &  arr,
int  cx,
int  cy,
bool  forward = true 
)
inline

Definition at line 823 of file BaselineUtils.cc.

826  : _real(real), _cx(cx), _cy(cy), _forward(forward)
827  {
828  if (_forward) {
829  _end = arr.end();
830  } else {
831  _end = arr.begin();
832  }
833  }
T real(const T &x)
Definition: Integrate.h:199

Member Function Documentation

◆ dxhi()

int RelativeSpanIterator::dxhi ( )
inline

Definition at line 892 of file BaselineUtils.cc.

892  {
893  if (_forward) {
894  return _real->getX1() - _cx;
895  } else {
896  return _cx - _real->getX0();
897  }
898  }

◆ dxlo()

int RelativeSpanIterator::dxlo ( )
inline

Definition at line 885 of file BaselineUtils.cc.

885  {
886  if (_forward) {
887  return _real->getX0() - _cx;
888  } else {
889  return _cx - _real->getX1();
890  }
891  }

◆ dy()

int RelativeSpanIterator::dy ( )
inline

Definition at line 899 of file BaselineUtils.cc.

899  {
900  return std::abs(_real->getY() - _cy);
901  }
Angle abs(Angle const &a)
Definition: Angle.h:106

◆ notDone()

bool RelativeSpanIterator::notDone ( )
inline

Definition at line 877 of file BaselineUtils.cc.

877  {
878  if (_forward) {
879  return _real < _end;
880  } else {
881  return _real >= _end;
882  }
883  }

◆ operator!=() [1/2]

bool RelativeSpanIterator::operator!= ( const SpanSet::const_iterator other)
inline

Definition at line 838 of file BaselineUtils.cc.

838  {
839  return _real != other;
840  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator!=() [2/2]

bool RelativeSpanIterator::operator!= ( RelativeSpanIterator other)
inline

Definition at line 859 of file BaselineUtils.cc.

859  {
860  return !(*this == other);
861  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator++() [1/2]

RelativeSpanIterator RelativeSpanIterator::operator++ ( )
inline

Definition at line 863 of file BaselineUtils.cc.

863  {
864  if (_forward) {
865  _real++;
866  } else {
867  _real--;
868  }
869  return *this;
870  }

◆ operator++() [2/2]

RelativeSpanIterator RelativeSpanIterator::operator++ ( int  dummy)
inline

Definition at line 871 of file BaselineUtils.cc.

871  {
873  ++(*this);
874  return result;
875  }
py::object result
Definition: schema.cc:418
This is a convenience class used in symmetrizeFootprint, wrapping the idea of iterating through a Spa...

◆ operator<()

bool RelativeSpanIterator::operator< ( const SpanSet::const_iterator other)
inline

Definition at line 844 of file BaselineUtils.cc.

844  {
845  return _real < other;
846  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator<=()

bool RelativeSpanIterator::operator<= ( const SpanSet::const_iterator other)
inline

Definition at line 841 of file BaselineUtils.cc.

841  {
842  return _real <= other;
843  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator==() [1/2]

bool RelativeSpanIterator::operator== ( const SpanSet::const_iterator other)
inline

Definition at line 835 of file BaselineUtils.cc.

835  {
836  return _real == other;
837  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator==() [2/2]

bool RelativeSpanIterator::operator== ( RelativeSpanIterator other)
inline

Definition at line 854 of file BaselineUtils.cc.

854  {
855  return (_real == other._real) &&
856  (_cx == other._cx) && (_cy == other._cy) &&
857  (_forward == other._forward);
858  }

◆ operator>()

bool RelativeSpanIterator::operator> ( const SpanSet::const_iterator other)
inline

Definition at line 850 of file BaselineUtils.cc.

850  {
851  return _real > other;
852  }
ItemVariant const * other
Definition: Schema.cc:56

◆ operator>=()

bool RelativeSpanIterator::operator>= ( const SpanSet::const_iterator other)
inline

Definition at line 847 of file BaselineUtils.cc.

847  {
848  return _real >= other;
849  }
ItemVariant const * other
Definition: Schema.cc:56

◆ x0()

int RelativeSpanIterator::x0 ( )
inline

Definition at line 902 of file BaselineUtils.cc.

902  {
903  return _real->getX0();
904  }

◆ x1()

int RelativeSpanIterator::x1 ( )
inline

Definition at line 905 of file BaselineUtils.cc.

905  {
906  return _real->getX1();
907  }

◆ y()

int RelativeSpanIterator::y ( )
inline

Definition at line 908 of file BaselineUtils.cc.

908  {
909  return _real->getY();
910  }

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