All Implemented Interfaces:
FileProtocol

public class PF1 extends ProjectFile
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)

  • Constructor Details

    • PF1

      public PF1()
      Default constructor.
  • Method Details

    • writeFile

      public <T extends ArrayList> void writeFile(String path, String name, T data)
      Description copied from interface: FileProtocol
      Writes the provided data to a file at the specified path. This should be a direct inverse of the corresponding FileProtocol.readFile(String, String, Spinner) method.
      Specified by:
      writeFile in interface FileProtocol
      Overrides:
      writeFile in class ProjectFile
      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

      private static void msg(String message)
    • 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:
      readFile in interface FileProtocol
      Overrides:
      readFile in class ProjectFile
      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