LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
23 #include "pybind11/pybind11.h"
24 #include "pybind11/stl.h"
36 using PySpan = py::class_<Span, std::shared_ptr<Span>>;
44 SpanIterator(
const Span &s) : _it{s.begin()}, _end{s.end()} {};
47 throw py::stop_iteration();
57 static void declareSpanIterator(
py::module &mod) {
58 py::class_<SpanIterator>
cls(mod,
"SpanIterator");
59 cls.def(
"__iter__", [](SpanIterator &it) -> SpanIterator & {
return it; });
64 py::module::import(
"lsst.geom");
66 declareSpanIterator(mod);
68 PySpan
cls(mod,
"Span");
69 cls.def(py::init<int, int, int>());
70 cls.def(py::init<>());
71 cls.def(
"__eq__", &Span::operator==, py::is_operator());
72 cls.def(
"__ne__", &Span::operator!=, py::is_operator());
73 cls.def(
"__lt__", &Span::operator<, py::is_operator());
79 cls.def(
"__iter__", [](
const Span &s) {
return SpanIterator(s); });
SpanPixelIterator Iterator
An iterator over points in the Span.
int getX1() const noexcept
Return the ending x-value.
PYBIND11_MODULE(spanSet, mod)
int getWidth() const noexcept
Return the number of pixels.
std::string toString() const
Return a string-representation of a Span.
int getY() const noexcept
Return the y-value.
int getEndX() const noexcept
End (exclusive) x-value.
bool contains(int x) const noexcept
bool isEmpty() const noexcept
Return true if the span contains no pixels.
int getMinX() const noexcept
Minimum x-value.
lsst::geom::Point2I const getMax() const noexcept
Point corresponding to maximum x.
int getMaxX() const noexcept
Maximum x-value.
A base class for image defects.
int getX0() const noexcept
Return the starting x-value.
int getBeginX() const noexcept
Begin (inclusive) x-value.
void shift(int dx, int dy) noexcept
lsst::geom::Point2I const getMin() const noexcept
Point corresponding to minimum x.