Class PF2
java.lang.Object
com.j3d.storage.files.protocol.GenericFileProtocol
com.j3d.storage.files.protocol.proj.ProjectFile
com.j3d.storage.files.protocol.proj.PF2
- All Implemented Interfaces:
FileProtocol
PF2 is a J3D file protocol implementation for reading and writing
project files that contain layer and thing information to and from disk.
Typically .j3p files
This version is different from PF1 as it makes the following changes:
(in the format 0xAARRGGBB)
- Writes
GObject.getColour()invalid input: '<'/li - Writes
GObject.getColour() - Changes
GTri's 4 colour ints to be 1 singular signed 32 bit int.
The Exact format is as follows:
- J3D Header (UTF-8)
- J3D Version (int)
- PROJECT Header (UTF-8)
- PROJECT Header Version (int)
- Number of Layers (int)
- For each Layer:
- Layer Identifier (UTF-8)
- Layer Hidden (boolean)
- Number of points in project (int)
- For each point:
- Point UUID (UTF-8)
- Thing Parent UUID (UTF-8)
- X Coordinate (double)
- Y Coordinate (double)
- Z Coordinate (double)
- Point Colour (signed 32 bit int) (Different from
PF1)- Number of lines in project (int)
- For each line:
- Line UUID (UTF-8)
- Thing Parent UUID (UTF-8)
- Line Colour (signed 32 bit int) (Different from
PF1)- Start Point UUID (UTF-8)
- End Point UUID (UTF-8)
- Number of triangles in project (int)
- For each triangle:
- Triangle UUID (UTF-8)
- Thing Parent UUID (UTF-8)
- Tri colour (signed 32 bit int) (Different from
PF1)- Line 1 UUID (UTF-8)
- Line 2 UUID (UTF-8)
- Line 3 UUID (UTF-8)
- For each Layer:
- Layer Index (int)
- Number of Things in Layer (int)
- For each Thing:
- Thing UUID (UTF-8)
- Thing Name (UTF-8)
- Thing Visibility (boolean)
- ... Multiple lines UUIDs of lines points and tris that the thing owns (UTF-8)
-
Nested Class Summary
Nested classes/interfaces inherited from class com.j3d.storage.files.protocol.proj.ProjectFile
ProjectFile.PF -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.j3d.storage.files.protocol.proj.ProjectFile
colToInt, convertibleFromLower, convertibleToHigher, getExtension, getFromVersion, getHeaderReader, getHeaderWriter, getProtocolHeader, getProtocolVersion, handleErr, intToColMethods inherited from class com.j3d.storage.files.protocol.GenericFileProtocol
readHeader, writeHeader
-
Constructor Details
-
PF2
public PF2()
-
-
Method Details
-
writeFile
Description copied from interface:FileProtocolWrites the provided data to a file at the specified path. This should be a direct inverse of the correspondingFileProtocol.readFile(String, String, Spinner)method.- Specified by:
writeFilein interfaceFileProtocol- Overrides:
writeFilein classProjectFile- Type Parameters:
T- The type of the data to be written, which must extend ArrayList.- Parameters:
path- The path to the file to be written.data- The data to be written to the file.
-
msg
-
readFile
public <T extends ArrayList> T readFile(String path, String name, Spinner throbber) throws Exception Reads a project file from the specified path and constructs the entire project structure including layers and things.- Specified by:
readFilein interfaceFileProtocol- Overrides:
readFilein classProjectFile- Type Parameters:
T- The type of ArrayList to be returned.- Parameters:
path- The path to the file to be read.name- The name of the file to be read.throbber- The Spinner instance- Returns:
- An ArrayLit containing the success state of the read operation.
- Throws:
Exception
-