5 #include <DetailedVoxel.h>
9 #include <HeliosException.h>
69 std::string
const & path,
70 size_t numHeaderLines=2,
71 bool const exactFormat =
true,
72 bool const discardNullPad =
false,
73 std::string
const separator =
" "
83 std::string
const & path,
84 size_t numHeaderLines=2,
85 bool const exactFormat =
true,
86 bool const discardNullPad =
false,
87 std::string
const separator =
" "
98 void loadFile(std::vector<std::string> &lines, std::string
const & path);
112 std::vector<std::string> &lines,
113 size_t const numHeaderLines,
114 bool &minCornerXFound,
116 bool &minCornerYFound,
118 bool &minCornerZFound,
120 bool &maxCornerXFound,
122 bool &maxCornerYFound,
124 bool &maxCornerZFound,
158 std::string
const &line,
159 bool &minCornerXFound,
161 bool &minCornerYFound,
163 bool &minCornerZFound,
165 bool &maxCornerXFound,
167 bool &maxCornerYFound,
169 bool &maxCornerZFound,
236 std::string
const &line,
237 bool &minCornerXFound,
239 bool &minCornerYFound,
241 bool &minCornerZFound,
243 bool &maxCornerXFound,
245 bool &maxCornerYFound,
247 bool &maxCornerZFound,
274 std::vector<std::string> &lines,
275 size_t numHeaderLines
283 bool minCornerXFound,
284 bool minCornerYFound,
285 bool minCornerZFound,
286 bool maxCornerXFound,
287 bool maxCornerYFound,
288 bool maxCornerZFound,
307 std::string
const separator,
308 bool const exactFormat,
309 bool const discardNullPad,
320 double voxelHalfSize,
Class which extends Voxel to support AMAPVox format with extra features.
Definition: DetailedVoxel.h:15
Class for parsing voxel files.
Definition: VoxelFileParser.h:19
static char const BLANK_CHARACTERS[N_BLANK_CHARACTERS]
Characters considered "blank".
Definition: VoxelFileParser.h:30
void cleanLines(std::vector< std::string > &lines, size_t const numHeaderLines, bool &minCornerXFound, double &minCornerX, bool &minCornerYFound, double &minCornerY, bool &minCornerZFound, double &minCornerZ, bool &maxCornerXFound, double &maxCornerX, bool &maxCornerYFound, double &maxCornerY, bool &maxCornerZFound, double &maxCornerZ, bool &splitXFound, size_t &splitX, bool &splitYFound, size_t &splitY, bool &splitZFound, size_t &splitZ, double &voxelSize, double &maxPad)
Clean unnecessary lines.
Definition: VoxelFileParser.cpp:120
void loadFile(std::vector< std::string > &lines, std::string const &path)
Loads the file at given path.
Definition: VoxelFileParser.cpp:99
static constexpr size_t N_BLANK_CHARACTERS
Nummber of blank characters.
Definition: VoxelFileParser.h:26
DetailedVoxel * parseDetailedVoxelLine(std::string &line, std::string const separator, bool const exactFormat, bool const discardNullPad, char const *format1, char const *format2, char const *format3, double minCornerX, double minCornerY, double minCornerZ, double maxCornerX, double maxCornerY, double maxCornerZ, double voxelSize, double voxelHalfSize, double maxPad)
Parse the DetailedVoxel specified in given line.
Definition: VoxelFileParser.cpp:456
bool handleSpecLine(std::string const &line, bool &minCornerXFound, double &minCornerX, bool &minCornerYFound, double &minCornerY, bool &minCornerZFound, double &minCornerZ, bool &maxCornerXFound, double &maxCornerX, bool &maxCornerYFound, double &maxCornerY, bool &maxCornerZFound, double &maxCornerZ, bool &splitXFound, size_t &splitX, bool &splitYFound, size_t &splitY, bool &splitZFound, size_t &splitZ, double &voxelSize, double &maxPad)
Handle line if it is an spec line. Do nothing otherwise.
Definition: VoxelFileParser.cpp:194
void validateDetailed(bool minCornerXFound, bool minCornerYFound, bool minCornerZFound, bool maxCornerXFound, bool maxCornerYFound, bool maxCornerZFound, bool splitXFound, bool splitYFound, bool splitZFound)
Check if flags are valid.
Definition: VoxelFileParser.cpp:398
void cleanLine(std::string &line)
Remove unnecessary stuff from received line.
Definition: VoxelFileParser.cpp:349
std::vector< std::shared_ptr< DetailedVoxel > > parseDetailed(std::string const &path, size_t numHeaderLines=2, bool const exactFormat=true, bool const discardNullPad=false, std::string const separator=" ")
Parse detailed voxels specified at file located at given path.
Definition: VoxelFileParser.cpp:7
void handleSpec(std::string const &line, bool &minCornerXFound, double &minCornerX, bool &minCornerYFound, double &minCornerY, bool &minCornerZFound, double &minCornerZ, bool &maxCornerXFound, double &maxCornerX, bool &maxCornerYFound, double &maxCornerY, bool &maxCornerZFound, double &maxCornerZ, bool &splitXFound, size_t &splitX, bool &splitYFound, size_t &splitY, bool &splitZFound, size_t &splitZ, double &voxelSize, double &maxPad)
Assuming received line is a spec line, handle it.
Definition: VoxelFileParser.cpp:251
VoxelFileParser()
Build a VoxelFileParser.
Definition: VoxelFileParser.h:42
std::vector< DetailedVoxel * > bruteParseDetailed(std::string const &path, size_t numHeaderLines=2, bool const exactFormat=true, bool const discardNullPad=false, std::string const separator=" ")
Like parseDetailed but returns a vector a normla pointers instead of shared pointers.
Definition: VoxelFileParser.cpp:24
static constexpr char SPEC_CHARACTER
Character which starts spec lines.
Definition: VoxelFileParser.h:34
void removeHeaderLines(std::vector< std::string > &lines, size_t numHeaderLines)
Remove header lines.
Definition: VoxelFileParser.cpp:391
bool isBlankLine(std::string const &line)
Check if the line is a blank line.
Definition: VoxelFileParser.cpp:178