itom
Loading...
Searching...
No Matches
pythonRegion.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22
23#ifndef PYTHONREGION_H
24#define PYTHONREGION_H
25
26/* includes */
27#ifndef Q_MOC_RUN
28 #define PY_ARRAY_UNIQUE_SYMBOL itom_ARRAY_API //see numpy help ::array api :: Miscellaneous :: Importing the api (this line must before include global.h)
29 #define NO_IMPORT_ARRAY
30
31 #include "python/pythonWrapper.h"
32#endif
33
34#include <qregion.h>
35
36namespace ito
37{
38
40{
41public:
42 typedef struct
43 {
44 PyObject_HEAD
45 QRegion *r;
46 }
48
49 #define PyRegion_Check(op) PyObject_TypeCheck(op, &ito::PythonRegion::PyRegionType)
50
51 //-------------------------------------------------------------------------------------------------
52 // constructor, deconstructor, alloc, dellaoc
53 //-------------------------------------------------------------------------------------------------
54 static void PyRegion_dealloc(PyRegion *self);
55 static PyObject* PyRegion_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
56 static int PyRegion_init(PyRegion *self, PyObject *args, PyObject *kwds);
57
58 static PyObject* createPyRegion(const QRegion &region);
59
60 //-------------------------------------------------------------------------------------------------
61 // general members
62 //-------------------------------------------------------------------------------------------------
63 static PyObject* PyRegion_repr(PyRegion *self);
64
65 static PyObject* PyRegion_contains(PyRegion *self, PyObject *args, PyObject *kwds);
66 static PyObject* PyRegion_intersected(PyRegion *self, PyObject *args, PyObject *kwds);
67 static PyObject* PyRegion_intersects(PyRegion *self, PyObject *args, PyObject *kwds);
68 static PyObject* PyRegion_subtracted(PyRegion *self, PyObject *args, PyObject *kwds);
69 static PyObject* PyRegion_translate(PyRegion *self, PyObject *args, PyObject *kwds);
70 static PyObject* PyRegion_translated(PyRegion *self, PyObject *args, PyObject *kwds);
71 static PyObject* PyRegion_united(PyRegion *self, PyObject *args, PyObject *kwds);
72 static PyObject* PyRegion_xored(PyRegion *self, PyObject *args, PyObject *kwds);
73
74 static PyObject* PyRegion_createMask(PyRegion *self, PyObject *args, PyObject *kwds);
75
76 //-------------------------------------------------------------------------------------------------
77 // pickling
78 //-------------------------------------------------------------------------------------------------
79 static PyObject* PyRegion_Reduce(PyRegion *self, PyObject *args);
80 static PyObject* PyRegion_SetState(PyRegion *self, PyObject *args);
81
82 //-------------------------------------------------------------------------------------------------
83 // number protocol
84 //-------------------------------------------------------------------------------------------------
85 static PyObject* PyRegion_nbAdd(PyRegion* o1, PyRegion* o2);
86 static PyObject* PyRegion_nbSubtract(PyRegion* o1, PyRegion* o2);
87 static PyObject* PyRegion_nbAnd(PyRegion* o1, PyRegion* o2);
88 static PyObject* PyRegion_nbXor(PyRegion* o1, PyRegion* o2);
89 static PyObject* PyRegion_nbOr(PyRegion* o1, PyRegion* o2);
90 static PyObject* PyRegion_nbInplaceAdd(PyRegion* o1, PyRegion* o2);
91 static PyObject* PyRegion_nbInplaceSubtract(PyRegion* o1, PyRegion* o2);
92 static PyObject* PyRegion_nbInplaceAnd(PyRegion* o1, PyRegion* o2);
93 static PyObject* PyRegion_nbInplaceXor(PyRegion* o1, PyRegion* o2);
94 static PyObject* PyRegion_nbInplaceOr(PyRegion* o1, PyRegion* o2);
95
96 //-------------------------------------------------------------------------------------------------
97 // getter / setter
98 //-------------------------------------------------------------------------------------------------
99 static PyObject* PyRegion_getEmpty(PyRegion *self, void *closure);
100 static PyObject* PyRegion_getRectCount(PyRegion *self, void *closure);
101 static PyObject* PyRegion_getRects(PyRegion *self, void *closure);
102 static PyObject* PyRegion_getBoundingRect(PyRegion *self, void *closure);
103
104 //-------------------------------------------------------------------------------------------------
105 // type structures
106 //-------------------------------------------------------------------------------------------------
107 //static PyMemberDef PyRegion_members[];
108 static PyMethodDef PyRegion_methods[];
109 static PyGetSetDef PyRegion_getseters[];
110 static PyTypeObject PyRegionType;
111 static PyModuleDef PyRegionModule;
112 static PyNumberMethods PyRegion_numberProtocol;
113
114 static void PyRegion_addTpDict(PyObject *tp_dict);
115
116
117
118};
119
120}; //end namespace ito
121
122
123#endif
Definition pythonRegion.h:40
Definition apiFunctionsGraph.cpp:40
Definition pythonRegion.h:43