Esempio n. 1
0
/// Get a dimension type list for the storage schema.
/// \return  Storage dimension types.
DimTypeList DbWriter::dbDimTypes() const
{
    using namespace Dimension;

    DimTypeList dimTypes;
    for (auto di = m_dimTypes.begin(); di != m_dimTypes.end(); ++di)
        dimTypes.push_back(DimType(di->m_id, di->m_type, XForm()));

    if (!m_locationScaling)
        return dimTypes;

    //ONLY for location scaling...
    for (auto di = dimTypes.begin(); di != dimTypes.end(); ++di)
    {
        if (di->m_id == Id::X)
        {
            di->m_xform = m_xXform;
            di->m_type = Type::Signed32;
        }
        if (di->m_id == Id::Y)
        {
            di->m_xform = m_yXform;
            di->m_type = Type::Signed32;
        }
        if (di->m_id == Id::Z)
        {
            di->m_xform = m_zXform;
            di->m_type = Type::Signed32;
        }
    }
    return dimTypes;
}
Esempio n. 2
0
 /// Load the point buffer from memory whose arrangement is specified
 /// by the dimension list.
 /// \param[in] dims  Dimension/types of data in packed order
 /// \param[in] idx   Index of point to write.
 /// \param[in] buf   Packed data buffer.
 void setPackedPoint(const DimTypeList& dims, PointId idx, const char *buf)
 {
     for (auto di = dims.begin(); di != dims.end(); ++di)
     {
         setField(di->m_id, di->m_type, idx, (const void *)buf);
         buf += Dimension::size(di->m_type);
     }
 }
Esempio n. 3
0
 /// Fill a buffer with point data specified by the dimension list.
 /// \param[in] dims  List of dimensions/types to retrieve.
 /// \param[in] idx   Index of point to get.
 /// \param[in] buf   Pointer to buffer to fill.
 void getPackedPoint(const DimTypeList& dims, PointId idx, char *buf) const
 {
     for (auto di = dims.begin(); di != dims.end(); ++di)
     {
         getField(buf, di->m_id, di->m_type, idx);
         buf += Dimension::size(di->m_type);
     }
 }
Esempio n. 4
0
void Block::update(XMLSchema *s)
{
    using namespace Dimension;

    m_point_size = 0; // Wipe the size to reset
    m_num_remaining = num_points;
    m_schema.setOrientation(s->orientation());
    DimTypeList dims = s->dimTypes();
    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        if (di->m_id == Id::X || di->m_id == Id::Y || di->m_id == Id::Z)
            m_schema.setXForm(di->m_id, di->m_xform);
        m_point_size += Dimension::size(di->m_type);
    }
}
Esempio n. 5
0
point_count_t OciReader::readDimMajor(PointView& view, BlockPtr block,
    point_count_t numPts)
{
    using namespace Dimension;

    point_count_t numRemaining = block->numRemaining();
    PointId startId = view.size();
    point_count_t blockRemaining = numRemaining;
    point_count_t numRead = 0;

    DimTypeList dims = dbDimTypes();
    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        PointId nextId = startId;
        char *pos = seekDimMajor(*di, block);
        blockRemaining = numRemaining;
        numRead = 0;
        while (numRead < numPts && blockRemaining > 0)
        {
            writeField(view, pos, *di, nextId);
            pos += Dimension::size(di->m_type);

            if (di->m_id == Id::PointSourceId && m_updatePointSourceId)
                view.setField(Id::PointSourceId, nextId, block->obj_id);

            if (m_cb && di == dims.rbegin().base() - 1)
                m_cb(view, nextId);

            nextId++;
            numRead++;
            blockRemaining--;
        }
    }
    block->setNumRemaining(blockRemaining);
    return numRead;
}