Package gaiasky.data.group
Class BinaryPointDataProvider
java.lang.Object
gaiasky.data.group.BinaryPointDataProvider
- All Implemented Interfaces:
BinaryIO
,IParticleGroupDataProvider
Loads and writes binary data into particle groups (
ParticleRecord.ParticleRecordType.PARTICLE_EXT
).
The format is:
- int (4 bytes) -- number of records
- byte (1 byte [0|1]) -- particle record type: true - PARTICLE_EXT, false - PARTICLE
- for each record:
- long (8 bytes) -- id
- short (2 bytes) -- nameLength
- char (2 bytes) * nameLength -- name characters
- double (8 bytes) -- alpha [deg]
- double (8 bytes) -- delta [deg]
- double (8 bytes) -- distance [pc]
- if type == PARTICLE_EXT
- float (4 bytes) -- mu alpha
- float (4 bytes) -- mu delta
- float (4 bytes) -- radial velocity
- float (4 bytes) -- apparent magnitude
- float (4 bytes) -- packed color
- float (4 bytes) -- size
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionloadData
(InputStream is, double factor) Loads the data applying a factor.Loads the data as it is.Loads the data applying a factor.loadDataMapped
(String file, double factor) Loads the data applying a factor using a memory mapped file for improved speed.readData
(InputStream in, double factor) readParticleRecord
(IDataReader in, double factor) readParticleRecord
(DataInputStream in, double factor) Read a star from the input stream.readParticleRecord
(MappedByteBuffer mem, double factor) Read a star from the mapped buffer.void
setDatasetOptions
(DatasetOptions datasetOptions) void
setFileNumberCap
(int cap) Sets a cap on the number of files to load.void
setProviderParams
(Map<String, Object> params) Set provider parameters as a map.void
setStarNumberCap
(int cap) Sets the maximum number of stars to be processed per file.void
setTransformMatrix
(Matrix4d matrix) Sets a transform matrix to apply to all data points.void
writeData
(List<IParticleRecord> data, OutputStream out, boolean extra) void
Write the star bean to the output stream.
-
Field Details
-
logger
-
list
-
-
Constructor Details
-
BinaryPointDataProvider
public BinaryPointDataProvider()
-
-
Method Details
-
setDatasetOptions
-
loadData
Description copied from interface:IParticleGroupDataProvider
Loads the data as it is.- Specified by:
loadData
in interfaceIParticleGroupDataProvider
- Parameters:
file
- The file to load.- Returns:
- The array of particle records.
-
loadData
Description copied from interface:IParticleGroupDataProvider
Loads the data applying a factor.- Specified by:
loadData
in interfaceIParticleGroupDataProvider
- Parameters:
file
- The file to load.factor
- Factor to apply to the positions.- Returns:
- The array of particle records.
-
loadData
Description copied from interface:IParticleGroupDataProvider
Loads the data applying a factor.- Specified by:
loadData
in interfaceIParticleGroupDataProvider
- Parameters:
is
- Input stream to load the data from.factor
- Factor to apply to the positions.- Returns:
- The array of particle records.
-
readData
-
loadDataMapped
Description copied from interface:IParticleGroupDataProvider
Loads the data applying a factor using a memory mapped file for improved speed.- Specified by:
loadDataMapped
in interfaceIParticleGroupDataProvider
- Parameters:
file
- The file to load.factor
- Factor to apply to the positions.- 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 interfaceIParticleGroupDataProvider
- 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 interfaceIParticleGroupDataProvider
- Parameters:
cap
- The star cap number.
-
setProviderParams
Description copied from interface:IParticleGroupDataProvider
Set provider parameters as a map.- Specified by:
setProviderParams
in interfaceIParticleGroupDataProvider
- Parameters:
params
- The parameters map.
-
setTransformMatrix
Description copied from interface:IParticleGroupDataProvider
Sets a transform matrix to apply to all data points.- Specified by:
setTransformMatrix
in interfaceIParticleGroupDataProvider
- Parameters:
matrix
- The transform matrix.
-
readParticleRecord
Description copied from interface:BinaryIO
Read a star from the mapped buffer.- Specified by:
readParticleRecord
in interfaceBinaryIO
- Parameters:
mem
- Mapped memory buffer to read from.factor
- Scale factor to apply to the positions.- Returns:
- The star.
- Throws:
IOException
-
readParticleRecord
Description copied from interface:BinaryIO
Read a star from the input stream.- Specified by:
readParticleRecord
in interfaceBinaryIO
- Parameters:
in
- Input stream.factor
- Scale factor to apply to the positions.- Returns:
- The star.
- Throws:
IOException
- If the read fails.
-
readParticleRecord
- Throws:
IOException
-
writeData
-
writeParticleRecord
Description copied from interface:BinaryIO
Write the star bean to the output stream.- Specified by:
writeParticleRecord
in interfaceBinaryIO
- Parameters:
sb
- The star bean.out
- The output stream.- Throws:
IOException
- If the write operation fails.
-