当前位置: 首页>>代码示例>>C++>>正文


C++ PointBuffer::size方法代码示例

本文整理汇总了C++中PointBuffer::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PointBuffer::size方法的具体用法?C++ PointBuffer::size怎么用?C++ PointBuffer::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointBuffer的用法示例。


在下文中一共展示了PointBuffer::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readDimMajor

point_count_t BpfReader::readDimMajor(PointBuffer& data, point_count_t count)
{
    PointId idx(0);
    PointId startId = data.size();
    point_count_t numRead = 0;
    for (size_t d = 0; d < m_dims.size(); ++d)
    {
        idx = m_index;
        PointId nextId = startId;
        numRead = 0;
        seekDimMajor(d, idx);
        for (; numRead < count && idx < numPoints(); idx++, numRead++, nextId++)
        {
            float f;

            m_stream >> f;
            data.setField(m_dims[d].m_id, nextId, f + m_dims[d].m_offset);
        }
    }
    m_index = idx;

    // Transformation only applies to X, Y and Z
    for (PointId idx = startId; idx < data.size(); idx++)
    {
        double x = data.getFieldAs<double>(Dimension::Id::X, idx);
        double y = data.getFieldAs<double>(Dimension::Id::Y, idx);
        double z = data.getFieldAs<double>(Dimension::Id::Z, idx);
        m_header.m_xform.apply(x, y, z);
        data.setField(Dimension::Id::X, idx, x);
        data.setField(Dimension::Id::Y, idx, y);
        data.setField(Dimension::Id::Z, idx, z);
    }

    return numRead;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:35,代码来源:BpfReader.cpp

示例2: clipEdge

    inline void clipEdge( bool closePolygon,
                          PointBuffer<Point> &points, PointBuffer<Point> &clippedPoints ) const
    {
        clippedPoints.reset();

        if ( points.size() < 2 )
        {
            if ( points.size() == 1 )
                clippedPoints.add( points[0] );
            return;
        }

        const Edge edge( d_clipRect.x(), d_clipRect.x() + d_clipRect.width(),
                         d_clipRect.y(), d_clipRect.y() + d_clipRect.height() );

        int lastPos, start;
        if ( closePolygon )
        {
            start = 0;
            lastPos = points.size() - 1;
        }
        else
        {
            start = 1;
            lastPos = 0;

            if ( edge.isInside( points[0] ) )
                clippedPoints.add( points[0] );
        }

        const uint nPoints = points.size();
        for ( uint i = start; i < nPoints; i++ )
        {
            const Point &p1 = points[i];
            const Point &p2 = points[lastPos];

            if ( edge.isInside( p1 ) )
            {
                if ( edge.isInside( p2 ) )
                {
                    clippedPoints.add( p1 );
                }
                else
                {
                    clippedPoints.add( edge.intersection( p1, p2 ) );
                    clippedPoints.add( p1 );
                }
            }
            else
            {
                if ( edge.isInside( p2 ) )
                {
                    clippedPoints.add( edge.intersection( p1, p2 ) );
                }
            }
            lastPos = i;
        }
    }
开发者ID:iclosure,项目名称:jframework,代码行数:58,代码来源:qwt_clipper.cpp

示例3: readByteMajor

point_count_t BpfReader::readByteMajor(PointBuffer& data, point_count_t count)
{
    PointId idx(0);
    PointId startId = data.size();
    point_count_t numRead = 0;

    // We need a temp buffer for the point data.
    union uu
    {
        float f;
        uint32_t u32;
    };
    std::unique_ptr<union uu> uArr(
        new uu[std::min(count, numPoints() - m_index)]);

    for (size_t d = 0; d < m_dims.size(); ++d)
    {
        for (size_t b = 0; b < sizeof(float); ++b)
        {
            idx = m_index;
            numRead = 0;
            PointId nextId = startId;
            seekByteMajor(d, b, idx);

            for (;numRead < count && idx < numPoints();
                idx++, numRead++, nextId++)
            {
                union uu& u = *(uArr.get() + numRead);

                if (b == 0)
                    u.u32 = 0;
                uint8_t u8;
                m_stream >> u8;
                u.u32 |= ((uint32_t)u8 << (b * CHAR_BIT));
                if (b == 3)
                {
                    u.f += m_dims[d].m_offset;
                    data.setField(m_dims[d].m_id, nextId, u.f);
                }
            }
        }
    }
    m_index = idx;

    // Transformation only applies to X, Y and Z
    for (PointId idx = startId; idx < data.size(); idx++)
    {
        double x = data.getFieldAs<double>(Dimension::Id::X, idx);
        double y = data.getFieldAs<double>(Dimension::Id::Y, idx);
        double z = data.getFieldAs<double>(Dimension::Id::Z, idx);
        m_header.m_xform.apply(x, y, z);
        data.setField(Dimension::Id::X, idx, x);
        data.setField(Dimension::Id::Y, idx, y);
        data.setField(Dimension::Id::Z, idx, z);
    }

    return numRead;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:58,代码来源:BpfReader.cpp

示例4: readPointMajor

point_count_t BpfReader::readPointMajor(PointBuffer& data, point_count_t count)
{
    PointId nextId = data.size();
    PointId idx = m_index;
    point_count_t numRead = 0;
    seekPointMajor(idx);
    while (numRead < count && idx < numPoints())
    {
        for (size_t d = 0; d < m_dims.size(); ++d)
        {
            float f;

            m_stream >> f;
            data.setField(m_dims[d].m_id, nextId, f + m_dims[d].m_offset);
        }

        // Transformation only applies to X, Y and Z
        double x = data.getFieldAs<double>(Dimension::Id::X, nextId);
        double y = data.getFieldAs<double>(Dimension::Id::Y, nextId);
        double z = data.getFieldAs<double>(Dimension::Id::Z, nextId);
        m_header.m_xform.apply(x, y, z);
        data.setField(Dimension::Id::X, nextId, x);
        data.setField(Dimension::Id::Y, nextId, y);
        data.setField(Dimension::Id::Z, nextId, z);

        idx++;
        numRead++;
        nextId++;
    }
    m_index = idx;
    return numRead;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:32,代码来源:BpfReader.cpp

示例5: crop

void Crop::crop(PointBuffer& input, PointBuffer& output)
{
    bool logOutput = (log()->getLevel() > LogLevel::Debug4);
    if (logOutput)
        log()->floatPrecision(8);

    for (PointId idx = 0; idx < input.size(); ++idx)
    {
        double x = input.getFieldAs<double>(Dimension::Id::X, idx);
        double y = input.getFieldAs<double>(Dimension::Id::Y, idx);
        double z = input.getFieldAs<double>(Dimension::Id::Z, idx);

        if (logOutput)
        {
            log()->floatPrecision(10);
            log()->get(LogLevel::Debug5) << "input: " << x << " y: " << y <<
                " z: " << z << std::endl;
        }

        if (m_poly.empty())
        {
            // We don't have a polygon, just a bounds. Filter on that
            // by itself.
            if (!m_cropOutside && m_bounds.contains(x, y, z))
                output.appendPoint(input, idx);
        }
#ifdef PDAL_HAVE_GEOS
        else
        {
            int ret(0);

            // precise filtering based on the geometry
            GEOSCoordSequence* coords =
                GEOSCoordSeq_create_r(m_geosEnvironment, 1, 3);
            if (!coords)
                throw pdal_error("unable to allocate coordinate sequence");
            ret = GEOSCoordSeq_setX_r(m_geosEnvironment, coords, 0, x);
            if (!ret)
                throw pdal_error("unable to set x for coordinate sequence");
            ret = GEOSCoordSeq_setY_r(m_geosEnvironment, coords, 0, y);
            if (!ret)
                throw pdal_error("unable to set y for coordinate sequence");
            ret = GEOSCoordSeq_setZ_r(m_geosEnvironment, coords, 0, z);
            if (!ret)
                throw pdal_error("unable to set z for coordinate sequence");

            GEOSGeometry* p = GEOSGeom_createPoint_r(m_geosEnvironment, coords);
            if (!p)
                throw pdal_error("unable to allocate candidate test point");

            if (static_cast<bool>(GEOSPreparedContains_r(m_geosEnvironment,
                m_geosPreparedGeometry, p)) != m_cropOutside)
                output.appendPoint(input, idx);
            GEOSGeom_destroy_r(m_geosEnvironment, p);
        }
#endif
    }
}
开发者ID:pramsey,项目名称:PDAL,代码行数:58,代码来源:Crop.cpp

示例6: begin

void BufferedInvocation::begin(PointBuffer& buffer)
{
    PointContext ctx = buffer.m_context;
    Dimension::IdList const& dims = ctx.dims();

    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        Dimension::Id::Enum d = *di;
        Dimension::Detail *dd = ctx.dimDetail(d);
        void *data = malloc(dd->size() * buffer.size());
        m_buffers.push_back(data);  // Hold pointer for deallocation
        char *p = (char *)data;
        for (PointId idx = 0; idx < buffer.size(); ++idx)
        {
            buffer.getFieldInternal(d, idx, (void *)p);
            p += dd->size();
        }
        std::string name = ctx.dimName(*di);
        insertArgument(name, (uint8_t *)data, dd->type(), buffer.size());
    }
}
开发者ID:rskelly,项目名称:PDAL,代码行数:21,代码来源:BufferedInvocation.cpp

示例7: read

point_count_t PgReader::read(PointBuffer& buffer, point_count_t count)
{
    if (eof())
        return 0;

    log()->get(LogLevel::Debug) << "readBufferImpl called with "
        "PointBuffer filled to " << buffer.size() << " points" <<
        std::endl;

    point_count_t totalNumRead = 0;
    while (totalNumRead < count)
    {
        if (m_patch.remaining == 0)
            if (!NextBuffer())
                return totalNumRead;
        PointId bufBegin = buffer.size();
        point_count_t numRead = readPgPatch(buffer, count - totalNumRead);
        PointId bufEnd = bufBegin + numRead;
        totalNumRead += numRead;
    }
    return totalNumRead;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:22,代码来源:PgReader.cpp

示例8: filter

void AttributeFilter::filter(PointBuffer& buffer)
{

    for (auto& dim_par : m_dimensions)
    {
        if (dim_par.second.isogr)
        {
            UpdateGEOSBuffer(buffer, dim_par.second);
        }  else
        {
            for (PointId i = 0; i < buffer.size(); ++i)
            {
                double v = boost::lexical_cast<double>(dim_par.second.value);
                buffer.setField(dim_par.second.dim, i, v);
            }

        }
    }
}
开发者ID:rskelly,项目名称:PDAL,代码行数:19,代码来源:AttributeFilter.cpp

示例9: readPgPatch

point_count_t PgReader::readPgPatch(PointBuffer& buffer, point_count_t numPts)
{
    point_count_t numRemaining = m_patch.remaining;
    PointId nextId = buffer.size();
    point_count_t numRead = 0;

    size_t offset = ((m_patch.count - m_patch.remaining) * m_point_size);
    char *pos = (char *)(m_patch.binary.data() + offset);

    while (numRead < numPts && numRemaining > 0)
    {
        writePoint(buffer, nextId, pos);
        pos += m_point_size;
        numRemaining--;
        nextId++;
        numRead++;
    }
    m_patch.remaining = numRemaining;
    return numRead;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:20,代码来源:PgReader.cpp

示例10: checkPoints

void Diff::checkPoints(const PointBuffer& source_data,
    const PointBuffer& candidate_data, ptree& errors)
{
    uint32_t i(0);
    uint32_t MAX_BADBYTES(20);
    uint32_t badbytes(0);

    // Both schemas have already been determined to be equal, so are the
    // same size and in the same order.
    Dimension::IdList const& sourceDims = source_data.dims();
    Dimension::IdList const& candidateDims = candidate_data.dims();

    char sbuf[8];
    char cbuf[8];
    for (PointId idx = 0; idx < source_data.size(); ++idx)
    {
        for (size_t d = 0; d < sourceDims.size(); ++d)
        {
            Dimension::Id::Enum sd = sourceDims[d];
            Dimension::Id::Enum cd = candidateDims[d];

            source_data.getRawField(sd, idx, (void *)sbuf);
            candidate_data.getRawField(cd, idx, (void *)cbuf);
            Dimension::Type::Enum t = Dimension::defaultType(cd);
            size_t size = Dimension::size(t);
            if (memcmp(sbuf, cbuf, size))
            {
                std::ostringstream oss;

                oss << "Point " << idx << " differs for dimension \"" <<
                    Dimension::name(sd) << "\" for source and candidate";
                errors.put<std::string>("data.error", oss.str());
                badbytes++;
            }
        }
        if (badbytes > MAX_BADBYTES )
            break;
    }
}
开发者ID:pramsey,项目名称:PDAL,代码行数:39,代码来源:Diff.cpp

示例11: read

point_count_t SbetReader::read(PointBuffer& buf, point_count_t count)
{
    PointId nextId = buf.size();
    PointId idx = m_index;
    point_count_t numRead = 0;
    seek(idx);
    Dimension::IdList dims = getDefaultDimensions();
    while (numRead < count && idx < m_numPts)
    {
        for (auto di = dims.begin(); di != dims.end(); ++di)
        {
            double d;
            *m_stream >> d;
            Dimension::Id::Enum dim = *di;
            buf.setField(dim, nextId, d);
        }
        idx++;
        nextId++;
        numRead++;
    }
    m_index = idx;
    return numRead;
}
开发者ID:pramsey,项目名称:PDAL,代码行数:23,代码来源:SbetReader.cpp

示例12: end

void BufferedInvocation::end(PointBuffer& buffer)
{
    // for each entry in the script's outs dictionary,
    // look up that entry's name in the schema and then
    // copy the data into the right dimension spot in the
    // buffer

    std::vector<std::string> names;
    getOutputNames(names);

    PointContext ctx = buffer.m_context;
    Dimension::IdList const& dims = ctx.dims();

    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        Dimension::Id::Enum d = *di;
        Dimension::Detail *dd = ctx.dimDetail(d);
        std::string name = ctx.dimName(*di);
        auto found = std::find(names.begin(), names.end(), name);
        if (found == names.end()) continue; // didn't have this dim in the names

        assert(name == *found);
        assert(hasOutputVariable(name));

        size_t size = dd->size();
        void *data = extractResult(name, dd->type());
        char *p = (char *)data;
        for (PointId idx = 0; idx < buffer.size(); ++idx)
        {
            buffer.setField(d, dd->type(), idx, (void *)p);
            p += size;
        }
    }
    for (auto bi = m_buffers.begin(); bi != m_buffers.end(); ++bi)
        free(*bi);
    m_buffers.clear();
}
开发者ID:rskelly,项目名称:PDAL,代码行数:37,代码来源:BufferedInvocation.cpp

示例13: setPoints

point_count_t GreyhoundReader::setPoints(
        PointBuffer& pointBuffer,
        const char* data,
        const point_count_t pointsToRead) const
{
    PointId nextId(pointBuffer.size());

    std::size_t dataOffset(0);
    point_count_t numRead(0);

    while (numRead < pointsToRead)
    {
        for (auto dim : m_dimData)
        {
            pointBuffer.setField(dim.id, dim.type, nextId, data + dataOffset);
            dataOffset += Dimension::size(dim.type);
        }

        ++nextId;
        ++numRead;
    }

    return numRead;
}
开发者ID:pramsey,项目名称:PDAL,代码行数:24,代码来源:GreyhoundReader.cpp

示例14: read

point_count_t Reader::read(PointBuffer& buf, point_count_t count)
{
    //All data we read for icebridge is currently 4 bytes wide, so
    //  just allocate once and forget it.
    //This could be a huge allocation.  Perhaps we should do something
    //  in the icebridge handler?

    PointId startId = buf.size();
    point_count_t remaining = m_hdf5Handler.getNumPoints() - m_index;
    count = std::min(count, remaining);

    std::unique_ptr<unsigned char>
        rawData(new unsigned char[count * sizeof(float)]);

    //Not loving the position-linked data, but fine for now.
    Dimension::IdList dims = getDefaultDimensions();
    auto di = dims.begin();
    for (auto ci = hdf5Columns.begin(); ci != hdf5Columns.end(); ++ci, ++di)
    {
        PointId nextId = startId;
        PointId idx = m_index;
        const hdf5::Hdf5ColumnData& column = *ci;

        try
        {
            m_hdf5Handler.getColumnEntries(rawData.get(), column.name, count,
                m_index);
            void *p = (void *)rawData.get();

            // This is ugly but avoids a test in a tight loop.
            if (column.predType == H5::PredType::NATIVE_FLOAT)
            {
                // Offset time is in ms but icebridge stores in seconds.
                if (*di == Dimension::Id::OffsetTime)
                {
                    float *fval = (float *)p;
                    for (PointId i = 0; i < count; ++i)
                    {
                        buf.setField(*di, nextId++, *fval * 1000);
                        fval++;
                    }
                }
                else
                {
                    float *fval = (float *)p;
                    for (PointId i = 0; i < count; ++i)
                        buf.setField(*di, nextId++, *fval++);
                }
            }
            else if (column.predType == H5::PredType::NATIVE_INT)
            {
                int32_t *ival = (int32_t *)p;
                for (PointId i = 0; i < count; ++i)
                    buf.setField(*di, nextId++, *ival++);
            }
        }
        catch(...)
        {
            throw icebridge_error("Error fetching column data");
        }
    }
    return count;
}
开发者ID:simonsonc,项目名称:PDAL,代码行数:63,代码来源:Reader.cpp

示例15: read

point_count_t TerrasolidReader::read(PointBuffer& data, point_count_t count)
{
    count = std::min(count, getNumPoints() - m_index);

    uint8_t *buf = new uint8_t[m_size * count];
    Utils::read_n(buf, *m_istream, m_size * count);

    //See https://www.terrasolid.com/download/tscan.pdf
    // This spec is awful, but it's something.  
    // The scaling adjustments are different than what we used to do and
    // seem wrong (scaling the offset is odd), but that's what the document
    // says.
    // Also modified the fetch of time/color based on header flag (rather
    // than just not write the data into the buffer).
    PointId nextId = data.size();
    while (!eof())
    {
        uint8_t* p = buf + m_size * m_index;

        if (m_format == TERRASOLID_Format_1)
        {
            uint8_t classification = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Classification, nextId,
                    classification);

            uint8_t flight_line = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::PointSourceId, nextId,
                flight_line);

            uint16_t echo_int = Utils::read_field<uint16_t>(p);
            data.setField(Dimension::Id::ReturnNumber, nextId, echo_int);

            int32_t x = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::X, nextId,
                (x - m_header->OrgX) / m_header->Units);

            int32_t y = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::Y, nextId,
                (y - m_header->OrgY) / m_header->Units);

            int32_t z = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::Z, nextId,
                (z - m_header->OrgZ) / m_header->Units);
        }

        if (m_format == TERRASOLID_Format_2)
        {
            int32_t x = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::X, nextId,
                (x - m_header->OrgX) / m_header->Units);

            int32_t y = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::Y, nextId,
                (y - m_header->OrgY) / m_header->Units);

            int32_t z = Utils::read_field<int32_t>(p);
            data.setField(Dimension::Id::Z, nextId,
                (z - m_header->OrgZ) / m_header->Units);

            uint8_t classification = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Classification, nextId,
                classification);

            uint8_t return_number = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::ReturnNumber, nextId,
                return_number);

            uint8_t flag = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Flag, nextId, flag);

            uint8_t mark = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Mark, nextId, mark);

            uint16_t flight_line = Utils::read_field<uint16_t>(p);
            data.setField(Dimension::Id::PointSourceId, nextId,
                flight_line);

            uint16_t intensity = Utils::read_field<uint16_t>(p);
            data.setField(Dimension::Id::Intensity, nextId, intensity);
        }

        if (m_haveTime)
        {
            uint32_t t = Utils::read_field<uint32_t>(p);
            if (m_index == 0)
                m_baseTime = t;
            t -= m_baseTime;    //Offset from the beginning of the read.
                                //instead of GPS week.
            t /= 5;             //5000ths of a second to milliseconds
            data.setField(Dimension::Id::OffsetTime, nextId, t);
        }

        if (m_haveColor)
        {
            uint8_t red = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Red, nextId, red);

            uint8_t green = Utils::read_field<uint8_t>(p);
            data.setField(Dimension::Id::Green, nextId,  green);

//.........这里部分代码省略.........
开发者ID:rskelly,项目名称:PDAL,代码行数:101,代码来源:TerrasolidReader.cpp


注:本文中的PointBuffer::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。