JavaView© v3.95.000

jv.loader
Class PgJvxLoader

java.lang.Object
  extended byjv.loader.PgJvxLoader
All Implemented Interfaces:
PgLoaderIf

public final class PgJvxLoader
extends java.lang.Object
implements PgLoaderIf

Loader for geometry files given in JavaView's JVX file format. For details see the webpage on supported file formats.


Field Summary
 
Fields inherited from interface jv.loader.PgLoaderIf
GEOM_DATA_AUTHOR, GEOM_DATA_COLORS, GEOM_DATA_HEADER, GEOM_DATA_INFO, GEOM_DATA_NORMALS, GEOM_DATA_TEXTURE, GEOM_DATA_VECTORS
 
Constructor Summary
PgJvxLoader()
           
 
Method Summary
 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.
static java.lang.String[][] parseFunList(PsXmlNode parentNode, java.lang.String type, java.lang.String[] attr)
          Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of functions to be interpreted.
 PgJvxSrc[] read(java.io.BufferedReader in)
          Read XML file and fill a new PsJvxSrc class.
static PgJvxSrc[] read(java.lang.String fileName)
          Deprecated. use methods load() and getGeometries().
 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.
 java.lang.String write(PgJvxSrc[] geom)
          Write all geometries in a XML tree structure of instances of type PsXmlNode and create a XML formatted string.
 boolean write(java.io.Writer writer, PgJvxSrc[] geom)
          Write all geometries in a XML tree structure of instances of type PsXmlNode and into a writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PgJvxLoader

public PgJvxLoader()
Method Detail

isEnabledOptimization

public boolean isEnabledOptimization()
Determines if the loaded geometry requires some optimization. The method in this class prohibits optimization and always returns false.

For example, some file formats do not store a connected mesh but provide individual vertices for each face every time the face is menetioned. 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.

Specified by:
isEnabledOptimization in interface PgLoaderIf
Returns:
true if loader is enabled for optimization.
Since:
JavaView 2.99.018
See Also:
PgLoader.isEnabledOptimization(), PgLoader.setEnabledOptimization(boolean)

setGeometryOption

public void setGeometryOption(java.util.BitSet option)
Set the geometry options which indicate which parts of a geometry shall be saved. This method must be called before writing the geometry. Note, not all geometry file formats support geometry options.

Specified by:
setGeometryOption in interface PgLoaderIf
Since:
JavaView 2.68.000

getDisplayOption

public PvDisplayOption getDisplayOption()
Get display options which some parsers and geometry file formats supply. This geometry file format does not support loading/saving of display options. Instead, use "jvd" configuration files.

Specified by:
getDisplayOption in interface PgLoaderIf
See Also:
PgLoaderIf.load(BufferedReader)

setDisplayOption

public void setDisplayOption(PvDisplayOption option)
Set the display options to be saved within the geometry file. This method must be called before writing the geometry. This geometry file format does not support loading/saving of display options. Instead, use "jvd" configuration files.

Specified by:
setDisplayOption in interface PgLoaderIf

isAnimation

public boolean isAnimation()
Determine if currently loaded data is an animation.

This method may be called after successful parsing an input stream with the method load(BufferedReader).

Specified by:
isAnimation in interface PgLoaderIf
Returns:
true if loaded data is an animation.
See Also:
load(BufferedReader)

setAnimation

public void setAnimation(boolean flag)
Set flag whether current geometry data is an animation.

Specified by:
setAnimation in interface PgLoaderIf
Parameters:
flag - true if loaded data is an animation.

getAnimations

public PgJvxSrc[][] getAnimations()
Retrieve the previously loaded animations.

This method may be called after successful parsing an input stream with the method load(BufferedReader) and if isAnimation() returns true.

Specified by:
getAnimations in interface PgLoaderIf
Returns:
Double array of JVX geometries.
See Also:
load(BufferedReader)

getGeometries

public PgJvxSrc[] getGeometries()
Retrieve the previously loaded geometries.

This method may be called after successful parsing an input stream with the method load(BufferedReader) and if isAnimation() returns false.

Specified by:
getGeometries in interface PgLoaderIf
Returns:
Array of JVX geometries.
See Also:
load(BufferedReader)

getSpecializedGeometries

public PgGeometryIf[] getSpecializedGeometries()
Currently, this method always returns 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 geometies, 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.

Specified by:
getSpecializedGeometries in interface PgLoaderIf
Returns:
Array of geometries whose actual class type may vary between loaders.
Since:
JavaView 2.53
See Also:
getGeometries()

load

public boolean load(java.io.BufferedReader in)
Read a geometry file containing a set of geometries or animations.

After successful parsing retrieve the loaded geometries or animations using the methods getGeometries() respectively getAnimations() depending on the return value of the method isAnimation().

Specified by:
load in interface PgLoaderIf
Parameters:
in - BufferedReader to read textual data from.
Returns:
true if parsing was successfull.
See Also:
getAnimations(), getGeometries(), isAnimation()

read

public static PgJvxSrc[] read(java.lang.String fileName)
Deprecated. use methods load() and getGeometries().

Read geometry from file in JavaView JVX format.

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.

Parameters:
fileName - File or URL to read data from.

read

public PgJvxSrc[] read(java.io.BufferedReader in)
Read XML file and fill a new PsJvxSrc class.

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.

Specified by:
read in interface PgLoaderIf
Parameters:
in - BufferedReader to read textual data from.
Returns:
Array of JVX geometries.
See Also:
PgLoaderIf.write(Writer, PgJvxSrc [])

write

public boolean write(java.io.Writer writer,
                     PgJvxSrc[] geom)
Write all geometries in a XML tree structure of instances of type PsXmlNode and into a writer.

Specified by:
write in interface PgLoaderIf
Parameters:
writer - Write all data to this stream
geom - Array with geometries to save
Returns:
true on success.
See Also:
write(PgJvxSrc [])

write

public java.lang.String write(PgJvxSrc[] geom)
Write all geometries in a XML tree structure of instances of type PsXmlNode and create a XML formatted string.

Parameters:
geom - Array with geometries to save
Returns:
formatted string of xml tree.
See Also:
write(Writer, PgJvxSrc [])

parseFunList

public static java.lang.String[][] parseFunList(PsXmlNode parentNode,
                                                java.lang.String type,
                                                java.lang.String[] attr)
Parse an array of PsXmlNodes of same element type, where each element has data consisting of a blank separated list of functions to be interpreted.

Parameters:
parentNode - parent node containing a set of color nodes as children
type - type of elements in array
attr - array of attributes the vector might have, may be null.
Returns:
parsed string array, or null if failed

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.