Class MetadataBinaryIO

java.lang.Object
gaiasky.data.octreegen.MetadataBinaryIO

public class MetadataBinaryIO extends Object
Writes and reads the metadata to/from binary. The format is as follows:

- 32 bits (int) with the number of nodes, nNodes repeat the following nNodes times (for each node) - 32 bits (int) - pageId - The ID of the octant, or octree node - 32 bits (float) - centreX - The x component of the centre - 32 bits (float) - centreY - The y component of the centre - 32 bits (float) - centreZ - The z component of the centre - 32 bits (float) - sx - The half-size in x - 32 bits (float) - sy - The half-size in y - 32 bits (float) - sz - The half-size in z - 32 bits * 8 (int) - childrenIds - 8 integers with the ids of the children. If no child in the given position, the id is negative. - 32 bits (int) - depth - The level (depth) of the node in the tree - 32 bits (int) - nObjects - The cumulative number of objects of this node and its descendants - 32 bits (int) - ownObjects - The number of objects of this node - 32 bits (int) - childCount - The number of children nodes

  • Field Details

  • Constructor Details

    • MetadataBinaryIO

      public MetadataBinaryIO()
  • Method Details

    • readMetadata

      public OctreeNode readMetadata(InputStream in)
      Reads the metadata into an octree node
      Parameters:
      in -
      Returns:
      The octree node
    • readMetadata

      public OctreeNode readMetadata(InputStream in, LoadStatus status)
      Reads the metadata into an octree node
      Parameters:
      in - Input stream
      Returns:
      The octree node
    • readMetadataMapped

      public OctreeNode readMetadataMapped(String file)
    • readMetadataMapped

      public OctreeNode readMetadataMapped(String file, LoadStatus status)
    • writeMetadata

      public void writeMetadata(OctreeNode root, OutputStream out)
      Writes the metadata of the given octree node and its descendants to the given output stream in binary.
      Parameters:
      root -
      out -
    • toList

      public void toList(OctreeNode node, List<OctreeNode> nodes)