PluginFunctionsPlane.cc

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   if  (_identifier == -1)
00055     return false;
00056 
00057   BaseObject* object = objectRoot()->childExists( _identifier );
00058   _object = dynamic_cast< PlaneObject* >(object);
00059   return ( _object != 0 );
00060 }
00061 
00062 
00063 // ===============================================================================
00064 // Getting data from objects and casting between them
00065 // ===============================================================================
00066 
00067 PlaneNode* planeNode( BaseObjectData* _object ) {
00068   if ( _object->dataType(DATA_PLANE) ) {
00069     PlaneObject* object = dynamic_cast< PlaneObject* >(_object);
00070     return object->planeNode();
00071   } else
00072     return NULL;
00073 }
00074 
00075 
00076 PlaneObject* planeObject( BaseObjectData* _object ) {
00077   if ( ! _object->dataType(DATA_PLANE) )
00078     return NULL;
00079   return dynamic_cast< PlaneObject* >( _object );
00080 }
00081 
00082 }

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .