Skip to content

Commit

Permalink
Don't allow 'all' for readers.las.extra_dims.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Mar 6, 2018
1 parent dac7cfe commit cfb72b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion io/LasReader.cpp
Expand Up @@ -159,7 +159,7 @@ void LasReader::initializeLocal(PointTableRef table, MetadataNode& m)
{
try
{
m_extraDims = LasUtils::parse(m_extraDimSpec);
m_extraDims = LasUtils::parse(m_extraDimSpec, false);
}
catch (const LasUtils::error& err)
{
Expand Down
7 changes: 6 additions & 1 deletion io/LasUtils.cpp
Expand Up @@ -212,7 +212,7 @@ std::vector<IgnoreVLR> parseIgnoreVLRs(const StringList& ignored)
return ignoredVLRs;

}
std::vector<ExtraDim> parse(const StringList& dimString)
std::vector<ExtraDim> parse(const StringList& dimString, bool allOk)
{
std::vector<ExtraDim> extraDims;
bool all = false;
Expand All @@ -221,6 +221,11 @@ std::vector<ExtraDim> parse(const StringList& dimString)
{
if (dim == "all")
{
// We only accept all for LasWriter.
if (!allOk)
throw error("Invalid extra dimension specified: '" + dim +
"'. Need <dimension>=<type>. See documentation "
" for details.");
all = true;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion io/LasUtils.hpp
Expand Up @@ -171,7 +171,7 @@ struct error : public std::runtime_error
{}
};

std::vector<ExtraDim> parse(const StringList& dimString);
std::vector<ExtraDim> parse(const StringList& dimString, bool allOk);


struct IgnoreVLR
Expand Down
2 changes: 1 addition & 1 deletion io/LasWriter.cpp
Expand Up @@ -152,7 +152,7 @@ void LasWriter::initialize()
#endif
try
{
m_extraDims = LasUtils::parse(m_extraDimSpec);
m_extraDims = LasUtils::parse(m_extraDimSpec, true);
}
catch (const LasUtils::error& err)
{
Expand Down

0 comments on commit cfb72b4

Please sign in to comment.