flightclub.client
Class GliderType
java.lang.Object
|
+--flightclub.client.GliderType
- Direct Known Subclasses:
- HangGlider, Paraglider, Sailplane
- public class GliderType
- extends java.lang.Object
This class implements the reading and writing of data files for
different types of glider. A glider's data file determines its
flying characteristics and its 3d representation.
Currently we have three types of glider. The relevant data files -
hangglider.txt, paraglider.txt, sailplane.txt - may be found in the
folder ~/xc/class/. The file format is as follows:
# hangglider
# by foo, 18 Aug 2002
TURN: 0.3
POLAR: 20 -2, 40 -6, 60 -10,
OBJ3D:
2
t "3399ff" 0 0 0, 1 0 0, 1 -0.2 0, 0 -0.2 0,
t "3399ff" 0 0 0, -1 0 0, -1 -0.2 0, 0 -0.2 0,
Note the polar has a trailing comma after the last pair of speed
and sink values. The text after OBJ3D: is the 3d representation of
the glider. This portion of the file will be parsed by Obj3d.
|
Constructor Summary |
GliderType(ModelViewer modelViewer,
java.lang.String typeName)
Creates an instance of typeName or throws an IO
error. |
GliderType(java.lang.String typeName)
Creates an empty instance of glider type ready for you to
specify its properties. |
|
Method Summary |
java.lang.String |
toString()
|
void |
writeFile()
Outputs the data for this type of glider to a text file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
modelViewer
protected ModelViewer modelViewer
typeName
protected java.lang.String typeName
obj
protected Obj3dDir obj
polar
protected float[][] polar
turnRadius
protected float turnRadius
GliderType
public GliderType(ModelViewer modelViewer,
java.lang.String typeName)
throws java.io.IOException
- Creates an instance of
typeName or throws an IO
error. Opens the relevant data file, parses it and sets my
properties accordingly. This is the cpnstructor used by the
client.
GliderType
public GliderType(java.lang.String typeName)
- Creates an empty instance of glider type ready for you to
specify its properties. Use this constructor if you are
running glider type stand alone in order to *write* a def
file.
- See Also:
Paraglider,
flightclub.data.Hangglider,
Sailplane
writeFile
public void writeFile()
throws java.io.IOException
- Outputs the data for this type of glider to a text file.
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object