H3D API
2.4.1
|
The Anchor grouping node retrieves the content of a URL when the user activates (e.g., clicks) some geometry contained within the Anchor node's children. More...
#include <H3D/Anchor.h>
Classes | |
class | GeometrySelected |
Takes care of changing the scene when an object in the Anchor is selected (by clicking on it with the mouse). More... | |
Public Member Functions | |
Anchor (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFString > _description=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< MFString > _parameter=0, Inst< MFString > _url=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0) | |
Constructor. | |
![]() | |
X3DGroupingNode (Inst< AddChildren > _addChildren=0, Inst< RemoveChildren > _removeChildren=0, Inst< MFChild > _children=0, Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0) | |
Constructor. | |
virtual | ~X3DGroupingNode () |
Destructor. | |
virtual void | initialize () |
Sets up the bound field using the bboxCenter and bboxSize fields. More... | |
virtual void | render () |
Render the children. | |
virtual void | traverseSG (TraverseInfo &ti) |
Traverse the scenegraph. traverseSG() is called in all children nodes. | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and a Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
![]() | |
H3DBoundedObject (Inst< SFBound > _bound=0) | |
Constructor. | |
![]() | |
H3DDisplayListObject (Inst< DisplayList > _displayList=0) | |
Constructor. | |
Static Public Member Functions | |
static void | replaceScene (AutoRef< Node > new_world, const X3DViewpointNode *new_vp, const Anchor *the_anchor) |
Replaces the world in the scene with a new one. More... | |
static void | replaceSceneRoot (Scene *the_scene) |
Replaces the world in the scene with a new one. More... | |
static bool | isAnchorInScene (const X3DGroupingNode *group_node, const Anchor *anchor_to_find) |
Checks which Scenes the given anchor is part of. More... | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
Public Attributes | |
H3DUniquePtr< SFString > | description |
The description field in the Anchor node specifies a textual description of the Anchor node. More... | |
H3DUniquePtr< MFString > | parameter |
The parameter field may be used to supply any additional information to be interpreted by the browser. More... | |
H3DUniquePtr< MFString > | url |
Contains path to file (or name of Viewpoint) used when clicking on a geometry in the children field. More... | |
![]() | |
bool | use_union_bound |
if true a route will be set up between the bound field of the nodes in children and the bound field of the grouping node. More... | |
H3DUniquePtr< AddChildren > | addChildren |
The addChildren event appends nodes to the children field of a grouping node. More... | |
H3DUniquePtr< RemoveChildren > | removeChildren |
The removeChildren event removes nodes from the children field of the grouping node . More... | |
H3DUniquePtr< MFChild > | children |
The nodes that are grouped together by this node. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
![]() | |
H3DUniquePtr< SFVec3f > | bboxCenter |
Specifies a the center of an axis-aligned bounding box enclosing the node. More... | |
H3DUniquePtr< SFVec3f > | bboxSize |
Specifies a the size of an axis-aligned bounding box enclosing the node. More... | |
![]() | |
H3DUniquePtr< SFBound > | bound |
The field containing the bound object. More... | |
![]() | |
H3DUniquePtr< DisplayList > | displayList |
The DisplayList instance handling the OpenGL caching of this object. | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
![]() | |
bool | children_multi_pass_transparency |
Will be set in traverseSG to indicate if any of the children enables multi-pass transparency. More... | |
vector< H3DRenderStateObject * > | render_states |
A vector of all the H3DRenderStatesObject within this X3DGroupingNode. | |
vector< ClipPlane * > | clip_planes |
A vector of only ClipPlane children of this X3DGroupingNode. | |
The Anchor grouping node retrieves the content of a URL when the user activates (e.g., clicks) some geometry contained within the Anchor node's children.
If the URL points to a valid X3D file, that world replaces the world of which the Anchor node is a part (except when the parameter field, described below, alters this behaviour). If non-X3D data is retrieved, the browser shall determine how to handle that data; typically, it will be passed to an appropriate non-X3D browser.
Exactly how a user activates geometry contained by the Anchor node depends on the pointing device and is determined by the X3D browser. Typically, clicking with the pointing device will result in the new scene replacing the current scene. An Anchor node with an empty url does nothing when its children are chosen. For a description of how multiple Anchors and pointing-device sensors are resolved on activation see the Pointing Device Sensor Component in the X3D specification.
The description field in the Anchor node specifies a textual description of the Anchor node. This may be used by browser-specific user interfaces that wish to present users with more detailed information about the Anchor.
The parameter field may be used to supply any additional information to be interpreted by the browser. Each string shall consist of "keyword=value" pairs. For example, some browsers allow the specification of a "target" for a link to display a link in another part of an HTML document. The parameter field is then:
Anchor {
parameter [ "target=name_of_frame" ];
...
}
An Anchor node may be used to bind the initial Viewpoint node in a world by specifying a URL ending with "#ViewpointName" where "ViewpointName" is the DEF name of a viewpoint defined in the X3D file.
EXAMPLE
Anchor {
url "http://www.school.edu/X3D/someScene.wrl#OverView";
children Shape { geometry Box {} };
}
specifies an anchor that loads the X3D file "someScene.wrl" and binds the initial user view to the Viewpoint node named "OverView" when the Anchor node's geometry (Box) is activated. If the named Viewpoint node is not found in the X3D file, the X3D file is loaded using the default Viewpoint node binding stack rules.
If the url field is specified in the form "#ViewpointName" (i.e., no file name), the Viewpoint node with the given name ("ViewpointName") in the Anchor's run-time name scope(s) shall be bound (set_bind TRUE). The results are undefined if there are multiple Viewpoints with the same name in the Anchor's run-time name scope(s). The results are undefined if the Anchor node is not part of any run-time name scope or is part of more than one run-time name scope. ( RUN-TIME scope not implemented, if the name exist the first created X3DViewpoint with the correct name will be used )
For example:
Anchor {
url "#Doorway";
children Shape { geometry Sphere {} };
}
binds the viewer to the viewpoint defined by the "Doorway" viewpoint in the current world when the sphere is activated. In this case, if the Viewpoint is not found, no action occurs on activation. NOTE: This node is not fully tested and may crash now and then when used.
Examples:
|
static |
Checks which Scenes the given anchor is part of.
group_node | The X3DGroupingNode to traverse in order to find the anchor. |
anchor_to_find | The anchor that is tested for inclusion in the scene defined by the group_node. |
References H3D::X3DGroupingNode::children, and H3DUtil::AutoRefVector< class >::size().
Referenced by replaceScene(), and replaceSceneRoot().
|
static |
Replaces the world in the scene with a new one.
new_world | The top node of the new world. |
new_vp | The viewpoint to use after changing the world. |
the_anchor | The Anchor node causing the call to this function. |
References H3D::X3DGroupingNode::children, H3D::H3DNavigation::enableDevice(), H3DUtil::AutoRef< class >::get(), H3D::X3DViewpointNode::getAllViewpoints(), isAnchorInScene(), H3D::Scene::scenes, and H3D::X3DBindableNode::set_bind.
|
static |
Replaces the world in the scene with a new one.
Uses the static protected parameters new_scene_root, old_anchor, new_world_vp set internally by the Anchor. Used in order to replace the sceneRoot from Scene::idle instead of the routing network since calling it from the routing network might cause corruption in heap.
References H3D::X3DGroupingNode::children, H3D::X3D::createX3DFromURL(), H3D::H3DNavigation::enableDevice(), H3DUtil::ResourceResolver::getBaseURL(), H3D::X3D::DEFNodes::getNode(), isAnchorInScene(), H3D::Scene::sceneRoot, and H3DUtil::ResourceResolver::setBaseURL().
Referenced by H3D::Scene::idle().
H3DUniquePtr< SFString > H3D::Anchor::description |
H3DUniquePtr< MFString > H3D::Anchor::parameter |
The parameter field may be used to supply any additional information to be interpreted by the browser.
Each string shall consist of "keyword=value" pairs.
Access type: inputOutput
H3DUniquePtr< MFString > H3D::Anchor::url |
Contains path to file (or name of Viewpoint) used when clicking on a geometry in the children field.
Access type: inputOutput
Referenced by H3D::Anchor::GeometrySelected::update().