RDB 2
Public Member Functions | List of all members
riegl::rdb::pointcloud::QueryFill Class Reference

Point fill query. More...

#include <queryFill.hpp>

Public Member Functions

 QueryFill ()
 Default constructor. More...
 
 QueryFill (riegl::rdb::PointcloudData *pointcloud, const std::vector< GraphNode::ID > *nodes, const std::string &filter)
 Constructor. More...
 
 operator bool () const
 Check if query is not null. More...
 
bool valid () const
 Check if query is not null. More...
 
void close ()
 Finish query. More...
 
void bind (const std::string &attribute, const DataType dataType, const void *buffer)
 Bind attribute buffer. More...
 
template<typename ValueType >
void bindBuffer (const std::string &attribute, const ValueType &buffer)
 Bind attribute buffer. More...
 
template<typename ObjectType , typename MemberPointer >
void bindMember (const std::string &attribute, const ObjectType &object, const MemberPointer member)
 Bind attribute buffer. More...
 
template<typename ObjectType , typename MemberPointer >
void bindMember (const std::string &attribute, const ObjectType &object, const MemberPointer member, const std::size_t index)
 Bind attribute buffer. More...
 
std::uint32_t next (std::uint32_t count)
 Fill points. More...
 
std::uint32_t progress () const
 Progress. More...
 

Detailed Description

Point fill query.

This class can be used to set attributes of existing points to a (one) specific value (e.g. set "riegl.selected" to "1" for all points). This query is similar to using select() and update() except that it only accepts one value per point attribute and this value is copied to all points.

See also
riegl::rdb::Pointcloud::fill()
Note
You either must delete the query object or call close() before the parent Pointcloud instance is closed/deleted!
Examples:
rdb-example-07-fill-points.cpp.

Definition at line 71 of file queryFill.hpp.

Constructor & Destructor Documentation

riegl::rdb::pointcloud::QueryFill::QueryFill ( )
explicit

Default constructor.

Creates a null query - i.e. the query cannot be used to modify points.

See also
riegl::rdb::Pointcloud::fill()
riegl::rdb::pointcloud::QueryFill::QueryFill ( riegl::rdb::PointcloudData *  pointcloud,
const std::vector< GraphNode::ID > *  nodes,
const std::string &  filter 
)
explicit

Constructor.

Creates a query prepared for modifying points.

Note
You cannot create new QueryFill objects this way, use riegl::rdb::Pointcloud::fill() instead.

Member Function Documentation

void riegl::rdb::pointcloud::QueryFill::bind ( const std::string &  attribute,
const DataType  dataType,
const void *  buffer 
)

Bind attribute buffer.

Use this function to define a source buffer for a point attribute. Exactly one buffer can be defined for an attribute (i.e. only the most recently defined buffer will be used).

The buffer is expected to be 1*s*d bytes large, where s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).

Note
This function just stores the buffer pointer. So make sure that the buffer remains valid until you call next().
If the value contained in the buffer is equal to the value of a point in the database, then the point is not updated. So if the values of all points are equal to the given value, then no points are updated and the point attribute revision stored at the primary index node will not change.
See also
riegl::rdb::pointcloud::PointAttributes
Parameters
[in]attributeattribute name
[in]dataTypebuffer data type
[in]bufferbuffer location
template<typename ValueType >
void riegl::rdb::pointcloud::QueryFill::bindBuffer ( const std::string &  attribute,
const ValueType &  buffer 
)
inline

Bind attribute buffer.

Use this function to define a source buffer for a point attribute. Exactly one buffer can be defined for an attribute (i.e. only the most recently defined buffer will be used).

The buffer is expected to be 1*s*d bytes large, where s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).

Note
This function just stores the buffer pointer. So make sure that the buffer remains valid until you call next().
If the value contained in the buffer is equal to the value of a point in the database, then the point is not updated. So if the values of all points are equal to the given value, then no points are updated and the point attribute revision stored at the primary index node will not change.
See also
riegl::rdb::pointcloud::PointAttributes
Parameters
[in]attributeattribute name
[in]bufferbuffer (data, pointer to data, std::array or std::vector)
Examples:
rdb-example-07-fill-points.cpp.

Definition at line 148 of file queryFill.hpp.

template<typename ObjectType , typename MemberPointer >
void riegl::rdb::pointcloud::QueryFill::bindMember ( const std::string &  attribute,
const ObjectType &  object,
const MemberPointer  member 
)
inline

Bind attribute buffer.

This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer.

See also
bindBuffer()
Parameters
[in]attributeattribute name
[in]objecte.g. first object of container
[in]memberobject member variable pointer

Definition at line 165 of file queryFill.hpp.

template<typename ObjectType , typename MemberPointer >
void riegl::rdb::pointcloud::QueryFill::bindMember ( const std::string &  attribute,
const ObjectType &  object,
const MemberPointer  member,
const std::size_t  index 
)
inline

Bind attribute buffer.

This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer.

See also
bindBuffer()
Parameters
[in]attributeattribute name
[in]objecte.g. first object of container
[in]memberobject member variable pointer
[in]indexindex for array-like object members

Definition at line 176 of file queryFill.hpp.

void riegl::rdb::pointcloud::QueryFill::close ( )

Finish query.

Call this function when done with modifying points.

std::uint32_t riegl::rdb::pointcloud::QueryFill::next ( std::uint32_t  count)

Fill points.

Use this function to actually read the point attributes from all defined buffers and update the points in the database.

To process all points, you need to repeatedly call next() until it returns 0 (zero, see example 7). The number of points to process in one step is defined by 'count'. Please note that the actual number of processed points may be slightly different. To cancel processing just stop calling next() and cancel (rollback) the transaction.

Note
IEEE-754 "NaN" values contained in floating point source buffers are ignored and the attribute's default value is used instead. Furthermore IEEE-754 "Infinity" values will always cause next() to fail with error code 10414, i.e. riegl::rdb::Error::QueryAttributeValueOutOfRange.
Since version 2.4.2, unit vector point attributes (e.g. "riegl.direction") are automatically normalized (divided by the vector length) on insertion. This is done for all point attributes that meet the following requirements: length is 3, minimumValue is -1, maximumValue is 1, resolution is not 1, scaleFactor is 1, unitSymbol is empty, invalidValue is undefined and tags contains the "direction" tag but not the "do-not-normalize" tag.
Returns
the number of points processed
Parameters
[in]countnumber of points to process
Examples:
rdb-example-07-fill-points.cpp.
riegl::rdb::pointcloud::QueryFill::operator bool ( ) const

Check if query is not null.

See also
valid()
std::uint32_t riegl::rdb::pointcloud::QueryFill::progress ( ) const

Progress.

This function returns a coarse progress information in percent (0..100%). Since the total number of modified points is not known in advance, this value just reflects the progress of the (internal) index traversal.

Examples:
rdb-example-07-fill-points.cpp.
bool riegl::rdb::pointcloud::QueryFill::valid ( ) const

Check if query is not null.

A null query cannot be used to read points.


The documentation for this class was generated from the following file: