Source Code Cross Referenced for PointAttributes.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: PointAttributes.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:28 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        /**
035:         * The PointAttributes object defines all attributes that apply to 
036:         * point primitives. The point attributes that can be defined are:<p>
037:         * <ul>
038:         * <li>Size - the size of the point, in pixels. The default is a point
039:         * size of one pixel.</li><p>
040:         * <li>Antialiasing - for points greater than one-pixel in size, 
041:         * antialiasing smooths the outline of the point when it is rendered.</li>
042:         * <p></ul>
043:         * If antialiasing is disabled (the default), fractional point sizes
044:         * are rounded to integer sizes, and a screen-aligned square region
045:         * of pixels is drawn.<p>
046:         * <p>
047:         * If antialiasing is enabled, the points are considered transparent
048:         * for rendering purposes.  They are rendered with all the other transparent 
049:         * objects and adhere to the other transparency settings such as the
050:         * View transparency sorting policy and the View depth buffer freeze 
051:         * transparent enable.
052:         * </p> 
053:         *
054:         * @see Appearance
055:         * @see View
056:         */
057:        public class PointAttributes extends NodeComponent {
058:
059:            /**
060:             * Specifies that this PointAttributes object allows reading its
061:             * point size information.
062:             */
063:            public static final int ALLOW_SIZE_READ = CapabilityBits.POINT_ATTRIBUTES_ALLOW_SIZE_READ;
064:
065:            /**
066:             * Specifies that this PointAttributes object allows writing its
067:             * point size information.
068:             */
069:            public static final int ALLOW_SIZE_WRITE = CapabilityBits.POINT_ATTRIBUTES_ALLOW_SIZE_WRITE;
070:
071:            /**
072:             * Specifies that this PointAttributes object allows reading its
073:             * point antialiasing flag.
074:             */
075:            public static final int ALLOW_ANTIALIASING_READ = CapabilityBits.POINT_ATTRIBUTES_ALLOW_ANTIALIASING_READ;
076:
077:            /**
078:             * Specifies that this PointAttributes object allows writing its
079:             * point antialiasing flag.
080:             */
081:            public static final int ALLOW_ANTIALIASING_WRITE = CapabilityBits.POINT_ATTRIBUTES_ALLOW_ANTIALIASING_WRITE;
082:
083:            // Array for setting default read capabilities
084:            private static final int[] readCapabilities = { ALLOW_SIZE_READ,
085:                    ALLOW_ANTIALIASING_READ };
086:
087:            /**
088:             * Constructs a PointAttributes object with default parameters.
089:             * The default values are as follows:
090:             * <ul>
091:             * point size : 1<br>
092:             * point antialiasing : false<br>
093:             * </ul>
094:             */
095:            public PointAttributes() {
096:                // set default read capabilities
097:                setDefaultReadCapabilities(readCapabilities);
098:            }
099:
100:            /**
101:             * Constructs a PointAttributes object with specified values.
102:             * @param pointSize the size of points, in pixels
103:             * @param pointAntialiasing flag to set point antialising ON or OFF
104:             */
105:            public PointAttributes(float pointSize, boolean pointAntialiasing) {
106:                // set default read capabilities
107:                setDefaultReadCapabilities(readCapabilities);
108:
109:                ((PointAttributesRetained) this .retained)
110:                        .initPointSize(pointSize);
111:                ((PointAttributesRetained) this .retained)
112:                        .initPointAntialiasingEnable(pointAntialiasing);
113:            }
114:
115:            /**
116:             * Sets the point size for this appearance component object.
117:             * @param pointSize the size, in pixels, of point primitives
118:             * @exception CapabilityNotSetException if appropriate capability is
119:             * not set and this object is part of live or compiled scene graph
120:             */
121:            public void setPointSize(float pointSize) {
122:                if (isLiveOrCompiled())
123:                    if (!this .getCapability(ALLOW_SIZE_WRITE))
124:                        throw new CapabilityNotSetException(J3dI18N
125:                                .getString("PointAttributes0"));
126:
127:                if (isLive())
128:                    ((PointAttributesRetained) this .retained)
129:                            .setPointSize(pointSize);
130:                else
131:                    ((PointAttributesRetained) this .retained)
132:                            .initPointSize(pointSize);
133:
134:            }
135:
136:            /**
137:             * Gets the point size for this appearance component object.
138:             * @return the size, in pixels, of point primitives
139:             * @exception CapabilityNotSetException if appropriate capability is
140:             * not set and this object is part of live or compiled scene graph
141:             */
142:            public float getPointSize() {
143:                if (isLiveOrCompiled())
144:                    if (!this .getCapability(ALLOW_SIZE_READ))
145:                        throw new CapabilityNotSetException(J3dI18N
146:                                .getString("PointAttributes1"));
147:                return ((PointAttributesRetained) this .retained).getPointSize();
148:            }
149:
150:            /**
151:             * Enables or disables point antialiasing
152:             * for this appearance component object.
153:             * <p>
154:             * If antialiasing is enabled, the points are considered transparent
155:             * for rendering purposes.  They are rendered with all the other 
156:             * transparent objects and adhere to the other transparency settings 
157:             * such as the View transparency sorting policy and the View depth 
158:             * buffer freeze transparent enable.
159:             * </p> 
160:             * @param state true or false to enable or disable point antialiasing
161:             * @exception CapabilityNotSetException if appropriate capability is
162:             * not set and this object is part of live or compiled scene graph
163:             * @see View
164:             */
165:            public void setPointAntialiasingEnable(boolean state) {
166:                if (isLiveOrCompiled())
167:                    if (!this .getCapability(ALLOW_ANTIALIASING_WRITE))
168:                        throw new CapabilityNotSetException(J3dI18N
169:                                .getString("PointAttributes2"));
170:                if (isLive())
171:                    ((PointAttributesRetained) this .retained)
172:                            .setPointAntialiasingEnable(state);
173:                else
174:                    ((PointAttributesRetained) this .retained)
175:                            .initPointAntialiasingEnable(state);
176:
177:            }
178:
179:            /**
180:             * Retrieves the state of the point antialiasing flag.
181:             * @return true if point antialiasing is enabled,
182:             * false if point antialiasing is disabled
183:             * @exception CapabilityNotSetException if appropriate capability is
184:             * not set and this object is part of live or compiled scene graph
185:             */
186:            public boolean getPointAntialiasingEnable() {
187:                if (isLiveOrCompiled())
188:                    if (!this .getCapability(ALLOW_ANTIALIASING_READ))
189:                        throw new CapabilityNotSetException(J3dI18N
190:                                .getString("PointAttributes3"));
191:                return ((PointAttributesRetained) this .retained)
192:                        .getPointAntialiasingEnable();
193:            }
194:
195:            /**
196:             * Creates a retained mode PointAttributesRetained object that this
197:             * PointAttributes component object will point to.
198:             */
199:            void createRetained() {
200:                this .retained = new PointAttributesRetained();
201:                this .retained.setSource(this );
202:            }
203:
204:            /**
205:             * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)  
206:             */
207:            public NodeComponent cloneNodeComponent() {
208:                PointAttributes pa = new PointAttributes();
209:                pa.duplicateNodeComponent(this );
210:                return pa;
211:            }
212:
213:            /**
214:             * Copies all node information from <code>originalNodeComponent</code> into
215:             * the current node.  This method is called from the
216:             * <code>duplicateNode</code> method. This routine does
217:             * the actual duplication of all "local data" (any data defined in
218:             * this object). 
219:             *
220:             * @param originalNodeComponent the original node to duplicate.
221:             * @param forceDuplicate when set to <code>true</code>, causes the
222:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
223:             *  <code>false</code>, the value of each node's
224:             *  <code>duplicateOnCloneTree</code> variable determines whether
225:             *  NodeComponent data is duplicated or copied.
226:             *
227:             * @see Node#cloneTree
228:             * @see NodeComponent#setDuplicateOnCloneTree
229:             */
230:            void duplicateAttributes(NodeComponent originalNodeComponent,
231:                    boolean forceDuplicate) {
232:                super 
233:                        .duplicateAttributes(originalNodeComponent,
234:                                forceDuplicate);
235:
236:                PointAttributesRetained attr = (PointAttributesRetained) originalNodeComponent.retained;
237:                PointAttributesRetained rt = (PointAttributesRetained) retained;
238:
239:                rt.initPointSize(attr.getPointSize());
240:                rt.initPointAntialiasingEnable(attr
241:                        .getPointAntialiasingEnable());
242:            }
243:
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.