H3D API  2.4.1
Anchor.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 __ANCHOR_H__
30 #define __ANCHOR_H__
31 
32 #include <H3D/X3DGroupingNode.h>
33 #include <H3D/X3DViewpointNode.h>
34 #include <H3D/MFString.h>
35 #include <H3D/PeriodicUpdate.h>
36 #include <H3D/Scene.h>
37 
38 namespace H3D {
39 
116  class H3DAPI_API Anchor : public X3DGroupingNode {
117  public:
118 
121  class H3DAPI_API GeometrySelected: public PeriodicUpdate < SFBool > {
122  protected:
123  // Check the url and call replaceScene if the url is correct.
124  virtual void update();
125 
126  };
127 #ifdef __BORLANDC__
128  friend class GeometrySelected;
129 #endif
130 
132  Anchor( Inst< AddChildren > _addChildren = 0,
133  Inst< RemoveChildren > _removeChildren = 0,
134  Inst< MFChild > _children = 0,
135  Inst< SFString > _description = 0,
136  Inst< SFNode > _metadata = 0,
137  Inst< SFBound > _bound = 0,
138  Inst< MFString > _parameter = 0,
139  Inst< MFString > _url = 0,
140  Inst< SFVec3f > _bboxCenter = 0,
141  Inst< SFVec3f > _bboxSize = 0 );
142 
143  ~Anchor();
144 
149  static void replaceScene( AutoRef< Node > new_world,
150  const X3DViewpointNode *new_vp,
151  const Anchor *the_anchor );
152 
158  static void replaceSceneRoot( Scene * the_scene );
159 
167  static bool isAnchorInScene( const X3DGroupingNode *group_node,
168  const Anchor *anchor_to_find );
169 
176  H3DUniquePtr< SFString > description;
177 
185  H3DUniquePtr< MFString > parameter;
186 
193  H3DUniquePtr< MFString > url;
194 
197  protected:
198  // Internal variables used to control when to replace the world
199  // ( or change viewpoint ).
200  H3DUniquePtr< GeometrySelected > on_click;
201  H3DUniquePtr< X3DPointingDeviceSensorNode > intern_pdsn;
202  static AutoRef< Anchor > old_anchor;
203  static string new_world_url;
204  static string new_world_vp;
205  static string new_world_base_url;
206  string internal_base_url;
207  };
208 }
209 
210 #endif
Contains the MFString field class.
Header file for PeriodicUpdate, template field modifier.
Header file for Scene.
Header file for X3DGroupingNode, X3D scene-graph node.
Header file for X3DViewpointNode, X3D scene-graph node.
Takes care of changing the scene when an object in the Anchor is selected (by clicking on it with the...
Definition: Anchor.h:121
The Anchor grouping node retrieves the content of a URL when the user activates (e....
Definition: Anchor.h:116
H3DUniquePtr< MFString > url
Contains path to file (or name of Viewpoint) used when clicking on a geometry in the children field.
Definition: Anchor.h:193
H3DUniquePtr< MFString > parameter
The parameter field may be used to supply any additional information to be interpreted by the browser...
Definition: Anchor.h:185
H3DUniquePtr< SFString > description
The description field in the Anchor node specifies a textual description of the Anchor node.
Definition: Anchor.h:176
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Anchor.h:196
The PeriodicUpdate is a template modifier that changes the way the field is updated.
Definition: PeriodicUpdate.h:74
The Scene node is topmost node that takes care of the rendering of the scene graph both haptically an...
Definition: Scene.h:56
This abstract node type indicates that concrete node types derived from it contain children nodes and...
Definition: X3DGroupingNode.h:53
The X3DViewpointNode node defines a specific location in the local coordinate system from which the u...
Definition: X3DViewpointNode.h:239
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