Added BIMElementDatabase::findObjects

This commit is contained in:
Ralph Wessel
2024-11-05 11:25:33 +00:00
parent 74d4871fbd
commit d7a95fd37c
2 changed files with 29 additions and 0 deletions
@@ -101,6 +101,21 @@ void BIMElementDatabase::clearSelection() const {
} //BIMElementDatabase::clearSelection
/*--------------------------------------------------------------------
Find a filtered list of objects
filter: The object filter (nullptr = find all objects)
tableID: Optional table ID (defaults to the first table)
documentID: Optional document ID (filter for this document only - nullopt = all objects)
return: A list containing IDs of found elements (empty if none found)
--------------------------------------------------------------------*/
std::vector<BIMRecordID> BIMElementDatabase::findElements(const Filter& filter, std::optional<BIMRecordID> tableID,
std::optional<BIMRecordID> documentID) const {
return m_engine->findObjects(filter, tableID, documentID);
} //BIMElementDatabase::findElements
/*--------------------------------------------------------------------
Get a specified element
@@ -21,6 +21,11 @@ namespace speckle::database {
*/
class BIMElementDatabase {
public:
// MARK: - Types
///Element filter (NB: expand in future to support optimised filtering)
using Filter = std::function<bool(const record::element::Element&)>;
// MARK: - Constructors
@@ -49,6 +54,15 @@ namespace speckle::database {
Clear the element selection
*/
void clearSelection() const;
/*!
Find a filtered list of objects
@param filter The object filter (nullptr = find all objects)
@param tableID Optional table ID (defaults to the first table)
@param documentID Optional document ID (filter for this document only - nullopt = all objects)
@return A list containing IDs of found elements (empty if none found)
*/
std::vector<BIMRecordID> findElements(const Filter& filter = nullptr, std::optional<BIMRecordID> tableID = std::nullopt,
std::optional<BIMRecordID> documentID = std::nullopt) const;
/*!
Get a specified element
@param elementID The ID of the target element