1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
/*
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package javax.media.j3d;
/**
* The BranchGroup serves as a pointer to the root of a
* scene graph branch; BranchGroup objects are the only objects that
* can be inserted into a Locale's set of objects. A subgraph, rooted
* by a BranchGroup node can be thought of as a compile unit. The
* following things may be done with BranchGroup:
* <P><UL>
* <LI>A BranchGroup may be compiled by calling its compile method. This causes the
* entire subgraph to be compiled. If any BranchGroup nodes are contained within the
* subgraph, they are compiled as well (along with their descendants).</LI>
* <p>
* <LI>A BranchGroup may be inserted into a virtual universe by attaching it to a
* Locale. The entire subgraph is then said to be live.</LI>
* <p>
* <LI>A BranchGroup that is contained within another subgraph may be reparented or
* detached at run time if the appropriate capabilities are set.</LI>
* </UL>
* Note that that if a BranchGroup is included in another subgraph, as a child of
* some other group node, it may not be attached to a Locale.
*/
public class BranchGroup extends Group {
/**
* For BranchGroup nodes, specifies that this BranchGroup allows detaching
* from its parent.
*/
public static final int
ALLOW_DETACH = CapabilityBits.BRANCH_GROUP_ALLOW_DETACH;
/**
* Constructs and initializes a new BranchGroup node object.
*/
public BranchGroup() {
}
/**
* Creates the retained mode BranchGroupRetained object that this
* BranchGroup component object will point to.
*/
@Override
void createRetained() {
this.retained = new BranchGroupRetained();
this.retained.setSource(this);
}
/**
* Compiles the source BranchGroup associated with this object and
* creates and caches a compiled scene graph.
* @exception SceneGraphCycleException if there is a cycle in the
* scene graph
* @exception RestrictedAccessException if the method is called
* when this object is part of a live scene graph.
*/
public void compile() {
if (isLive()) {
throw new RestrictedAccessException(
J3dI18N.getString("BranchGroup0"));
}
if (isCompiled() == false) {
// will throw SceneGraphCycleException if there is a cycle
// in the scene graph
checkForCycle();
((BranchGroupRetained)this.retained).compile();
}
}
/**
* Detaches this BranchGroup from its parent.
*/
public void detach() {
Group parent;
if (isLiveOrCompiled()) {
if(!this.getCapability(ALLOW_DETACH))
throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup1"));
if (((BranchGroupRetained)this.retained).parent != null) {
parent = (Group)((BranchGroupRetained)this.retained).parent.source;
if(!parent.getCapability(Group.ALLOW_CHILDREN_WRITE))
throw new CapabilityNotSetException(J3dI18N.getString("BranchGroup2"));
}
}
((BranchGroupRetained)this.retained).detach();
}
void validateModeFlagAndPickShape(int mode, int flags, PickShape pickShape) {
if(isLive()==false) {
throw new IllegalStateException(J3dI18N.getString("BranchGroup3"));
}
if((mode != PickInfo.PICK_BOUNDS) && (mode != PickInfo.PICK_GEOMETRY)) {
throw new IllegalArgumentException(J3dI18N.getString("BranchGroup4"));
}
if((pickShape instanceof PickPoint) && (mode == PickInfo.PICK_GEOMETRY)) {
throw new IllegalArgumentException(J3dI18N.getString("BranchGroup5"));
}
if(((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) &&
((flags & PickInfo.ALL_GEOM_INFO) != 0)) {
throw new IllegalArgumentException(J3dI18N.getString("BranchGroup6"));
}
if((mode == PickInfo.PICK_BOUNDS) &&
(((flags & (PickInfo.CLOSEST_GEOM_INFO |
PickInfo.ALL_GEOM_INFO |
PickInfo.CLOSEST_DISTANCE |
PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) {
throw new IllegalArgumentException(J3dI18N.getString("BranchGroup7"));
}
if((pickShape instanceof PickBounds) &&
(((flags & (PickInfo.CLOSEST_GEOM_INFO |
PickInfo.ALL_GEOM_INFO |
PickInfo.CLOSEST_DISTANCE |
PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) {
throw new IllegalArgumentException(J3dI18N.getString("BranchGroup8"));
}
}
/**
* Returns an array referencing all the items that are pickable below this
* <code>BranchGroup</code> that intersect with PickShape.
* The resultant array is unordered.
*
* @param pickShape the PickShape object
*
* @see SceneGraphPath
* @see Locale#pickAll
* @see PickShape
* @exception IllegalStateException if BranchGroup is not live.
*
*/
public SceneGraphPath[] pickAll( PickShape pickShape ) {
if(isLive()==false)
throw new IllegalStateException(J3dI18N.getString("BranchGroup3"));
return ((BranchGroupRetained)this.retained).pickAll(pickShape);
}
/**
* Returns an array unsorted references to all the PickInfo objects that are
* pickable below this <code>BranchGroup</code> that intersect with PickShape.
* The accuracy of the pick is set by the pick mode. The mode include :
* PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned
* is specified via a masked variable, flags, indicating which components are
* present in each returned PickInfo object.
*
* @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
*
* @param flags a mask indicating which components are present in each PickInfo object.
* This is specified as one or more individual bits that are bitwise "OR"ed together to
* describe the PickInfo data. The flags include :
* <ul>
* <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>
* <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
* <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
* <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
* <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
* <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
* <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
* </ul>
*
* @param pickShape the description of this picking volume or area.
*
* @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and
* ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
* is set to PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS
* nor PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is PICK_BOUNDS
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is PickBounds
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalStateException if BranchGroup is not live.
*
* @exception CapabilityNotSetException if the mode is
* PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
* is not set in any Geometry objects referred to by any shape
* node whose bounds intersects the PickShape.
*
* @exception CapabilityNotSetException if flags contains any of
* CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
* or ALL_GEOM_INFO, and the capability bits that control reading of
* coordinate data are not set in any GeometryArray object referred
* to by any shape node that intersects the PickShape.
* The capability bits that must be set to avoid this exception are as follows :
* <ul>
* <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
* <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
* <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
* (in addition to one of the above)</li>
* </ul>
*
* @see Locale#pickAll(int,int,javax.media.j3d.PickShape)
* @see PickInfo
*
* @since Java 3D 1.4
*
*/
public PickInfo[] pickAll( int mode, int flags, PickShape pickShape ) {
validateModeFlagAndPickShape(mode, flags, pickShape);
return ((BranchGroupRetained)this.retained).pickAll(mode, flags, pickShape);
}
/**
* Returns a sorted array of references to all the Pickable items that
* intersect with the pickShape. Element [0] references the item closest
* to <i>origin</i> of PickShape successive array elements are further
* from the <i>origin</i>
*
* Note: If pickShape is of type PickBounds, the resulting array
* is unordered.
* @param pickShape the PickShape object
*
* @see SceneGraphPath
* @see Locale#pickAllSorted
* @see PickShape
* @exception IllegalStateException if BranchGroup is not live.
*
*/
public SceneGraphPath[] pickAllSorted( PickShape pickShape ) {
if(isLive()==false)
throw new IllegalStateException(J3dI18N.getString("BranchGroup3"));
return ((BranchGroupRetained)this.retained).pickAllSorted(pickShape);
}
/**
* Returns a sorted array of PickInfo references to all the pickable
* items that intersect with the pickShape. Element [0] references
* the item closest to <i>origin</i> of PickShape successive array
* elements are further from the <i>origin</i>
* The accuracy of the pick is set by the pick mode. The mode include :
* PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned
* is specified via a masked variable, flags, indicating which components are
* present in each returned PickInfo object.
*
* @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
*
* @param flags a mask indicating which components are present in each PickInfo object.
* This is specified as one or more individual bits that are bitwise "OR"ed together to
* describe the PickInfo data. The flags include :
* <ul>
* <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>
* <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
* <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
* <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
* <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
* <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
* <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
* </ul>
*
* @param pickShape the description of this picking volume or area.
*
* @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and
* ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
* is set to PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS
* nor PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is PICK_BOUNDS
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is PickBounds
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalStateException if BranchGroup is not live.
*
* @exception CapabilityNotSetException if the mode is
* PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
* is not set in any Geometry objects referred to by any shape
* node whose bounds intersects the PickShape.
*
* @exception CapabilityNotSetException if flags contains any of
* CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
* or ALL_GEOM_INFO, and the capability bits that control reading of
* coordinate data are not set in any GeometryArray object referred
* to by any shape node that intersects the PickShape.
* The capability bits that must be set to avoid this exception are as follows :
* <ul>
* <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
* <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
* <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
* (in addition to one of the above)</li>
* </ul>
*
* @see Locale#pickAllSorted(int,int,javax.media.j3d.PickShape)
* @see PickInfo
*
* @since Java 3D 1.4
*
*/
public PickInfo[] pickAllSorted( int mode, int flags, PickShape pickShape ) {
validateModeFlagAndPickShape(mode, flags, pickShape);
return ((BranchGroupRetained)this.retained).pickAllSorted(mode, flags, pickShape);
}
/**
* Returns a SceneGraphPath that references the pickable item
* closest to the origin of <code>pickShape</code>.
*
* Note: If pickShape is of type PickBounds, the return is any pickable node
* below this BranchGroup.
* @param pickShape the PickShape object
*
* @see SceneGraphPath
* @see Locale#pickClosest
* @see PickShape
* @exception IllegalStateException if BranchGroup is not live.
*
*/
public SceneGraphPath pickClosest( PickShape pickShape ) {
if(isLive()==false)
throw new IllegalStateException(J3dI18N.getString("BranchGroup3"));
return ((BranchGroupRetained)this.retained).pickClosest(pickShape);
}
/**
* Returns a PickInfo which references the pickable item
* which is closest to the origin of <code>pickShape</code>.
* The accuracy of the pick is set by the pick mode. The mode include :
* PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned
* is specified via a masked variable, flags, indicating which components are
* present in each returned PickInfo object.
*
* @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
*
* @param flags a mask indicating which components are present in each PickInfo object.
* This is specified as one or more individual bits that are bitwise "OR"ed together to
* describe the PickInfo data. The flags include :
* <ul>
* <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>
* <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
* <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
* <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
* <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
* <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
* <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
* </ul>
*
* @param pickShape the description of this picking volume or area.
*
* @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and
* ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
* is set to PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS
* nor PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is PICK_BOUNDS
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is PickBounds
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalStateException if BranchGroup is not live.
*
* @exception CapabilityNotSetException if the mode is
* PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
* is not set in any Geometry objects referred to by any shape
* node whose bounds intersects the PickShape.
*
* @exception CapabilityNotSetException if flags contains any of
* CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
* or ALL_GEOM_INFO, and the capability bits that control reading of
* coordinate data are not set in any GeometryArray object referred
* to by any shape node that intersects the PickShape.
* The capability bits that must be set to avoid this exception are as follows :
* <ul>
* <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
* <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
* <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
* (in addition to one of the above)</li>
* </ul>
*
* @see Locale#pickClosest(int,int,javax.media.j3d.PickShape)
* @see PickInfo
*
* @since Java 3D 1.4
*
*/
public PickInfo pickClosest( int mode, int flags, PickShape pickShape ) {
validateModeFlagAndPickShape(mode, flags, pickShape);
return ((BranchGroupRetained)this.retained).pickClosest(mode, flags, pickShape);
}
/**
* Returns a reference to any item that is Pickable below this BranchGroup that
* intersects with <code>pickShape</code>.
* @param pickShape the PickShape object
*
* @see SceneGraphPath
* @see Locale#pickAny
* @see PickShape
* @exception IllegalStateException if BranchGroup is not live.
*
*/
public SceneGraphPath pickAny( PickShape pickShape ) {
if(isLive()==false)
throw new IllegalStateException(J3dI18N.getString("BranchGroup3"));
return ((BranchGroupRetained)this.retained).pickAny(pickShape);
}
/**
* Returns a PickInfo which references the pickable item below this
* BranchGroup that intersects with <code>pickShape</code>.
* The accuracy of the pick is set by the pick mode. The mode include :
* PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned
* is specified via a masked variable, flags, indicating which components are
* present in each returned PickInfo object.
*
* @param mode picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
*
* @param flags a mask indicating which components are present in each PickInfo object.
* This is specified as one or more individual bits that are bitwise "OR"ed together to
* describe the PickInfo data. The flags include :
* <ul>
* <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>
* <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
* <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
* <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
* <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
* <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
* <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
* </ul>
*
* @param pickShape the description of this picking volume or area.
*
* @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and
* ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
* is set to PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS
* nor PICK_GEOMETRY.
*
* @exception IllegalArgumentException if pick mode is PICK_BOUNDS
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalArgumentException if pickShape is PickBounds
* and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
* CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
*
* @exception IllegalStateException if BranchGroup is not live.
*
* @exception CapabilityNotSetException if the mode is
* PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
* is not set in any Geometry objects referred to by any shape
* node whose bounds intersects the PickShape.
*
* @exception CapabilityNotSetException if flags contains any of
* CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
* or ALL_GEOM_INFO, and the capability bits that control reading of
* coordinate data are not set in any GeometryArray object referred
* to by any shape node that intersects the PickShape.
* The capability bits that must be set to avoid this exception are as follows :
* <ul>
* <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
* <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
* <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
* (in addition to one of the above)</li>
* </ul>
*
* @see Locale#pickAny(int,int,javax.media.j3d.PickShape)
* @see PickInfo
*
* @since Java 3D 1.4
*
*/
public PickInfo pickAny( int mode, int flags, PickShape pickShape ) {
validateModeFlagAndPickShape(mode, flags, pickShape);
return ((BranchGroupRetained)this.retained).pickAny(mode, flags, pickShape);
}
/**
* Creates a new instance of the node. This routine is called
* by <code>cloneTree</code> to duplicate the current node.
* @param forceDuplicate when set to <code>true</code>, causes the
* <code>duplicateOnCloneTree</code> flag to be ignored. When
* <code>false</code>, the value of each node's
* <code>duplicateOnCloneTree</code> variable determines whether
* NodeComponent data is duplicated or copied.
*
* @see Node#cloneTree
* @see Node#cloneNode
* @see Node#duplicateNode
* @see NodeComponent#setDuplicateOnCloneTree
*/
@Override
public Node cloneNode(boolean forceDuplicate) {
BranchGroup bg = new BranchGroup();
bg.duplicateNode(this, forceDuplicate);
return bg;
}
}
|