Loading [MathJax]/extensions/tex2jax.js
LSST Applications 28.0.2,g0fba68d861+5b923b673a,g1fd858c14a+7a7b9dd5ed,g2c84ff76c0+5548bfee71,g30358e5240+f0e04ebe90,g35bb328faa+fcb1d3bbc8,g436fd98eb5+bdc6fcdd04,g4af146b050+742274f7cd,g4d2262a081+3efd3f8190,g4e0f332c67+cb09b8a5b6,g53246c7159+fcb1d3bbc8,g5a012ec0e7+477f9c599b,g5edb6fd927+826dfcb47f,g60b5630c4e+bdc6fcdd04,g67b6fd64d1+2218407a0c,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+f9ac2ab1bd,g8852436030+ebf28f0d95,g89139ef638+2218407a0c,g9125e01d80+fcb1d3bbc8,g989de1cb63+2218407a0c,g9f33ca652e+42fb53f4c8,g9f7030ddb1+11b9b6f027,ga2b97cdc51+bdc6fcdd04,gab72ac2889+bdc6fcdd04,gabe3b4be73+1e0a283bba,gabf8522325+3210f02652,gb1101e3267+9c79701da9,gb58c049af0+f03b321e39,gb89ab40317+2218407a0c,gcf25f946ba+ebf28f0d95,gd6cbbdb0b4+e8f9c9c900,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+a08f294619,ge278dab8ac+3ef3db156b,ge410e46f29+2218407a0c,gf67bdafdda+2218407a0c
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SpanPixelIterator.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2
3/*
4 * LSST Data Management System
5 * Copyright 2008, 2009, 2010 LSST Corporation.
6 *
7 * This product includes software developed by the
8 * LSST Project (http://www.lsst.org/).
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the LSST License Statement and
21 * the GNU General Public License along with this program. If not,
22 * see <http://www.lsstcorp.org/LegalNotices/>.
23 */
24
25#ifndef LSST_AFW_GEOM_SpanPixelIterator_h_INCLUDED
26#define LSST_AFW_GEOM_SpanPixelIterator_h_INCLUDED
27
28#include "boost/iterator/iterator_facade.hpp"
29
30#include "lsst/geom/Point.h"
31
32namespace lsst {
33namespace afw {
34namespace geom {
35
42class SpanPixelIterator : public boost::iterator_facade<SpanPixelIterator, lsst::geom::Point2I const,
43 boost::random_access_traversal_tag> {
44public:
45 explicit SpanPixelIterator(lsst::geom::Point2I const& p = lsst::geom::Point2I()) noexcept : _p(p) {}
46
47 SpanPixelIterator(SpanPixelIterator const&) noexcept = default;
48 SpanPixelIterator(SpanPixelIterator&&) noexcept = default;
49 SpanPixelIterator& operator=(SpanPixelIterator const&) noexcept = default;
50 SpanPixelIterator& operator=(SpanPixelIterator&&) noexcept = default;
51 ~SpanPixelIterator() noexcept = default;
52
53private:
55
56 lsst::geom::Point2I const& dereference() const { return _p; }
57
58 void increment() { ++_p.getX(); }
59
60 void decrement() { --_p.getX(); }
61
62 void advance(int n) { _p.getX() += n; }
63
64 bool equal(SpanPixelIterator const& other) const {
65 return _p.getX() == other._p.getX() && _p.getY() == other._p.getY();
66 }
67
68 int distance_to(SpanPixelIterator const& other) const {
69 assert(other._p.getY() == _p.getY());
70 return other._p.getX() - _p.getX();
71 }
72
74};
75} // namespace geom
76} // namespace afw
77} // namespace lsst
78
79#endif // !LSST_AFW_GEOM_SpanPixelIterator_h_INCLUDED
SpanPixelIterator(SpanPixelIterator &&) noexcept=default
SpanPixelIterator(lsst::geom::Point2I const &p=lsst::geom::Point2I()) noexcept
SpanPixelIterator(SpanPixelIterator const &) noexcept=default
Point< int, 2 > Point2I
Definition Point.h:321