Difference between revisions of "Anchor"
(Initial Entry) |
|||
Line 13: | Line 13: | ||
} | } | ||
+ | </pre> | ||
+ | |||
+ | <p>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 <i>parameter</i> 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.</p> | ||
+ | |||
+ | <p>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 <i>url</i> does nothing when its children | ||
+ | are chosen. A description of how multiple Anchors and pointing-device sensors | ||
+ | are resolved on activation is contained in | ||
+ | <a href="pointingsensor.html#Concepts">20.2 Concepts.</a></p> | ||
+ | |||
+ | <p>More details on the <i>children</i>, <i>addChildren</i>, and <i>removeChildren</i> | ||
+ | fields can be found in <a href="group.html#Concepts">10.2 Concepts</a>.</p> | ||
+ | |||
+ | <p>The <i>description</i> 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.</p> | ||
+ | |||
+ | <p>The <i>parameter</i> 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 <i>parameter</i> | ||
+ | field is then:</p> | ||
+ | |||
+ | <pre>Anchor { | ||
+ | parameter [ "target=name_of_frame" ]; | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | <p>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.</p> | ||
+ | |||
+ | <p><span class="example">EXAMPLE</span></p> | ||
+ | |||
+ | <pre>Anchor { | ||
+ | url "http://www.school.edu/X3D/someScene.wrl#OverView"; | ||
+ | children Shape { geometry Box {} }; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | <p>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 (see <a href="navigation.html#Viewpoint">23.3.5 | ||
+ | Viewpoint</a>).</p> | ||
+ | |||
+ | <p>If the <i>url</i> 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 (<i>set_bind </i> <span class="code"> <code>TRUE</code></span>). | ||
+ | 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. See <a href="../concepts.html#Runtimenamescope">4.4.7 Run-time | ||
+ | name scope</a> for a description of run-time name scopes. | ||
+ | See <a href="navigation.html#Viewpoint">23.3.5 Viewpoint</a>, for the Viewpoint transition | ||
+ | rules that specify how browsers shall interpret the transition from the old | ||
+ | Viewpoint node to the new one. For example:</p> | ||
+ | |||
+ | <pre>Anchor { | ||
+ | url "#Doorway"; | ||
+ | children Shape { geometry Sphere {} }; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | <p>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.</p> | ||
+ | |||
+ | <p>More details on the <i>url</i> field are contained in | ||
+ | <a href="../concepts.html#URLs">9.2.1 URLs</a>.</p> | ||
+ | |||
+ | <p>The <i>bboxCenter</i> and <i>bboxSize</i> fields specify a bounding box that | ||
+ | encloses the Anchor's children. This is a hint that may be used for optimization | ||
+ | purposes. The results are undefined if the specified bounding box is smaller | ||
+ | than the actual bounding box of the children at any time. The default <i>bboxSize</i> | ||
+ | value, (-1, -1, -1), implies that the bounding box is not specified | ||
+ | and if needed shall be calculated by the browser. More details on the <i>bboxCenter</i> | ||
+ | and <i>bboxSize</i> fields can be found in <a href="group.html#Boundingboxes"> | ||
+ | |||
+ | 10.2.2 Bounding boxes</a>.</p> | ||
+ | |||
+ | ==Example== | ||
+ | <pre> | ||
+ | #X3D V3.0 utf8 | ||
+ | |||
+ | PROFILE Immersive | ||
+ | |||
+ | Anchor { | ||
+ | description "A test anchor" | ||
+ | url ["anchor_dest.x3dv" ] | ||
+ | children [ | ||
+ | Shape { | ||
+ | geometry Box {} | ||
+ | } | ||
+ | ] | ||
+ | } | ||
</pre> | </pre> |
Revision as of 21:15, 27 January 2006
Anchor
Anchor : X3DGroupingNode { MFNode [in] addChildren MFNode [in] removeChildren MFNode [in,out] children [] [X3DChildNode] SFString [in,out] description "" SFNode [in,out] metadata NULL [X3DMetadataObject] MFString [in,out] parameter [] MFString [in,out] url [] [<i>url</i> or <i>urn</i>] SFVec3f [] bboxCenter 0 0 0 (-∞,∞) SFVec3f [] bboxSize -1 -1 -1 [0,∞) or −1 −1 −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. 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. A description of how multiple Anchors and pointing-device sensors are resolved on activation is contained in <a href="pointingsensor.html#Concepts">20.2 Concepts.</a>
More details on the children, addChildren, and removeChildren fields can be found in <a href="group.html#Concepts">10.2 Concepts</a>.
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 (see <a href="navigation.html#Viewpoint">23.3.5 Viewpoint</a>).
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. See <a href="../concepts.html#Runtimenamescope">4.4.7 Run-time
name scope</a> for a description of run-time name scopes.
See <a href="navigation.html#Viewpoint">23.3.5 Viewpoint</a>, for the Viewpoint transition
rules that specify how browsers shall interpret the transition from the old
Viewpoint node to the new one. 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.
More details on the url field are contained in <a href="../concepts.html#URLs">9.2.1 URLs</a>.
The bboxCenter and bboxSize fields specify a bounding box that encloses the Anchor's children. This is a hint that may be used for optimization purposes. The results are undefined if the specified bounding box is smaller than the actual bounding box of the children at any time. The default bboxSize value, (-1, -1, -1), implies that the bounding box is not specified and if needed shall be calculated by the browser. More details on the bboxCenter and bboxSize fields can be found in <a href="group.html#Boundingboxes"> 10.2.2 Bounding boxes</a>.
Example
#X3D V3.0 utf8 PROFILE Immersive Anchor { description "A test anchor" url ["anchor_dest.x3dv" ] children [ Shape { geometry Box {} } ] }