Developer Documentation

BaseObjectData.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42
43 //=============================================================================
44 //
45 // Types
46 //
47 //=============================================================================
48
55 #pragma once
56
57
58 //== INCLUDES =================================================================
59
60 #include <OpenFlipper/common/GlobalDefines.hh>
61 #include <OpenFlipper/common/BaseObject.hh>
62 #include <vector>
63 #include <ACG/Scenegraph/PickTarget.hh>
64 #include <ACG/Scenegraph/DrawModes.hh>
65
66 //== FORWARD Declarations to avoid gl qt collisions =================================================================
67
68 namespace ACG {
69 namespace SceneGraph {
70
71 class MaterialNode;
72 class QtTranslationManipulatorNode;
73 class SeparatorNode;
74 class BaseNode;
75 class BoundingBoxNode;
76 class StencilRefNode;
77 class ShaderNode;
78
79 }
80 }
81
82
83 //== TYPEDEFS FOR SCENEGRAPH ===============================================
85 typedef ACG::SceneGraph::MaterialNode MaterialNode;
87 typedef ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode;
89 typedef ACG::SceneGraph::SeparatorNode SeparatorNode;
91 typedef ACG::SceneGraph::BaseNode BaseNode;
93 typedef ACG::SceneGraph::BoundingBoxNode BoundingBoxNode;
95 typedef ACG::SceneGraph::StencilRefNode StencilRefNode;
96
97 //== CLASS DEFINITION =========================================================
98
102 class DLLEXPORT BaseObjectData : public BaseObject
103 {
104
105 friend class Core;
106
107 Q_OBJECT
108
109 public:
110
115 BaseObjectData(const BaseObjectData& _object);
116
118 BaseObjectData();
119
121 virtual ~BaseObjectData();
122
123 private:
125 void initializeScenegraphNodes();
126
129 //===========================================================================
132 //===========================================================================
133
134 public:
138 virtual void cleanup();
139
140
143 virtual void setName(QString _name );
144
145 //===========================================================================
148 //===========================================================================
149
150 public :
152 virtual void show();
153
155 virtual void hide();
156
158 virtual bool visible();
159
161 virtual void visible(bool _visible);
162
166 SeparatorNode* baseNode();
167
173 virtual bool hasNode(BaseNode* _node);
174
177 virtual BaseNode* primaryNode();
178
182 QtTranslationManipulatorNode* manipulatorNode();
183
189 virtual ACG::SceneGraph::ShaderNode* shaderNode();
190
192 MaterialNode* materialNode();
193
195 const MaterialNode* materialNode() const;
196
198 BoundingBoxNode* boundingBoxNode();
199
201 StencilRefNode* stencilRefNode();
202
204 bool manipPlaced();
205
207 void manipPlaced( bool _placed );
208
210 void getBoundingBox(ACG::Vec3d& bbmin, ACG::Vec3d& bbmax);
211
216 void setObjectDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode, const bool& _force = false);
217
218 private :
219
220
221 bool manipPlaced_;
222
224 SeparatorNode* rootNode_;
225
227 SeparatorNode* separatorNode_;
228
230 QtTranslationManipulatorNode* manipulatorNode_;
231
233 MaterialNode* materialNode_;
234
236 BoundingBoxNode * boundingBoxNode_;
237
239 StencilRefNode* stencilRefNode_;
240
244 //===========================================================================
247 //===========================================================================
248
249 public :
251 virtual bool picked( uint _node_idx );
252
257 virtual void enablePicking( bool _enable );
258
263 virtual bool pickingEnabled();
264
279 virtual ACG::Vec3d refinePick(ACG::SceneGraph::PickTarget _pickTarget,
280 const ACG::Vec3d _hitPoint,
281 const ACG::Vec3d _start ,
282 const ACG::Vec3d _dir,
283 const unsigned int _targetIdx );
284
287 //===========================================================================
290 //===========================================================================
291
292 protected:
301 virtual void update(UpdateType _type = UPDATE_ALL );
302
305 //===========================================================================
313 //===========================================================================
314 public:
329 template< typename NodeT >
330 bool addAdditionalNode(NodeT* _node , QString _pluginName, QString _nodeName , int _id = 0);
331
342 bool hasAdditionalNode(QString _pluginName, QString _nodeName , int _id = 0);
343
354 template< typename NodeT >
355 bool getAdditionalNode(NodeT*& _node , QString _pluginName, QString _nodeName , int _id = 0 );
356
369 template< typename NodeT >
370 bool removeAdditionalNode(NodeT*& _node, QString _pluginName, QString _nodeName , int _id = 0 );
371 private:
375 std::vector< std::pair <BaseNode*,QString> > additionalNodes_;
376
379 };
380
381
382 //=============================================================================
383
384 #if defined(INCLUDE_TEMPLATES) && !defined(BASEOBJECTDATA_C)
385 #define BASEOBJECT_TEMPLATES
386 #include "BaseObjectDataT_impl.hh"
387 #endif
388
ACG
Namespace providing different geometric functions concerning angles.
Definition: BaseObjectData.hh:68
UpdateType
Update type class.
Definition: UpdateType.hh:60
BaseObjectData::manipPlaced_
bool manipPlaced_
rootNode of global Scenegraph structure
Definition: BaseObjectData.hh:221
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
MaterialNode
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Definition: BaseObjectData.hh:85
GlobalDefines.hh
BaseNode
ACG::SceneGraph::BaseNode BaseNode
Base Node.
Definition: BaseObjectData.hh:91
QtTranslationManipulatorNode
ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode
ManipulatorNode.
Definition: BaseObjectData.hh:87
BoundingBoxNode
ACG::SceneGraph::BoundingBoxNode BoundingBoxNode
Bounding box Node.
Definition: BaseObjectData.hh:93
BaseObjectData::separatorNode_
SeparatorNode * separatorNode_
Separator at top of Scenegraph structure used for this Object.
Definition: BaseObjectData.hh:227
Core
Definition: Core.hh:132
BaseObjectData::boundingBoxNode_
BoundingBoxNode * boundingBoxNode_
Bounding box node for the object.
Definition: BaseObjectData.hh:236
BaseObject.hh
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:338
BaseObjectData::rootNode_
SeparatorNode * rootNode_
rootNode of global Scenegraph structure
Definition: BaseObjectData.hh:224
BaseObjectData::stencilRefNode_
StencilRefNode * stencilRefNode_
Stencil reference node for the object.
Definition: BaseObjectData.hh:239
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:288
ACG::SceneGraph::QtTranslationManipulatorNode
Definition: QtTranslationManipulatorNode.hh:81
ACG::SceneGraph::ShaderNode
Definition: ShaderNode.hh:81
BaseObjectData::manipulatorNode_
QtTranslationManipulatorNode * manipulatorNode_
Manipulator used for this Object.
Definition: BaseObjectData.hh:230
SceneGraph
Definition: QtPrincipalAxisDialog.hh:67
ACG::SceneGraph::PickTarget
PickTarget
What target to use for picking.
Definition: PickTarget.hh:73
ACG::SceneGraph::BaseNode
Definition: BaseNode.hh:104
BaseObject
Definition: BaseObject.hh:82
ACG::SceneGraph::StencilRefNode
Definition: StencilRefNode.hh:74
OpenMesh::VectorT
Definition: Vector11T.hh:83
BaseObjectData::materialNode_
MaterialNode * materialNode_
Scenegraph Material Node for the object.
Definition: BaseObjectData.hh:233
StencilRefNode
ACG::SceneGraph::StencilRefNode StencilRefNode
Stencil reference Node.
Definition: BaseObjectData.hh:95
SeparatorNode
ACG::SceneGraph::SeparatorNode SeparatorNode
Seperator Node.
Definition: BaseObjectData.hh:89
ACG::SceneGraph::BoundingBoxNode
Definition: BoundingBoxNode.hh:79
BaseObjectData
Definition: BaseObjectData.hh:102
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:95
ACG::SceneGraph::SeparatorNode
Definition: SeparatorNode.hh:78
BaseObjectData::additionalNodes_
std::vector< std::pair< BaseNode *, QString > > additionalNodes_
Definition: BaseObjectData.hh:375