Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+83433b07ee,g16d25e1f1b+23bc9e47ac,g1ec0fe41b4+3ea9d11450,g1fd858c14a+9be2b0f3b9,g2440f9efcc+8c5ae1fdc5,g35bb328faa+8c5ae1fdc5,g4a4af6cd76+d25431c27e,g4d2262a081+c74e83464e,g53246c7159+8c5ae1fdc5,g55585698de+1e04e59700,g56a49b3a55+92a7603e7a,g60b5630c4e+1e04e59700,g67b6fd64d1+3fc8cb0b9e,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g8852436030+60e38ee5ff,g89139ef638+3fc8cb0b9e,g94187f82dc+1e04e59700,g989de1cb63+3fc8cb0b9e,g9d31334357+1e04e59700,g9f33ca652e+0a83e03614,gabe3b4be73+8856018cbb,gabf8522325+977d9fabaf,gb1101e3267+8b4b9c8ed7,gb89ab40317+3fc8cb0b9e,gc0af124501+57ccba3ad1,gcf25f946ba+60e38ee5ff,gd6cbbdb0b4+1cc2750d2e,gd794735e4e+7be992507c,gdb1c4ca869+be65c9c1d7,gde0f65d7ad+c7f52e58fe,ge278dab8ac+6b863515ed,ge410e46f29+3fc8cb0b9e,gf35d7ec915+97dd712d81,gf5e32f922b+8c5ae1fdc5,gf618743f1b+747388abfa,gf67bdafdda+3fc8cb0b9e,w.2025.18
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