Class PF1
java.lang.Object
com.j3d.storage.files.protocol.GenericFileProtocol
com.j3d.storage.files.protocol.proj.ProjectFile
com.j3d.storage.files.protocol.proj.PF1
- All Implemented Interfaces:
FileProtocol
PF1 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
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)
- Number of lines in project (int)
- For each line:
- Line UUID (UTF-8)
- Thing Parent UUID (UTF-8)
- 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)
- Colour Red (int)
- Colour Green (int)
- Colour Blue (int)
- Colour Alpha (int)
- 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
-
PF1
public PF1()Default constructor.
-
-
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
-