Class PointDataProvider

java.lang.Object
gaiasky.data.group.PointDataProvider
All Implemented Interfaces:
IParticleGroupDataProvider

public class PointDataProvider extends Object implements IParticleGroupDataProvider
Generic data provider for point clouds that reads cartesian positions (XYZ) from a text file. Consider using BinaryPointDataProvider instead, which includes many more features and is more compact.
  • Constructor Details

    • PointDataProvider

      public PointDataProvider()
  • Method Details

    • loadData

      public List<IParticleRecord> loadData(String file, Runnable preCallback, BiConsumer<Long,Long> updateCallback, Runnable postCallback)
      Description copied from interface: IParticleGroupDataProvider
      Loads the data as it is.
      Specified by:
      loadData in interface IParticleGroupDataProvider
      Parameters:
      file - The file to load.
      preCallback - Callback to run before loading starts.
      updateCallback - Callback to run during loading, for every object. Contains the current object number and the total number.
      postCallback - Callback to run after loading is done.
      Returns:
      The array of particle records.
    • loadData

      public List<IParticleRecord> loadData(String file, double factor, Runnable preCallback, BiConsumer<Long,Long> updateCallback, Runnable postCallback)
      Description copied from interface: IParticleGroupDataProvider
      Loads the data applying a factor.
      Specified by:
      loadData in interface IParticleGroupDataProvider
      Parameters:
      file - The file to load.
      factor - Factor to apply to the positions.
      preCallback - Callback to run before loading starts.
      updateCallback - Callback to run during loading, for every object. Contains the current object number and the total number.
      postCallback - Callback to run after loading is done.
      Returns:
      The array of particle records.
    • loadData

      public List<IParticleRecord> loadData(InputStream is, double factor, Runnable preCallback, BiConsumer<Long,Long> updateCallback, Runnable postCallback)
      Description copied from interface: IParticleGroupDataProvider
      Loads the data applying a factor.
      Specified by:
      loadData in interface IParticleGroupDataProvider
      Parameters:
      is - Input stream to load the data from.
      factor - Factor to apply to the positions.
      preCallback - Callback to run before loading starts.
      updateCallback - Callback to run during loading, for every object. Contains the current object number and the total number.
      postCallback - Callback to run after loading is done.
      Returns:
      The array of particle records.
    • setFileNumberCap

      public void setFileNumberCap(int cap)
      Description copied from interface: IParticleGroupDataProvider
      Sets a cap on the number of files to load. Set to negative for unlimited.
      Specified by:
      setFileNumberCap in interface IParticleGroupDataProvider
      Parameters:
      cap - The file cap number.
    • setStarNumberCap

      public void setStarNumberCap(int cap)
      Description copied from interface: IParticleGroupDataProvider
      Sets the maximum number of stars to be processed per file. Set to negative for unlimited.
      Specified by:
      setStarNumberCap in interface IParticleGroupDataProvider
      Parameters:
      cap - The star cap number.
    • setProviderParams

      public void setProviderParams(Map<String,Object> params)
      Description copied from interface: IParticleGroupDataProvider
      Set provider parameters as a map.
      Specified by:
      setProviderParams in interface IParticleGroupDataProvider
      Parameters:
      params - The parameters map.
    • setTransformMatrix

      public void setTransformMatrix(Matrix4D matrix)
      Description copied from interface: IParticleGroupDataProvider
      Sets a transform matrix to apply to all data points.
      Specified by:
      setTransformMatrix in interface IParticleGroupDataProvider
      Parameters:
      matrix - The transform matrix.
    • loadDataMapped

      public List<IParticleRecord> loadDataMapped(String file, double factor, Runnable preCallback, BiConsumer<Long,Long> updateCallback, Runnable postCallback)
      Description copied from interface: IParticleGroupDataProvider
      Loads the data applying a factor using a memory mapped file for improved speed.
      Specified by:
      loadDataMapped in interface IParticleGroupDataProvider
      Parameters:
      file - The file to load.
      factor - Factor to apply to the positions.
      preCallback - Callback to run before loading starts.
      updateCallback - Callback to run during loading, for every object. Contains the current object number and the total number.
      postCallback - Callback to run after loading is done.
      Returns:
      The array of particle records.