Source Code Cross Referenced for Fog.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: Fog.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:21 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        import java.util.Enumeration;
035:        import javax.vecmath.Color3f;
036:
037:        /**
038:         * The Fog leaf node defines a set of fog parameters common to all
039:         * types of fog.  These parameters include the fog color and a region
040:         * of influence in which this Fog node is active.
041:         * A Fog node also contains a list of Group nodes that specifies the
042:         * hierarchical scope of this Fog.  If the scope list is empty, then
043:         * the Fog node has universe scope: all nodes within the region of
044:         * influence are affected by this Fog node.  If the scope list is
045:         * non-empty, then only those Leaf nodes under the Group nodes in the
046:         * scope list are affected by this Fog node (subject to the
047:         * influencing bounds).
048:         * <p>
049:         * If the regions of influence of multiple Fog nodes overlap, the
050:         * Java 3D system will choose a single set of fog parameters for those
051:         * objects that lie in the intersection.  This is done in an
052:         * implementation-dependent manner, but in general, the Fog node that
053:         * is "closest" to the object is chosen.
054:         */
055:
056:        public abstract class Fog extends Leaf {
057:            /**
058:             * Specifies that this Fog node allows read access to its
059:             * influencing bounds and bounds leaf information.
060:             */
061:            public static final int ALLOW_INFLUENCING_BOUNDS_READ = CapabilityBits.FOG_ALLOW_INFLUENCING_BOUNDS_READ;
062:
063:            /**
064:             * Specifies that this Fog node allows write access to its
065:             * influencing bounds and bounds leaf information.
066:             */
067:            public static final int ALLOW_INFLUENCING_BOUNDS_WRITE = CapabilityBits.FOG_ALLOW_INFLUENCING_BOUNDS_WRITE;
068:
069:            /**
070:             * Specifies that this Fog node allows read access to its color
071:             * information.
072:             */
073:            public static final int ALLOW_COLOR_READ = CapabilityBits.FOG_ALLOW_COLOR_READ;
074:
075:            /**
076:             * Specifies that this Fog node allows write access to its color
077:             * information.
078:             */
079:            public static final int ALLOW_COLOR_WRITE = CapabilityBits.FOG_ALLOW_COLOR_WRITE;
080:
081:            /**
082:             * Specifies that this Fog node allows read access to its scope
083:             * information at runtime.
084:             */
085:            public static final int ALLOW_SCOPE_READ = CapabilityBits.FOG_ALLOW_SCOPE_READ;
086:
087:            /**
088:             * Specifies that this Fog node allows write access to its scope
089:             * information at runtime.
090:             */
091:            public static final int ALLOW_SCOPE_WRITE = CapabilityBits.FOG_ALLOW_SCOPE_WRITE;
092:
093:            // Array for setting default read capabilities
094:            private static final int[] readCapabilities = {
095:                    ALLOW_INFLUENCING_BOUNDS_READ, ALLOW_COLOR_READ,
096:                    ALLOW_SCOPE_READ };
097:
098:            /**
099:             * Constructs a Fog node with default parameters.  The default
100:             * values are as follows:
101:             * <ul>
102:             * color : black (0,0,0)<br>
103:             * scope : empty (universe scope)<br>
104:             * influencing bounds : null<br>
105:             * influencing bounding leaf : null<br>
106:             * </ul>
107:             */
108:            public Fog() {
109:                // Just use the defaults
110:                // set default read capabilities
111:                setDefaultReadCapabilities(readCapabilities);
112:            }
113:
114:            /**
115:             * Constructs a Fog node with the specified fog color.
116:             * @param color the fog color
117:             */
118:            public Fog(Color3f color) {
119:                // set default read capabilities
120:                setDefaultReadCapabilities(readCapabilities);
121:
122:                ((FogRetained) this .retained).initColor(color);
123:            }
124:
125:            /**
126:             * Constructs a Fog node with the specified fog color.
127:             * @param r the red component of the fog color
128:             * @param g the green component of the fog color
129:             * @param b the blue component of the fog color
130:             */
131:            public Fog(float r, float g, float b) {
132:                // set default read capabilities
133:                setDefaultReadCapabilities(readCapabilities);
134:
135:                ((FogRetained) this .retained).initColor(r, g, b);
136:            }
137:
138:            /**
139:             * Sets the fog color to the specified color.
140:             * @param color the new fog color
141:             * @exception CapabilityNotSetException if appropriate capability is
142:             * not set and this object is part of live or compiled scene graph
143:             */
144:            public void setColor(Color3f color) {
145:                if (isLiveOrCompiled())
146:                    if (!this .getCapability(ALLOW_COLOR_WRITE))
147:                        throw new CapabilityNotSetException(J3dI18N
148:                                .getString("Fog0"));
149:
150:                if (isLive())
151:                    ((FogRetained) this .retained).setColor(color);
152:                else
153:                    ((FogRetained) this .retained).initColor(color);
154:            }
155:
156:            /**
157:             * Sets the fog color to the specified color.
158:             * @param r the red component of the fog color
159:             * @param g the green component of the fog color
160:             * @param b the blue component of the fog color
161:             * @exception CapabilityNotSetException if appropriate capability is
162:             * not set and this object is part of live or compiled scene graph
163:             */
164:            public void setColor(float r, float g, float b) {
165:                if (isLiveOrCompiled())
166:                    if (!this .getCapability(ALLOW_COLOR_WRITE))
167:                        throw new CapabilityNotSetException(J3dI18N
168:                                .getString("Fog0"));
169:
170:                if (isLive())
171:                    ((FogRetained) this .retained).setColor(r, g, b);
172:                else
173:                    ((FogRetained) this .retained).initColor(r, g, b);
174:            }
175:
176:            /**
177:             * Retrieves the fog color.
178:             * @param color the vector that will receive the current fog color
179:             * @exception CapabilityNotSetException if appropriate capability is
180:             * not set and this object is part of live or compiled scene graph
181:             */
182:            public void getColor(Color3f color) {
183:                if (isLiveOrCompiled())
184:                    if (!this .getCapability(ALLOW_COLOR_READ))
185:                        throw new CapabilityNotSetException(J3dI18N
186:                                .getString("Fog2"));
187:
188:                ((FogRetained) this .retained).getColor(color);
189:            }
190:
191:            /**
192:             * Sets the Fog's influencing region to the specified bounds.
193:             * This is used when the influencing bounding leaf is set to null.
194:             * @param region the bounds that contains the Fog's new influencing region.
195:             * @exception CapabilityNotSetException if appropriate capability is
196:             * not set and this object is part of live or compiled scene graph
197:             */
198:            public void setInfluencingBounds(Bounds region) {
199:                if (isLiveOrCompiled())
200:                    if (!this .getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE))
201:                        throw new CapabilityNotSetException(J3dI18N
202:                                .getString("Fog3"));
203:
204:                if (isLive())
205:                    ((FogRetained) this .retained).setInfluencingBounds(region);
206:                else
207:                    ((FogRetained) this .retained).initInfluencingBounds(region);
208:
209:            }
210:
211:            /**  
212:             * Retrieves the Fog node's influencing bounds.
213:             * @return this Fog's influencing bounds information
214:             * @exception CapabilityNotSetException if appropriate capability is
215:             * not set and this object is part of live or compiled scene graph
216:             */
217:            public Bounds getInfluencingBounds() {
218:                if (isLiveOrCompiled())
219:                    if (!this .getCapability(ALLOW_INFLUENCING_BOUNDS_READ))
220:                        throw new CapabilityNotSetException(J3dI18N
221:                                .getString("Fog4"));
222:
223:                return ((FogRetained) this .retained).getInfluencingBounds();
224:            }
225:
226:            /**
227:             * Sets the Fog's influencing region to the specified bounding leaf.
228:             * When set to a value other than null, this overrides the influencing
229:             * bounds object.
230:             * @param region the bounding leaf node used to specify the Fog
231:             * node's new influencing region.
232:             * @exception CapabilityNotSetException if appropriate capability is
233:             * not set and this object is part of live or compiled scene graph
234:             */
235:            public void setInfluencingBoundingLeaf(BoundingLeaf region) {
236:                if (isLiveOrCompiled())
237:                    if (!this .getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE))
238:                        throw new CapabilityNotSetException(J3dI18N
239:                                .getString("Fog3"));
240:
241:                if (isLive())
242:                    ((FogRetained) this .retained)
243:                            .setInfluencingBoundingLeaf(region);
244:                else
245:                    ((FogRetained) this .retained)
246:                            .initInfluencingBoundingLeaf(region);
247:            }
248:
249:            /**  
250:             * Retrieves the Fog node's influencing bounding leaf.
251:             * @return this Fog's influencing bounding leaf information
252:             * @exception CapabilityNotSetException if appropriate capability is
253:             * not set and this object is part of live or compiled scene graph
254:             */
255:            public BoundingLeaf getInfluencingBoundingLeaf() {
256:                if (isLiveOrCompiled())
257:                    if (!this .getCapability(ALLOW_INFLUENCING_BOUNDS_READ))
258:                        throw new CapabilityNotSetException(J3dI18N
259:                                .getString("Fog4"));
260:
261:                return ((FogRetained) this .retained)
262:                        .getInfluencingBoundingLeaf();
263:            }
264:
265:            /**
266:             * Replaces the node at the specified index in this Fog node's
267:             * list of scopes with the specified Group node.
268:             * By default, Fog nodes are scoped only by their influencing
269:             * bounds.  This allows them to be further scoped by a list of
270:             * nodes in the hierarchy.
271:             * @param scope the Group node to be stored at the specified index.
272:             * @param index the index of the Group node to be replaced.
273:             * @exception CapabilityNotSetException if appropriate capability is
274:             * not set and this object is part of live or compiled scene graph
275:             * @exception RestrictedAccessException if the specified group node
276:             * is part of a compiled scene graph
277:             */
278:            public void setScope(Group scope, int index) {
279:                if (isLiveOrCompiled())
280:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
281:                        throw new CapabilityNotSetException(J3dI18N
282:                                .getString("Fog7"));
283:
284:                if (isLive())
285:                    ((FogRetained) this .retained).setScope(scope, index);
286:                else
287:                    ((FogRetained) this .retained).initScope(scope, index);
288:            }
289:
290:            /**
291:             * Retrieves the Group node at the specified index from this Fog node's
292:             * list of scopes.
293:             * @param index the index of the Group node to be returned.
294:             * @return the Group node at the specified index.
295:             * @exception CapabilityNotSetException if appropriate capability is
296:             * not set and this object is part of live or compiled scene graph
297:             */
298:            public Group getScope(int index) {
299:                if (isLiveOrCompiled())
300:                    if (!this .getCapability(ALLOW_SCOPE_READ))
301:                        throw new CapabilityNotSetException(J3dI18N
302:                                .getString("Fog8"));
303:
304:                return ((FogRetained) this .retained).getScope(index);
305:            }
306:
307:            /**
308:             * Inserts the specified Group node into this Fog node's
309:             * list of scopes at the specified index.
310:             * By default, Fog nodes are scoped only by their influencing
311:             * bounds.  This allows them to be further scoped by a list of
312:             * nodes in the hierarchy.
313:             * @param scope the Group node to be inserted at the specified index.
314:             * @param index the index at which the Group node is inserted.
315:             * @exception CapabilityNotSetException if appropriate capability is
316:             * not set and this object is part of live or compiled scene graph
317:             * @exception RestrictedAccessException if the specified group node
318:             * is part of a compiled scene graph
319:             */
320:            public void insertScope(Group scope, int index) {
321:                if (isLiveOrCompiled())
322:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
323:                        throw new CapabilityNotSetException(J3dI18N
324:                                .getString("Fog9"));
325:
326:                if (isLive())
327:                    ((FogRetained) this .retained).insertScope(scope, index);
328:                else
329:                    ((FogRetained) this .retained).initInsertScope(scope, index);
330:            }
331:
332:            /**
333:             * Removes the node at the specified index from this Fog node's
334:             * list of scopes.  If this operation causes the list of scopes to
335:             * become empty, then this Fog will have universe scope: all nodes
336:             * within the region of influence will be affected by this Fog node.
337:             * @param index the index of the Group node to be removed.
338:             * @exception CapabilityNotSetException if appropriate capability is
339:             * not set and this object is part of live or compiled scene graph
340:             * @exception RestrictedAccessException if the group node at the
341:             * specified index is part of a compiled scene graph
342:             */
343:            public void removeScope(int index) {
344:                if (isLiveOrCompiled())
345:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
346:                        throw new CapabilityNotSetException(J3dI18N
347:                                .getString("Fog10"));
348:
349:                if (isLive())
350:                    ((FogRetained) this .retained).removeScope(index);
351:                else
352:                    ((FogRetained) this .retained).initRemoveScope(index);
353:            }
354:
355:            /**
356:             * Returns an enumeration of this Fog node's list of scopes.
357:             * @return an Enumeration object containing all nodes in this Fog node's
358:             * list of scopes.
359:             * @exception CapabilityNotSetException if appropriate capability is
360:             * not set and this object is part of live or compiled scene graph
361:             */
362:            public Enumeration getAllScopes() {
363:                if (isLiveOrCompiled())
364:                    if (!this .getCapability(ALLOW_SCOPE_READ))
365:                        throw new CapabilityNotSetException(J3dI18N
366:                                .getString("Fog11"));
367:
368:                return (Enumeration) ((FogRetained) this .retained)
369:                        .getAllScopes();
370:            }
371:
372:            /**
373:             * Appends the specified Group node to this Fog node's list of scopes.
374:             * By default, Fog nodes are scoped only by their influencing
375:             * bounds.  This allows them to be further scoped by a list of
376:             * nodes in the hierarchy.
377:             * @param scope the Group node to be appended.
378:             * @exception CapabilityNotSetException if appropriate capability is
379:             * not set and this object is part of live or compiled scene graph
380:             * @exception RestrictedAccessException if the specified group node
381:             * is part of a compiled scene graph
382:             */
383:            public void addScope(Group scope) {
384:                if (isLiveOrCompiled())
385:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
386:                        throw new CapabilityNotSetException(J3dI18N
387:                                .getString("Fog12"));
388:
389:                if (isLive())
390:                    ((FogRetained) this .retained).addScope(scope);
391:                else
392:                    ((FogRetained) this .retained).initAddScope(scope);
393:            }
394:
395:            /**
396:             * Returns the number of nodes in this Fog node's list of scopes.
397:             * If this number is 0, then the list of scopes is empty and this
398:             * Fog node has universe scope: all nodes within the region of
399:             * influence are affected by this Fog node.
400:             * @return the number of nodes in this Fog node's list of scopes.
401:             * @exception CapabilityNotSetException if appropriate capability is
402:             * not set and this object is part of live or compiled scene graph
403:             */
404:            public int numScopes() {
405:                if (isLiveOrCompiled())
406:                    if (!this .getCapability(ALLOW_SCOPE_READ))
407:                        throw new CapabilityNotSetException(J3dI18N
408:                                .getString("Fog11"));
409:
410:                return ((FogRetained) this .retained).numScopes();
411:            }
412:
413:            /**
414:             * Retrieves the index of the specified Group node in this
415:             * Fog node's list of scopes.
416:             *
417:             * @param scope the Group node to be looked up.
418:             * @return the index of the specified Group node;
419:             * returns -1 if the object is not in the list.
420:             * @exception CapabilityNotSetException if appropriate capability is
421:             * not set and this object is part of live or compiled scene graph
422:             *
423:             * @since Java 3D 1.3
424:             */
425:            public int indexOfScope(Group scope) {
426:                if (isLiveOrCompiled())
427:                    if (!this .getCapability(ALLOW_SCOPE_READ))
428:                        throw new CapabilityNotSetException(J3dI18N
429:                                .getString("Fog8"));
430:                return ((FogRetained) this .retained).indexOfScope(scope);
431:            }
432:
433:            /**
434:             * Removes the specified Group node from this Fog
435:             * node's list of scopes.  If the specified object is not in the
436:             * list, the list is not modified.  If this operation causes the
437:             * list of scopes to become empty, then this Fog
438:             * will have universe scope: all nodes within the region of
439:             * influence will be affected by this Fog node.
440:             *
441:             * @param scope the Group node to be removed.
442:             * @exception CapabilityNotSetException if appropriate capability is
443:             * not set and this object is part of live or compiled scene graph
444:             * @exception RestrictedAccessException if the specified group node
445:             * is part of a compiled scene graph
446:             *
447:             * @since Java 3D 1.3
448:             */
449:            public void removeScope(Group scope) {
450:                if (isLiveOrCompiled())
451:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
452:                        throw new CapabilityNotSetException(J3dI18N
453:                                .getString("Fog10"));
454:
455:                if (isLive())
456:                    ((FogRetained) this .retained).removeScope(scope);
457:                else
458:                    ((FogRetained) this .retained).initRemoveScope(scope);
459:            }
460:
461:            /**
462:             * Removes all Group nodes from this Fog node's
463:             * list of scopes.  The Fog node will then have
464:             * universe scope: all nodes within the region of influence will
465:             * be affected by this Fog node.
466:             *
467:             * @exception CapabilityNotSetException if appropriate capability is
468:             * not set and this object is part of live or compiled scene graph
469:             * @exception RestrictedAccessException if any group node in this
470:             * node's list of scopes is part of a compiled scene graph
471:             *
472:             * @since Java 3D 1.3
473:             */
474:            public void removeAllScopes() {
475:                if (isLiveOrCompiled())
476:                    if (!this .getCapability(ALLOW_SCOPE_WRITE))
477:                        throw new CapabilityNotSetException(J3dI18N
478:                                .getString("Fog10"));
479:
480:                if (isLive())
481:                    ((FogRetained) this .retained).removeAllScopes();
482:                else
483:                    ((FogRetained) this .retained).initRemoveAllScopes();
484:            }
485:
486:            /**
487:             * Copies all Fog information from
488:             * <code>originalNode</code> into
489:             * the current node.  This method is called from the
490:             * <code>cloneNode</code> method which is, in turn, called by the
491:             * <code>cloneTree</code> method.<P> 
492:             *
493:             * @param originalNode the original node to duplicate.
494:             * @param forceDuplicate when set to <code>true</code>, causes the
495:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
496:             *  <code>false</code>, the value of each node's
497:             *  <code>duplicateOnCloneTree</code> variable determines whether
498:             *  NodeComponent data is duplicated or copied.
499:             *
500:             * @exception RestrictedAccessException if this object is part of a live
501:             *  or compiled scenegraph.
502:             *
503:             * @see Node#duplicateNode
504:             * @see Node#cloneTree
505:             * @see NodeComponent#setDuplicateOnCloneTree
506:             */
507:            void duplicateAttributes(Node originalNode, boolean forceDuplicate) {
508:                super .duplicateAttributes(originalNode, forceDuplicate);
509:
510:                FogRetained attr = (FogRetained) originalNode.retained;
511:                FogRetained rt = (FogRetained) retained;
512:
513:                Color3f c = new Color3f();
514:                attr.getColor(c);
515:                rt.initColor(c);
516:                rt.initInfluencingBounds(attr.getInfluencingBounds());
517:
518:                Enumeration elm = attr.getAllScopes();
519:                while (elm.hasMoreElements()) {
520:                    // this reference will set correctly in updateNodeReferences() callback
521:                    rt.initAddScope((Group) elm.nextElement());
522:                }
523:
524:                // this reference will set correctly in updateNodeReferences() callback
525:                rt.initInfluencingBoundingLeaf(attr
526:                        .getInfluencingBoundingLeaf());
527:            }
528:
529:            /**
530:             * Callback used to allow a node to check if any nodes referenced
531:             * by that node have been duplicated via a call to <code>cloneTree</code>.
532:             * This method is called by <code>cloneTree</code> after all nodes in
533:             * the sub-graph have been duplicated. The cloned Leaf node's method
534:             * will be called and the Leaf node can then look up any node references
535:             * by using the <code>getNewObjectReference</code> method found in the
536:             * <code>NodeReferenceTable</code> object.  If a match is found, a
537:             * reference to the corresponding Node in the newly cloned sub-graph
538:             * is returned.  If no corresponding reference is found, either a
539:             * DanglingReferenceException is thrown or a reference to the original
540:             * node is returned depending on the value of the
541:             * <code>allowDanglingReferences</code> parameter passed in the
542:             * <code>cloneTree</code> call.
543:             * <p>
544:             * NOTE: Applications should <i>not</i> call this method directly.
545:             * It should only be called by the cloneTree method.
546:             *
547:             * @param referenceTable a NodeReferenceTableObject that contains the
548:             *  <code>getNewObjectReference</code> method needed to search for
549:             *  new object instances.
550:             * @see NodeReferenceTable
551:             * @see Node#cloneTree
552:             * @see DanglingReferenceException
553:             */
554:            public void updateNodeReferences(NodeReferenceTable referenceTable) {
555:
556:                FogRetained rt = (FogRetained) retained;
557:                BoundingLeaf bl = rt.getInfluencingBoundingLeaf();
558:
559:                if (bl != null) {
560:                    Object o = referenceTable.getNewObjectReference(bl);
561:                    rt.initInfluencingBoundingLeaf((BoundingLeaf) o);
562:                }
563:
564:                int num = rt.numScopes();
565:                for (int i = 0; i < num; i++) {
566:                    rt.initScope((Group) referenceTable
567:                            .getNewObjectReference(rt.getScope(i)), i);
568:                }
569:            }
570:
571:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.