Source Code Cross Referenced for BranchGroup.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » javax.media.j3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: BranchGroup.java,v $
003:         *
004:         * Copyright 1996-2008 Sun Microsystems, Inc.  All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006:         *
007:         * This code is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License version 2 only, as
009:         * published by the Free Software Foundation.  Sun designates this
010:         * particular file as subject to the "Classpath" exception as provided
011:         * by Sun in the LICENSE file that accompanied this code.
012:         *
013:         * This code is distributed in the hope that it will be useful, but WITHOUT
014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
016:         * version 2 for more details (a copy is included in the LICENSE file that
017:         * accompanied this code).
018:         *
019:         * You should have received a copy of the GNU General Public License version
020:         * 2 along with this work; if not, write to the Free Software Foundation,
021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022:         *
023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024:         * CA 95054 USA or visit www.sun.com if you need additional information or
025:         * have any questions.
026:         *
027:         * $Revision: 1.6 $
028:         * $Date: 2008/02/28 20:17:20 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        /**
035:         * The BranchGroup serves as a pointer to the root of a
036:         * scene graph branch; BranchGroup objects are the only objects that
037:         * can be inserted into a Locale's set of objects. A subgraph, rooted
038:         * by a BranchGroup node can be thought of as a compile unit. The
039:         * following things may be done with BranchGroup:
040:         * <P><UL>
041:         * <LI>A BranchGroup may be compiled by calling its compile method. This causes the
042:         * entire subgraph to be compiled. If any BranchGroup nodes are contained within the
043:         * subgraph, they are compiled as well (along with their descendants).</LI>
044:         * <p>
045:         * <LI>A BranchGroup may be inserted into a virtual universe by attaching it to a
046:         * Locale. The entire subgraph is then said to be live.</LI>
047:         * <p>
048:         * <LI>A BranchGroup that is contained within another subgraph may be reparented or
049:         * detached at run time if the appropriate capabilities are set.</LI>
050:         * </UL>
051:         * Note that that if a BranchGroup is included in another subgraph, as a child of
052:         * some other group node, it may not be attached to a Locale.
053:         */
054:
055:        public class BranchGroup extends Group {
056:
057:            /**
058:             * For BranchGroup nodes, specifies that this BranchGroup allows detaching 
059:             * from its parent.
060:             */
061:            public static final int ALLOW_DETACH = CapabilityBits.BRANCH_GROUP_ALLOW_DETACH;
062:
063:            /**
064:             * Constructs and initializes a new BranchGroup node object.
065:             */
066:            public BranchGroup() {
067:            }
068:
069:            /**
070:             * Creates the retained mode BranchGroupRetained object that this
071:             * BranchGroup component object will point to.
072:             */
073:            void createRetained() {
074:                this .retained = new BranchGroupRetained();
075:                this .retained.setSource(this );
076:            }
077:
078:            /**
079:             * Compiles the source BranchGroup associated with this object and
080:             * creates and caches a compiled scene graph.
081:             * @exception SceneGraphCycleException if there is a cycle in the
082:             * scene graph
083:             * @exception RestrictedAccessException if the method is called
084:             * when this object is part of a live scene graph.
085:             */
086:            public void compile() {
087:                if (isLive()) {
088:                    throw new RestrictedAccessException(J3dI18N
089:                            .getString("BranchGroup0"));
090:                }
091:
092:                if (isCompiled() == false) {
093:                    // will throw SceneGraphCycleException if there is a cycle
094:                    // in the scene graph
095:                    checkForCycle();
096:
097:                    ((BranchGroupRetained) this .retained).compile();
098:                }
099:            }
100:
101:            /**
102:             * Detaches this BranchGroup from its parent.
103:             */
104:            public void detach() {
105:                Group parent;
106:
107:                if (isLiveOrCompiled()) {
108:                    if (!this .getCapability(ALLOW_DETACH))
109:                        throw new CapabilityNotSetException(J3dI18N
110:                                .getString("BranchGroup1"));
111:
112:                    if (((BranchGroupRetained) this .retained).parent != null) {
113:                        parent = (Group) ((BranchGroupRetained) this .retained).parent.source;
114:                        if (!parent.getCapability(Group.ALLOW_CHILDREN_WRITE))
115:                            throw new CapabilityNotSetException(J3dI18N
116:                                    .getString("BranchGroup2"));
117:                    }
118:                }
119:
120:                ((BranchGroupRetained) this .retained).detach();
121:            }
122:
123:            void validateModeFlagAndPickShape(int mode, int flags,
124:                    PickShape pickShape) {
125:
126:                if (isLive() == false) {
127:                    throw new IllegalStateException(J3dI18N
128:                            .getString("BranchGroup3"));
129:                }
130:
131:                if ((mode != PickInfo.PICK_BOUNDS)
132:                        && (mode != PickInfo.PICK_GEOMETRY)) {
133:
134:                    throw new IllegalArgumentException(J3dI18N
135:                            .getString("BranchGroup4"));
136:                }
137:
138:                if ((pickShape instanceof  PickPoint)
139:                        && (mode == PickInfo.PICK_GEOMETRY)) {
140:                    throw new IllegalArgumentException(J3dI18N
141:                            .getString("BranchGroup5"));
142:                }
143:
144:                if (((flags & PickInfo.CLOSEST_GEOM_INFO) != 0)
145:                        && ((flags & PickInfo.ALL_GEOM_INFO) != 0)) {
146:                    throw new IllegalArgumentException(J3dI18N
147:                            .getString("BranchGroup6"));
148:                }
149:
150:                if ((mode == PickInfo.PICK_BOUNDS)
151:                        && (((flags & (PickInfo.CLOSEST_GEOM_INFO
152:                                | PickInfo.ALL_GEOM_INFO
153:                                | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) {
154:
155:                    throw new IllegalArgumentException(J3dI18N
156:                            .getString("BranchGroup7"));
157:                }
158:
159:                if ((pickShape instanceof  PickBounds)
160:                        && (((flags & (PickInfo.CLOSEST_GEOM_INFO
161:                                | PickInfo.ALL_GEOM_INFO
162:                                | PickInfo.CLOSEST_DISTANCE | PickInfo.CLOSEST_INTERSECTION_POINT)) != 0))) {
163:
164:                    throw new IllegalArgumentException(J3dI18N
165:                            .getString("BranchGroup8"));
166:                }
167:
168:            }
169:
170:            /**
171:             * Returns an array referencing all the items that are pickable below this
172:             * <code>BranchGroup</code> that intersect with PickShape.
173:             * The resultant array is unordered.
174:             *
175:             * @param pickShape the PickShape object
176:             *
177:             * @see SceneGraphPath
178:             * @see Locale#pickAll
179:             * @see PickShape
180:             * @exception IllegalStateException if BranchGroup is not live.
181:             *
182:             */
183:            public SceneGraphPath[] pickAll(PickShape pickShape) {
184:
185:                if (isLive() == false)
186:                    throw new IllegalStateException(J3dI18N
187:                            .getString("BranchGroup3"));
188:
189:                return ((BranchGroupRetained) this .retained).pickAll(pickShape);
190:
191:            }
192:
193:            /**
194:             * Returns an array unsorted references to all the PickInfo objects that are 
195:             * pickable  below this <code>BranchGroup</code> that intersect with PickShape.
196:             * The accuracy of the pick is set by the pick mode. The mode include : 
197:             * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned 
198:             * is specified via a masked variable, flags, indicating which components are 
199:             * present in each returned PickInfo object. 
200:             *
201:             * @param mode  picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
202:             *
203:             * @param flags a mask indicating which components are present in each PickInfo object.  
204:             * This is specified as one or more individual bits that are bitwise "OR"ed together to 
205:             * describe the PickInfo data. The flags include :
206:             * <ul>
207:             * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>    
208:             * <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
209:             * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
210:             * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
211:             * <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
212:             * <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
213:             * <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
214:             * </ul>
215:             *
216:             * @param pickShape the description of this picking volume or area.
217:             *
218:             * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and 
219:             * ALL_GEOM_INFO.
220:             *
221:             * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
222:             * is set to PICK_GEOMETRY.
223:             *
224:             * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS 
225:             * nor PICK_GEOMETRY.
226:             *
227:             * @exception IllegalArgumentException if pick mode is PICK_BOUNDS 
228:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
229:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
230:             *
231:             * @exception IllegalArgumentException if pickShape is PickBounds 
232:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
233:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
234:             *
235:             * @exception IllegalStateException if BranchGroup is not live.
236:             *
237:             * @exception CapabilityNotSetException if the mode is
238:             * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
239:             * is not set in any Geometry objects referred to by any shape
240:             * node whose bounds intersects the PickShape.
241:             *   
242:             * @exception CapabilityNotSetException if flags contains any of
243:             * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
244:             * or ALL_GEOM_INFO, and the capability bits that control reading of
245:             * coordinate data are not set in any GeometryArray object referred
246:             * to by any shape node that intersects the PickShape.
247:             * The capability bits that must be set to avoid this exception are as follows :
248:             * <ul> 
249:             * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
250:             * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
251:             * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
252:             * (in addition to one of the above)</li>
253:             * </ul>
254:             *
255:             * @see Locale#pickAll(int,int,javax.media.j3d.PickShape)
256:             * @see PickInfo
257:             * 
258:             * @since Java 3D 1.4
259:             *
260:             */
261:
262:            public PickInfo[] pickAll(int mode, int flags, PickShape pickShape) {
263:
264:                validateModeFlagAndPickShape(mode, flags, pickShape);
265:                return ((BranchGroupRetained) this .retained).pickAll(mode,
266:                        flags, pickShape);
267:
268:            }
269:
270:            /**
271:             * Returns a sorted array of references to all the Pickable items that 
272:             * intersect with the pickShape. Element [0] references the item closest 
273:             * to <i>origin</i> of PickShape successive array elements are further 
274:             * from the <i>origin</i>
275:             *
276:             * Note: If pickShape is of type PickBounds, the resulting array 
277:             * is unordered.
278:             * @param pickShape the PickShape object
279:             * 
280:             * @see SceneGraphPath
281:             * @see Locale#pickAllSorted
282:             * @see PickShape
283:             * @exception IllegalStateException if BranchGroup is not live.
284:             *  
285:             */
286:            public SceneGraphPath[] pickAllSorted(PickShape pickShape) {
287:
288:                if (isLive() == false)
289:                    throw new IllegalStateException(J3dI18N
290:                            .getString("BranchGroup3"));
291:
292:                return ((BranchGroupRetained) this .retained)
293:                        .pickAllSorted(pickShape);
294:
295:            }
296:
297:            /**
298:             * Returns a sorted array of PickInfo references to all the pickable
299:             * items that intersect with the pickShape. Element [0] references 
300:             * the item closest to <i>origin</i> of PickShape successive array
301:             * elements are further from the <i>origin</i>
302:             * The accuracy of the pick is set by the pick mode. The mode include : 
303:             * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned 
304:             * is specified via a masked variable, flags, indicating which components are 
305:             * present in each returned PickInfo object. 
306:             *
307:             * @param mode  picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
308:             *
309:             * @param flags a mask indicating which components are present in each PickInfo object.  
310:             * This is specified as one or more individual bits that are bitwise "OR"ed together to 
311:             * describe the PickInfo data. The flags include :
312:             * <ul>
313:             * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>    
314:             * <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
315:             * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
316:             * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
317:             * <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
318:             * <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
319:             * <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
320:             * </ul>
321:             *
322:             * @param pickShape the description of this picking volume or area.
323:             *
324:             * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and 
325:             * ALL_GEOM_INFO.
326:             *
327:             * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
328:             * is set to PICK_GEOMETRY.
329:             *
330:             * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS 
331:             * nor PICK_GEOMETRY.
332:             *
333:             * @exception IllegalArgumentException if pick mode is PICK_BOUNDS 
334:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
335:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
336:             *
337:             * @exception IllegalArgumentException if pickShape is PickBounds 
338:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
339:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
340:             *
341:             * @exception IllegalStateException if BranchGroup is not live.
342:             *
343:             * @exception CapabilityNotSetException if the mode is
344:             * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
345:             * is not set in any Geometry objects referred to by any shape
346:             * node whose bounds intersects the PickShape.
347:             *   
348:             * @exception CapabilityNotSetException if flags contains any of
349:             * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
350:             * or ALL_GEOM_INFO, and the capability bits that control reading of
351:             * coordinate data are not set in any GeometryArray object referred
352:             * to by any shape node that intersects the PickShape.
353:             * The capability bits that must be set to avoid this exception are as follows :
354:             * <ul> 
355:             * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
356:             * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
357:             * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
358:             * (in addition to one of the above)</li>
359:             * </ul>
360:             *
361:             * @see Locale#pickAllSorted(int,int,javax.media.j3d.PickShape)
362:             * @see PickInfo
363:             * 
364:             * @since Java 3D 1.4
365:             *
366:             */
367:            public PickInfo[] pickAllSorted(int mode, int flags,
368:                    PickShape pickShape) {
369:
370:                validateModeFlagAndPickShape(mode, flags, pickShape);
371:                return ((BranchGroupRetained) this .retained).pickAllSorted(
372:                        mode, flags, pickShape);
373:
374:            }
375:
376:            /**
377:             * Returns a SceneGraphPath that references the pickable item 
378:             * closest to the origin of <code>pickShape</code>.
379:             *
380:             * Note: If pickShape is of type PickBounds, the return is any pickable node
381:             * below this BranchGroup.
382:             * @param pickShape the PickShape object
383:             *
384:             * @see SceneGraphPath
385:             * @see Locale#pickClosest
386:             * @see PickShape
387:             * @exception IllegalStateException if BranchGroup is not live.
388:             *  
389:             */
390:            public SceneGraphPath pickClosest(PickShape pickShape) {
391:
392:                if (isLive() == false)
393:                    throw new IllegalStateException(J3dI18N
394:                            .getString("BranchGroup3"));
395:
396:                return ((BranchGroupRetained) this .retained)
397:                        .pickClosest(pickShape);
398:
399:            }
400:
401:            /**
402:             * Returns a PickInfo which references the pickable item
403:             * which is closest to the origin of <code>pickShape</code>.
404:             * The accuracy of the pick is set by the pick mode. The mode include : 
405:             * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned 
406:             * is specified via a masked variable, flags, indicating which components are 
407:             * present in each returned PickInfo object. 
408:             *
409:             * @param mode  picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
410:             *
411:             * @param flags a mask indicating which components are present in each PickInfo object.  
412:             * This is specified as one or more individual bits that are bitwise "OR"ed together to 
413:             * describe the PickInfo data. The flags include :
414:             * <ul>
415:             * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>    
416:             * <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
417:             * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
418:             * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
419:             * <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
420:             * <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
421:             * <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
422:             * </ul>
423:             *
424:             * @param pickShape the description of this picking volume or area.
425:             *
426:             * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and 
427:             * ALL_GEOM_INFO.
428:             *
429:             * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
430:             * is set to PICK_GEOMETRY.
431:             *
432:             * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS 
433:             * nor PICK_GEOMETRY.
434:             *
435:             * @exception IllegalArgumentException if pick mode is PICK_BOUNDS 
436:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
437:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
438:             *
439:             * @exception IllegalArgumentException if pickShape is PickBounds 
440:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
441:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
442:             *
443:             * @exception IllegalStateException if BranchGroup is not live.
444:             *
445:             * @exception CapabilityNotSetException if the mode is
446:             * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
447:             * is not set in any Geometry objects referred to by any shape
448:             * node whose bounds intersects the PickShape.
449:             *   
450:             * @exception CapabilityNotSetException if flags contains any of
451:             * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
452:             * or ALL_GEOM_INFO, and the capability bits that control reading of
453:             * coordinate data are not set in any GeometryArray object referred
454:             * to by any shape node that intersects the PickShape.
455:             * The capability bits that must be set to avoid this exception are as follows :
456:             * <ul> 
457:             * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
458:             * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
459:             * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
460:             * (in addition to one of the above)</li>
461:             * </ul>
462:             *
463:             * @see Locale#pickClosest(int,int,javax.media.j3d.PickShape)
464:             * @see PickInfo
465:             * 
466:             * @since Java 3D 1.4
467:             *
468:             */
469:            public PickInfo pickClosest(int mode, int flags, PickShape pickShape) {
470:
471:                validateModeFlagAndPickShape(mode, flags, pickShape);
472:                return ((BranchGroupRetained) this .retained).pickClosest(mode,
473:                        flags, pickShape);
474:
475:            }
476:
477:            /**
478:             * Returns a reference to any item that is Pickable below this BranchGroup that
479:             * intersects with <code>pickShape</code>.
480:             * @param pickShape the PickShape object
481:             *
482:             * @see SceneGraphPath
483:             * @see Locale#pickAny
484:             * @see PickShape
485:             * @exception IllegalStateException if BranchGroup is not live.
486:             *  
487:             */
488:            public SceneGraphPath pickAny(PickShape pickShape) {
489:
490:                if (isLive() == false)
491:                    throw new IllegalStateException(J3dI18N
492:                            .getString("BranchGroup3"));
493:
494:                return ((BranchGroupRetained) this .retained).pickAny(pickShape);
495:
496:            }
497:
498:            /**
499:             * Returns a PickInfo which references the pickable item  below this
500:             * BranchGroup that intersects with <code>pickShape</code>.
501:             * The accuracy of the pick is set by the pick mode. The mode include : 
502:             * PickInfo.PICK_BOUNDS and PickInfo.PICK_GEOMETRY. The amount of information returned 
503:             * is specified via a masked variable, flags, indicating which components are 
504:             * present in each returned PickInfo object. 
505:             *
506:             * @param mode  picking mode, one of <code>PickInfo.PICK_BOUNDS</code> or <code>PickInfo.PICK_GEOMETRY</code>.
507:             *
508:             * @param flags a mask indicating which components are present in each PickInfo object.  
509:             * This is specified as one or more individual bits that are bitwise "OR"ed together to 
510:             * describe the PickInfo data. The flags include :
511:             * <ul>
512:             * <code>PickInfo.SCENEGRAPHPATH</code> - request for computed SceneGraphPath.<br>    
513:             * <code>PickInfo.NODE</code> - request for computed intersected Node.<br>
514:             * <code>PickInfo.LOCAL_TO_VWORLD</code> - request for computed local to virtual world transform.<br>
515:             * <code>PickInfo.CLOSEST_INTERSECTION_POINT</code> - request for closest intersection point.<br>
516:             * <code>PickInfo.CLOSEST_DISTANCE</code> - request for the distance of closest intersection.<br>
517:             * <code>PickInfo.CLOSEST_GEOM_INFO</code> - request for only the closest intersection geometry information.<br>
518:             * <code>PickInfo.ALL_GEOM_INFO</code> - request for all intersection geometry information.<br>
519:             * </ul>
520:             *
521:             * @param pickShape the description of this picking volume or area.
522:             *
523:             * @exception IllegalArgumentException if flags contains both CLOSEST_GEOM_INFO and 
524:             * ALL_GEOM_INFO.
525:             *
526:             * @exception IllegalArgumentException if pickShape is a PickPoint and pick mode
527:             * is set to PICK_GEOMETRY.
528:             *
529:             * @exception IllegalArgumentException if pick mode is neither PICK_BOUNDS 
530:             * nor PICK_GEOMETRY.
531:             *
532:             * @exception IllegalArgumentException if pick mode is PICK_BOUNDS 
533:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
534:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
535:             *
536:             * @exception IllegalArgumentException if pickShape is PickBounds 
537:             * and flags includes any of CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE,
538:             * CLOSEST_GEOM_INFO or ALL_GEOM_INFO.
539:             *
540:             * @exception IllegalStateException if BranchGroup is not live.
541:             *
542:             * @exception CapabilityNotSetException if the mode is
543:             * PICK_GEOMETRY and the Geometry.ALLOW_INTERSECT capability bit
544:             * is not set in any Geometry objects referred to by any shape
545:             * node whose bounds intersects the PickShape.
546:             *   
547:             * @exception CapabilityNotSetException if flags contains any of
548:             * CLOSEST_INTERSECTION_POINT, CLOSEST_DISTANCE, CLOSEST_GEOM_INFO
549:             * or ALL_GEOM_INFO, and the capability bits that control reading of
550:             * coordinate data are not set in any GeometryArray object referred
551:             * to by any shape node that intersects the PickShape.
552:             * The capability bits that must be set to avoid this exception are as follows :
553:             * <ul> 
554:             * <li>By-copy geometry : GeometryArray.ALLOW_COORDINATE_READ</li>
555:             * <li>By-reference geometry : GeometryArray.ALLOW_REF_DATA_READ</li>
556:             * <li>Indexed geometry : IndexedGeometryArray.ALLOW_COORDINATE_INDEX_READ
557:             * (in addition to one of the above)</li>
558:             * </ul>
559:             *
560:             * @see Locale#pickAny(int,int,javax.media.j3d.PickShape)
561:             * @see PickInfo
562:             * 
563:             * @since Java 3D 1.4
564:             *
565:             */
566:            public PickInfo pickAny(int mode, int flags, PickShape pickShape) {
567:
568:                validateModeFlagAndPickShape(mode, flags, pickShape);
569:                return ((BranchGroupRetained) this .retained).pickAny(mode,
570:                        flags, pickShape);
571:
572:            }
573:
574:            /**
575:             * Creates a new instance of the node.  This routine is called
576:             * by <code>cloneTree</code> to duplicate the current node.
577:             * @param forceDuplicate when set to <code>true</code>, causes the
578:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
579:             *  <code>false</code>, the value of each node's
580:             *  <code>duplicateOnCloneTree</code> variable determines whether
581:             *  NodeComponent data is duplicated or copied.
582:             *
583:             * @see Node#cloneTree
584:             * @see Node#cloneNode
585:             * @see Node#duplicateNode
586:             * @see NodeComponent#setDuplicateOnCloneTree
587:             */
588:            public Node cloneNode(boolean forceDuplicate) {
589:
590:                BranchGroup bg = new BranchGroup();
591:                bg.duplicateNode(this, forceDuplicate);
592:                return bg;
593:
594:            }
595:
596:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.