itom 1.0.14
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 für Technische Optik (ITO),
00005     Universität 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 //python
00031 // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
00032 #ifdef _DEBUG
00033     #undef _DEBUG
00034     #include "Python.h" 
00035     #define _DEBUG
00036 #else
00037     #include "Python.h"   
00038 #endif
00039 #endif
00040 
00041 #include <qregion.h>
00042 
00043 namespace ito
00044 {
00045 
00046 class PythonRegion
00047 {
00048 public:
00049     typedef struct
00050     {
00051         PyObject_HEAD
00052         QRegion *r;
00053     }
00054     PyRegion;
00055 
00056     #define PyRegion_Check(op) PyObject_TypeCheck(op, &ito::PythonRegion::PyRegionType)
00057 
00058     //-------------------------------------------------------------------------------------------------
00059     // constructor, deconstructor, alloc, dellaoc
00060     //------------------------------------------------------------------------------------------------- 
00061     static void PyRegion_dealloc(PyRegion *self);
00062     static PyObject* PyRegion_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
00063     static int PyRegion_init(PyRegion *self, PyObject *args, PyObject *kwds);
00064 
00065     static PyObject* createPyRegion(const QRegion &region);
00066 
00067     //-------------------------------------------------------------------------------------------------
00068     // general members
00069     //------------------------------------------------------------------------------------------------- 
00070     static PyObject* PyRegion_repr(PyRegion *self);
00071 
00072     static PyObject* PyRegion_contains(PyRegion *self, PyObject *args, PyObject *kwds);
00073     static PyObject* PyRegion_intersected(PyRegion *self, PyObject *args, PyObject *kwds);
00074     static PyObject* PyRegion_intersects(PyRegion *self, PyObject *args, PyObject *kwds);
00075     static PyObject* PyRegion_subtracted(PyRegion *self, PyObject *args, PyObject *kwds);
00076     static PyObject* PyRegion_translate(PyRegion *self, PyObject *args, PyObject *kwds);
00077     static PyObject* PyRegion_translated(PyRegion *self, PyObject *args, PyObject *kwds);
00078     static PyObject* PyRegion_united(PyRegion *self, PyObject *args, PyObject *kwds);
00079     static PyObject* PyRegion_xored(PyRegion *self, PyObject *args, PyObject *kwds);
00080 
00081     static PyObject* PyRegion_createMask(PyRegion *self);
00082 
00083     //-------------------------------------------------------------------------------------------------
00084     // pickling
00085     //-------------------------------------------------------------------------------------------------
00086     static PyObject* PyRegion_Reduce(PyRegion *self, PyObject *args);
00087     static PyObject* PyRegion_SetState(PyRegion *self, PyObject *args);
00088 
00089     //-------------------------------------------------------------------------------------------------
00090     // number protocol
00091     //------------------------------------------------------------------------------------------------- 
00092     static PyObject* PyRegion_nbAdd(PyRegion* o1, PyRegion* o2);
00093     static PyObject* PyRegion_nbSubtract(PyRegion* o1, PyRegion* o2);
00094     static PyObject* PyRegion_nbAnd(PyRegion* o1, PyRegion* o2);
00095     static PyObject* PyRegion_nbXor(PyRegion* o1, PyRegion* o2);
00096     static PyObject* PyRegion_nbOr(PyRegion* o1, PyRegion* o2);
00097     static PyObject* PyRegion_nbInplaceAdd(PyRegion* o1, PyRegion* o2);
00098     static PyObject* PyRegion_nbInplaceSubtract(PyRegion* o1, PyRegion* o2);
00099     static PyObject* PyRegion_nbInplaceAnd(PyRegion* o1, PyRegion* o2);
00100     static PyObject* PyRegion_nbInplaceXor(PyRegion* o1, PyRegion* o2);
00101     static PyObject* PyRegion_nbInplaceOr(PyRegion* o1, PyRegion* o2);
00102 
00103     //-------------------------------------------------------------------------------------------------
00104     // getter / setter
00105     //------------------------------------------------------------------------------------------------- 
00106     static PyObject* PyRegion_getEmpty(PyRegion *self, void *closure);
00107     static PyObject* PyFigure_getRectCount(PyRegion *self, void *closure);
00108     static PyObject* PyFigure_getRects(PyRegion *self, void *closure);
00109     static PyObject* PyFigure_getBoundingRect(PyRegion *self, void *closure);
00110 
00111     //-------------------------------------------------------------------------------------------------
00112     // type structures
00113     //------------------------------------------------------------------------------------------------- 
00114     //static PyMemberDef PyRegion_members[];
00115     static PyMethodDef PyRegion_methods[];
00116     static PyGetSetDef PyRegion_getseters[];
00117     static PyTypeObject PyRegionType;
00118     static PyModuleDef PyRegionModule;
00119     static PyNumberMethods PyRegion_numberProtocol;
00120 
00121     static void PyRegion_addTpDict(PyObject *tp_dict);
00122 
00123     
00124 
00125 };
00126 
00127 }; //end namespace ito
00128 
00129 
00130 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends