ComplexGeoDataPyImp.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) Jürgen Riegel          (juergen.riegel@web.de) 2007     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00026 #include "ComplexGeoData.h"
00027 
00028 // inclusion of the generated files (generated out of ComplexGeoDataPy.xml)
00029 #include "ComplexGeoDataPy.h"
00030 #include "ComplexGeoDataPy.cpp"
00031 #include <Base/BoundBoxPy.h>
00032 #include <Base/MatrixPy.h>
00033 #include <Base/PlacementPy.h>
00034 #include <Base/GeometryPyCXX.h>
00035 
00036 using namespace Data;
00037 using namespace Base;
00038 
00039 // returns a string which represent the object e.g. when printed in python
00040 std::string ComplexGeoDataPy::representation(void) const
00041 {
00042     return std::string("<ComplexGeoData object>");
00043 }
00044 
00045 Py::Object ComplexGeoDataPy::getBoundBox(void) const
00046 {
00047     return Py::BoundingBox(getComplexGeoDataPtr()->getBoundBox());
00048 }
00049 
00050 Py::Object ComplexGeoDataPy::getPlacement(void) const
00051 {
00052     return Py::Placement(getComplexGeoDataPtr()->getPlacement());
00053 }
00054 
00055 void  ComplexGeoDataPy::setPlacement(Py::Object arg)
00056 {
00057     PyObject* p = arg.ptr();
00058     if (PyObject_TypeCheck(p, &(Base::PlacementPy::Type))) {
00059         Base::Placement* trf = static_cast<Base::PlacementPy*>(p)->getPlacementPtr();
00060         getComplexGeoDataPtr()->setPlacement(*trf);
00061     }
00062     else {
00063         std::string error = std::string("type must be 'Placement', not ");
00064         error += p->ob_type->tp_name;
00065         throw Py::TypeError(error);
00066     }
00067 }
00068 
00069 Py::Object ComplexGeoDataPy::getMatrix(void) const
00070 {
00071     return Py::Matrix(getComplexGeoDataPtr()->getTransform());
00072 }
00073 
00074 void  ComplexGeoDataPy::setMatrix(Py::Object arg)
00075 {
00076     PyObject* p = arg.ptr();
00077     if (PyObject_TypeCheck(p, &(Base::MatrixPy::Type))) {
00078         Base::Matrix4D mat = static_cast<Base::MatrixPy*>(p)->value();
00079         getComplexGeoDataPtr()->setTransform(mat);
00080     }
00081     else {
00082         std::string error = std::string("type must be 'Matrix', not ");
00083         error += p->ob_type->tp_name;
00084         throw Py::TypeError(error);
00085     }
00086 }
00087 
00088 PyObject *ComplexGeoDataPy::getCustomAttributes(const char* /*attr*/) const
00089 {
00090     return 0;
00091 }
00092 
00093 int ComplexGeoDataPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
00094 {
00095     return 0; 
00096 }

Generated on Wed Nov 23 19:00:03 2011 for FreeCAD by  doxygen 1.6.1