Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PluginFunctionsSkyDome.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
5 * www.openflipper.org *
6 * *
7 *--------------------------------------------------------------------------- *
8 * This file is part of OpenFlipper. *
9 * *
10 * OpenFlipper is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenFlipper is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenFlipper. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36 * *
37 * $Revision: 15085 $ *
38 * $LastChangedBy: moebius $ *
39 * $Date: 2012-07-25 08:57:39 +0200 (Mi, 25 Jul 2012) $ *
40 * *
41 \*===========================================================================*/
42 
43 
44 
45 
46 //=============================================================================
47 //
48 // Plugin Functions for SkyDomes
49 //
50 //=============================================================================
51 
53 #include "SkyDomeObject.hh"
54 
57 #include "SkyDome.hh"
58 
59 namespace PluginFunctions {
60 
61 // ===============================================================================
62 // Get objects
63 // ===============================================================================
64 
65 bool getObject( int _identifier , SkyDomeObject*& _object ) {
66 
67  if ( _identifier == -1 ) {
68  _object = 0;
69  return false;
70  }
71 
72  // Get object by using the map accelerated plugin function
73  BaseObjectData* object = 0;
74  PluginFunctions::getObject(_identifier,object);
75 
76  _object = dynamic_cast< SkyDomeObject* >(object);
77  return ( _object != 0 );
78 }
79 
80 SkyDomeObject* skyDomeObject( int _objectId ) {
81 
82  if ( _objectId == -1 ) {
83  return 0;
84  }
85 
86  // Get object by using the map accelerated plugin function
87  BaseObjectData* object = 0;
88  PluginFunctions::getObject(_objectId,object);
89 
90  SkyDomeObject* skyDomeObject = dynamic_cast< SkyDomeObject* >(object);
91  return skyDomeObject;
92 
93 }
94 
95 
96 // ===============================================================================
97 // Getting data from objects and casting between them
98 // ===============================================================================
99 
101 
102  if ( _object->dataType(DATA_SKYDOME) ) {
103  SkyDomeObject* object = dynamic_cast< SkyDomeObject* >(_object);
104  return object->skyDomeNode();
105  } else
106  return 0;
107 }
108 
109 
111  if ( ! _object->dataType(DATA_SKYDOME) )
112  return 0;
113  return dynamic_cast< SkyDomeObject* >( _object );
114 }
115 
116 }
SkyDomeNode * skyDomeNode(BaseObjectData *_object)
Get a SkyDomeNode from an object.
bool dataType(DataType _type) const
Definition: BaseObject.cc:232
bool getObject(int _identifier, BSplineCurveObject *&_object)
SkyDomeObject * skyDomeObject(int _objectId)
Get a SkyDomeObject from id if possible.
SkyDomeNode * skyDomeNode()
Get the scenegraph Node.
#define DATA_SKYDOME
Definition: SkyDome.hh:56