![]() |
RDB 2
|
Point insert query. More...
#include <queryInsert.hpp>
Public Member Functions | |
QueryInsert () | |
Default constructor. More... | |
QueryInsert (riegl::rdb::PointcloudData *pointcloud) | |
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 | loadMultiPassSettings (const std::string &json) |
Load multi-pass insert settings from JSON string. More... | |
void | bind (const std::string &attribute, const DataType dataType, const void *buffer, const std::int32_t stride=0) |
Bind attribute buffer. More... | |
void | bindId (const DataType dataType, void *buffer, const std::int32_t stride=0) |
Bind point id buffer. More... | |
template<typename ValueType > | |
void | bindBuffer (const std::string &attribute, const ValueType &buffer, const std::int32_t stride=0) |
Bind attribute buffer. More... | |
template<typename ValueType > | |
void | bindIdBuffer (ValueType &buffer, const std::int32_t stride=0) |
Bind point id buffer. More... | |
template<typename ValueType > | |
void | bindIdBuffer (ValueType *buffer, const std::int32_t stride=0) |
Bind point id 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 | bindIdMember (ObjectType &object, MemberPointer member) |
Bind point id 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... | |
template<typename ObjectType , typename MemberPointer > | |
void | bindIdMember (ObjectType &object, MemberPointer member, const std::size_t index) |
Bind point id buffer. More... | |
std::uint32_t | next (std::uint32_t count) |
Insert points. More... | |
Point insert query.
This class can be used to insert (new) points into the database.
Definition at line 67 of file queryInsert.hpp.
|
explicit |
Default constructor.
Creates a null query - i.e. the query cannot be used to insert points.
|
explicit |
Constructor.
Creates a query prepared for inserting points.
void riegl::rdb::pointcloud::QueryInsert::bind | ( | const std::string & | attribute, |
const DataType | dataType, | ||
const void * | buffer, | ||
const std::int32_t | stride = 0 |
||
) |
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).
You can but don't need to define a buffer for each attribute. If no buffer is defined for an attribute, the attribute's default value will be used instead.
The buffer is expected to be n*s*d bytes large, where n is the number of points defined in next(), s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).
[in] | attribute | attribute name |
[in] | dataType | buffer data type |
[in] | buffer | buffer location |
[in] | stride | bytes between beginnings of successive elements (0: auto) |
|
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).
You can but don't need to define a buffer for each attribute. If no buffer is defined for an attribute, the attribute's default value will be used instead.
The buffer is expected to be n*s*d bytes large, where n is the number of points defined in next(), s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).
[in] | attribute | attribute name |
[in] | buffer | buffer (data, pointer to data, std::array or std::vector) |
[in] | stride | bytes between beginnings of successive elements (0: auto) |
Definition at line 206 of file queryInsert.hpp.
void riegl::rdb::pointcloud::QueryInsert::bindId | ( | const DataType | dataType, |
void * | buffer, | ||
const std::int32_t | stride = 0 |
||
) |
Bind point id buffer.
If you provide a buffer for the point identifier attribute ("riegl.id"), then it will receive the identifiers of the inserted points (PID). Each point is assigned a unique PID on insertion. The PID starts at 1 for the first point and is incremented by 1 for each subsequent point (so that the PID reflects the insertion order of the points, but only as long as riegl::rdb::pointcloud::CreateSettings::optimizePointID is set to false).
[in] | dataType | buffer data type |
[in] | buffer | buffer location |
[in] | stride | bytes between beginnings of successive elements (0: auto) |
|
inline |
Bind point id buffer.
If you provide a buffer for the point identifier attribute ("riegl.id"), then it will receive the identifiers of the inserted points (PID). Each point is assigned a unique PID on insertion. The PID starts at 1 for the first point and is incremented by 1 for each subsequent point (so that the PID reflects the insertion order of the points, but only as long as riegl::rdb::pointcloud::CreateSettings::optimizePointID is set to false).
[in] | buffer | buffer (data, pointer to data, std::array or std::vector) |
[in] | stride | bytes between beginnings of successive elements (0: auto) |
Definition at line 220 of file queryInsert.hpp.
|
inline |
Bind point id buffer.
If you provide a buffer for the point identifier attribute ("riegl.id"), then it will receive the identifiers of the inserted points (PID). Each point is assigned a unique PID on insertion. The PID starts at 1 for the first point and is incremented by 1 for each subsequent point (so that the PID reflects the insertion order of the points, but only as long as riegl::rdb::pointcloud::CreateSettings::optimizePointID is set to false).
[in] | buffer | buffer (data, pointer to data, std::array or std::vector) |
[in] | stride | bytes between beginnings of successive elements (0: auto) |
Definition at line 233 of file queryInsert.hpp.
|
inline |
Bind point id buffer.
If you provide a buffer for the point identifier attribute ("riegl.id"), then it will receive the identifiers of the inserted points (PID). Each point is assigned a unique PID on insertion. The PID starts at 1 for the first point and is incremented by 1 for each subsequent point (so that the PID reflects the insertion order of the points, but only as long as riegl::rdb::pointcloud::CreateSettings::optimizePointID is set to false).
[in] | object | e.g. first object of container |
[in] | member | object member variable pointer |
Definition at line 269 of file queryInsert.hpp.
|
inline |
Bind point id buffer.
If you provide a buffer for the point identifier attribute ("riegl.id"), then it will receive the identifiers of the inserted points (PID). Each point is assigned a unique PID on insertion. The PID starts at 1 for the first point and is incremented by 1 for each subsequent point (so that the PID reflects the insertion order of the points, but only as long as riegl::rdb::pointcloud::CreateSettings::optimizePointID is set to false).
[in] | object | e.g. first object of container |
[in] | member | object member variable pointer |
[in] | index | index for array-like object members |
Definition at line 300 of file queryInsert.hpp.
|
inline |
Bind attribute buffer.
This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer. The object can be part of a container that stores the objects contiguously (e.g. std::vector, std::array) and the stride is automatically derived from the object size.
[in] | attribute | attribute name |
[in] | object | e.g. first object of container |
[in] | member | object member variable pointer |
Definition at line 252 of file queryInsert.hpp.
|
inline |
Bind attribute buffer.
This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer. The object can be part of a container that stores the objects contiguously (e.g. std::vector, std::array) and the stride is automatically derived from the object size.
[in] | attribute | attribute name |
[in] | object | e.g. first object of container |
[in] | member | object member variable pointer |
[in] | index | index for array-like object members |
Definition at line 282 of file queryInsert.hpp.
void riegl::rdb::pointcloud::QueryInsert::close | ( | ) |
Finish query.
Call this function when done with inserting points.
void riegl::rdb::pointcloud::QueryInsert::loadMultiPassSettings | ( | const std::string & | json | ) |
Load multi-pass insert settings from JSON string.
This function can be used to change settings for insert queries in multi-pass insert mode (see 'pointInsertMode' in the database creation settings). To be applied, the settings must be loaded before the first call of next(). For settings that have not been explicitly specified, the default value is used. The settings are not saved in the database. When parsing the JSON string fails, an exception is thrown.
Supported settings:
- temporary_file_path (string): Path of the temporary file; if not specified, null or an empty string, then the database path with suffix ".temp" is used. Default: empty - points_per_block (integer [1]): Inserted points are grouped into blocks with this number of points before they are processed further. Default: 1048576 (= 16 * 65536) - initial_voxel_size (float [m]): Inserted points are grouped into voxels with this edge length in meters. The value must be a power of two of the resolution of the point coordinates (usually 0.00025 m). After all points have been inserted, voxels are combined or subdivided to achieve the desired maximum number of points per voxel set in the database creation settings (see 'chunkSize'). Default: 2.048 m
Example JSON string:
{ "temporary_file_path": "", "points_per_block": 1048576, "initial_voxel_size": 2.048 }
std::uint32_t riegl::rdb::pointcloud::QueryInsert::next | ( | std::uint32_t | count | ) |
Insert points.
Use this function to actually read the point attributes from all defined buffers and insert the points into the database.
Afterwards you may re-fill the buffers or define new buffers with bind() and call next() again until all points have been inserted.
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.[in] | count | size of source buffers in terms of points |
riegl::rdb::pointcloud::QueryInsert::operator bool | ( | ) | const |
Check if query is not null.
bool riegl::rdb::pointcloud::QueryInsert::valid | ( | ) | const |
Check if query is not null.
A null query cannot be used to insert points.