public class PgAbstractLoader extends java.lang.Object implements PgLoaderIf
GEOM_DATA_AUTHOR, GEOM_DATA_COLORS, GEOM_DATA_HEADER, GEOM_DATA_INFO, GEOM_DATA_NORMALS, GEOM_DATA_TEXTURE, GEOM_DATA_VECTORS
Constructor and Description |
---|
PgAbstractLoader()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
PgJvxSrc[][] |
getAnimations()
Retrieve the previously loaded animations.
|
PvDisplayOption |
getDisplayOption()
Get display options which some parsers and geometry file formats supply.
|
PgJvxSrc[] |
getGeometries()
Retrieve the previously loaded geometries.
|
PgGeometryIf[] |
getSpecializedGeometries()
Currently, this method always returns
null . |
boolean |
isAnimation()
Determine if currently loaded data is an animation.
|
boolean |
isEnabledOptimization()
Determines if the loaded geometry requires some optimization.
|
boolean |
load(java.io.BufferedReader in)
Read a geometry file containing a set of geometries or animations.
|
PgJvxSrc[] |
read(java.io.BufferedReader in)
Read a geometry file and return an array of new geometries.
|
PgJvxSrc[] |
read(java.io.DataInputStream inReader)
Read an array of geometries from a binary input stream.
|
void |
setAnimation(boolean flag)
Set flag whether current geometry data is an animation.
|
void |
setDisplayOption(PvDisplayOption option)
Set the display options to be saved within the geometry file.
|
void |
setGeometryOption(java.util.BitSet option)
Set the geometry options which indicate which parts of a geometry shall be saved.
|
boolean |
write(java.io.DataOutputStream outWriter,
PgJvxSrc[] geomArr)
Write an array of geometries into a binary output stream writer.
|
boolean |
write(java.io.Writer writer,
PgJvxSrc[] geomArr)
Write an array of geometries into an output stream writer.
|
public boolean isEnabledOptimization()
For example, some file formats do not store a connected mesh but provide individual vertices for each face every time the face is mentioned. In this case, a loader manager may identify equal vertices.
A similar method in the loader manager PgLoader may override the individual settings of each loader.
isEnabledOptimization
in interface PgLoaderIf
true
if loader is enabled for optimization.PgLoader.isEnabledOptimization()
,
PgLoader.setEnabledOptimization(boolean)
public void setGeometryOption(java.util.BitSet option)
setGeometryOption
in interface PgLoaderIf
public PvDisplayOption getDisplayOption()
getDisplayOption
in interface PgLoaderIf
PgLoaderIf.load(BufferedReader)
public void setDisplayOption(PvDisplayOption option)
setDisplayOption
in interface PgLoaderIf
public boolean isAnimation()
This method may be called after successful parsing an input stream
with the method load(BufferedReader)
.
isAnimation
in interface PgLoaderIf
true
if loaded data is an animation.load(BufferedReader)
public void setAnimation(boolean flag)
setAnimation
in interface PgLoaderIf
flag
- true
if loaded data is an animation.public PgJvxSrc[][] getAnimations()
This method may be called after successful parsing an input stream
with the method load(BufferedReader)
and
if isAnimation()
returns true
.
getAnimations
in interface PgLoaderIf
load(BufferedReader)
public PgJvxSrc[] getGeometries()
This method may be called after successful parsing an input stream
with the method load(BufferedReader)
and
if isAnimation()
returns false
.
getGeometries
in interface PgLoaderIf
load(BufferedReader)
public PgGeometryIf[] getSpecializedGeometries()
null
.
Return the loaded geometry in a more specialized class. This method allows a loader to return a geometry class which best fits the data found in a geometry file.
The loader manager jv.loader.PgLoader
in JavaView
will first check if a loader returns specialized geometries, and if
not, check for a data supplied in a container class PgJvxSrc.
This method may be called after successful parsing an input stream
with the method load(BufferedReader)
and
if isAnimation()
returns false
.
getSpecializedGeometries
in interface PgLoaderIf
getGeometries()
public boolean load(java.io.BufferedReader in)
After successful parsing retrieve the loaded geometries or animations
using the methods getGeometries()
respectively
getAnimations()
depending on the return value
of the method isAnimation()
.
load
in interface PgLoaderIf
in
- BufferedReader to read textual data from.true
if parsing was successfull.getAnimations()
,
getGeometries()
,
isAnimation()
public PgJvxSrc[] read(java.io.BufferedReader in)
The returned array of geometry may contain keyframes of
an animation. This is checked with the method isAnimation()
.
Alternatively, one may call load(BuffereredReader) followed by getGeometries() resp. getAnimations() to have a finer control about which information one wants to use from a source. For example, optional display information must be retrieve by a subsequent call getDisplayOption() if available.
read
in interface PgLoaderIf
in
- BufferedReader to read textual data from.write(Writer, PgJvxSrc [])
public PgJvxSrc[] read(java.io.DataInputStream inReader)
inReader
- Provides all data to this streamload(BufferedReader)
,
write(Writer, PgJvxSrc [])
public boolean write(java.io.Writer writer, PgJvxSrc[] geomArr) throws java.io.IOException
write
in interface PgLoaderIf
writer
- Write all data to this streamgeomArr
- Array with geometries to savetrue
on success.java.io.IOException
read(BufferedReader)
,
write(DataOutputStream, PgJvxSrc [])
public boolean write(java.io.DataOutputStream outWriter, PgJvxSrc[] geomArr) throws java.io.IOException
write
in interface PgLoaderIf
outWriter
- Write all data to this streamgeomArr
- Array with geometries to savetrue
on success.java.io.IOException
read(BufferedReader)
,
read(DataInputStream)
,
write(Writer, PgJvxSrc [])
"