Source Code Cross Referenced for Tracker.java in  » 6.0-JDK-Modules » java-3d » com » sun » j3d » utils » trackers » 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 » com.sun.j3d.utils.trackers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: Tracker.java,v $
003:         *
004:         * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         *
010:         * - Redistribution of source code must retain the above copyright
011:         *   notice, this list of conditions and the following disclaimer.
012:         *
013:         * - Redistribution in binary form must reproduce the above copyright
014:         *   notice, this list of conditions and the following disclaimer in
015:         *   the documentation and/or other materials provided with the
016:         *   distribution.
017:         *
018:         * Neither the name of Sun Microsystems, Inc. or the names of
019:         * contributors may be used to endorse or promote products derived
020:         * from this software without specific prior written permission.
021:         *
022:         * This software is provided "AS IS," without a warranty of any
023:         * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
024:         * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
025:         * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
026:         * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
027:         * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
028:         * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
029:         * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
030:         * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
031:         * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
032:         * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
033:         * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
034:         * POSSIBILITY OF SUCH DAMAGES.
035:         *
036:         * You acknowledge that this software is not designed, licensed or
037:         * intended for use in the design, construction, operation or
038:         * maintenance of any nuclear facility.
039:         *
040:         * $Revision: 1.1 $
041:         * $Date: 2007/09/25 20:01:20 $
042:         * $State: Exp $
043:         */
044:
045:        package com.sun.j3d.utils.trackers;
046:
047:        import java.lang.String;
048:        import javax.media.j3d.*;
049:
050:        /**
051:         * The Tracker Class defines an input device that generates
052:         * SensorReads
053:         *
054:         * @version 	1.16, 99/09/15 13:47:26
055:         * @author 	Henry Sowizral
056:         */
057:
058:        /**
059:         * A Tracker object encapsulates the Tracker's basic information.
060:         */
061:
062:        public abstract class Tracker implements  InputDevice {
063:
064:            /**
065:             * The transform that converts a vector in device coordinates into
066:             * uniform Tracker coordinates.
067:             * TrackerVec = TrackerBaseToDevice x DeviceVec
068:             */
069:            Transform3D TrackerBaseToDevice = new Transform3D();
070:
071:            // The number of physical sensors associated with this device
072:            int sensorCount;
073:
074:            // This device's sensor objects
075:            Sensor sensors[] = null;
076:
077:            // The maximum number of buttons associated with each Sensor.
078:            int buttonCount;
079:
080:            // This device's filename
081:            String deviceFilename;
082:
083:            // This device's UNIX file descriptor
084:            int fileDescriptor;
085:
086:            //This device's input mode, one of POLLED or STREAMING
087:            //int processingMode = STREAMING;
088:            int processingMode = InputDevice.NON_BLOCKING;
089:
090:            native int OpenSerialDeviceRaw(String deviceFilename, int baudRate);
091:
092:            native int WriteSerialRaw(int fDescriptor, String outString);
093:
094:            native int CloseSerialDevice(int fDescriptor);
095:
096:            /**
097:             * Construct a new Tracker with the specified sensorCount and
098:             * buttonCount.
099:             * @param physicalEnvironment the physical environment object where we
100:             * want access to this device.
101:             * @param deviceFilename the filename associated with the device
102:             * @param mode the device's query mode (POLLED or STREAMING)
103:             * @param sensorCount the number of sensors attached to this device
104:             * @param buttonCount the number of buttons attached to this device
105:             * @return a new Tracker object
106:             */
107:            Tracker(PhysicalEnvironment env, String deviceFilename, int mode,
108:                    int sensorCount, int buttonCount) {
109:                this .deviceFilename = deviceFilename;
110:                this .processingMode = mode;
111:                this .sensorCount = sensorCount;
112:                this .buttonCount = buttonCount;
113:                //env.addInputDevice(this);
114:                sensors = new Sensor[sensorCount];
115:                for (int i = 0; i < sensorCount; i++)
116:                    sensors[i] = new Sensor(this );
117:            }
118:
119:            // nuke later, shouldn't use view
120:            Tracker(View view, String deviceFilename, int mode,
121:                    int sensorCount, int buttonCount) {
122:                this .deviceFilename = deviceFilename;
123:                this .processingMode = mode;
124:                this .sensorCount = sensorCount;
125:                this .buttonCount = buttonCount;
126:                //view.addInputDevice(this);
127:                sensors = new Sensor[sensorCount];
128:                for (int i = 0; i < sensorCount; i++)
129:                    sensors[i] = new Sensor(this );
130:            }
131:
132:            /**
133:             * Construct a new Tracker with the specified sensorCount and
134:             * buttonCount.
135:             * @param sensorCount the number of sensors attached to this device
136:             * @param buttonCount the number of buttons attached to this device
137:             * @return a new Tracker object
138:             */
139:            Tracker(int sensorCount, int buttonCount) {
140:                this .sensorCount = sensorCount;
141:                this .buttonCount = buttonCount;
142:                sensors = new Sensor[sensorCount];
143:                for (int i = 0; i < sensorCount; i++)
144:                    sensors[i] = new Sensor(this );
145:            }
146:
147:            /**
148:             * Construct a new Tracker with the specified sensorCount and
149:             * buttonCount.
150:             * @param physicalEnvironment the physical environment object where we
151:             * want access to this device.
152:             * @param deviceFilename the filename associated with the device
153:             * @param mode the device's query mode (POLLED or STREAMING)
154:             * @param sensorCount the number of sensors attached to this device
155:             * @param sensorReadCount the number of sensorReadings per sensor
156:             * @param buttonCount the number of buttons attached to this device
157:             * @return a new Tracker object
158:             */
159:            Tracker(PhysicalEnvironment env, String deviceFilename, int mode,
160:                    int sensorCount, int sensorReadCount, int buttonCount) {
161:                this .deviceFilename = deviceFilename;
162:                this .processingMode = mode;
163:                this .sensorCount = sensorCount;
164:                this .buttonCount = buttonCount;
165:                //env.addInputDevice(this);
166:                sensors = new Sensor[sensorCount];
167:                for (int i = 0; i < sensorCount; i++)
168:                    sensors[i] = new Sensor(this , sensorReadCount, buttonCount);
169:            }
170:
171:            Tracker(View view, String deviceFilename, int mode,
172:                    int sensorCount, int sensorReadCount, int buttonCount) {
173:                this .deviceFilename = deviceFilename;
174:                this .processingMode = mode;
175:                this .sensorCount = sensorCount;
176:                this .buttonCount = buttonCount;
177:                //view.addInputDevice(this);
178:                sensors = new Sensor[sensorCount];
179:                for (int i = 0; i < sensorCount; i++)
180:                    sensors[i] = new Sensor(this , sensorReadCount, buttonCount);
181:            }
182:
183:            /**
184:             * Code to open and initialize the device
185:             */
186:            public abstract boolean initialize();
187:
188:            /**
189:             * Code to cleanup and close the device
190:             */
191:            public void close() {
192:                CloseSerialDevice(fileDescriptor);
193:            }
194:
195:            /**
196:             * Retrieve the Device's processing mode
197:             */
198:            public int getProcessingMode() {
199:                System.out
200:                        .println("Tracker.java has NON_BLOCKING driver type hard "
201:                                + "coded");
202:                //return this.processingMode;
203:                return InputDevice.NON_BLOCKING;
204:            }
205:
206:            /**
207:             * Retrieve the Device's processing mode
208:             */
209:            public void setProcessingMode(int mode) {
210:                this .processingMode = mode;
211:            }
212:
213:            /**
214:             * Code to set the device's current position and orientation as the devices
215:             * nominal position and orientation(establish its reference frame relative
216:             * to the "Tracker base" reference frame).
217:             */
218:            public abstract void setNominalPositionAndOrientation();
219:
220:            /**
221:             * Code to poll and process the device's input.
222:             */
223:            public abstract void pollAndProcessInput();
224:
225:            /**
226:             * Code to process the device's streaming input.
227:             */
228:            public abstract void processStreamInput();
229:
230:            /**
231:             * Writes the specified string to the device.
232:             * @param outString the string to be output to this device.
233:             */
234:            void writeSerial(String outString) {
235:                this .WriteSerialRaw(fileDescriptor, outString);
236:            }
237:
238:            /**
239:             * Set the Tracker's sensorCount
240:             * @param sensorCount the Tracker's new sensorCount
241:             */
242:            void setSensorCount(int sensorCount) {
243:                this .sensorCount = sensorCount;
244:            }
245:
246:            /**
247:             * Get the Tracker's sensorCount
248:             * @return this input device's sensor count.
249:             */
250:            public int getSensorCount() {
251:                return this .sensorCount;
252:            }
253:
254:            /**
255:             * Get this Tracker's specified Sensor
256:             * @param sensorIndex the sensor to retrieve
257:             * @return Returns the specified sensor.
258:             */
259:            public Sensor getSensor(int sensorIndex) {
260:                return this .sensors[sensorIndex];
261:            }
262:
263:            /**
264:             * Set the Tracker's deviceFilename
265:             * @param deviceFilename the Tracker's new deviceFilename
266:             */
267:            void setDeviceFilename(String deviceFilename) {
268:                this .deviceFilename = deviceFilename;
269:            }
270:
271:            /**
272:             * Get the Tracker's deviceFilename
273:             * @return this input device's file name
274:             */
275:            public String getDeviceFilename() {
276:                return new String(this .deviceFilename);
277:            }
278:
279:            /**
280:             * Set the Tracker's buttonCount
281:             * @param buttonCount the Tracker's new buttonCount
282:             */
283:            void setButtonCount(int buttonCount) {
284:                this .buttonCount = buttonCount;
285:            }
286:
287:            /**
288:             * Get the Tracker's buttonCount
289:             * @return this input device's button count.
290:             */
291:            public int getButtonCount() {
292:                return this.buttonCount;
293:            }
294:
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.