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


C++ PointBuffer类代码示例

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


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

示例1: assert

boost::uint32_t DecimationFilterSequentialIterator::readBufferImpl(PointBuffer& dstData)
{
    // The client has asked us for dstData.getCapacity() points.
    // We will read from our previous stage until we get that amount (or
    // until the previous stage runs out of points).

    boost::uint32_t numPointsNeeded = dstData.getCapacity();
    assert(dstData.getNumPoints() == 0);

    // set up buffer to be filled by prev stage
    PointBuffer srcData(dstData.getSchemaLayout(), numPointsNeeded);

    while (numPointsNeeded > 0)
    {
        // read from prev stage
        const boost::uint64_t srcStartIndex = getPrevIterator().getIndex();
        const boost::uint32_t numSrcPointsRead = getPrevIterator().read(srcData);
        assert(numSrcPointsRead <= srcData.getNumPoints());
        //assert(numSrcPointsRead <= numPointsNeeded);

        // we got no data, and there is no more to get -- exit the loop
        if (numSrcPointsRead == 0) break;

        // copy points from src (prev stage) into dst (our stage), 
        // based on the CropFilter's rules (i.e. its bounds)
        const boost::uint32_t numPointsAdded = m_filter.processBuffer(dstData, srcData, srcStartIndex);

        numPointsNeeded -= numPointsAdded;
        //printf(".");fflush(stdout);
    }

    const boost::uint32_t numPointsAchieved = dstData.getNumPoints();
    return numPointsAchieved;
}
开发者ID:PingYang,项目名称:PDAL,代码行数:34,代码来源:DecimationFilterIterator.cpp

示例2: 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

示例3: processBuffer

void InPlaceReprojection::processBuffer(PointBuffer& data) const
{
    const boost::uint32_t numPoints = data.getNumPoints();

    const Schema& schema = this->getSchema();
    
    Dimension const& d_x = schema.getDimension(getOptions().getValueOrDefault<std::string>("x_dim", "X"));
    Dimension const& d_y = schema.getDimension(getOptions().getValueOrDefault<std::string>("y_dim", "Y"));
    Dimension const& d_z = schema.getDimension(getOptions().getValueOrDefault<std::string>("z_dim", "Z"));
    
    for (boost::uint32_t pointIndex=0; pointIndex<numPoints; pointIndex++)
    {
        double x = getScaledValue(data, m_x, pointIndex);
        double y = getScaledValue(data, m_y, pointIndex);
        double z = getScaledValue(data, m_z, pointIndex);
        
        // std::cout << "input: " << x << " y: " << y << " z: " << z << std::endl;
        this->transform(x,y,z);
        // std::cout << "output: " << x << " y: " << y << " z: " << z << std::endl;
        
        setScaledValue(data, x, d_x, pointIndex);
        setScaledValue(data, y, d_y, pointIndex);
        setScaledValue(data, z, d_z, pointIndex);

        // std::cout << "set: " << getScaledValue(data, d_x, pointIndex, indexX) 
        //           << " y: " << getScaledValue(data, d_y, pointIndex, indexY) 
        //           << " z: " << getScaledValue(data, d_z, pointIndex, indexZ) << std::endl;
        
        data.setNumPoints(pointIndex+1);
    }

    return;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例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: while

boost::uint32_t Mosaic::readBufferImpl(PointBuffer& destData)
{
    boost::uint32_t totalNumPointsToRead = destData.getCapacity();
    boost::uint32_t totalNumPointsRead = 0;
    boost::uint32_t destPointIndex = 0;

    // for each stage, we read as many points as we can
    while (totalNumPointsRead < totalNumPointsToRead)
    {
        assert(m_iteratorIndex < m_prevIterators.size());
        m_prevIterator = m_prevIterators[m_iteratorIndex];

        // read as much as we can into temp buffer
        PointBuffer tmp(destData.getSchema(), totalNumPointsToRead-totalNumPointsRead);
        boost::uint32_t numRead = m_prevIterator->read(tmp);
        totalNumPointsRead += numRead;

        // concat the temp buffer on to end of real dest buffer
        destData.copyPointsFast(destPointIndex, 0, tmp, numRead);
        destPointIndex += numRead;
        destData.setNumPoints(destData.getNumPoints() + numRead);

        if (m_prevIterator->atEnd())
        {
            ++m_iteratorIndex;
        }
        if (m_iteratorIndex == m_prevIterators.size())
        {
            break;
        }
    }

    return totalNumPointsRead;
}
开发者ID:mweisman,项目名称:PDAL,代码行数:34,代码来源:Mosaic.cpp

示例6: getNumPoints

boost::uint32_t Reader::processBuffer(PointBuffer& data, boost::uint64_t index) const
{
    const Schema& schema = data.getSchema();

    // how many are they asking for?
    boost::uint64_t numPointsWanted = data.getCapacity();

    // we can only give them as many as we have left
    boost::uint64_t numPointsAvailable = getNumPoints() - index;
    if (numPointsAvailable < numPointsWanted)
        numPointsWanted = numPointsAvailable;

    schema::DimensionMap* d = m_buffer.getSchema().mapDimensions(data.getSchema());

    data.setNumPoints(0);

    PointBuffer::copyLikeDimensions(m_buffer, data,
                                    *d,
                                    index,
                                    0,
                                    numPointsWanted);

    data.setNumPoints(numPointsWanted);
    delete d;
    return numPointsWanted;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例7:

boost::uint32_t ByteSwap::processBuffer(PointBuffer& dstData, const PointBuffer& srcData) const
{
    const Schema& dstSchema = dstData.getSchema();

    schema::index_by_index const& dstDims = dstSchema.getDimensions().get<schema::index>();

    dstData.setSpatialBounds(srcData.getSpatialBounds());
    dstData.copyPointsFast(0, 0, srcData, srcData.getNumPoints());

    dstData.setNumPoints(srcData.getNumPoints());

    for (boost::uint32_t i = 0; i != dstData.getNumPoints(); ++i)
    {
        boost::uint8_t* data = dstData.getData(i);
        std::size_t position = 0;
        for (boost::uint32_t n = 0; n < dstDims.size(); ++n)
        {
            const Dimension& d = dstSchema.getDimension(n);
            std::size_t size = d.getByteSize();

            boost::uint8_t* pos = data + position;
            SWAP_ENDIANNESS_N(*pos, size);
            position = position + size;
        }

    }

    return dstData.getNumPoints();
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例8: assert

boost::uint32_t Crop::readBufferImpl(PointBuffer& dstData)
{
    // The client has asked us for dstData.getCapacity() points.
    // We will read from our previous stage until we get that amount (or
    // until the previous stage runs out of points).

    boost::uint32_t numPointsNeeded = dstData.getCapacity();
    assert(dstData.getNumPoints() == 0);

    while (numPointsNeeded > 0)
    {
        if (getPrevIterator().atEnd()) break;

        // set up buffer to be filled by prev stage
        PointBuffer srcData(dstData.getSchema(), numPointsNeeded);

        // read from prev stage
        const boost::uint32_t numSrcPointsRead = getPrevIterator().read(srcData);
        assert(numSrcPointsRead == srcData.getNumPoints());
        assert(numSrcPointsRead <= numPointsNeeded);

        // we got no data, and there is no more to get -- exit the loop
        if (numSrcPointsRead == 0) break;

        // copy points from src (prev stage) into dst (our stage), 
        // based on the CropFilter's rules (i.e. its bounds)
        const boost::uint32_t numPointsProcessed = m_cropFilter.processBuffer(dstData, srcData);

        numPointsNeeded -= numPointsProcessed;
    }

    const boost::uint32_t numPointsAchieved = dstData.getNumPoints();

    return numPointsAchieved;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例9: updateBounds

void InPlaceReprojection::updateBounds(PointBuffer& buffer)
{
    const Bounds<double>& oldBounds = buffer.getSpatialBounds();

    double minx = oldBounds.getMinimum(0);
    double miny = oldBounds.getMinimum(1);
    double minz = oldBounds.getMinimum(2);
    double maxx = oldBounds.getMaximum(0);
    double maxy = oldBounds.getMaximum(1);
    double maxz = oldBounds.getMaximum(2);

    try
    {

        m_reprojectionFilter.transform(minx, miny, minz);
        m_reprojectionFilter.transform(maxx, maxy, maxz);

    }
    catch (pdal::pdal_error&)
    {
        return;
    }

    Bounds<double> newBounds(minx, miny, minz, maxx, maxy, maxz);

    buffer.setSpatialBounds(newBounds);

    return;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例10: d2

void Selector::alterSchema(PointBuffer& buffer)
{
    Schema const& original_schema = buffer.getSchema();

    Schema new_schema = buffer.getSchema();
    
    std::map<std::string, bool> const& ignoredMap = m_selectorFilter.getIgnoredMap();
    // for (std::map<std::string, bool>::const_iterator i = ignoredMap.begin();
    //     i != ignoredMap.end(); ++i)
    // {
    //     boost::optional<Dimension const&> d = original_schema.getDimensionOptional(i->first);
    //     if (d)
    //     {
    //         Dimension d2(*d);
    //         boost::uint32_t flags = d2.getFlags();
    //         if (i->second)
    //             d2.setFlags(flags | dimension::IsIgnored);
    //         new_schema.setDimension(d2);
    //     }
    // }
    // 

    schema::Map dimensions = original_schema.getDimensions();
    schema::index_by_index const& dims = dimensions.get<schema::index>();
    for (schema::index_by_index::const_iterator t = dims.begin(); 
         t != dims.end(); 
         ++t)
    {
        
        std::map<std::string, bool>::const_iterator ignored = ignoredMap.find(t->getName());
        if (ignored != ignoredMap.end())
        {
            if (ignored->second) // marked to be dropped
            {
                // set to ignored
                Dimension d2(*t);
                boost::uint32_t flags = d2.getFlags();
                d2.setFlags(flags | dimension::IsIgnored);
                new_schema.setDimension(d2);
            }
        }
        
        else { // didn't find it in our map of specified dimensions
            
            if (m_selectorFilter.doIgnoreUnspecifiedDimensions())
            {
                // set to ignored
                Dimension d2(*t);
                boost::uint32_t flags = d2.getFlags();
                d2.setFlags(flags | dimension::IsIgnored);
                new_schema.setDimension(d2);
            }
        }

    }

    buffer = PointBuffer(new_schema, buffer.getCapacity());
}
开发者ID:xhy20070406,项目名称:PDAL,代码行数:58,代码来源:Selector.cpp

示例11: 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

示例12: 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

示例13: PointBuffer

void Cache::addToCache(boost::uint64_t pointIndex, const PointBuffer& data) const
{
    PointBuffer* block = new PointBuffer(data.getSchema(), m_cacheBlockSize);
    block->copyPointsFast(0, 0, data, m_cacheBlockSize);

    m_cache->insert(pointIndex, block);

    return;
}
开发者ID:xhy20070406,项目名称:PDAL,代码行数:9,代码来源:Cache.cpp

示例14: filter

    virtual void filter(PointBuffer& buf)
    {
        if (m_dim == Dimension::Id::Unknown)
            return;

        auto cmp = [this](const PointRef& p1, const PointRef& p2)
            { return p1.compare(m_dim, p2); };

        std::sort(buf.begin(), buf.end(), cmp);
    }
开发者ID:rskelly,项目名称:PDAL,代码行数:10,代码来源:SortFilter.hpp

示例15: glClearColor

void Cursor3dSample::demonstrate(const int width, const int height, const Crystal::Graphics::ICamera<float>& camera)
{
	this->rotationMatrix = camera.getRotationMatrix();
	glClearColor(0.7f, 0.7f, 0.7f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	PointBuffer buffer;
	Point point( cursor, ColorRGBA<float>(1.0, 0.0, 0.0, 1.0), 100.0f);
	buffer.add(point);
	renderer.render(camera, buffer);
}
开发者ID:SatoshiMabuchi,项目名称:CGLib,代码行数:11,代码来源:Cursor3dSample.cpp


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