H3D API  2.4.1
ViewpointGroup.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __VIEWPOINTGROUP_H__
30 #define __VIEWPOINTGROUP_H__
31 
32 #include <H3D/X3DViewpointNode.h>
33 #include <H3D/MFNode.h>
34 
35 namespace H3D {
64  class H3DAPI_API ViewpointGroup : public X3DChildNode {
65  public:
66 
68  class H3DAPI_API MFChild: public MFNode {
69  virtual void onAdd( Node * n );
70  };
71 
73  ViewpointGroup( Inst< SFVec3f > _center = 0,
74  Inst< MFChild > _children = 0,
75  Inst< SFString > _description = 0,
76  Inst< SFBool > _displayed = 0,
77  Inst< SFNode > _metadata = 0,
78  Inst< SFBool > _retainUserOffsets = 0,
79  Inst< SFVec3f > _size = 0 );
80 
81  virtual ~ViewpointGroup() {
82  viewpoint_groups.remove( this );
83  viewpoint_groups_changed = true;
84  }
85 
86  virtual bool windowFromfieldOfView( H3DFloat /*width*/, H3DFloat /*height*/,
87  H3DFloat /*clip_near*/,
88  H3DFloat &/*top*/, H3DFloat &/*bottom*/,
89  H3DFloat &/*right*/, H3DFloat &/*left*/ ) {
90  return false;
91  }
92 
97  virtual void traverseSG( TraverseInfo &ti );
98 
101  bool containsViewpoint( X3DViewpointNode *vp ) const;
102 
103  list< Node * > getChildrenAsList();
104 
106  inline bool isTopLevel() {
107  return is_top_level;
108  }
109 
111  inline bool inSceneGraph() {
112  return in_scene_graph;
113  }
114 
115  typedef list< ViewpointGroup * > ViewpointGroupList;
116 
118  static const ViewpointGroupList &getAllViewpointGroups() {
119  return viewpoint_groups;
120  }
121 
124  static bool viewpointGroupsChanged() {
125  bool status = viewpoint_groups_changed;
126  viewpoint_groups_changed = false;
127  return status;
128  }
129 
135  H3DUniquePtr< SFVec3f > center;
136 
141  H3DUniquePtr< MFChild > children;
142 
148  H3DUniquePtr< SFString > description;
149 
155  H3DUniquePtr< SFBool > displayed;
156 
162  H3DUniquePtr< SFBool > retainUserOffsets;
163 
171  H3DUniquePtr< SFVec3f > size;
172 
176 
177  static H3DNodeDatabase database;
178 
179  protected:
180  //static NodeVector groups;
181  static ViewpointGroupList viewpoint_groups;
182 
183  //on any change of is_top_level or in_scene_graph of any node in viewpoint_groups
184  static bool viewpoint_groups_changed;
185 
186  Vec3f last_position;
187 
190 
193  };
194 }
195 
196 #endif
Contains the MFNode class.
Header file for X3DViewpointNode, X3D scene-graph node.
MFNode is almost like any MField but it encapsulates a vector of Node pointers.
Definition: MFNode.h:44
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
Type class of children field.
Definition: ViewpointGroup.h:68
ViewpointGroup is used to control display of viewpoints on the viewpoint list.
Definition: ViewpointGroup.h:64
H3DUniquePtr< SFVec3f > size
The size field provides the size of a proximity box within which the ViewpointGroup is usable and dis...
Definition: ViewpointGroup.h:171
bool display_in_list
Flag to show whether this ViewpointGroup should be displayed in browser list of viewpoints.
Definition: ViewpointGroup.h:175
H3DUniquePtr< SFVec3f > center
The center field provides a position offset from origin of local coordinate system.
Definition: ViewpointGroup.h:135
bool inSceneGraph()
Returns true if this node exists in the scene graph.
Definition: ViewpointGroup.h:111
bool in_scene_graph
True if this ViewpointGroup exists in scene graph.
Definition: ViewpointGroup.h:192
bool is_top_level
True if this ViewpointGroup exists outside of a another ViewpointGroup.
Definition: ViewpointGroup.h:189
static bool viewpointGroupsChanged()
True on any addition/deletion/in_scene_graph status change of viewpoint group, reset once inquired.
Definition: ViewpointGroup.h:124
static const ViewpointGroupList & getAllViewpointGroups()
Returns a list of all current ViewpointGroup instances.
Definition: ViewpointGroup.h:118
bool isTopLevel()
Returns true if this node exists outside of another ViewpointGroup.
Definition: ViewpointGroup.h:106
H3DUniquePtr< SFBool > retainUserOffsets
The retainUserOffsets field specifies whether the user is returned to the originally defined viewpoin...
Definition: ViewpointGroup.h:162
H3DUniquePtr< SFString > description
The description field provides a simple description or navigation hint to be displayed for this Viewp...
Definition: ViewpointGroup.h:148
H3DUniquePtr< MFChild > children
The children field is a sequence of nodes of type X3DViewpointNode.
Definition: ViewpointGroup.h:141
H3DUniquePtr< SFBool > displayed
The displayed field determines whether this ViewpointGroup is displayed in the current viewpoint list...
Definition: ViewpointGroup.h:155
This abstract node type indicates that the concrete nodes which are instantiated based on it may be u...
Definition: X3DChildNode.h:42
float H3DFloat
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194