示例#1
0
void Ilvis2Reader::readPoint(PointRef& point, StringList s,
    std::string pointMap)
{
    point.setField(pdal::Dimension::Id::LvisLfid,
        convert<unsigned>(s, "LVIS_LFID", 0));
    point.setField(pdal::Dimension::Id::ShotNumber,
        convert<unsigned>(s, "SHOTNUMBER", 1));
    point.setField(pdal::Dimension::Id::GpsTime,
        convert<double>(s, "GPSTIME", 2));
    point.setField(pdal::Dimension::Id::LongitudeCentroid,
        Utils::normalizeLongitude(convert<double>(s, "LONGITUDE_CENTROID", 3)));
    point.setField(pdal::Dimension::Id::LatitudeCentroid,
        convert<double>(s, "LATITUDE_CENTROID", 4));
    point.setField(pdal::Dimension::Id::ElevationCentroid,
        convert<double>(s, "ELEVATION_CENTROID", 5));
    point.setField(pdal::Dimension::Id::LongitudeLow,
        Utils::normalizeLongitude(convert<double>(s, "LONGITUDE_LOW", 6)));
    point.setField(pdal::Dimension::Id::LatitudeLow,
        convert<double>(s, "LATITUDE_LOW", 7));
    point.setField(pdal::Dimension::Id::ElevationLow,
        convert<double>(s, "ELEVATION_LOW", 8));
    point.setField(pdal::Dimension::Id::LongitudeHigh,
        Utils::normalizeLongitude(convert<double>(s, "LONGITUDE_HIGH", 9)));
    point.setField(pdal::Dimension::Id::LatitudeHigh,
        convert<double>(s, "LATITUDE_HIGH", 10));
    point.setField(pdal::Dimension::Id::ElevationHigh,
        convert<double>(s, "ELEVATION_HIGH", 11));

    double x, y, z;
    pdal::Dimension::Id::Enum xd, yd, zd;

    xd = m_layout->findDim("LONGITUDE_" + pointMap);
    yd = m_layout->findDim("LATITUDE_" + pointMap);
    zd = m_layout->findDim("ELEVATION_" + pointMap);

    x = point.getFieldAs<double>(xd);
    y = point.getFieldAs<double>(yd);
    z = point.getFieldAs<double>(zd);

    point.setField(pdal::Dimension::Id::X, x);
    point.setField(pdal::Dimension::Id::Y, y);
    point.setField(pdal::Dimension::Id::Z, z);
}
示例#2
0
void RxpPointcloud::copyPoint(const Point& from, PointRef& to) const {
    using namespace Dimension;
    to.setField(Id::X, from.target.vertex[0]);
    to.setField(Id::Y, from.target.vertex[1]);
    to.setField(Id::Z, from.target.vertex[2]);
    to.setField(getTimeDimensionId(m_syncToPps), from.target.time);
    to.setField(Id::Amplitude, from.target.amplitude);
    to.setField(Id::Reflectance, from.target.reflectance);
    to.setField(Id::ReturnNumber, from.returnNumber);
    to.setField(Id::NumberOfReturns, from.numberOfReturns);
    to.setField(Id::EchoRange, from.target.echo_range);
    to.setField(Id::Deviation, from.target.deviation);
    to.setField(Id::BackgroundRadiation, from.target.background_radiation);
    to.setField(Id::IsPpsLocked, from.target.is_pps_locked);

    if (m_reflectanceAsIntensity) {
        uint16_t intensity;
        if (from.target.reflectance > m_maxReflectance) {
            intensity = (std::numeric_limits<uint16_t>::max)();
        } else if (from.target.reflectance < m_minReflectance) {
            intensity = 0;
        } else {
            intensity = uint16_t(std::roundf(double((std::numeric_limits<uint16_t>::max)()) *
                        (from.target.reflectance - m_minReflectance) / (m_maxReflectance - m_minReflectance)));
        }
        to.setField(Id::Intensity, intensity);
    }
}