![]() |
RDB 2
|
Manage point attributes. More...
#include <pointAttributes.hpp>
Public Types | |
typedef std::uint64_t | PointID |
Point identifier data type. More... | |
Public Member Functions | |
PointAttributes (riegl::rdb::PointcloudData *pointcloud) | |
Constructor. More... | |
std::vector< std::string > | list () const |
Query attribute names. More... | |
bool | exists (const std::string &name) const |
Check if attribute exists. More... | |
void | add (const PointAttribute &attribute) |
Add new attribute. More... | |
void | add (const std::string &name) |
Add RIEGL attribute. More... | |
PointAttribute | get (const std::string &name) const |
Query attribute details. More... | |
void | group (const std::string &name, std::string &group, std::uint32_t &index) const |
Query attribute group and index. More... | |
void | put (const PointAttribute &attribute) |
Modify attribute details. More... | |
void | remove (const std::string &name) |
Delete attribute. More... | |
void | duplicate (const std::string &source, const std::string &target) |
Duplicate attribute data. More... | |
void | discard (const std::string &name) |
Discard attribute data. More... | |
std::string | primaryAttributeName () const |
Name of primary point attribute. More... | |
Static Public Member Functions | |
static std::vector< std::string > | listDefault (riegl::rdb::Context &context) |
Query default attribute names. More... | |
static std::vector< std::string > | listFiltered (const std::string &filter, riegl::rdb::Context &context) |
Query attribute names of filter. More... | |
static PointAttribute | getDefault (riegl::rdb::Context &context, const std::string &name) |
Query default attribute details. More... | |
static void | groupDefault (riegl::rdb::Context &context, const std::string &name, std::string &group, std::uint32_t &index) |
Query default attribute group and index. More... | |
static PointAttribute | getMerged (riegl::rdb::Context &context, const std::vector< riegl::rdb::Pointcloud * > &pointclouds, const std::string &name) |
Merge attribute details. More... | |
static std::vector < PointAttribute > | getMerged (riegl::rdb::Context &context, const std::vector< riegl::rdb::Pointcloud * > &pointclouds) |
Merge attribute details. More... | |
static std::string | pointIDName () |
Point identifier attribute name. More... | |
static std::string | pointIDUnit () |
Point identifier attribute unit. More... | |
static DataType | pointIDType () |
Point identifier data type enum. More... | |
Manage point attributes.
This class allows to manage point attributes (dimensions).
When creating a new database, each point has at least two attributes:
Both attributes cannot be deleted or modified in any way.
The point identifier attribute is always named "id" and is an unsigned 64 bit integer number (see DataTypes::UINT64, pointIDType() and pointIDName()).
Definition at line 83 of file pointAttributes.hpp.
typedef std::uint64_t riegl::rdb::pointcloud::PointAttributes::PointID |
Point identifier data type.
Definition at line 362 of file pointAttributes.hpp.
|
explicit |
Constructor.
void riegl::rdb::pointcloud::PointAttributes::add | ( | const PointAttribute & | attribute | ) |
Add new attribute.
[in] | attribute | attribute information to be added |
void riegl::rdb::pointcloud::PointAttributes::add | ( | const std::string & | name | ) |
Add RIEGL attribute.
If the given name refers to an built-in RIEGL default point attribute, this function adds the point attribute to the database. Otherwise this function fails.
[in] | name | name of a RIEGL point attribute |
void riegl::rdb::pointcloud::PointAttributes::discard | ( | const std::string & | name | ) |
Discard attribute data.
Use this function to delete the current point attribute data (but not the point attribute description). This is equivalent to a newly created point attribute, i.e. all points will have the default value.
[in] | name | attribute name |
void riegl::rdb::pointcloud::PointAttributes::duplicate | ( | const std::string & | source, |
const std::string & | target | ||
) |
Duplicate attribute data.
Use this function to duplicate the current point attribute data (but not the point attribute description). This can e.g. be used to make a backup of point attribute data.
[in] | source | source attribute name |
[in] | target | target attribute name |
bool riegl::rdb::pointcloud::PointAttributes::exists | ( | const std::string & | name | ) | const |
Check if attribute exists.
[in] | name | attribute name |
PointAttribute riegl::rdb::pointcloud::PointAttributes::get | ( | const std::string & | name | ) | const |
Query attribute details.
If the given attribute name could not be found, the function fails.
[in] | name | attribute name |
|
static |
Query default attribute details.
This function is similar to get() but instead of returning the attribute details defined in the database, it returns the details of the built-in RIEGL default point attribute.
If the given attribute name could not be found, the function fails.
[in] | context | library context |
[in] | name | attribute name |
|
static |
Merge attribute details.
This function returns the details (description) of a point attribute by analyzing two or more point clouds. If the attribute details are not the same in all point clouds (e.g. a typo was fixed or the minimum, maximum, resolution or default value has changed), merged details that cover all variants are returned. However, some changes can not be merged, e.g. changes to the vector length, the unit symbol or changes to the minimum, maximum and resolution values that would require unsupported data types (see riegl::rdb::pointcloud::DataType). In this case an exception with error code riegl::rdb::Error::PointAttributeNotMergeable is thrown. It is not required that the point attribute exists in all point clouds.
This function might be helpful when merging point clouds, i.e. when reading points from multiple databases and storing them in a single database. In this case one needs to define the point attributes in the target database. If the source databases were generated by different software applications (or different versions of the same application), the details of the same attribute may slightly differ (see above), which makes the definition of the attribute in the target database quite hard. So instead of defining the attributes by using a hard-coded table, one can use this function to generate the attribute description at runtime.
Examples (simplified, fake attributes):
Example 1 | Attribute | Description | Resolution | Minimum | Maximum |
---|---|---|---|---|---|
Point cloud A | amplitude | signal amplitude | 0.01 | 0.00 | 655.35 |
Point cloud B | amplitude | signal amplitude | 0.01 | -327.68 | 327.67 |
Merged details | amplitude | signal amplitude | 0.01 | -327.68 | 655.35 |
Example 2 | Attribute | Description | Resolution | Minimum | Maximum |
---|---|---|---|---|---|
Point cloud A | temperature | coarse temperature | 0.50 | -100.00 | 500.00 |
Point cloud B | temperature | precise temperature | 0.01 | -100.00 | 1000.00 |
Merged details | temperature | precise temperature | 0.01 | -100.00 | 1000.00 |
In both examples the value range (minimum/maximum) of the attribute has changed, so the result range is the combination (disjunction) of both ranges.
In the second example the resolution is different too. The example shows that always the higher resolution (lower value) is returned.
If the description text changes, then the result is the text that is stored in the younger database (the database that was created last). In example 2, "Point cloud B" is the younger database.
[in] | context | library context |
[in] | pointclouds | list of point clouds |
[in] | name | attribute name |
|
static |
Merge attribute details.
Same as the overloaded version above, but instead of merging one point attribute, this function merges all point attributes of all given point clouds.
[in] | context | library context |
[in] | pointclouds | list of point clouds |
void riegl::rdb::pointcloud::PointAttributes::group | ( | const std::string & | name, |
std::string & | group, | ||
std::uint32_t & | index | ||
) | const |
Query attribute group and index.
Since RDB version 2.2 the point attributes are grouped and sorted for a better overview. The grouping and order is defined by a table which is stored in the meta data entry "riegl.point_attribute_groups". Each database is filled with a default table with RIEGL point attributes.
The list() function returns the names of the attributes actually used in the order defined by the table. Function group() returns the group name as well as the table index of a point attribute (index starts at 1 for the first attribute in the first group and goes up to N for the last attribute in the last group).
So unless you want to change the order of the point attributes or add your own, it is not necessary to access or change the attribute table.
[in] | name | attribute name |
[out] | group | attribute group name |
[out] | index | attribute index |
|
static |
Query default attribute group and index.
This function works like group() but returns the group and index from the built-in RIEGL default attribute table.
[in] | context | library context |
[in] | name | attribute name |
[out] | group | attribute group name |
[out] | index | attribute index |
std::vector<std::string> riegl::rdb::pointcloud::PointAttributes::list | ( | ) | const |
Query attribute names.
This function returns the names of the attributes defined in the database in the order defined by the point attribute group table (details see group() function).
|
static |
Query default attribute names.
|
static |
Query attribute names of filter.
Examples:
filter: (riegl.reflectance > 0) result: [riegl.reflectance] filter: (riegl.id < 100) && (riegl.class == 2) result: [riegl.id, riegl.class] filter: (riegl.target_index == riegl.target_count) result: [riegl.target_index, riegl.target_count] filter: (riegl.xyz[0] > 0.0) && (riegl.xyz[1] > 0.0) result: [riegl.xyz]
[in] | filter | filter string |
|
static |
Point identifier attribute name.
|
static |
Point identifier data type enum.
|
static |
Point identifier attribute unit.
std::string riegl::rdb::pointcloud::PointAttributes::primaryAttributeName | ( | ) | const |
Name of primary point attribute.
void riegl::rdb::pointcloud::PointAttributes::put | ( | const PointAttribute & | attribute | ) |
Modify attribute details.
This function allows to modify certain point attribute properties. Thereto the function looks for a point attribute of the given name, compares the given properties with those stored in the database and finally updates the modified properties in the database.
name
, title
, description
, tags
, unitSymbol
, scaleFactor
and lodSettings
is supported. If a point attribute shall be renamed, the name
property must contain the old and the new name separated by " -> ". Example: To rename riegl.xyz
to riegl.xyz_socs
, set attribute.name
to riegl.xyz -> riegl.xyz_socs
. [in] | attribute | attribute information to be modified |
void riegl::rdb::pointcloud::PointAttributes::remove | ( | const std::string & | name | ) |
Delete attribute.
If the given attribute name could not be found, this function does not fail.
[in] | name | attribute name |