cesium-native
0.41.0
|
Utility to retrieve the data of PropertyTable. More...
#include <CesiumGltf/PropertyTableView.h>
Public Member Functions | |
PropertyTableView (const Model &model, const PropertyTable &propertyTable) | |
Creates an instance of PropertyTableView. More... | |
PropertyTableViewStatus | status () const noexcept |
Gets the status of this property table view. More... | |
const std::optional< std::string > & | name () const noexcept |
Gets the name of the property table being viewed. Returns std::nullopt if no name was specified. | |
int64_t | size () const noexcept |
Get the number of elements in this PropertyTableView. If the view is valid, this returns PropertyTable::count. Otherwise, this returns 0. More... | |
const Class * | getClass () const noexcept |
Gets the Class that this property table conforms to. More... | |
const ClassProperty * | getClassProperty (const std::string &propertyId) const |
Finds the ClassProperty that describes the type information of the property with the specified id. More... | |
template<typename T , bool Normalized = false> | |
PropertyTablePropertyView< T, Normalized > | getPropertyView (const std::string &propertyId) const |
Gets a PropertyTablePropertyView that views the data of a property stored in the PropertyTable. More... | |
template<typename Callback > | |
void | getPropertyView (const std::string &propertyId, Callback &&callback) const |
Gets a PropertyTablePropertyView through a callback that accepts a property id and a PropertyTablePropertyView<T> that views the data of the property with the specified id. More... | |
template<typename Callback > | |
void | forEachProperty (Callback &&callback) const |
Iterates over each property in the PropertyTable with a callback that accepts a property id and a PropertyTablePropertyView<T> to view the data stored in the PropertyTableProperty. More... | |
Utility to retrieve the data of PropertyTable.
This should be used to get a PropertyTablePropertyView of a property in the property table. It will validate the EXT_structural_metadata format and ensure PropertyTablePropertyView does not access out of bounds.
Definition at line 54 of file PropertyTableView.h.
CesiumGltf::PropertyTableView::PropertyTableView | ( | const Model & | model, |
const PropertyTable & | propertyTable | ||
) |
Creates an instance of PropertyTableView.
model | The glTF Model that contains the property table data. |
propertyTable | The PropertyTable from which the view will retrieve data. |
|
inline |
Iterates over each property in the PropertyTable with a callback that accepts a property id and a PropertyTablePropertyView<T> to view the data stored in the PropertyTableProperty.
This method will validate the EXT_structural_metadata format to ensure PropertyTablePropertyView retrieves the correct data. T must be one of the following: a scalar (uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double), a glm vecN composed of one of the scalar types, a glm matN composed of one of the scalar types, bool, std::string_view, or PropertyArrayView<T> with T as one of the aforementioned types.
If the property is invalid, an empty PropertyTablePropertyView with an error status code will be passed to the callback. Otherwise, a valid property view will be passed to the callback.
propertyId | The id of the property to retrieve data from |
callback | A callback function that accepts property id and PropertyTablePropertyView<T> |
Definition at line 328 of file PropertyTableView.h.
|
inlinenoexcept |
Gets the Class that this property table conforms to.
Definition at line 99 of file PropertyTableView.h.
const ClassProperty* CesiumGltf::PropertyTableView::getClassProperty | ( | const std::string & | propertyId | ) | const |
Finds the ClassProperty that describes the type information of the property with the specified id.
propertyId | The id of the property to retrieve the class for. |
|
inline |
Gets a PropertyTablePropertyView that views the data of a property stored in the PropertyTable.
This method will validate the EXT_structural_metadata format to ensure PropertyTablePropertyView retrieves the correct data. T must be one of the following: a scalar (uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double), a glm vecN composed of one of the scalar types, a glm matN composed of one of the scalar types, bool, std::string_view, or PropertyArrayView<T> with T as one of the aforementioned types.
If T does not match the type specified by the class property, this returns an invalid PropertyTablePropertyView. Likewise, if the value of Normalized does not match the value of {@ClassProperty::normalized} for that class property, this returns an invalid property view. Only types with integer components may be normalized.
T | The C++ type corresponding to the type of the data retrieved. |
Normalized | Whether the property is normalized. Only applicable to types with integer components. |
propertyId | The id of the property to retrieve data from |
Definition at line 138 of file PropertyTableView.h.
|
inline |
Gets a PropertyTablePropertyView through a callback that accepts a property id and a PropertyTablePropertyView<T> that views the data of the property with the specified id.
This method will validate the EXT_structural_metadata format to ensure PropertyTablePropertyView retrieves the correct data. T must be one of the following: a scalar (uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double), a glm vecN composed of one of the scalar types, a glm matN composed of one of the scalar types, bool, std::string_view, or PropertyArrayView<T> with T as one of the aforementioned types.
If the property is invalid, an empty PropertyTablePropertyView with an error status will be passed to the callback. Otherwise, a valid property view will be passed to the callback.
propertyId | The id of the property to retrieve data from |
callback | A callback function that accepts a property id and a PropertyTablePropertyView<T> |
Definition at line 176 of file PropertyTableView.h.
|
inlinenoexcept |
Get the number of elements in this PropertyTableView. If the view is valid, this returns PropertyTable::count. Otherwise, this returns 0.
Definition at line 88 of file PropertyTableView.h.
|
inlinenoexcept |
Gets the status of this property table view.
Indicates whether the view accurately reflects the property table's data, or whether an error occurred.
Definition at line 72 of file PropertyTableView.h.