From 35f4e58a5862b2fc0293e7e52834130a58565606 Mon Sep 17 00:00:00 2001 From: Ralph Wessel Date: Mon, 21 Oct 2024 16:25:23 +0100 Subject: [PATCH] Added BIM property database + engine Added property classes including: - templates - settings - values Added Classified interface for records supporting classification Added Propertied interface for records supporting attached properties Distinguished model elements from drawing elements (only model elements support classification/properties) with: - DrawingElement (2D only) - ModelElement (having a 3D/model presence) --- .../Speckle/Database/BIMAttributeDatabase.h | 5 - .../Speckle/Database/BIMPropertyDatabase.cpp | 141 +++++++++ .../Speckle/Database/BIMPropertyDatabase.h | 83 ++++++ .../Speckle/Database/Identity/BIMRecordID.h | 8 +- .../ArchicadAttributeDBaseEngine.cpp | 1 + .../Attribute/ArchicadAttributeDBaseEngine.h | 1 + .../Element/ArchicadElementDBaseEngine.cpp | 4 +- .../Element/ArchicadElementDBaseEngine.h | 1 + .../Property/ArchicadPropertyDBaseEngine.cpp | 256 +++++++++++++++++ .../Property/ArchicadPropertyDBaseEngine.h | 143 +++++++++ SpeckleLib/Speckle/Environment/Project.cpp | 4 +- SpeckleLib/Speckle/Environment/Project.h | 14 +- .../Record/Classification/Classified.cpp | 30 ++ .../Record/Classification/Classified.h | 48 ++++ SpeckleLib/Speckle/Record/Element/Column.cpp | 2 +- SpeckleLib/Speckle/Record/Element/Column.h | 8 +- .../Speckle/Record/Element/ColumnSegment.h | 6 +- ...{GenericElement.cpp => DrawingElement.cpp} | 79 ++--- .../{GenericElement.h => DrawingElement.h} | 29 +- SpeckleLib/Speckle/Record/Element/Element.cpp | 157 +--------- SpeckleLib/Speckle/Record/Element/Element.h | 13 - .../Record/Element/GenericDrawingElement.cpp | 122 ++++++++ .../Record/Element/GenericDrawingElement.h | 104 +++++++ .../Record/Element/GenericModelElement.cpp | 122 ++++++++ .../Record/Element/GenericModelElement.h | 103 +++++++ .../Speckle/Record/Element/ModelElement.cpp | 272 ++++++++++++++++++ .../Speckle/Record/Element/ModelElement.h | 119 ++++++++ .../Speckle/Record/Property/Propertied.cpp | 83 ++++++ .../Speckle/Record/Property/Propertied.h | 57 ++++ .../Speckle/Record/Property/Property.cpp | 132 +++++++++ SpeckleLib/Speckle/Record/Property/Property.h | 103 +++++++ .../Speckle/Record/Property/Setting.cpp | 87 ++++++ SpeckleLib/Speckle/Record/Property/Setting.h | 127 ++++++++ .../Speckle/Record/Property/Template.cpp | 210 ++++++++++++++ SpeckleLib/Speckle/Record/Property/Template.h | 192 +++++++++++++ SpeckleLib/Speckle/Record/Property/Value.cpp | 189 ++++++++++++ SpeckleLib/Speckle/Record/Property/Value.h | 140 +++++++++ SpeckleLib/Speckle/Utility/Guid.h | 16 ++ .../SpeckleLib.xcodeproj/project.pbxproj | 130 ++++++++- 39 files changed, 3070 insertions(+), 271 deletions(-) create mode 100644 SpeckleLib/Speckle/Database/BIMPropertyDatabase.cpp create mode 100644 SpeckleLib/Speckle/Database/BIMPropertyDatabase.h create mode 100644 SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Property/ArchicadPropertyDBaseEngine.cpp create mode 100644 SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Property/ArchicadPropertyDBaseEngine.h create mode 100644 SpeckleLib/Speckle/Record/Classification/Classified.cpp create mode 100644 SpeckleLib/Speckle/Record/Classification/Classified.h rename SpeckleLib/Speckle/Record/Element/{GenericElement.cpp => DrawingElement.cpp} (65%) rename SpeckleLib/Speckle/Record/Element/{GenericElement.h => DrawingElement.h} (70%) create mode 100644 SpeckleLib/Speckle/Record/Element/GenericDrawingElement.cpp create mode 100644 SpeckleLib/Speckle/Record/Element/GenericDrawingElement.h create mode 100644 SpeckleLib/Speckle/Record/Element/GenericModelElement.cpp create mode 100644 SpeckleLib/Speckle/Record/Element/GenericModelElement.h create mode 100644 SpeckleLib/Speckle/Record/Element/ModelElement.cpp create mode 100644 SpeckleLib/Speckle/Record/Element/ModelElement.h create mode 100644 SpeckleLib/Speckle/Record/Property/Propertied.cpp create mode 100644 SpeckleLib/Speckle/Record/Property/Propertied.h create mode 100644 SpeckleLib/Speckle/Record/Property/Property.cpp create mode 100644 SpeckleLib/Speckle/Record/Property/Property.h create mode 100644 SpeckleLib/Speckle/Record/Property/Setting.cpp create mode 100644 SpeckleLib/Speckle/Record/Property/Setting.h create mode 100644 SpeckleLib/Speckle/Record/Property/Template.cpp create mode 100644 SpeckleLib/Speckle/Record/Property/Template.h create mode 100644 SpeckleLib/Speckle/Record/Property/Value.cpp create mode 100644 SpeckleLib/Speckle/Record/Property/Value.h 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