Source Code Cross Referenced for BoundingLeaf.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: BoundingLeaf.java,v $
003:         *
004:         * Copyright 1997-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:        import javax.vecmath.*;
035:
036:        /**
037:         * The BoundingLeaf node defines a bounding region object that can be
038:         * referenced by other nodes to define a region of influence 
039:         * (Fog and Light nodes), an application region (Background, Clip,
040:         * and Soundscape nodes), or a scheduling region (Sound and
041:         * Behavior nodes). The bounding region is defined in the local
042:         * coordinate system of the BoundingLeaf node. A reference to a
043:         * BoundingLeaf node can be used in place
044:         * of a locally defined bounds object for any of the aforementioned regions.
045:         * <P>
046:         * This allows an application to specify a bounding region in one coordinate system
047:         * (the local coordinate system of the BoundingLeaf node) other than the local
048:         * coordinate system of the node that references the bounds. For an example of how
049:         * this might be used, consider a closed room with a number of track lights. Each
050:         * light can move independent of the other lights and, as such, needs its own local
051:         * coordinate system. However, the bounding volume is used by all the lights in the
052:         * boundary of the room, which doesn't move when the lights move. In this example,
053:         * the BoundingLeaf node allows the bounding region to be defined in the local
054:         * coordinate system of the room, rather than in the local coordinate system of a
055:         * particular light. All lights can then share this single bounding volume.
056:         */
057:        public class BoundingLeaf extends Leaf {
058:            /**
059:             * Specifies that this BoundingLeaf node allows read access to its
060:             * bounding region object.
061:             */
062:            public static final int ALLOW_REGION_READ = CapabilityBits.BOUNDING_LEAF_ALLOW_REGION_READ;
063:
064:            /**
065:             * Specifies that this BoundingLeaf node allows write access to its
066:             * bounding region object.
067:             */
068:            public static final int ALLOW_REGION_WRITE = CapabilityBits.BOUNDING_LEAF_ALLOW_REGION_WRITE;
069:
070:            // Array for setting default read capabilities
071:            private static final int[] readCapabilities = { ALLOW_REGION_READ };
072:
073:            /**
074:             * Constructs a BoundingLeaf node with a null (empty) bounding region.
075:             */
076:            public BoundingLeaf() {
077:                // set default read capabilities
078:                setDefaultReadCapabilities(readCapabilities);
079:
080:                ((BoundingLeafRetained) this .retained).createBoundingLeaf();
081:            }
082:
083:            /**
084:             * Constructs a BoundingLeaf node with the specified bounding region.
085:             * @param region the bounding region of this leaf node
086:             */
087:            public BoundingLeaf(Bounds region) {
088:                // set default read capabilities
089:                setDefaultReadCapabilities(readCapabilities);
090:
091:                ((BoundingLeafRetained) this .retained).createBoundingLeaf();
092:                ((BoundingLeafRetained) this .retained).initRegion(region);
093:            }
094:
095:            /**
096:             * Sets this BoundingLeaf node's bounding region.
097:             * @param region the bounding region of this leaf node
098:             * @exception CapabilityNotSetException if appropriate capability is
099:             * not set and this object is part of live or compiled scene graph
100:             */
101:            public void setRegion(Bounds region) {
102:                if (isLiveOrCompiled())
103:                    if (!this .getCapability(ALLOW_REGION_WRITE))
104:                        throw new CapabilityNotSetException(J3dI18N
105:                                .getString("BoundingLeaf0"));
106:
107:                if (isLive())
108:                    ((BoundingLeafRetained) this .retained).setRegion(region);
109:                else
110:                    ((BoundingLeafRetained) this .retained).initRegion(region);
111:            }
112:
113:            /**
114:             * Retrieves this BoundingLeaf's bounding region.
115:             * @return the bounding region of this leaf node
116:             * @exception CapabilityNotSetException if appropriate capability is
117:             * not set and this object is part of live or compiled scene graph
118:             */
119:            public Bounds getRegion() {
120:                if (isLiveOrCompiled())
121:                    if (!this .getCapability(ALLOW_REGION_READ))
122:                        throw new CapabilityNotSetException(J3dI18N
123:                                .getString("BoundingLeaf1"));
124:
125:                return ((BoundingLeafRetained) this .retained).getRegion();
126:            }
127:
128:            /** 
129:             * Creates the BoundingLeafRetained object that this 
130:             * BoundingLeaf object will point to. 
131:             */
132:            void createRetained() {
133:                this .retained = new BoundingLeafRetained();
134:                this .retained.setSource(this );
135:            }
136:
137:            /**
138:             * Used to create a new instance of the node.  This routine is called
139:             * by <code>cloneTree</code> to duplicate the current node.
140:             * @param forceDuplicate when set to <code>true</code>, causes the
141:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
142:             *  <code>false</code>, the value of each node's
143:             *  <code>duplicateOnCloneTree</code> variable determines whether
144:             *  NodeComponent data is duplicated or copied.
145:             *
146:             * @see Node#cloneTree
147:             * @see Node#cloneNode
148:             * @see Node#duplicateNode
149:             * @see NodeComponent#setDuplicateOnCloneTree
150:             */
151:            public Node cloneNode(boolean forceDuplicate) {
152:                BoundingLeaf bl = new BoundingLeaf();
153:                bl.duplicateNode(this , forceDuplicate);
154:                return bl;
155:            }
156:
157:            /**
158:             * Copies all BoundingLeaf information from
159:             * <code>originalNode</code> into
160:             * the current node.  This method is called from the
161:             * <code>cloneNode</code> method which is, in turn, called by the
162:             * <code>cloneTree</code> method.<P>
163:             *
164:             * @param originalNode the original node to duplicate.
165:             * @param forceDuplicate when set to <code>true</code>, causes the
166:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
167:             *  <code>false</code>, the value of each node's
168:             *  <code>duplicateOnCloneTree</code> variable determines whether
169:             *  NodeComponent data is duplicated or copied.
170:             *
171:             * @exception RestrictedAccessException if this object is part of a live
172:             *  or compiled scenegraph.
173:             *
174:             * @see Node#duplicateNode
175:             * @see Node#cloneTree
176:             * @see NodeComponent#setDuplicateOnCloneTree
177:             */
178:            void duplicateAttributes(Node originalNode, boolean forceDuplicate) {
179:                super .duplicateAttributes(originalNode, forceDuplicate);
180:
181:                ((BoundingLeafRetained) retained)
182:                        .initRegion(((BoundingLeafRetained) originalNode.retained)
183:                                .getRegion());
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.