diff --git a/SpeckleLib/Speckle/Database/BIMAttributeDatabase.h b/SpeckleLib/Speckle/Database/BIMAttributeDatabase.h index 0a28b89..17fe657 100644 --- a/SpeckleLib/Speckle/Database/BIMAttributeDatabase.h +++ b/SpeckleLib/Speckle/Database/BIMAttributeDatabase.h @@ -31,11 +31,6 @@ namespace speckle::database { // MARK: - Functions (const) - /*! - Get the current user attribute selection - @return A list of selected attribute IDs - */ - BIMLinkList getSelection() const; /*! Get a specified attribute @param attributeID The ID of the target attribute diff --git a/SpeckleLib/Speckle/Database/BIMPropertyDatabase.cpp b/SpeckleLib/Speckle/Database/BIMPropertyDatabase.cpp new file mode 100644 index 0000000..ffb0f5f --- /dev/null +++ b/SpeckleLib/Speckle/Database/BIMPropertyDatabase.cpp @@ -0,0 +1,141 @@ +#include "Speckle/Database/BIMPropertyDatabase.h" + +#include "Active/Database/Storage/Storage.h" +#include "Active/Serialise/UnboxedTransport.h" +#include "Speckle/Database/Identity/RecordID.h" +#include "Speckle/Database/Storage/ArchicadDBase/Property/ArchicadPropertyDBaseEngine.h" +#include "Speckle/Record/Property/Setting.h" + +#include + +using namespace active::container; +using namespace active::database; +using namespace active::event; +using namespace active::serialise; +using namespace speckle::database; +using namespace speckle::record; +using namespace speckle::record::property; +using namespace speckle::database; +using namespace speckle::utility; + +namespace speckle::database { + + ///Define other platform engines here as required +#ifdef ARCHICAD + using PropertyDatabaseEngine = ArchicadPropertyDBaseEngine; +#endif + + ///Property database engine declaration + class BIMPropertyDatabase::Engine : public PropertyDatabaseEngine { + using base = ArchicadPropertyDBaseEngine; + using base::base; + }; + + ///Property database storage declaration + class BIMPropertyDatabase::Store : public Storage { + using base = Storage; + using base::base; + }; + +} + +namespace { + + ///The database storage identifier for properties + const char* propertyDBaseName = "speckle::database::BIMPropertyDatabase"; + ///The primary model table, e.g. floor plan in Archicad + const char* modelTableName = "Model"; + +} + +/*-------------------------------------------------------------------- + Constructor + --------------------------------------------------------------------*/ +BIMPropertyDatabase::BIMPropertyDatabase() { + m_engine = std::make_shared(propertyDBaseName, + //Schema + DBaseSchema{active::utility::String{propertyDBaseName}, + //Tables + { + //Model property table + { + modelTableName, 0, 0, {} //The primary model. Additonal tables could be linked to other drawings/layouts in future + } + } + } + ); + m_store = std::make_shared(m_engine); +} //BIMPropertyDatabase::BIMPropertyDatabase + + +/*-------------------------------------------------------------------- + Destructor + --------------------------------------------------------------------*/ +BIMPropertyDatabase::~BIMPropertyDatabase() {} + + +/*-------------------------------------------------------------------- + Get a specified property + + propertyID: The ID of the target property + + return: The requested property (nullptr on failure) + --------------------------------------------------------------------*/ +Template::Unique BIMPropertyDatabase::getProperty(const BIMRecordID& propertyID, std::optional tableID, + std::optional documentID) const { + return m_engine->getObject(propertyID, tableID, documentID); +} //BIMPropertyDatabase::getProperty + + +/*-------------------------------------------------------------------- + Get a specified property + + link: A link to the target property + + return: The requested property (nullptr on failure) + --------------------------------------------------------------------*/ +Template::Unique BIMPropertyDatabase::getProperty(const BIMLink& link) const { + return getProperty(link, link.tableID, link.docID); +} //BIMPropertyDatabase::getProperty + + +/*-------------------------------------------------------------------- + Get all properties + + return: All the properties + --------------------------------------------------------------------*/ +Vector