itom 1.3.0
D:/git-itom/sources/itom/Qitom/python/pythonRegion.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef PYTHONREGION_H
00024 #define PYTHONREGION_H
00025 
00026 /* includes */
00027 #ifndef Q_MOC_RUN
00028     #define PY_ARRAY_UNIQUE_SYMBOL itom_ARRAY_API //see numpy help ::array api :: Miscellaneous :: Importing the api (this line must bebefore include global.h)
00029     #define NO_IMPORT_ARRAY
00030 
00031     //python
00032     // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
00033     #if (defined _DEBUG) && (!defined linux)
00034         #undef _DEBUG
00035         #include "Python.h" 
00036         #define _DEBUG
00037     #else
00038         #include "Python.h"   
00039     #endif
00040 #endif
00041 
00042 #include <qregion.h>
00043 
00044 namespace ito
00045 {
00046 
00047 class PythonRegion
00048 {
00049 public:
00050     typedef struct
00051     {
00052         PyObject_HEAD
00053         QRegion *r;
00054     }
00055     PyRegion;
00056 
00057     #define PyRegion_Check(op) PyObject_TypeCheck(op, &ito::PythonRegion::PyRegionType)
00058 
00059     //-------------------------------------------------------------------------------------------------
00060     // constructor, deconstructor, alloc, dellaoc
00061     //------------------------------------------------------------------------------------------------- 
00062     static void PyRegion_dealloc(PyRegion *self);
00063     static PyObject* PyRegion_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
00064     static int PyRegion_init(PyRegion *self, PyObject *args, PyObject *kwds);
00065 
00066     static PyObject* createPyRegion(const QRegion &region);
00067 
00068     //-------------------------------------------------------------------------------------------------
00069     // general members
00070     //------------------------------------------------------------------------------------------------- 
00071     static PyObject* PyRegion_repr(PyRegion *self);
00072 
00073     static PyObject* PyRegion_contains(PyRegion *self, PyObject *args, PyObject *kwds);
00074     static PyObject* PyRegion_intersected(PyRegion *self, PyObject *args, PyObject *kwds);
00075     static PyObject* PyRegion_intersects(PyRegion *self, PyObject *args, PyObject *kwds);
00076     static PyObject* PyRegion_subtracted(PyRegion *self, PyObject *args, PyObject *kwds);
00077     static PyObject* PyRegion_translate(PyRegion *self, PyObject *args, PyObject *kwds);
00078     static PyObject* PyRegion_translated(PyRegion *self, PyObject *args, PyObject *kwds);
00079     static PyObject* PyRegion_united(PyRegion *self, PyObject *args, PyObject *kwds);
00080     static PyObject* PyRegion_xored(PyRegion *self, PyObject *args, PyObject *kwds);
00081 
00082     static PyObject* PyRegion_createMask(PyRegion *self);
00083 
00084     //-------------------------------------------------------------------------------------------------
00085     // pickling
00086     //-------------------------------------------------------------------------------------------------
00087     static PyObject* PyRegion_Reduce(PyRegion *self, PyObject *args);
00088     static PyObject* PyRegion_SetState(PyRegion *self, PyObject *args);
00089 
00090     //-------------------------------------------------------------------------------------------------
00091     // number protocol
00092     //------------------------------------------------------------------------------------------------- 
00093     static PyObject* PyRegion_nbAdd(PyRegion* o1, PyRegion* o2);
00094     static PyObject* PyRegion_nbSubtract(PyRegion* o1, PyRegion* o2);
00095     static PyObject* PyRegion_nbAnd(PyRegion* o1, PyRegion* o2);
00096     static PyObject* PyRegion_nbXor(PyRegion* o1, PyRegion* o2);
00097     static PyObject* PyRegion_nbOr(PyRegion* o1, PyRegion* o2);
00098     static PyObject* PyRegion_nbInplaceAdd(PyRegion* o1, PyRegion* o2);
00099     static PyObject* PyRegion_nbInplaceSubtract(PyRegion* o1, PyRegion* o2);
00100     static PyObject* PyRegion_nbInplaceAnd(PyRegion* o1, PyRegion* o2);
00101     static PyObject* PyRegion_nbInplaceXor(PyRegion* o1, PyRegion* o2);
00102     static PyObject* PyRegion_nbInplaceOr(PyRegion* o1, PyRegion* o2);
00103 
00104     //-------------------------------------------------------------------------------------------------
00105     // getter / setter
00106     //------------------------------------------------------------------------------------------------- 
00107     static PyObject* PyRegion_getEmpty(PyRegion *self, void *closure);
00108     static PyObject* PyFigure_getRectCount(PyRegion *self, void *closure);
00109     static PyObject* PyFigure_getRects(PyRegion *self, void *closure);
00110     static PyObject* PyFigure_getBoundingRect(PyRegion *self, void *closure);
00111 
00112     //-------------------------------------------------------------------------------------------------
00113     // type structures
00114     //------------------------------------------------------------------------------------------------- 
00115     //static PyMemberDef PyRegion_members[];
00116     static PyMethodDef PyRegion_methods[];
00117     static PyGetSetDef PyRegion_getseters[];
00118     static PyTypeObject PyRegionType;
00119     static PyModuleDef PyRegionModule;
00120     static PyNumberMethods PyRegion_numberProtocol;
00121 
00122     static void PyRegion_addTpDict(PyObject *tp_dict);
00123 
00124     
00125 
00126 };
00127 
00128 }; //end namespace ito
00129 
00130 
00131 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends