本文整理汇总了C++中PointView::hasDim方法的典型用法代码示例。如果您正苦于以下问题:C++ PointView::hasDim方法的具体用法?C++ PointView::hasDim怎么用?C++ PointView::hasDim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointView
的用法示例。
在下文中一共展示了PointView::hasDim方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillWriteBuf
point_count_t LasWriter::fillWriteBuf(const PointView& view,
PointId startId, std::vector<char>& buf)
{
point_count_t blocksize = buf.size() / m_lasHeader.pointLen();
blocksize = std::min(blocksize, view.size() - startId);
bool hasColor = m_lasHeader.hasColor();
bool hasTime = m_lasHeader.hasTime();
PointId lastId = startId + blocksize;
static const size_t maxReturnCount = m_lasHeader.maxReturnCount();
LeInserter ostream(buf.data(), buf.size());
for (PointId idx = startId; idx < lastId; idx++)
{
// we always write the base fields
using namespace Dimension;
uint8_t returnNumber(1);
uint8_t numberOfReturns(1);
if (view.hasDim(Id::ReturnNumber))
{
returnNumber = view.getFieldAs<uint8_t>(Id::ReturnNumber,
idx);
if (returnNumber < 1 || returnNumber > maxReturnCount)
m_error.returnNumWarning(returnNumber);
}
if (view.hasDim(Id::NumberOfReturns))
numberOfReturns = view.getFieldAs<uint8_t>(
Id::NumberOfReturns, idx);
if (numberOfReturns == 0)
m_error.numReturnsWarning(0);
if (numberOfReturns > maxReturnCount)
{
if (m_discardHighReturnNumbers)
{
// If this return number is too high, pitch the point.
if (returnNumber > maxReturnCount)
continue;
numberOfReturns = maxReturnCount;
}
else
m_error.numReturnsWarning(numberOfReturns);
}
double xOrig = view.getFieldAs<double>(Id::X, idx);
double yOrig = view.getFieldAs<double>(Id::Y, idx);
double zOrig = view.getFieldAs<double>(Id::Z, idx);
double x = (xOrig - m_xXform.m_offset) / m_xXform.m_scale;
double y = (yOrig - m_yXform.m_offset) / m_yXform.m_scale;
double z = (zOrig - m_zXform.m_offset) / m_zXform.m_scale;
ostream << boost::numeric_cast<int32_t>(lround(x));
ostream << boost::numeric_cast<int32_t>(lround(y));
ostream << boost::numeric_cast<int32_t>(lround(z));
uint16_t intensity = 0;
if (view.hasDim(Id::Intensity))
intensity = view.getFieldAs<uint16_t>(Id::Intensity, idx);
ostream << intensity;
uint8_t scanDirectionFlag(0);
if (view.hasDim(Id::ScanDirectionFlag))
scanDirectionFlag = view.getFieldAs<uint8_t>(
Id::ScanDirectionFlag, idx);
uint8_t edgeOfFlightLine(0);
if (view.hasDim(Id::EdgeOfFlightLine))
edgeOfFlightLine = view.getFieldAs<uint8_t>(
Id::EdgeOfFlightLine, idx);
uint8_t bits = returnNumber | (numberOfReturns<<3) |
(scanDirectionFlag << 6) | (edgeOfFlightLine << 7);
ostream << bits;
uint8_t classification = 0;
if (view.hasDim(Id::Classification))
classification = view.getFieldAs<uint8_t>(Id::Classification,
idx);
ostream << classification;
int8_t scanAngleRank = 0;
if (view.hasDim(Id::ScanAngleRank))
scanAngleRank = view.getFieldAs<int8_t>(Id::ScanAngleRank,
idx);
ostream << scanAngleRank;
uint8_t userData = 0;
if (view.hasDim(Id::UserData))
userData = view.getFieldAs<uint8_t>(Id::UserData, idx);
ostream << userData;
uint16_t pointSourceId = 0;
if (view.hasDim(Id::PointSourceId))
pointSourceId = view.getFieldAs<uint16_t>(Id::PointSourceId,
idx);
ostream << pointSourceId;
if (hasTime)
{
double t = 0.0;
//.........这里部分代码省略.........