Source Code Cross Referenced for Cylinder.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3d » loaders » vrml97 » impl » 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 » org.jdesktop.j3d.loaders.vrml97.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: Cylinder.java,v $
003:         *
004:         *      @(#)Cylinder.java 1.23 98/11/05 20:34:22
005:         *
006:         * Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
007:         *
008:         * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
009:         * modify and redistribute this software in source and binary code form,
010:         * provided that i) this copyright notice and license appear on all copies of
011:         * the software; and ii) Licensee does not utilize the software in a manner
012:         * which is disparaging to Sun.
013:         *
014:         * This software is provided "AS IS," without a warranty of any kind. ALL
015:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
016:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
017:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
018:         * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
020:         * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023:         * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
024:         * POSSIBILITY OF SUCH DAMAGES.
025:         *
026:         * This software is not designed or intended for use in on-line control of
027:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028:         * the design, construction, operation or maintenance of any nuclear
029:         * facility. Licensee represents and warrants that it will not use or
030:         * redistribute the Software for such purposes.
031:         *
032:         * $Revision: 1.3 $
033:         * $Date: 2006/03/28 14:58:09 $
034:         * $State: Exp $
035:         */
036:        /*
037:         *@Author:  Rick Goldberg
038:         *@Author:  Doug Gehringer
039:         *@Author:  Nikolai V. Chr.
040:         *
041:         */
042:        package org.jdesktop.j3d.loaders.vrml97.impl;
043:
044:        import javax.media.j3d.BoundingBox;
045:        import javax.vecmath.Point3d;
046:
047:        /**  Description of the Class */
048:        public class Cylinder extends GroupGeom {
049:
050:            // field
051:            SFFloat radius;
052:            SFFloat height;
053:            SFBool side;
054:            SFBool bottom;
055:            SFBool top;
056:
057:            BoundingBox bounds;
058:
059:            /**
060:             *Constructor for the Cylinder object
061:             *
062:             *@param  loader Description of the Parameter
063:             */
064:            public Cylinder(Loader loader) {
065:                super (loader);
066:                radius = new SFFloat(1.0f);
067:                height = new SFFloat(2.0f);
068:                side = new SFBool(true);
069:                bottom = new SFBool(true);
070:                top = new SFBool(true);
071:                initFields();
072:            }
073:
074:            /**
075:             *Constructor for the Cylinder object
076:             *
077:             *@param  loader Description of the Parameter
078:             *@param  radius Description of the Parameter
079:             *@param  height Description of the Parameter
080:             *@param  side Description of the Parameter
081:             *@param  bottom Description of the Parameter
082:             *@param  top Description of the Parameter
083:             */
084:            Cylinder(Loader loader, SFFloat radius, SFFloat height,
085:                    SFBool side, SFBool bottom, SFBool top) {
086:                super (loader);
087:                this .radius = radius;
088:                this .height = height;
089:                this .side = side;
090:                this .bottom = bottom;
091:                this .top = top;
092:                initFields();
093:            }
094:
095:            /**  Description of the Method */
096:            void initFields() {
097:                radius.init(this , FieldSpec, Field.FIELD, "radius");
098:                height.init(this , FieldSpec, Field.FIELD, "height");
099:                side.init(this , FieldSpec, Field.FIELD, "side");
100:                bottom.init(this , FieldSpec, Field.FIELD, "bottom");
101:                top.init(this , FieldSpec, Field.FIELD, "top");
102:            }
103:
104:            /**
105:             *  Description of the Method
106:             *
107:             *@param  eventInName Description of the Parameter
108:             *@param  time Description of the Parameter
109:             */
110:            public void notifyMethod(String eventInName, double time) {
111:                ;
112:            }
113:
114:            /**
115:             *  Description of the Method
116:             *
117:             *@return  Description of the Return Value
118:             */
119:            public Object clone() {
120:                return new Cylinder(loader, (SFFloat) radius.clone(),
121:                        (SFFloat) height.clone(), (SFBool) side.clone(),
122:                        (SFBool) bottom.clone(), (SFBool) top.clone());
123:            }
124:
125:            /**  Description of the Method */
126:            public void initImpl() {
127:                ;
128:            }
129:
130:            /**
131:             *  Description of the Method
132:             *
133:             *@param  ap Description of the Parameter
134:             *@return  Description of the Return Value
135:             */
136:            public javax.media.j3d.Group initGroupImpl(
137:                    javax.media.j3d.Appearance ap) {
138:
139:                //    System.out.println("r and h"+radius.value+ " " + height.value);
140:                implGroup = new com.sun.j3d.utils.geometry.Cylinder(
141:                        radius.value,
142:                        height.value,
143:                        com.sun.j3d.utils.geometry.Cylinder.GENERATE_NORMALS
144:                                | com.sun.j3d.utils.geometry.Cylinder.GENERATE_TEXTURE_COORDS,
145:                        20, 2, ap);
146:                ((javax.media.j3d.Node) implGroup)
147:                        .clearCapability(javax.media.j3d.Node.ENABLE_PICK_REPORTING);
148:
149:                // The util constructs a group with the side, bottom and top as
150:                // children.  Handle removing the elements from the end of the
151:                // group to the beginning
152:                if (loader.debug) {
153:                    System.out.println("Cylinder group before edit: ");
154:                    loader.treePrinter.print(implGroup);
155:                }
156:                if (!bottom.value) {
157:                    if (loader.debug) {
158:                        System.out.println("no bottom");
159:                    }
160:                    ((javax.media.j3d.Group) implGroup)
161:                            .removeChild(com.sun.j3d.utils.geometry.Cylinder.BOTTOM);
162:                }
163:                if (!top.value) {
164:                    if (loader.debug) {
165:                        System.out.println("no top");
166:                    }
167:                    ((javax.media.j3d.Group) implGroup)
168:                            .removeChild(com.sun.j3d.utils.geometry.Cylinder.TOP);
169:                }
170:                if (!side.value) {
171:                    if (loader.debug) {
172:                        System.out.println("no side");
173:                    }
174:                    ((javax.media.j3d.Group) implGroup)
175:                            .removeChild(com.sun.j3d.utils.geometry.Cylinder.BODY);
176:                }
177:                if (loader.debug) {
178:                    System.out.println("Cylinder group after edit: ");
179:                    loader.treePrinter.print(implGroup);
180:                }
181:
182:                bounds = new BoundingBox(new Point3d(-radius.value,
183:                        -height.value / 2.0, -radius.value), new Point3d(
184:                        radius.value, height.value / 2.0, radius.value));
185:
186:                return implGroup;
187:            }
188:
189:            /**
190:             *  Gets the boundingBox attribute of the Cylinder object
191:             *
192:             *@return  The boundingBox value
193:             */
194:            public BoundingBox getBoundingBox() {
195:                return bounds;
196:            }
197:
198:            /**
199:             *  Gets the implGeom attribute of the Cylinder object
200:             *
201:             *@return  The implGeom value
202:             */
203:            public javax.media.j3d.Geometry getImplGeom() {
204:                // should not be called
205:                throw new NullPointerException();
206:            }
207:
208:            // this should perhaps be renamed haveTextureCoords()
209:            /**
210:             *  Description of the Method
211:             *
212:             *@return  Description of the Return Value
213:             */
214:            public boolean haveTexture() {
215:                return true;
216:            }
217:
218:            /**
219:             *  Gets the type attribute of the Cylinder object
220:             *
221:             *@return  The type value
222:             */
223:            public String getType() {
224:                return "Cylinder";
225:            }
226:
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.