ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
E57SimpleReader.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Stan Coleby (scoleby@intelisum.com)
3  * Copyright (c) 2020 PTC Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person or organization
6  * obtaining a copy of the software and accompanying documentation covered by
7  * this license (the "Software") to use, reproduce, display, distribute,
8  * execute, and transmit the Software, and to prepare derivative works of the
9  * Software, and to permit third-parties to whom the Software is furnished to
10  * do so, all subject to the following:
11  *
12  * The copyright notices in the Software and this entire statement, including
13  * the above license grant, this restriction and the following disclaimer,
14  * must be included in all copies of the Software, in whole or in part, and
15  * all derivative works of the Software, unless such copies or derivative
16  * works are solely in the form of machine-executable object code generated by
17  * a source language processor.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26  */
27 
28 #include "E57SimpleReader.h"
29 #include "ReaderImpl.h"
30 
31 namespace e57
32 {
33 
34  Reader::Reader( const ustring &filePath ) : impl_( new ReaderImpl( filePath ) )
35  {
36  }
37 
38  bool Reader::IsOpen() const
39  {
40  return impl_->IsOpen();
41  };
42 
44  {
45  return impl_->Close();
46  };
47 
48  bool Reader::GetE57Root( E57Root &fileHeader ) const
49  {
50  return impl_->GetE57Root( fileHeader );
51  };
52 
53  int64_t Reader::GetImage2DCount() const
54  {
55  return impl_->GetImage2DCount();
56  };
57 
58  bool Reader::ReadImage2D( int64_t imageIndex, Image2D &image2DHeader ) const
59  {
60  return impl_->ReadImage2D( imageIndex, image2DHeader );
61  };
62 
63  bool Reader::GetImage2DSizes( int64_t imageIndex, Image2DProjection &imageProjection, Image2DType &imageType,
64  int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize,
65  Image2DType &imageMaskType, Image2DType &imageVisualType ) const
66  {
67  return impl_->GetImage2DSizes( imageIndex, imageProjection, imageType, imageWidth, imageHeight, imageSize,
68  imageMaskType, imageVisualType );
69  };
70 
71  int64_t Reader::ReadImage2DData( int64_t imageIndex, Image2DProjection imageProjection, Image2DType imageType,
72  void *pBuffer, int64_t start, int64_t count ) const
73  {
74  return impl_->ReadImage2DData( imageIndex, imageProjection, imageType, pBuffer, start, count );
75  };
76 
77  int64_t Reader::GetData3DCount() const
78  {
79  return impl_->GetData3DCount();
80  };
81 
83  {
84  return impl_->GetRawIMF();
85  }
86 
88  {
89  return impl_->GetRawE57Root();
90  };
91 
93  {
94  return impl_->GetRawData3D();
95  };
96 
98  {
99  return impl_->GetRawImages2D();
100  };
101 
102  bool Reader::ReadData3D( int64_t dataIndex, Data3D &data3DHeader ) const
103  {
104  return impl_->ReadData3D( dataIndex, data3DHeader );
105  }
106 
107  bool Reader::GetData3DSizes( int64_t dataIndex, int64_t &rowMax, int64_t &columnMax, int64_t &pointsSize,
108  int64_t &groupsSize, int64_t &countSize, bool &bColumnIndex ) const
109  {
110  return impl_->GetData3DSizes( dataIndex, rowMax, columnMax, pointsSize, groupsSize, countSize, bColumnIndex );
111  }
112 
113  bool Reader::ReadData3DGroupsData( int64_t dataIndex, int64_t groupCount, int64_t *idElementValue,
114  int64_t *startPointIndex, int64_t *pointCount ) const
115  {
116  return impl_->ReadData3DGroupsData( dataIndex, groupCount, idElementValue, startPointIndex, pointCount );
117  }
118 
119  CompressedVectorReader Reader::SetUpData3DPointsData( int64_t dataIndex, size_t pointCount,
120  const Data3DPointsData &buffers ) const
121  {
122  return impl_->SetUpData3DPointsData( dataIndex, pointCount, buffers );
123  }
124 
125  CompressedVectorReader Reader::SetUpData3DPointsData( int64_t dataIndex, size_t pointCount,
126  const Data3DPointsData_d &buffers ) const
127  {
128  return impl_->SetUpData3DPointsData( dataIndex, pointCount, buffers );
129  }
130 
131 } // end namespace e57
E57 Simple API for reading E57.
int count
most of the functions follows Reader
Definition: ReaderImpl.h:37
bool ReadImage2D(int64_t imageIndex, Image2D &image2DHeader) const
This function returns the image2D header and positions the cursor.
bool GetData3DSizes(int64_t dataIndex, int64_t &rowMax, int64_t &columnMax, int64_t &pointsSize, int64_t &groupsSize, int64_t &countSize, bool &columnIndex) const
This function returns the size of the point data.
VectorNode GetRawImages2D() const
Returns the raw Image2D Vector Node.
bool IsOpen() const
This function returns true if the file is open.
StructureNode GetRawE57Root() const
Returns the file raw E57Root Structure Node.
int64_t ReadImage2DData(int64_t imageIndex, Image2DProjection imageProjection, Image2DType imageType, void *buffer, int64_t start, int64_t count) const
This function reads an image.
bool ReadData3D(int64_t dataIndex, Data3D &data3DHeader) const
This function returns the Data3D header.
Reader(const ustring &filePath)
This function is the constructor for the reader class.
bool GetImage2DSizes(int64_t imageIndex, Image2DProjection &imageProjection, Image2DType &imageType, int64_t &imageWidth, int64_t &imageHeight, int64_t &imageSize, Image2DType &imageMaskType, Image2DType &imageVisualType) const
This function returns the size of the image data.
ImageFile GetRawIMF() const
Returns the ram ImageFile Node which is need to add enhancements.
VectorNode GetRawData3D() const
Returns the raw Data3D Vector Node.
int64_t GetImage2DCount() const
This function returns the total number of Picture Blocks.
int64_t GetData3DCount() const
This function returns the total number of Data3D Blocks.
bool Close()
This function closes the file.
bool ReadData3DGroupsData(int64_t dataIndex, int64_t groupCount, int64_t *idElementValue, int64_t *startPointIndex, int64_t *pointCount) const
This funtion reads the group data into the provided buffers.
CompressedVectorReader SetUpData3DPointsData(int64_t dataIndex, size_t pointCount, const Data3DPointsData &buffers) const
Use this function to read the actual 3D data.
bool GetE57Root(E57Root &fileHeader) const
This function returns the file header information.
Image2DProjection
Identifies the representation for the image data.
Image2DType
Identifies the format representation for the image data.
std::string ustring
UTF-8 encodeded Unicode string.
Definition: E57Format.h:54
Stores pointers to user-provided buffers.
Stores the top-level information for a single lidar scan.
Stores the top-level information for the XML section of the file.
Stores an image from a camera.