Helios++
Helios software for LiDAR simulations
Las14VectorialSyncFileMeasurementWriter.h
1 #pragma once
2 
3 #include <filems/write/comps/LasSyncFileWriter.h>
4 #include <filems/write/strategies/LasMeasurementWriteStrategy.h>
5 #include <filems/write/strategies/VectorialWriteStrategy.h>
6 #include <Measurement.h>
7 
8 #include <glm/glm.hpp>
9 
10 #include <memory>
11 #include <string>
12 
13 
14 namespace helios{ namespace filems{
15 
16 using std::make_shared;
17 
30  public LasSyncFileWriter<
31  vector<Measurement> const &,
32  glm::dvec3 const &
33  >
34 {
35 protected:
36  // *** ATTRIBUTES *** //
37  // ******************** //
45 
46 public:
47  // *** CONSTRUCTION / DESTRUCTION *** //
48  // ************************************ //
55  const std::string &path,
56  bool const compress = false,
57  double const scaleFactor = 0.0001,
58  glm::dvec3 const offset = glm::dvec3(0, 0, 0),
59  double const minIntensity = 0.0,
60  double const deltaIntensity = 1000000.0,
61  bool const createWriter = true
62  ) :
64  vector<Measurement> const &,
65  glm::dvec3 const &
66  >(
67  path,
68  compress,
69  scaleFactor,
70  offset,
71  minIntensity,
72  deltaIntensity,
73  false
74  ),
75  lmws(
76  *lw,
77  lws.lp,
78  lws.scaleFactorInverse,
79  lws.offset,
80  lws.minIntensity,
81  lws.maxIntensity,
82  lws.intensityCoefficient,
83  lws.ewAttrStart,
84  lws.fwiAttrStart,
85  lws.hoiAttrStart,
86  lws.ampAttrStart
87  )
88  {
89  // If construct requires creating the wi
90  if(createWriter){
91  // Create the LASWriter
92  createLasWriter(path, compress);
93  // In-place update LasMeasurementWriteStrategy
95  *lw,
96  lws.lp,
98  lws.offset,
106  );
107  }
108  // Write strategy
109  this->writeStrategy = make_shared<VectorialWriteStrategy<
110  Measurement,
111  glm::dvec3 const &
112  >>(lmws);
113  }
114 
115  // *** CREATE WRITER *** //
116  // *********************** //
123  void craftSpec(LasWriterSpec &lws) override {lws.craft14();}
124 };
125 
126 }}
Class representing a measurement.
Definition: Measurement.h:13
Concrete class specializing LasSyncFileWriter to write a vector of measurements to a LAS14 file.
Definition: Las14VectorialSyncFileMeasurementWriter.h:34
Las14VectorialSyncFileMeasurementWriter(const std::string &path, bool const compress=false, double const scaleFactor=0.0001, glm::dvec3 const offset=glm::dvec3(0, 0, 0), double const minIntensity=0.0, double const deltaIntensity=1000000.0, bool const createWriter=true)
LAS-1.4 vectorial synchronous file measurement vector writer constructor.
Definition: Las14VectorialSyncFileMeasurementWriter.h:54
LasMeasurementWriteStrategy lmws
The measurement write strategy that is wrapped by the main write strategy in a vectorial fashion ( fi...
Definition: Las14VectorialSyncFileMeasurementWriter.h:44
void craftSpec(LasWriterSpec &lws) override
Assist the LasSyncFileWriter::createLasWriters method by crafting the given specification using the 1...
Definition: Las14VectorialSyncFileMeasurementWriter.h:123
Concrete class specializing WriteStrategy to directly write measurements to a file with LAS format.
Definition: LasMeasurementWriteStrategy.h:23
Abstract specialization of SingleSyncFileWriter to write output in LAS format.
Definition: LasSyncFileWriter.h:23
LasWriterSpec lws
The specification defining the LAS writer.
Definition: LasSyncFileWriter.h:30
std::shared_ptr< LASwriter > lw
LASwriter. Used to write to LAS file.
Definition: LasSyncFileWriter.h:34
virtual void createLasWriter(const std::string &path, bool const compress)
Creation of the LasWriter itself, including LASpoint initialization.
Definition: LasSyncFileWriter.h:88
Class representing the specification defining a LasWriter (not the writer itself)
Definition: LasWriterSpec.h:23
void craft14()
Craft the header of the LAS File for version 1.4.
Definition: LasWriterSpec.h:221
LASpoint lp
LASpoint used to build different points which shall be written to LAS output file.
Definition: LasWriterSpec.h:39
double maxIntensity
Maximum value for intensity. Values greater than this will be clipped to maxIntensity.
Definition: LasWriterSpec.h:73
I32 ampAttrStart
Helios amplitude attribute start (LAS extra bytes format)
Definition: LasWriterSpec.h:124
glm::dvec3 offset
Offset for coordinates.
Definition: LasWriterSpec.h:63
I32 fwiAttrStart
Full wave index attribute start (LAS extra bytes format)
Definition: LasWriterSpec.h:116
I32 hoiAttrStart
Hit object ID attribute start (LAS extra bytes format)
Definition: LasWriterSpec.h:120
I32 ewAttrStart
Echo width attribute start (LAS extra bytes format)
Definition: LasWriterSpec.h:112
double scaleFactorInverse
Inverse of the scale factor.
Definition: LasWriterSpec.h:55
double intensityCoefficient
Precomputed intensity coefficient.
Definition: LasWriterSpec.h:92
double minIntensity
Minimum value for intensity. Values less than this will be clipped to minIntensity.
Definition: LasWriterSpec.h:68
std::string path
Path to file to be written.
Definition: SingleSyncFileWriter.h:28
std::shared_ptr< WriteStrategy< WriteArgs ... > > writeStrategy
The write strategy specifying how to write data to file.
Definition: SingleSyncFileWriter.h:36
Concrete class specializing WriteStrategy to make any other write strategy operate over a vector.
Definition: VectorialWriteStrategy.h:23