lsst.sphgeom
gdcc65144bf+d801c9999e
Toggle main menu visibility
Loading...
Searching...
No Matches
interval.h
1
/*
2
* This file is part of sphgeom.
3
*
4
* Developed for the LSST Data Management System.
5
* This product includes software developed by the LSST Project
6
* (http://www.lsst.org).
7
* See the COPYRIGHT file at the top-level directory of this distribution
8
* for details of code ownership.
9
*
10
* This software is dual licensed under the GNU General Public License and also
11
* under a 3-clause BSD license. Recipients may choose which of these licenses
12
* to use; please see the files gpl-3.0.txt and/or bsd_license.txt,
13
* respectively. If you choose the GPL option then the following text applies
14
* (but note that there is still no warranty even if you opt for BSD instead):
15
*
16
* This program is free software: you can redistribute it and/or modify
17
* it under the terms of the GNU General Public License as published by
18
* the Free Software Foundation, either version 3 of the License, or
19
* (at your option) any later version.
20
*
21
* This program is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU General Public License for more details.
25
*
26
* You should have received a copy of the GNU General Public License
27
* along with this program. If not, see <http://www.gnu.org/licenses/>.
28
*/
29
30
#ifndef LSST_SPHGEOM_PYTHON_INTERVAL_H_
31
#define LSST_SPHGEOM_PYTHON_INTERVAL_H_
32
33
#include "pybind11/pybind11.h"
34
35
#include "relationship.h"
36
37
namespace
py = pybind11;
38
using namespace
pybind11::literals;
39
40
namespace
lsst {
41
namespace
sphgeom
{
42
namespace
python {
43
namespace
{
44
50
template
<
typename
PyClass,
typename
Class,
typename
Scalar>
51
void
defineInterval(PyClass& cls) {
52
cls.def(
"__eq__"
, [](Class
const
& self,
53
Class
const
& other) {
return
self == other; },
54
py::is_operator());
55
cls.def(
"__eq__"
,
56
[](Class
const
& self, Scalar other) {
return
self == other; },
57
py::is_operator());
58
cls.def(
"__ne__"
, [](Class
const
& self,
59
Class
const
& other) {
return
self != other; },
60
py::is_operator());
61
cls.def(
"__ne__"
,
62
[](Class
const
& self, Scalar other) {
return
self != other; },
63
py::is_operator());
64
65
cls.def(
"getA"
, [](Class
const
& self) {
return
self.getA(); });
66
cls.def(
"getB"
, [](Class
const
& self) {
return
self.getB(); });
67
cls.def(
"isEmpty"
, [](Class
const
& self) {
return
self.isEmpty(); });
68
cls.def(
"getCenter"
, [](Class
const
& self) {
return
self.getCenter(); });
69
cls.def(
"getSize"
, [](Class
const
& self) {
return
self.getSize(); });
70
71
cls.def(
"__contains__"
, [](Class
const
& self,
72
Scalar other) {
return
self.contains(other); },
73
py::is_operator());
74
cls.def(
"__contains__"
,
75
[](Class
const
& self, Class
const
& other) {
76
return
self.contains(other);
77
},
78
py::is_operator());
79
80
cls.def(
"contains"
, [](Class
const
& self, Scalar other) {
81
return
self.contains(other);
82
});
83
cls.def(
"contains"
, [](Class
const
& self, Class
const
& other) {
84
return
self.contains(other);
85
});
86
cls.def(
"isDisjointFrom"
, [](Class
const
& self, Scalar other) {
87
return
self.isDisjointFrom(other);
88
});
89
cls.def(
"isDisjointFrom"
, [](Class
const
& self, Class
const
& other) {
90
return
self.isDisjointFrom(other);
91
});
92
cls.def(
"intersects"
, [](Class
const
& self, Scalar other) {
93
return
self.intersects(other);
94
});
95
cls.def(
"intersects"
, [](Class
const
& self, Class
const
& other) {
96
return
self.intersects(other);
97
});
98
cls.def(
"isWithin"
, [](Class
const
& self, Scalar other) {
99
return
self.isWithin(other);
100
});
101
cls.def(
"isWithin"
, [](Class
const
& self, Class
const
& other) {
102
return
self.isWithin(other);
103
});
104
cls.def(
"relate"
, [](Class
const
& self, Scalar other) {
105
return
self.relate(other);
106
});
107
cls.def(
"relate"
, [](Class
const
& self, Class
const
& other) {
108
return
self.relate(other);
109
});
110
111
// Note that when a reference to *this is returned in C++, it will
112
// have an existing wrapper object which is automatically returned
113
// by pybind11 - no return value policy is needed. The explicit
114
// reference return type for the corresponding lambdas seems to be
115
// required to obtain this behavior.
116
117
cls.def(
"clipTo"
, [](Class& self, Scalar other) -> Class & {
118
self.clipTo(other);
119
return
self;
120
});
121
cls.def(
"clipTo"
, [](Class& self, Class
const
& other) -> Class & {
122
self.clipTo(other);
123
return
self;
124
});
125
cls.def(
"clippedTo"
, [](Class
const
& self, Scalar other) {
126
Class instance = self.clippedTo(other);
127
return
instance;
128
});
129
cls.def(
"clippedTo"
, [](Class
const
& self, Class
const
& other) {
130
Class instance = self.clippedTo(other);
131
return
instance;
132
});
133
cls.def(
"expandTo"
, [](Class& self, Scalar other) -> Class & {
134
self.expandTo(other);
135
return
self;
136
});
137
cls.def(
"expandTo"
, [](Class& self, Class
const
& other) -> Class & {
138
self.expandTo(other);
139
return
self;
140
});
141
cls.def(
"expandedTo"
, [](Class
const
& self, Scalar other) {
142
Class instance = self.expandedTo(other);
143
return
instance;
144
});
145
cls.def(
"expandedTo"
, [](Class
const
& self, Class
const
& other) {
146
Class instance = self.expandedTo(other);
147
return
instance;
148
});
149
150
cls.def(
"dilateBy"
, [](Class& self, Scalar other) -> Class & {
151
self.dilateBy(other);
152
return
self;
153
});
154
cls.def(
"dilatedBy"
, [](Class
const
& self, Scalar other) {
155
Class instance = self.dilatedBy(other);
156
return
instance;
157
});
158
cls.def(
"erodeBy"
, [](Class& self, Scalar other) -> Class & {
159
self.erodeBy(other);
160
return
self;
161
});
162
cls.def(
"erodedBy"
, [](Class
const
& self, Scalar other) {
163
Class instance = self.erodedBy(other);
164
return
instance;
165
});
166
167
cls.def(
"__reduce__"
, [cls](Class
const
&self) {
168
return
py::make_tuple(cls, py::make_tuple(self.getA(), self.getB()));
169
});
170
}
171
172
}
// unnamed
173
}
// python
174
}
// sphgeom
175
}
// lsst
176
177
#endif
// LSST_SPHGEOM_PYTHON_INTERVAL_H_
lsst::sphgeom
Definition
Angle.h:45
include
lsst
sphgeom
python
interval.h
Generated by
1.17.0