diff --git a/SpeckleConnector/Connector/Database/Identity/RecordID.h b/SpeckleConnector/Connector/Database/Identity/RecordID.h index ad36268..1437e49 100644 --- a/SpeckleConnector/Connector/Database/Identity/RecordID.h +++ b/SpeckleConnector/Connector/Database/Identity/RecordID.h @@ -1,16 +1,8 @@ #ifndef CONNECTOR_DATABASE_ID #define CONNECTOR_DATABASE_ID -#include "Speckle/Utility/Guid.h" - namespace connector::database { - //BIM element record identifier - using ElementID = speckle::utility::Guid; - - //A list of element IDs - using ElementIDList = std::vector; - } #endif //CONNECTOR_DATABASE_ID diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Base/HighlightModel.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Base/HighlightModel.cpp index ab27397..ca894f9 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Base/HighlightModel.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Base/HighlightModel.cpp @@ -41,7 +41,7 @@ void HighlightModel::run(const String& modelCardID) const { std::make_unique(connector()->getLocalString(errorString, modelCardNotFoundID), modelCardID)); return; } - String className = typeid(*modelCard).name(); + if (auto senderCard = dynamic_cast(modelCard.get())) { auto modelCardSelection = senderCard->getFilter().getElementIDs(); #ifdef ARCHICAD diff --git a/SpeckleConnector/Connector/Record/Model/Filter/ArchicadEverythingFilter.h b/SpeckleConnector/Connector/Record/Model/Filter/ArchicadEverythingFilter.h index 19f2af6..b320c9a 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/ArchicadEverythingFilter.h +++ b/SpeckleConnector/Connector/Record/Model/Filter/ArchicadEverythingFilter.h @@ -1,7 +1,7 @@ #ifndef CONNECTOR_RECORD_ARCHICAD_EVERYTHING_FILTER #define CONNECTOR_RECORD_ARCHICAD_EVERYTHING_FILTER -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Connector/Record/Model/Filter/EverythingSendFilter.h" namespace connector::record { diff --git a/SpeckleConnector/Connector/Record/Model/Filter/ArchicadSelectionFilter.h b/SpeckleConnector/Connector/Record/Model/Filter/ArchicadSelectionFilter.h index 231e3b4..097198f 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/ArchicadSelectionFilter.h +++ b/SpeckleConnector/Connector/Record/Model/Filter/ArchicadSelectionFilter.h @@ -1,7 +1,7 @@ #ifndef CONNECTOR_RECORD_ARCHICAD_SELECTION_FILTER #define CONNECTOR_RECORD_ARCHICAD_SELECTION_FILTER -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Connector/Record/Model/Filter/DirectSelectionSendFilter.h" namespace connector::record { diff --git a/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.cpp b/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.cpp index 7933d01..b413ef4 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.cpp +++ b/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.cpp @@ -7,7 +7,7 @@ #include using namespace active::serialise; -using namespace connector::database; +using namespace speckle::database; using namespace connector::record; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.h b/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.h index b4ae701..f2e64a5 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.h +++ b/SpeckleConnector/Connector/Record/Model/Filter/DirectSelectionSendFilter.h @@ -1,7 +1,7 @@ #ifndef CONNECTOR_RECORD_DIRECT_SELECT_SEND_FILTER #define CONNECTOR_RECORD_DIRECT_SELECT_SEND_FILTER -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Connector/Record/Model/Filter/SendFilter.h" namespace connector::record { @@ -36,7 +36,7 @@ namespace connector::record { Get the filtered element IDs @return The filter elements */ - const database::ElementIDList& getElementIDs() const override { return m_selectedElements; } + const speckle::database::ElementIDList& getElementIDs() const override { return m_selectedElements; } // MARK: - Serialisation @@ -59,7 +59,7 @@ namespace connector::record { private: ///A list of selected element IDs - database::ElementIDList m_selectedElements; + speckle::database::ElementIDList m_selectedElements; }; } diff --git a/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.cpp b/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.cpp index 9dce303..00a49aa 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.cpp +++ b/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.cpp @@ -9,7 +9,7 @@ #include using namespace active::serialise; -using namespace connector::database; +using namespace speckle::database; using namespace connector::record; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.h b/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.h index 94e2303..4cd604e 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.h +++ b/SpeckleConnector/Connector/Record/Model/Filter/EverythingSendFilter.h @@ -1,7 +1,7 @@ #ifndef CONNECTOR_RECORD_EVERYTHING_SEND_FILTER #define CONNECTOR_RECORD_EVERYTHING_SEND_FILTER -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Connector/Record/Model/Filter/SendFilter.h" namespace connector::record { @@ -36,13 +36,13 @@ namespace connector::record { Get the filtered element IDs @return The filter elements */ - const database::ElementIDList& getElementIDs() const override { return m_emptyList; } + const speckle::database::ElementIDList& getElementIDs() const override { return m_emptyList; } /*! Determine if the filter has expired because an element in the selection has changed @param changed The list of changed element IDs @return True if the one of the changed elements is in the selection */ - virtual bool checkExpiry(const database::ElementIDList& changed) const override { return true; } + virtual bool checkExpiry(const speckle::database::ElementIDList& changed) const override { return true; } // MARK: - Serialisation @@ -65,7 +65,7 @@ namespace connector::record { private: ///Enables a const empty list to be returned - database::ElementIDList m_emptyList; + speckle::database::ElementIDList m_emptyList; }; } diff --git a/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.cpp b/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.cpp index 81e2bf2..8b42cc8 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.cpp +++ b/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.cpp @@ -5,7 +5,7 @@ #include using namespace active::serialise; -using namespace connector::database; +using namespace speckle::database; using namespace connector::record; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.h b/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.h index 999d5fd..cedfc56 100644 --- a/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.h +++ b/SpeckleConnector/Connector/Record/Model/Filter/SendFilter.h @@ -3,7 +3,7 @@ #include "Active/Serialise/Package/Package.h" #include "Active/Utility/Cloner.h" -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Speckle/Utility/String.h" namespace connector::record { @@ -59,13 +59,13 @@ namespace connector::record { Get the filtered element IDs @return The filter elements */ - virtual const database::ElementIDList& getElementIDs() const = 0; + virtual const speckle::database::ElementIDList& getElementIDs() const = 0; /*! Determine if the filter has expired because an element in the selection has changed @param changed The list of changed element IDs @return True if the one of the changed elements is in the selection */ - virtual bool checkExpiry(const database::ElementIDList& changed) const; + virtual bool checkExpiry(const speckle::database::ElementIDList& changed) const; // MARK: - Serialisation diff --git a/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.cpp b/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.cpp index 3877f7c..55bb8c8 100644 --- a/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.cpp +++ b/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.cpp @@ -6,7 +6,7 @@ #include using namespace active::serialise; -using namespace connector::database; +using namespace speckle::database; using namespace connector::record; using namespace speckle::database; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.h b/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.h index 95c4217..e13acdb 100644 --- a/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.h +++ b/SpeckleConnector/Connector/Record/Model/ReceiverModelCard.h @@ -1,7 +1,7 @@ #ifndef CONNECTOR_RECORD_RECEIVER_MODEL_CARD #define CONNECTOR_RECORD_RECEIVER_MODEL_CARD -#include "Connector/Database/Identity/RecordID.h" +#include "Speckle/Database/Identity/RecordID.h" #include "Connector/Record/Model/ModelCard.h" namespace connector::record { @@ -37,7 +37,7 @@ namespace connector::record { const speckle::database::RecordID& modelID, const speckle::utility::String& modelName, const speckle::database::RecordID& selectedVersion, const speckle::database::RecordID& latestVersion, const speckle::database::RecordID& accountID, const speckle::utility::String& serverURL, - bool hasDimissedWarning, database::ElementIDList&& bakedObjects, const SettingList& settings) : + bool hasDimissedWarning, speckle::database::ElementIDList&& bakedObjects, const SettingList& settings) : ModelCard{modelID, projectID, accountID, serverURL, settings}, m_projectName{projectName}, m_modelName{modelName}, m_selectedVersionID{selectedVersion}, m_latestVersionID{latestVersion}, m_hasDismissedUpdateWarning{hasDimissedWarning}, m_bakedObjectIDs{bakedObjects} {} @@ -78,7 +78,7 @@ namespace connector::record { Get the IDs of objects accepted in the receive @return The accepted object IDs */ - const database::ElementIDList& getBakedObjectIDs() const { return m_bakedObjectIDs; } + const speckle::database::ElementIDList& getBakedObjectIDs() const { return m_bakedObjectIDs; } // MARK: - Serialisation @@ -111,7 +111,7 @@ namespace connector::record { ///True if the user has already dismissed an alert to update bool m_hasDismissedUpdateWarning = false; ///IDs of objects accepted in the receive - database::ElementIDList m_bakedObjectIDs; + speckle::database::ElementIDList m_bakedObjectIDs; }; } diff --git a/SpeckleLib/Speckle/Database/BIMElementDatabase.cpp b/SpeckleLib/Speckle/Database/BIMElementDatabase.cpp index d98a57f..2267186 100644 --- a/SpeckleLib/Speckle/Database/BIMElementDatabase.cpp +++ b/SpeckleLib/Speckle/Database/BIMElementDatabase.cpp @@ -85,6 +85,16 @@ BIMLinkList BIMElementDatabase::getSelection() const { } //BIMElementDatabase::getSelection +/*-------------------------------------------------------------------- + Set the element selection + + return: A list of selected element IDs + --------------------------------------------------------------------*/ +void BIMElementDatabase::setSelection(const BIMLinkList& elementIDs) const { + m_engine->setSelection(elementIDs); +} //BIMElementDatabase::setSelection + + /*-------------------------------------------------------------------- Get a specified element diff --git a/SpeckleLib/Speckle/Database/BIMElementDatabase.h b/SpeckleLib/Speckle/Database/BIMElementDatabase.h index efd1d18..e163b49 100644 --- a/SpeckleLib/Speckle/Database/BIMElementDatabase.h +++ b/SpeckleLib/Speckle/Database/BIMElementDatabase.h @@ -41,6 +41,11 @@ namespace speckle::database { @return A list of selected element IDs */ BIMLinkList getSelection() const; + /*! + Set the element selection + @return A list of selected element IDs + */ + void setSelection(const BIMLinkList& elementIDs) const; /*! Get a specified element @param elementID The ID of the target element diff --git a/SpeckleLib/Speckle/Database/Identity/BIMLink.h b/SpeckleLib/Speckle/Database/Identity/BIMLink.h index 08ec63e..a376a11 100644 --- a/SpeckleLib/Speckle/Database/Identity/BIMLink.h +++ b/SpeckleLib/Speckle/Database/Identity/BIMLink.h @@ -42,6 +42,11 @@ namespace speckle::database { //A list of links to BIM records using BIMLinkList = std::vector; + /*class BIMLinkList { + public: + BIMLinkList() = default; + BIMLinkList(database::ElementIDList&) + };*/ } diff --git a/SpeckleLib/Speckle/Database/Identity/RecordID.h b/SpeckleLib/Speckle/Database/Identity/RecordID.h index b26eadd..312ca44 100644 --- a/SpeckleLib/Speckle/Database/Identity/RecordID.h +++ b/SpeckleLib/Speckle/Database/Identity/RecordID.h @@ -2,6 +2,7 @@ #define SPECKLE_DATABASE_ID #include "Speckle/Utility/String.h" +#include "Speckle/Utility/Guid.h" namespace speckle::database { @@ -14,6 +15,12 @@ namespace speckle::database { //A list of record IDs using RecordIDList = std::vector; + + //BIM element record identifier + using ElementID = speckle::utility::Guid; + + //A list of element IDs + using ElementIDList = std::vector; } diff --git a/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.cpp b/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.cpp index f2071ae..e1f182a 100644 --- a/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.cpp +++ b/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.cpp @@ -123,6 +123,22 @@ BIMLinkList ArchicadElementDBaseEngine::getSelection() const { } //ArchicadElementDBaseEngine::getSelection +/*-------------------------------------------------------------------- + Set the element selection + + return: A list of selected element IDs + --------------------------------------------------------------------*/ +void ArchicadElementDBaseEngine::setSelection(const BIMLinkList& elementIDs) const { + ACAPI_Selection_DeselectAll(); + GS::Array selNeigs; + for (const auto elemID : elementIDs) { + API_Neig neig(elemID); + selNeigs.Push(neig); + } + ACAPI_Selection_Select(selNeigs, true); +} //ArchicadElementDBaseEngine::setSelection + + /*-------------------------------------------------------------------- Get an object by index diff --git a/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.h b/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.h index 6e150ba..0af9bc7 100644 --- a/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.h +++ b/SpeckleLib/Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.h @@ -58,6 +58,11 @@ namespace speckle::database { @return A list of selected element IDs */ BIMLinkList getSelection() const; + /*! + Set the element selection + @return A list of selected element IDs + */ + void setSelection(const BIMLinkList& elementIDs) const; /*! Get an object by index @param objID The object ID