001: /*
002: * $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/warp/WarpPosition.java,v 1.1 2005/04/20 21:05:19 paulby Exp $
003: *
004: * Sun Public License Notice
005: *
006: * The contents of this file are subject to the Sun Public License Version
007: * 1.0 (the "License"). You may not use this file except in compliance with
008: * the License. A copy of the License is available at http://www.sun.com/
009: *
010: * The Original Code is Java 3D(tm) Fly Through.
011: * The Initial Developer of the Original Code is Paul Byrne.
012: * Portions created by Paul Byrne are Copyright (C) 2002.
013: * All Rights Reserved.
014: *
015: * Contributor(s): Paul Byrne.
016: *
017: **/
018: package org.jdesktop.j3dfly.warp;
019:
020: import java.io.ObjectOutputStream;
021: import java.io.ObjectInputStream;
022: import java.io.IOException;
023: import java.io.Serializable;
024: import javax.media.j3d.Transform3D;
025: import javax.vecmath.Matrix4d;
026:
027: /**
028: * Encapsulates the name and position/orientation of a warp
029: *
030: * @author Paul Byrne
031: * @version 1.6, 01/18/02
032: */
033: public class WarpPosition extends java.lang.Object implements
034: Serializable {
035:
036: public final static long serialVersionUID = 7783666014159018852L;
037:
038: private String name;
039: private String description;
040: private Transform3D position;
041:
042: /** Creates new WarpObject */
043: public WarpPosition() {
044: name = null;
045: position = null;
046: description = null;
047: }
048:
049: public WarpPosition(String name, String description,
050: Transform3D position) {
051: this .name = name;
052: this .description = description;
053: this .position = position;
054: }
055:
056: public String getName() {
057: return name;
058: }
059:
060: public void setName(String name) {
061: this .name = name;
062: }
063:
064: public String getDescription() {
065: return description;
066: }
067:
068: public void setDescription(String description) {
069: this .description = description;
070: }
071:
072: public Transform3D getPosition() {
073: return position;
074: }
075:
076: public void setPosition(Transform3D position) {
077: this .position = position;
078: }
079:
080: /**
081: * Write the contents of this object to the stream
082: */
083: private void writeObject(ObjectOutputStream out) throws IOException {
084: out.writeUTF(name);
085: out.writeUTF(description);
086: Matrix4d mat = new Matrix4d();
087: position.get(mat);
088: out.writeObject(mat);
089: }
090:
091: /**
092: * Read this object with data from the stream
093: */
094: private void readObject(ObjectInputStream in) throws IOException,
095: ClassNotFoundException {
096: name = in.readUTF();
097: description = in.readUTF();
098: Matrix4d mat = (Matrix4d) in.readObject();
099: position = new Transform3D(mat);
100: }
101: }
|