Package com.irurueta.geometry.io
Class LoaderPLY.LoaderIteratorPLY
java.lang.Object
com.irurueta.geometry.io.LoaderPLY.LoaderIteratorPLY
- All Implemented Interfaces:
LoaderIterator
- Enclosing class:
- LoaderPLY
Internal implementation of a loader iterator for PLY files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classReads alpha color component from temporal buffer using char data type.private classReads alpha color component from temporal buffer using double data type.private classReads alpha color component from temporal buffer using float32 data type.private classReads alpha color component from temporal buffer using float64 data type.private classReads alpha color component from temporal buffer using float data type.private classReads alpha color component from temporal buffer using int16 data type.private classReads alpha color component from temporal buffer using int32 data type.private classReads alpha color component from temporal buffer using int8 data type.private classReads alpha color component from temporal buffer using int data type.private classReads alpha color component from temporal buffer using short data type.private classReads alpha color component from temporal buffer using uchar data type.private classReads alpha color component from temporal buffer using uint16 data type.private classReads alpha color component from temporal buffer using uint32 data type.private classReads alpha color component from temporal buffer using uint8 data type.private classReads alpha color component from temporal buffer using uint data type.private classReads alpha color component from temporal buffer using ushort data type.private classReads a char from the file stream of data assuming that file is in ascii text format.private classReads a double from the file stream of data assuming that file is in ascii text format.private classReads a float32 from the file stream of data assuming that file is in ascii text format.private classReads a float64 from the file stream of data assuming that file is in ascii text format.private classReads a float from the file stream of data assuming that file is in ascii text format.private classReads an int16 from the file stream of data assuming that file is in ascii text format.private classReads an int32 from the file stream of data assuming that file is in ascii text format.private classReads an int8 from the file stream of data assuming that file is in ascii text format.private classReads an int from the file stream of data assuming that file is in ascii text format.private classReads a short from the file stream of data assuming that file is in ascii text format.private classReads a uchar from the file stream of data assuming that file is in ascii text format.private classReads a uint16 from the file stream of data assuming that file is in ascii text format.private classReads a uint32 from the file stream of data assuming that file is in ascii text format.private classReads a uint8 from the file stream of data assuming that file is in ascii text format.private classReads a uint from the file stream of data assuming that file is in ascii text format.private classReads a ushort from the file stream of data assuming that file is in ascii text format.private classClass to fetch vertex position within the file stream for an ascii file.private classReads a double from the file stream of data assuming that file is in big endian binary format.private classReads a float32 from the file stream of data assuming that file is in big endian binary format.private classReads a float64 from the file stream of data assuming that file is in big endian binary format.private classReads a float from the file stream of data assuming that file is in big endian binary format.private classReads an int16 from the file stream of data assuming that file is in big endian binary format.private classReads an int32 from the file stream of data assuming that file is in big endian binary format.private classReads an int from the file stream of data assuming that file is in big endian binary format.private classReads a short from the file stream of data assuming that file is in big endian binary format.private classReads a uint16 from the file stream of data assuming that file is in big endian binary format.private classReads a uint32 from the file stream of data assuming that file is in big endian binary format.private classReads a uint from the file stream of data assuming that file is in big endian binary format.private classReads a ushort from the file stream of data assuming that file is in big endian binary format.private classReads a char from the file stream of data assuming that file is in binary format.private classReads an int8 from the file stream of data assuming that file is in binary format.private classReads a double from the file stream of data assuming that file is in little endian binary format.private classReads a float32 from the file stream of data assuming that file is in little endian binary format.private classReads a float64 from the file stream of data assuming that file is in little endian binary format.private classReads a float from the file stream of data assuming that file is in little endian binary format.private classReads an int16 from the file stream of data assuming that file is in little endian binary format.private classReads an int32 from the file stream of data assuming that file is in little endian binary format.private classReads an int from the file stream of data assuming that file is in little endian binary format.private classReads a short from the file stream of data assuming that file is in little endian binary format.private classReads a uint16 from the file stream of data assuming that file is in little endian binary format.private classReads a uint32 from the file stream of data assuming that file is in little endian binary format.private classReads a uint from the file stream of data assuming that file is in little endian binary format.private classReads a ushort from the file stream of data assuming that file is in little endian binary format.private classReads a uchar from the file stream of data assuming that file is in binary format.private classReads a uint8 from the file stream of data assuming that file is in binary format.private classClass to fetch vertex position within the file stream for a binary.private classReads blue color component from temporal buffer using char data type.private classReads blue color component from temporal buffer using double data type.private classReads blue color component from temporal buffer using float32 data type.private classReads blue color component from temporal buffer using float64 data type.private classReads blue color component from temporal buffer using float data type.private classReads blue color component from temporal buffer using int16 data type.private classReads blue color component from temporal buffer using int32 data type.private classReads blue color component from temporal buffer using int8 data type.private classReads blue color component from temporal buffer using int data type.private classReads blue color component from temporal buffer using short data type.private classReads blue color component from temporal buffer using uchar data type.private classReads blue color component from temporal buffer using uint16 data type.private classReads blue color component from temporal buffer using uint32 data type.private classReads blue color component from temporal buffer using uint8 data type.private classReads blue color component from temporal buffer using uint data type.private classReads blue color component from temporal buffer using ushort data type.private classReads length value of a list header element from temporal buffer of data assuming it has char data type.private classReads the index of a face/polygon vertex from temporal buffer using char type.private classReads length value of a list header element from temporal buffer of data assuming it has double data type.private classReads the index of a face/polygon vertex from temporal buffer using double type.private classReads length value of a list header element from temporal buffer of data assuming it has float32 data type.private classReads the index of a face/polygon vertex from temporal buffer using float32 type.private classReads length value of a list header element from temporal buffer of data assuming it has float64 data type.private classReads the index of a face/polygon vertex from temporal buffer using float64 type.private classReads length value of a list header element from temporal buffer of data assuming it has float data type.private classReads the index of a face/polygon vertex from temporal buffer using float type.private classReads length value of a list header element from temporal buffer of data assuming it has int16 data type.private classReads the index of a face/polygon vertex from temporal buffer using int16 type.private classReads length value of a list header element from temporal buffer of data assuming it has int32 data type.private classReads the index of a face/polygon vertex from temporal buffer using int32 type.private classReads length value of a list header element from temporal buffer of data assuming it has int8 data type.private classReads the index of a face/polygon vertex from temporal buffer using int8 type.private classReads length value of a list header element from temporal buffer of data assuming it has int data type.private classReads the index of a face/polygon vertex from temporal buffer using int type.private classReads length value of a list header element from temporal buffer of data assuming it has short data type.private classReads the index of a face/polygon vertex from temporal buffer using short type.private classReads length value of a list header element from temporal buffer of data assuming it has uchar data type.private classReads the index of a face/polygon vertex from temporal buffer using uchar type.private classReads length value of a list header element from temporal buffer of data assuming it has uint16 data type.private classReads the index of a face/polygon vertex from temporal buffer using uint16 type.private classReads length value of a list header element from temporal buffer of data assuming it has uint32 data type.private classReads the index of a face/polygon vertex from temporal buffer using uint32 type.private classReads length value of a list header element from temporal buffer of data assuming it has uint8 data type.private classReads the index of a face/polygon vertex from temporal buffer using uint8 type.private classReads length value of a list header element from temporal buffer of data assuming it has uint data type.private classReads the index of a face/polygon vertex from temporal buffer using uint type.private classReads length value of a list header element from temporal buffer of data assuming it has ushort data type.private classReads the index of a face/polygon vertex from temporal buffer using ushort type.private classReads green color component from temporal buffer using char data type.private classReads green color component from temporal buffer using double data type.private classReads green color component from temporal buffer using float32 data type.private classReads green color component from temporal buffer using float64 data type.private classReads green color component from temporal buffer using float data type.private classReads green color component from temporal buffer using int16 data type.private classReads green color component from temporal buffer using int32 data type.private classReads green color component from temporal buffer using int8 data type.private classReads green color component from temporal buffer using int data type.private classReads green color component from temporal buffer using short data type.private classReads green color component from temporal buffer using uchar data type.private classReads green color component from temporal buffer using uint16 data type.private classReads green color component from temporal buffer using uint32 data type.private classRead green color component from temporal buffer using uint8 data type.private classReads green color component from temporal buffer using uint data type.private classReads green color component from temporal buffer using ushort data type.private classReads a vertex normal x coordinate component from temporal buffer using char type.private classReads a vertex normal x coordinate component from temporal buffer using double type.private classReads a vertex normal x coordinate component from temporal buffer using float32 type.private classReads a vertex normal x coordinate component from temporal buffer using float64 type.private classReads a vertex normal x coordinate component form temporal buffer using float type.private classReads a vertex normal x coordinate component from temporal buffer using int16 type.private classReads a vertex normal x coordinate component from temporal buffer using int32 type.private classReads a vertex normal x coordinate component from temporal buffer using int8 type.private classReads a vertex normal x coordinate component from temporal buffer using int type.private classReads a vertex normal x coordinate component from temporal buffer using short type.private classReads a vertex normal x coordinate component from temporal buffer using uchar type.private classReads a vertex normal x coordinate component from temporal buffer using uint16 type.private classReads a vertex normal x coordinate component from temporal buffer using int32 type.private classReads a vertex normal x coordinate component from temporal buffer using uint8 type.private classReads a vertex normal x coordinate component from temporal buffer using uint type.private classReads a vertex normal x coordinate component from temporal buffer using ushort type.private classReads a vertex normal y coordinate component from temporal buffer using char type.private classReads a vertex normal y coordinate component from temporal buffer using double type.private classReads a vertex normal y coordinate component from temporal buffer using float32 type.private classReads a vertex normal y coordinate component from temporal buffer using float64 type.private classReads a vertex normal y coordinate component from temporal buffer using float type.private classReads a vertex normal y coordinate component from temporal buffer using int16 type.private classReads a vertex normal y coordinate component from temporal buffer using int32 type.private classReads a vertex normal y coordinate component from temporal buffer using int8 type.private classReads a vertex normal y coordinate component from temporal buffer using int type.private classReads a vertex normal y coordinate component from temporal buffer using short type.private classReads a vertex normal y coordinate component from temporal buffer using uchar type.private classReads a vertex normal y coordinate component from temporal buffer using uint16 type.private classReads a vertex normal y coordinate component from temporal buffer using uint32 type.private classReads a vertex normal y coordinate component from temporal buffer using uint8 type.private classReads a vertex normal y coordinate component from temporal buffer using uint type.private classReads a vertex normal y coordinate component from temporal buffer using ushort type.private classReads a vertex normal z coordinate component from temporal buffer using char type.private classReads a vertex normal z coordinate component from temporal buffer using double type.private classReads a vertex normal z coordinate component from temporal buffer using float32 type.private classReads a vertex normal z coordinate component from temporal buffer using float64 type.private classReads a vertex normal z coordinate component from temporal buffer using float type.private classReads a vertex normal z coordinate component from temporal buffer using int16 type.private classReads a vertex normal z coordinate component from temporal buffer using int32 type.private classReads a vertex normal z coordinate component from temporal buffer using int8 type.private classReads a vertex normal z coordinate component from temporal buffer using int type.private classReads a vertex normal z coordinate component from temporal buffer using short type.private classReads a vertex normal z coordinate component from temporal buffer using uchar type.private classReads a vertex normal z coordinate component from temporal buffer using uint16 type.private classReads a vertex normal z coordinate component from temporal buffer using uint32 type.private classReads a vertex normal z coordinate component from temporal buffer using uint8 type.private classReads a vertex normal z coordinate component from temporal buffer using uint type.private classReads a vertex normal z coordinate component from temporal buffer using ushort type.private classReads red color component from temporal buffer using char data type.private classReads red color component from temporal buffer using double data type.private classReads red color component from temporal buffer using float32 data type.private classReads red color component from temporal buffer using float64 data type.private classReads red color component from temporal buffer using float data type.private classReads red color component from temporal buffer using int16 data type.private classReads red color component from temporal buffer using int32 data type.private classReads red color component from temporal buffer using int8 data type.private classReads red color component from temporal buffer using int data type.private classReads red color component from temporal buffer using short data type.private classReads red color component from temporal buffer using uchar data type.private classReads red color component from temporal buffer using uint16 data type.private classReads red color component from temporal buffer using uint32 data type.private classReads red color component from temporal buffer using uint8 data type.private classReads red color component from temporal buffer using uint data type.private classReads red color component from temporal buffer using ushort data type.private classReads x vertex coordinate from temporal buffer using char data type.private classReads x vertex coordinate from temporal buffer using double data type.private classReads x vertex coordinate from temporal buffer using float32 data type.private classReads x vertex coordinate from temporal buffer using float64 data type.private classReads x vertex coordinate from temporal buffer using float data type.private classReads x vertex coordinate from temporal buffer using int16 data type.private classReads x vertex coordinate from temporal buffer using int32 data type.private classReads x vertex coordinate from temporal buffer using int8 data type.private classReads x vertex coordinate from temporal buffer using int data type.private classReads x vertex coordinate from temporal buffer using short data type.private classReads x vertex coordinate from temporal buffer using uchar data type.private classReads x vertex coordinate from temporal buffer using uint16 data type.private classReads x vertex coordinate from temporal buffer using uint32 data type.private classReads x vertex coordinate from temporal buffer using uint8 data type.private classReads x vertex coordinate from temporal buffer using uint data type.private classReads x vertex coordinate from temporal buffer using ushort data type.private classReads y vertex coordinate from temporal buffer using char data type.private classReads y vertex coordinate from temporal buffer using double data type.private classReads y vertex coordinate from temporal buffer using float32 data type.private classReads y vertex coordinate from temporal buffer using float64 data type.private classReads y vertex coordinate from temporal buffer using float data type.private classReads y vertex coordinate from temporal buffer using int16 data type.private classReads y vertex coordinate from temporal buffer using int32 data type.private classReads y vertex coordinate from temporal buffer using int8 data type.private classReads y vertex coordinate from temporal buffer using int data type.private classReads y vertex coordinate from temporal buffer using short data type.private classReads y vertex coordinate from temporal buffer using uchar data type.private classReads y vertex coordinate from temporal buffer using uint16 data type.private classReads y vertex coordinate from temporal buffer using uint32 data type.private classReads y vertex coordinate from temporal buffer using uint8 data type.private classReads y vertex coordinate from temporal buffer using uint data type.private classReads y vertex coordinate from temporal buffer using ushort data type.private classReads z vertex coordinate from temporal buffer using char data type.private classReads z vertex coordinate from temporal buffer using double data type.private classReads z vertex coordinate from temporal buffer using float32 data type.private classReads z vertex coordinate from temporal buffer using float64 data type.private classReads z vertex coordinate from temporal buffer using float data type.private classReads z vertex coordinate from temporal buffer using int16 data type.private classReads z vertex coordinate from temporal buffer using int32 data type.private classReads z vertex coordinate from temporal buffer using int8 data type.private classReads z vertex coordinate from temporal buffer using int data type.private classReads z vertex coordinate from temporal buffer using short data type.private classReads z vertex coordinate from temporal buffer using uchar data type.private classReads z vertex coordinate from temporal buffer using uint16 data type.private classReads z vertex coordinate from temporal buffer using uint32 data type.private classReads z vertex coordinate from temporal buffer using uint8 data type.private classReads z vertex coordinate from temporal buffer using uint data type.private classReads z vertex coordinate from temporal buffer using ushort data type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate shortLast alpha color component that was read.private shortLast blue color component that was read.private intIndicates number of color components of vertices.private booleanIndicates whether file contains colors.private short[]Array containing vertex colors in current chunk of data.private float[]Array containing vertex coordinates in current chunk of data.private floatLast x vertex coordinate that was read.private floatLast y vertex coordinate that was read.private floatLast z vertex coordinate that was read.private longCurrent triangle/polygon being read from all faces available in the file.private longStores current position in file stream.private longStores position where header of file finishes.private ElementPLYA header element that contains face (triangles/polygons) properties.private VertexFetcherListenerListener to fetch a vertex position in the stream of data based on its vertex index.private longStores position where first vertex index containing a triangle or polygon is located.private booleanIndicates whether first vertex index position has already been read and is available.private longStores position where first vertex is located.private booleanIndicates whether first vertex position has already been read and is available.private shortLast green color component that was read.private longLast vertex index that was read.private booleanIndicates whether file contains vertex indices.private intNumber of indices currently stored in chunk.private int[]Indices of vertices in current chunk.private intNumber of indices used as a default to initialize arrays.Map containing relations between original indices of the stream (key) and their corresponding index in the chunk (value).private intNumber of elements in a list property.private LoaderIteratorListenerListener of this iterator that notifies the loader when the iterator has finished loading the file, so that the loader becomes unlocked again.private final LoaderPLYReference to a LoaderPLY.private floatMaximum x coordinate of all vertices that have been read so far in current chunk of data.private floatMaximum y coordinate of all vertices that have been read so far in current chunk of data.private floatMaximum z coordinate of all vertices that have been read so far in current chunk of data.private floatMinimum x coordinate of all vertices that have been read so far in current chunk of data.private floatMinimum y coordinate of all vertices that have been read so far in current chunk of data.private floatMinimum z coordinate of all vertices that have been read so far in current chunk of data.private booleanIndicates whether file contains normals.private float[]Normals of vertices in current chunk.private longNumber of faces (triangles or polygons) contained in the file.private longNumber of vertices contained in the file.private floatLast normal x component that was red.private floatLast normal y component that was read.private floatLast normal z component that was read.private long[]Indices of vertices in file.private shortLast red color component that was read.private longNumber of instances of a given element in the header of the file (i.e. number of vertices or faces).private longIndicates size of vertex data.private ElementPLYA header element that contains vertex properties.private longStores current stream position so that vertices positions can be cached.private booleanIndicates whether file contains vertices.private intNumber of vertices currently stored in chunk.Map relating original indices in stream (key) and stream positions (value). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddExistingVertexToChunk(int existingIndex) Adds provided vertex index into chunk of data.private voidAdds data of last vertex that has been read to the arrays of current chunk of data.private voidaddVertexPositionToMap(long originalIndex, long streamPosition) Caches provided vertex index to relate it to given stream position where vertex data can be found.private long[]buildTriangulatedIndices(List<com.irurueta.geometry.Point3D> polygonVertices, long[] plyIndices) Triangulates provided polygon having vertices corresponding to provided indices and returns an array of indices corresponding to the triangles forming the polygon.private voidFinds in file stream the location of the first vertex and face.private PLYReadValueFromStreamListenergetReadFromStreamListener(DataTypePLY dataType, PLYStorageMode storageMode) Returns a listener to read data from the file stream using provided data type (int8, uint8, int16, uint16, etc.) and storage mode (ascii, little endian or big endian).booleanhasNext()Indicates if there are still more chunks of data to be read on this PLY file.private voidThis method increases the size of arrays containing data of current chunk.private voidInitializes arrays where chunk data will be stored.next()Reads next chunk of data from PLY file.private intsearchIndexInChunk(long originalIndex) Searches corresponding index in chunk for provided stream vertex index.voidsetListener(LoaderIteratorListener listener) Sets listener to notify when this iterator has finished loading the PLY file.private voidSets the listener to read length value from temporal buffer to provided property.private voidsetReadLengthValueFromStreamListener(PropertyPLY property, PLYStorageMode storageMode) Sets the listener to read length value of a property from the file stream for a given PLY header property and using provided storage mode.private voidsetReadValueFromStreamListener(PropertyPLY property, PLYStorageMode storageMode) Sets the listener to read data from the file stream for a given PLY header property and using provided storage mode.private voidsetUp()Reads header data to set up listeners capable of reading stream data according to data types contained in header.private longsizeForDataType(DataTypePLY type) Returns size in bytes for a given data type.private voidThis method removes unnecessary data of arrays.
-
Field Details
-
loader
Reference to a LoaderPLY. -
listElems
private int listElemsNumber of elements in a list property. -
coordX
private float coordXLast x vertex coordinate that was read. -
coordY
private float coordYLast y vertex coordinate that was read. -
coordZ
private float coordZLast z vertex coordinate that was read. -
red
private short redLast red color component that was read. -
green
private short greenLast green color component that was read. -
blue
private short blueLast blue color component that was read. -
alpha
private short alphaLast alpha color component that was read. -
nX
private float nXLast normal x component that was red. -
nY
private float nYLast normal y component that was read. -
nZ
private float nZLast normal z component that was read. -
index
private long indexLast vertex index that was read. -
minX
private float minXMinimum x coordinate of all vertices that have been read so far in current chunk of data. -
minY
private float minYMinimum y coordinate of all vertices that have been read so far in current chunk of data. -
minZ
private float minZMinimum z coordinate of all vertices that have been read so far in current chunk of data. -
maxX
private float maxXMaximum x coordinate of all vertices that have been read so far in current chunk of data. -
maxY
private float maxYMaximum y coordinate of all vertices that have been read so far in current chunk of data. -
maxZ
private float maxZMaximum z coordinate of all vertices that have been read so far in current chunk of data. -
verticesAvailable
private boolean verticesAvailableIndicates whether file contains vertices. -
colorsAvailable
private boolean colorsAvailableIndicates whether file contains colors. -
indicesAvailable
private boolean indicesAvailableIndicates whether file contains vertex indices. -
normalsAvailable
private boolean normalsAvailableIndicates whether file contains normals. -
colorComponents
private int colorComponentsIndicates number of color components of vertices. -
endHeaderStreamPosition
private long endHeaderStreamPositionStores position where header of file finishes. -
numberOfVertices
private long numberOfVerticesNumber of vertices contained in the file. -
numberOfFaces
private long numberOfFacesNumber of faces (triangles or polygons) contained in the file. -
firstVertexStreamPosition
private long firstVertexStreamPositionStores position where first vertex is located. -
firstVertexStreamPositionAvailable
private boolean firstVertexStreamPositionAvailableIndicates whether first vertex position has already been read and is available. -
vertexDataSize
private long vertexDataSizeIndicates size of vertex data. -
firstFaceStreamPosition
private long firstFaceStreamPositionStores position where first vertex index containing a triangle or polygon is located. -
firstFaceStreamPositionAvailable
private boolean firstFaceStreamPositionAvailableIndicates whether first vertex index position has already been read and is available. -
currentStreamPosition
private long currentStreamPositionStores current position in file stream. -
totalInstances
private long totalInstancesNumber of instances of a given element in the header of the file (i.e. number of vertices or faces). -
vertexElement
A header element that contains vertex properties. -
faceElement
A header element that contains face (triangles/polygons) properties. -
currentFace
private long currentFaceCurrent triangle/polygon being read from all faces available in the file. -
fetchVertexListener
Listener to fetch a vertex position in the stream of data based on its vertex index. There are implementations for binary and text (ascii) fetchers. -
listener
Listener of this iterator that notifies the loader when the iterator has finished loading the file, so that the loader becomes unlocked again. -
coordsInChunkArray
private float[] coordsInChunkArrayArray containing vertex coordinates in current chunk of data. Data is stored sequentially as x1, y1, z1, x2, y2, z2, etc. -
colorsInChunkArray
private short[] colorsInChunkArrayArray containing vertex colors in current chunk of data. Data is stored sequentially depending on the number of color components. For instance, for RGB this would be: r1, g1, b1, r2, g2, b2, etc. -
indicesInChunkArray
private int[] indicesInChunkArrayIndices of vertices in current chunk. Indices are stored sequentially in sets of 3 forming triangles like this: t1a, t1b, t1c, t2a, t2b, t2c, etc. -
originalIndicesInChunkArray
private long[] originalIndicesInChunkArrayIndices of vertices in file. Original indices might differ of indices numeration in current chunk because for each chunk indices start again at zero. Indices are stored sequentially in sets of 3 forming triangles like: t1a, t1b, t1c, t2a, t2b, t2c, etc. -
normalsInChunkArray
private float[] normalsInChunkArrayNormals of vertices in current chunk. Normals are stored sequentially for each vertex like this: n1x, n1y, n1z, n2x, n2y, n2z, etc. -
verticesInChunk
private int verticesInChunkNumber of vertices currently stored in chunk. This is used to determine when no more vertices can be stored in a chunk and an additional chunk needs to be loaded. -
indicesInChunk
private int indicesInChunkNumber of indices currently stored in chunk. -
indicesInChunkSize
private int indicesInChunkSizeNumber of indices used as a default to initialize arrays. When the number of indices exceeds this value arrays will be resized. -
vertexStreamPosition
private long vertexStreamPositionStores current stream position so that vertices positions can be cached. -
indicesMap
Map containing relations between original indices of the stream (key) and their corresponding index in the chunk (value). -
verticesStreamPositionsMap
Map relating original indices in stream (key) and stream positions (value).
-
-
Constructor Details
-
LoaderIteratorPLY
Constructor.- Parameters:
loader- Reference to the loader controlling this iterator.- Throws:
LoaderException- Raised if file is corrupted and cannot be loaded.IOException- if an I/O error occurs.
-
-
Method Details
-
setListener
Sets listener to notify when this iterator has finished loading the PLY file.- Parameters:
listener- listener to notify when this iterator has finished loading the PLY file.
-
hasNext
public boolean hasNext()Indicates if there are still more chunks of data to be read on this PLY file.- Specified by:
hasNextin interfaceLoaderIterator- Returns:
- True if there are more chunks of data, false otherwise.
-
next
Reads next chunk of data from PLY file.- Specified by:
nextin interfaceLoaderIterator- Returns:
- A chunk of data containing vertex coordinates, colors, vertex normals, textures, etc.
- Throws:
NotAvailableException- Raised if no more chunks are available.LoaderException- Raised if file is corrupted and cannot be loaded.IOException- Raised if an I/O error occurs.
-
buildTriangulatedIndices
private long[] buildTriangulatedIndices(List<com.irurueta.geometry.Point3D> polygonVertices, long[] plyIndices) throws com.irurueta.geometry.TriangulatorException Triangulates provided polygon having vertices corresponding to provided indices and returns an array of indices corresponding to the triangles forming the polygon.- Parameters:
polygonVertices- vertices forming a polygon to be triangulated.plyIndices- indices corresponding to provided polygon.- Returns:
- array of indices corresponding to the triangles forming the polygon.
- Throws:
com.irurueta.geometry.TriangulatorException- if triangulation fails because polygon is degenerate or vertices contains invalid values such as NaN or infinity.
-
initChunkArrays
private void initChunkArrays()Initializes arrays where chunk data will be stored. -
searchIndexInChunk
private int searchIndexInChunk(long originalIndex) Searches corresponding index in chunk for provided stream vertex index.- Parameters:
originalIndex- Index in original stream of data.- Returns:
- Vertex index in current chunk of data.
-
addVertexPositionToMap
private void addVertexPositionToMap(long originalIndex, long streamPosition) Caches provided vertex index to relate it to given stream position where vertex data can be found. This method only has effect for ASCII PLY files.- Parameters:
originalIndex- Vertex index in original stream of data.streamPosition- Stream position where vertex is found.
-
addNewVertexDataToChunk
private void addNewVertexDataToChunk()Adds data of last vertex that has been read to the arrays of current chunk of data. -
addExistingVertexToChunk
private void addExistingVertexToChunk(int existingIndex) Adds provided vertex index into chunk of data. This method is only called when duplicate vertices are allowed in chunks of data.- Parameters:
existingIndex- Index to be added into chunk.
-
increaseIndicesArraySize
private void increaseIndicesArraySize()This method increases the size of arrays containing data of current chunk. This method is called when arrays get full and need to be enlarged. -
trimArrays
private void trimArrays()This method removes unnecessary data of arrays. This method is called when finishing the processing of current chunk of data. -
setUp
Reads header data to set up listeners capable of reading stream data according to data types contained in header.- Throws:
LoaderException- Raised if file is corrupted (header is invalid).IOException- if an I/O error occurs.
-
sizeForDataType
Returns size in bytes for a given data type.- Parameters:
type- A data type.- Returns:
- Size in bytes for a given data type.
-
findFirstVertexAndFaceStreamPosition
private void findFirstVertexAndFaceStreamPosition() throws LoaderException, NotAvailableException, IOExceptionFinds in file stream the location of the first vertex and face.- Throws:
LoaderException- Raised if file is corrupted and location of first vertex or face cannot be found.NotAvailableException- Raised if header does not contain a given element.IOException- if an I/O error occurs.
-
setReadValueFromStreamListener
private void setReadValueFromStreamListener(PropertyPLY property, PLYStorageMode storageMode) throws NotAvailableException Sets the listener to read data from the file stream for a given PLY header property and using provided storage mode.- Parameters:
property- A PLY header property.storageMode- Storage mode of file.- Throws:
NotAvailableException- Raised if the listener cannot be set for provided property and storage mode.
-
setReadLengthValueFromStreamListener
private void setReadLengthValueFromStreamListener(PropertyPLY property, PLYStorageMode storageMode) throws NotAvailableException Sets the listener to read length value of a property from the file stream for a given PLY header property and using provided storage mode.- Parameters:
property- A PLY header property.storageMode- Storage mode of file.- Throws:
NotAvailableException- Raised if the listener cannot be set for provided property and storage mode.
-
getReadFromStreamListener
private PLYReadValueFromStreamListener getReadFromStreamListener(DataTypePLY dataType, PLYStorageMode storageMode) Returns a listener to read data from the file stream using provided data type (int8, uint8, int16, uint16, etc.) and storage mode (ascii, little endian or big endian).- Parameters:
dataType- Data type to read.storageMode- Storage mode of file.- Returns:
- A listener.
-
setReadLengthValueFromBufferListener
private void setReadLengthValueFromBufferListener(PropertyPLY property) throws NotAvailableException Sets the listener to read length value from temporal buffer to provided property.- Parameters:
property- A PLY header property.- Throws:
NotAvailableException- Raised if a listener cannot be set for given property because its data type is not supported.
-