00001 //============================================================================= 00002 // 00003 // OpenFlipper 00004 // Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen 00005 // www.openflipper.org 00006 // 00007 //----------------------------------------------------------------------------- 00008 // 00009 // License 00010 // 00011 // OpenFlipper is free software: you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as published by 00013 // the Free Software Foundation, either version 3 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // OpenFlipper is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public License 00022 // along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>. 00023 // 00024 //----------------------------------------------------------------------------- 00025 // 00026 // $Revision: 1720 $ 00027 // $Author: moebius $ 00028 // $Date: 2008-05-09 14:15:53 +0200 (Fri, 09 May 2008) $ 00029 // 00030 //============================================================================= 00031 00032 00033 00034 00035 //============================================================================= 00036 // 00037 // Plugin Functions for Planes 00038 // 00039 //============================================================================= 00040 00041 #include <OpenFlipper/common/Types.hh> 00042 #include "Plane.hh" 00043 00044 #include "PluginFunctionsPlane.hh" 00045 #include <OpenFlipper/BasePlugin/PluginFunctions.hh> 00046 00047 namespace PluginFunctions { 00048 00049 // =============================================================================== 00050 // Get objects 00051 // =============================================================================== 00052 00053 bool getObject( int _identifier , PlaneObject*& _object ) { 00054 00055 if ( _identifier == -1 ) { 00056 _object = 0; 00057 return false; 00058 } 00059 00060 BaseObject* object = objectRoot()->childExists( _identifier ); 00061 _object = dynamic_cast< PlaneObject* >(object); 00062 return ( _object != 0 ); 00063 } 00064 00065 00066 // =============================================================================== 00067 // Getting data from objects and casting between them 00068 // =============================================================================== 00069 00070 PlaneNode* planeNode( BaseObjectData* _object ) { 00071 00072 if ( _object->dataType(DATA_PLANE) ) { 00073 PlaneObject* object = dynamic_cast< PlaneObject* >(_object); 00074 return object->planeNode(); 00075 } else 00076 return 0; 00077 } 00078 00079 00080 PlaneObject* planeObject( BaseObjectData* _object ) { 00081 if ( ! _object->dataType(DATA_PLANE) ) 00082 return 0; 00083 return dynamic_cast< PlaneObject* >( _object ); 00084 } 00085 00086 }