From def9162e4ce81e7b899da7b27051acf08daaadee Mon Sep 17 00:00:00 2001 From: David Kekesi Date: Tue, 15 Oct 2024 17:10:48 +0200 Subject: [PATCH 1/4] added SelectionBridge, SelectionInfo, GetSelection --- SpeckleConnector/Connector.vcxproj | 6 ++ SpeckleConnector/Connector.vcxproj.filters | 24 +++++++ .../Bridge/Selection/Arg/SelectionInfo.cpp | 60 ++++++++++++++++ .../Bridge/Selection/Arg/SelectionInfo.h | 47 +++++++++++++ .../Browser/Bridge/Selection/GetSelection.cpp | 68 +++++++++++++++++++ .../Browser/Bridge/Selection/GetSelection.h | 30 ++++++++ .../Bridge/Selection/SelectionBridge.cpp | 13 ++++ .../Bridge/Selection/SelectionBridge.h | 29 ++++++++ .../Connector/Interface/ConnectorPalette.cpp | 2 + 9 files changed, 279 insertions(+) create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h diff --git a/SpeckleConnector/Connector.vcxproj b/SpeckleConnector/Connector.vcxproj index 9ac1fc7..acf33d4 100644 --- a/SpeckleConnector/Connector.vcxproj +++ b/SpeckleConnector/Connector.vcxproj @@ -111,6 +111,9 @@ + + + @@ -163,6 +166,9 @@ + + + diff --git a/SpeckleConnector/Connector.vcxproj.filters b/SpeckleConnector/Connector.vcxproj.filters index e879d95..374c759 100644 --- a/SpeckleConnector/Connector.vcxproj.filters +++ b/SpeckleConnector/Connector.vcxproj.filters @@ -65,6 +65,12 @@ {6693f9a9-5ece-4853-b008-4064d1c551ab} + + {806f4af5-fa02-49b8-ac01-297991fe90ea} + + + {8bb3df60-affe-4b66-8d78-f1b98e6ba8df} + @@ -228,6 +234,15 @@ Connector\Record\Collection + + Connector\Interface\Browser\Bridge\Selection + + + Connector\Interface\Browser\Bridge\Selection + + + Connector\Interface\Browser\Bridge\Selection\Arg + @@ -387,5 +402,14 @@ Connector\Record\Collection + + Connector\Interface\Browser\Bridge\Selection + + + Connector\Interface\Browser\Bridge\Selection + + + Connector\Interface\Browser\Bridge\Selection\Arg + \ No newline at end of file diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp new file mode 100644 index 0000000..42611d6 --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp @@ -0,0 +1,60 @@ +#include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" + +#include "Active/Serialise/Item/Wrapper/ValueWrap.h" +#include "Active/Serialise/Package/Wrapper/PackageWrap.h" + +#include + +using namespace active::serialise; +using namespace connector::interfac::browser::bridge; + +namespace { + + ///Serialisation fields + enum FieldIndex { + summaryID, + }; + + ///Serialisation field IDs + static std::array fieldID = { + Identity{"summary"}, + }; + +} + +/*-------------------------------------------------------------------- + Fill an inventory with the package items + + inventory: The inventory to receive the package items + + return: True if the package has added items to the inventory + --------------------------------------------------------------------*/ +bool SelectionInfo::fillInventory(Inventory& inventory) const { + using enum Entry::Type; + inventory.merge(Inventory{ + { + { fieldID[summaryID], summaryID, element }, + }, + }.withType(&typeid(SelectionInfo))); + return true; +} //ConnectorConfig::fillInventory + + +/*-------------------------------------------------------------------- + Get the specified cargo + + item: The inventory item to retrieve + + return: The requested cargo (nullptr on failure) + --------------------------------------------------------------------*/ +Cargo::Unique SelectionInfo::getCargo(const Inventory::Item& item) const { + if (item.ownerType != &typeid(SelectionInfo)) + return nullptr; + using namespace active::serialise; + switch (item.index) { + case summaryID: + return std::make_unique>(summary); + default: + return nullptr; //Requested an unknown index + } +} //ConnectorConfig::getCargo diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h new file mode 100644 index 0000000..2e81bea --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h @@ -0,0 +1,47 @@ +#ifndef CONNECTOR_INTERFACE_BRIDGE_SELECTION_INFO +#define CONNECTOR_INTERFACE_BRIDGE_SELECTION_INFO + +#include "Active/Serialise/Package/Package.h" +#include "Speckle/Interface/Browser/Bridge/ArgumentBase.h" + +namespace connector::interfac::browser::bridge { + + /*! + Configuration settings class + */ + class SelectionInfo : public active::serialise::Package { + public: + + // MARK: - Types + + using base = active::serialise::Package; + + // MARK: - Constructors + + /*! + Default constructor + */ + SelectionInfo() = default; + + active::utility::String summary = "Nothing is selected"; + std::vector selectedElementIds; + + // MARK: - Serialisation + + /*! + Fill an inventory with the package items + @param inventory The inventory to receive the package items + @return True if the package has added items to the inventory + */ + bool fillInventory(active::serialise::Inventory& inventory) const override; + /*! + Get the specified cargo + @param item The inventory item to retrieve + @return The requested cargo (nullptr on failure) + */ + Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override; + }; + +} + +#endif //CONNECTOR_INTERFACE_BRIDGE_SELECTION_INFO diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp new file mode 100644 index 0000000..fc239a7 --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp @@ -0,0 +1,68 @@ +#include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" + +#include "Active/Serialise/CargoHold.h" +#include "Active/Serialise/Package/Wrapper/PackageWrap.h" +#include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" + +#include "Connector/Connector.h" +#include "Connector/Record/Collection/ProjectCollection.h" + +#include "Speckle/Database/BIMElementDatabase.h" +#include "Speckle/Environment/Project.h" +#include "Speckle/Record/Element/Element.h" +using namespace speckle::record::element; + +#include + +using namespace active::serialise; +using namespace connector::interfac::browser::bridge; +using namespace speckle::utility; +using namespace connector::record; + +namespace { + + ///Return type for retrieving the current configuration + using WrappedValue = CargoHold; + +} +/*-------------------------------------------------------------------- + Default constructor + --------------------------------------------------------------------*/ +GetSelection::GetSelection() : BridgeMethod{"GetSelection", [&]() { + return run(); +}} {} + + +/*-------------------------------------------------------------------- + Send a specified model + + modelCardID: The ID of the model to send + --------------------------------------------------------------------*/ +std::unique_ptr GetSelection::run() const { + + auto selectionInfo = std::make_unique(); + + auto project = connector()->getActiveProject().lock(); + if (!project) { + // TODO + } + + //Build a collection from the selected elements + auto collection = std::make_unique(project); + auto elementDatabase = project->getElementDatabase(); + auto selected = elementDatabase->getSelection(); + + active::utility::String summary(selected.size()); + summary += " objects selected."; + + selectionInfo->summary = summary; + + for (const auto& link : selected) { + if (auto element = elementDatabase->getElement(link); element) { + collection->addElement(*element); + selectionInfo->selectedElementIds.push_back(element->getBIMID()); + } + } + + return std::make_unique(std::move(selectionInfo)); +} //GetSelection::run diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h new file mode 100644 index 0000000..8f9b73d --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h @@ -0,0 +1,30 @@ +#ifndef CONNECTOR_INTERFACE_BRIDGE_GETSELECTION +#define CONNECTOR_INTERFACE_BRIDGE_GETSELECTION + +#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h" + +namespace connector::interfac::browser::bridge { + + class GetSelection : public speckle::interfac::browser::bridge::BridgeMethod { + public: + + // MARK: - Constructors + + /*! + Constructor + @param bridge The parent bridge object (provides access to bridge methods) + */ + GetSelection(); + + // MARK: - Functions (const) + + /*! + Send a specified model + @param modelCardID The ID of the model to send + */ + std::unique_ptr run() const; + }; + +} + +#endif //CONNECTOR_INTERFACE_BRIDGE_GETSELECTION diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp new file mode 100644 index 0000000..5fa969f --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp @@ -0,0 +1,13 @@ +#include "Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h" + +#include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" + +using namespace connector::interfac::browser::bridge; + +/*-------------------------------------------------------------------- + Default constructor + --------------------------------------------------------------------*/ +SelectionBridge::SelectionBridge() : BrowserBridge{"selectionBinding"} { + //Add bridge methods + addMethod(); +} //SelectionBridge::SelectionBridge diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h new file mode 100644 index 0000000..053fba2 --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h @@ -0,0 +1,29 @@ +#ifndef CONNECTOR_INTERFACE_BRIDGE_SELECTION_BRIDGE +#define CONNECTOR_INTERFACE_BRIDGE_SELECTION_BRIDGE + +#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h" + +namespace connector::interfac::browser::bridge { + + /*! + A browser bridge to support sending model data to a Speckle server + */ + class SelectionBridge : public speckle::interfac::browser::bridge::BrowserBridge { + public: + + // MARK: - Types + + using base = speckle::interfac::browser::bridge::BrowserBridge; + + // MARK: - Constructors + + using base::base; + /*! + Default constructor + */ + SelectionBridge(); + }; + +} + +#endif //CONNECTOR_INTERFACE_BRIDGE_SELECTION_BRIDGE diff --git a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp index 6810467..0800691 100644 --- a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp +++ b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp @@ -10,6 +10,7 @@ #include "Connector/Interface/Browser/Bridge/Base/BaseBridge.h" #include "Connector/Interface/Browser/Bridge/Config/ConfigBridge.h" #include "Connector/Interface/Browser/Bridge/Send/SendBridge.h" +#include "Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h" #include "Connector/Interface/Browser/Bridge/Test/TestBridge.h" #include "Speckle/Environment/Addon.h" #include "Speckle/Event/Type/MenuEvent.h" @@ -170,6 +171,7 @@ BrowserPalette::BrowserPalette() : install(); install(); install(); + install(); install(); InitBrowserControl(); } From 511311eb84eddfe1de035d2ebb5e2477caae69e5 Mon Sep 17 00:00:00 2001 From: David Kekesi Date: Wed, 16 Oct 2024 15:08:34 +0200 Subject: [PATCH 2/4] selectionBridge works --- SpeckleConnector/Connector.vcxproj | 2 + SpeckleConnector/Connector.vcxproj.filters | 6 +++ SpeckleConnector/Connector/Connector.cpp | 2 + .../Bridge/Selection/Arg/SelectionInfo.cpp | 37 ++++++++++++++- .../Bridge/Selection/Arg/SelectionInfo.h | 8 ++-- .../Browser/Bridge/Selection/GetSelection.cpp | 46 +------------------ .../Bridge/Selection/SelectionBridge.cpp | 11 ++++- .../Bridge/Selection/SelectionBridge.h | 8 +++- .../Selection/SelectionChangeHandler.cpp | 28 +++++++++++ .../Bridge/Selection/SelectionChangeHandler.h | 28 +++++++++++ .../Connector/Interface/ConnectorPalette.cpp | 36 +++------------ .../Event/Subscriber/SelectionSubscriber.cpp | 12 +++-- .../Event/Subscriber/SelectionSubscriber.h | 15 ++++-- .../Speckle/Event/Type/SelectionEvent.h | 2 +- .../Speckle/Interface/Browser/JSObject.h | 2 +- .../Speckle/Interface/Browser/JSPortal.h | 12 ++--- 16 files changed, 160 insertions(+), 95 deletions(-) create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp create mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h diff --git a/SpeckleConnector/Connector.vcxproj b/SpeckleConnector/Connector.vcxproj index acf33d4..245709b 100644 --- a/SpeckleConnector/Connector.vcxproj +++ b/SpeckleConnector/Connector.vcxproj @@ -114,6 +114,7 @@ + @@ -169,6 +170,7 @@ + diff --git a/SpeckleConnector/Connector.vcxproj.filters b/SpeckleConnector/Connector.vcxproj.filters index 374c759..763dc5c 100644 --- a/SpeckleConnector/Connector.vcxproj.filters +++ b/SpeckleConnector/Connector.vcxproj.filters @@ -243,6 +243,9 @@ Connector\Interface\Browser\Bridge\Selection\Arg + + Connector\Interface\Browser\Bridge\Selection + @@ -411,5 +414,8 @@ Connector\Interface\Browser\Bridge\Selection\Arg + + Connector\Interface\Browser\Bridge\Selection + \ No newline at end of file diff --git a/SpeckleConnector/Connector/Connector.cpp b/SpeckleConnector/Connector/Connector.cpp index 23943be..4343b1e 100755 --- a/SpeckleConnector/Connector/Connector.cpp +++ b/SpeckleConnector/Connector/Connector.cpp @@ -1,6 +1,7 @@ #include "Active/File/Directory.h" #include "ConnectorResource.h" #include "Connector/Connector.h" +#include "Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h" #include "Connector/Database/ModelCardDatabase.h" #include "Connector/Interface/ConnectorMenu.h" #include "Connector/Interface/ConnectorPalette.h" @@ -12,6 +13,7 @@ using namespace active::file; using namespace active::environment; using namespace connector; using namespace connector::database; +using namespace connector::interfac::browser::bridge; using namespace speckle::database; using namespace speckle::environment; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp index 42611d6..b7126b9 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp @@ -2,6 +2,14 @@ #include "Active/Serialise/Item/Wrapper/ValueWrap.h" #include "Active/Serialise/Package/Wrapper/PackageWrap.h" +#include "Active/Serialise/Package/Wrapper/ContainerWrap.h" + +#include "Connector/Connector.h" + +#include "Speckle/Database/BIMElementDatabase.h" +#include "Speckle/Environment/Project.h" +#include "Speckle/Record/Element/Element.h" +using namespace speckle::record::element; #include @@ -12,16 +20,40 @@ namespace { ///Serialisation fields enum FieldIndex { + selectedObjectIdsID, summaryID, }; ///Serialisation field IDs static std::array fieldID = { + Identity{"selectedObjectIds"}, Identity{"summary"}, }; } +SelectionInfo::SelectionInfo() { + initialize(); +} + +void SelectionInfo::initialize() { + auto project = connector()->getActiveProject().lock(); + if (!project) { + // TODO: handle + } + + auto elementDatabase = project->getElementDatabase(); + auto selected = elementDatabase->getSelection(); + + active::utility::String summary(selected.size()); + summary += " objects selected."; + m_summary = summary; + + for (const auto& link : selected) { + m_selectedElementIds.push_back(link); + } +} + /*-------------------------------------------------------------------- Fill an inventory with the package items @@ -33,6 +65,7 @@ bool SelectionInfo::fillInventory(Inventory& inventory) const { using enum Entry::Type; inventory.merge(Inventory{ { + { fieldID[selectedObjectIdsID], selectedObjectIdsID, element }, { fieldID[summaryID], summaryID, element }, }, }.withType(&typeid(SelectionInfo))); @@ -52,8 +85,10 @@ Cargo::Unique SelectionInfo::getCargo(const Inventory::Item& item) const { return nullptr; using namespace active::serialise; switch (item.index) { + case selectedObjectIdsID: + return std::make_unique>>(m_selectedElementIds); case summaryID: - return std::make_unique>(summary); + return std::make_unique>(m_summary); default: return nullptr; //Requested an unknown index } diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h index 2e81bea..12c9ec3 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h @@ -21,10 +21,12 @@ namespace connector::interfac::browser::bridge { /*! Default constructor */ - SelectionInfo() = default; + SelectionInfo(); - active::utility::String summary = "Nothing is selected"; - std::vector selectedElementIds; + active::utility::String m_summary = "No objects selected"; + std::vector m_selectedElementIds; + + void initialize(); // MARK: - Serialisation diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp index fc239a7..6385c09 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp @@ -1,30 +1,10 @@ #include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" - #include "Active/Serialise/CargoHold.h" -#include "Active/Serialise/Package/Wrapper/PackageWrap.h" #include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" -#include "Connector/Connector.h" -#include "Connector/Record/Collection/ProjectCollection.h" - -#include "Speckle/Database/BIMElementDatabase.h" -#include "Speckle/Environment/Project.h" -#include "Speckle/Record/Element/Element.h" -using namespace speckle::record::element; - -#include - using namespace active::serialise; using namespace connector::interfac::browser::bridge; -using namespace speckle::utility; -using namespace connector::record; -namespace { - - ///Return type for retrieving the current configuration - using WrappedValue = CargoHold; - -} /*-------------------------------------------------------------------- Default constructor --------------------------------------------------------------------*/ @@ -39,30 +19,6 @@ GetSelection::GetSelection() : BridgeMethod{"GetSelection", [&]() { modelCardID: The ID of the model to send --------------------------------------------------------------------*/ std::unique_ptr GetSelection::run() const { - auto selectionInfo = std::make_unique(); - - auto project = connector()->getActiveProject().lock(); - if (!project) { - // TODO - } - - //Build a collection from the selected elements - auto collection = std::make_unique(project); - auto elementDatabase = project->getElementDatabase(); - auto selected = elementDatabase->getSelection(); - - active::utility::String summary(selected.size()); - summary += " objects selected."; - - selectionInfo->summary = summary; - - for (const auto& link : selected) { - if (auto element = elementDatabase->getElement(link); element) { - collection->addElement(*element); - selectionInfo->selectedElementIds.push_back(element->getBIMID()); - } - } - - return std::make_unique(std::move(selectionInfo)); + return std::make_unique>(std::move(selectionInfo)); } //GetSelection::run diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp index 5fa969f..f31cc98 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp @@ -1,7 +1,9 @@ #include "Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h" - #include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" +#include "Active/Serialise/CargoHold.h" +#include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" +using namespace active::serialise; using namespace connector::interfac::browser::bridge; /*-------------------------------------------------------------------- @@ -11,3 +13,10 @@ SelectionBridge::SelectionBridge() : BrowserBridge{"selectionBinding"} { //Add bridge methods addMethod(); } //SelectionBridge::SelectionBridge + +bool SelectionBridge::handle(const speckle::event::SelectionEvent& event) { + auto selectionInfo = std::make_unique(); + auto wrapped = std::make_unique>(std::move(selectionInfo)); + sendEvent("setSelection", std::move(wrapped)); + return true; +} diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h index 053fba2..a92f213 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h @@ -2,13 +2,15 @@ #define CONNECTOR_INTERFACE_BRIDGE_SELECTION_BRIDGE #include "Speckle/Interface/Browser/Bridge/BrowserBridge.h" +#include "Speckle/Event/Subscriber/SelectionSubscriber.h" +#include "Speckle/Event/Type/SelectionEvent.h" namespace connector::interfac::browser::bridge { /*! A browser bridge to support sending model data to a Speckle server */ - class SelectionBridge : public speckle::interfac::browser::bridge::BrowserBridge { + class SelectionBridge : public speckle::interfac::browser::bridge::BrowserBridge, public speckle::event::SelectionSubscriber { public: // MARK: - Types @@ -22,6 +24,10 @@ namespace connector::interfac::browser::bridge { Default constructor */ SelectionBridge(); + + protected: + + bool handle(const speckle::event::SelectionEvent& event) override; }; } diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp new file mode 100644 index 0000000..652b96d --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp @@ -0,0 +1,28 @@ +#include "Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h" + +#include "Active/Event/Event.h" +#include "Connector/ConnectorResource.h" +#include "Connector/Event/ConnectorEventID.h" +#include "Speckle/Environment/Addon.h" + +using namespace connector::interfac::browser::bridge; + + +/*-------------------------------------------------------------------- + Default constructor + --------------------------------------------------------------------*/ +SelectionChangeHandler::SelectionChangeHandler() { + int i = 0; +} //SelectionChangeHandler::SelectionChangeHandler + +/*-------------------------------------------------------------------- + Handle the menu selection + + event: The menu event + + return: True if the event should be closed + --------------------------------------------------------------------*/ +bool SelectionChangeHandler::handle(const speckle::event::SelectionEvent& event) { + int i = 0; + return true; +} diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h new file mode 100644 index 0000000..38cf52b --- /dev/null +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h @@ -0,0 +1,28 @@ +#ifndef CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER +#define CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER + +#include "Speckle/Event/Subscriber/SelectionSubscriber.h" +#include "Speckle/Event/Type/SelectionEvent.h" + +namespace connector::interfac::browser::bridge { + + /*! + Configuration settings class + */ + class SelectionChangeHandler : public speckle::event::SelectionSubscriber { + public: + // MARK: - Constructors + + /*! + Default constructor + */ + SelectionChangeHandler(); + + + protected: + bool handle(const speckle::event::SelectionEvent& event) override; + }; + +} + +#endif //CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER diff --git a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp index 0800691..da4a920 100644 --- a/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp +++ b/SpeckleConnector/Connector/Interface/ConnectorPalette.cpp @@ -4,6 +4,7 @@ #include "Active/Utility/String.h" #include "Active/Serialise/JSON/JSONTransport.h" #include "Active/Utility/BufferOut.h" +#include "Connector/Connector.h" #include "Connector/ConnectorResource.h" #include "Connector/Event/ConnectorEventID.h" #include "Connector/Interface/Browser/Bridge/Account/AccountBridge.h" @@ -77,9 +78,6 @@ namespace { virtual void PanelResized(const DG::PanelResizeEvent& ev) override; virtual void PanelCloseRequested(const DG::PanelCloseRequestEvent& ev, bool* accepted) override; - static GS::Array GetSelectedElements(); - static void ModifySelection(const GS::UniString& elemGuidStr, SelectionModification modification); - static GSErrCode __ACENV_CALL PaletteControlCallBack(Int32 paletteId, API_PaletteMessageID messageID, GS::IntPtr param); static GS::Ref instance; @@ -171,7 +169,12 @@ BrowserPalette::BrowserPalette() : install(); install(); install(); - install(); + if (auto ref = install(); ref) { + if (auto selectionBridgeRef = std::dynamic_pointer_cast(ref); selectionBridgeRef) { + connector::connector()->addWeak(selectionBridgeRef); + selectionBridgeRef->start(); + } + } install(); InitBrowserControl(); } @@ -245,31 +248,6 @@ void BrowserPalette::PanelCloseRequested(const DG::PanelCloseRequestEvent&, bool *accepted = true; } -GS::Array BrowserPalette::GetSelectedElements() { - API_SelectionInfo selectionInfo; - GS::Array selNeigs; - ACAPI_Selection_Get(&selectionInfo, &selNeigs, false, false); - BMKillHandle((GSHandle*)&selectionInfo.marquee.coords); - - GS::Array selectedElements; - for(const API_Neig& neig : selNeigs) { - API_Elem_Head elemHead = {}; - elemHead.guid = neig.guid; - ACAPI_Element_GetHeader(&elemHead); - - ElementInfo elemInfo; - elemInfo.guidStr = APIGuidToString(elemHead.guid); - ACAPI_Element_GetElemTypeName(elemHead.type, elemInfo.typeName); - ACAPI_Element_GetElementInfoString(&elemHead.guid, &elemInfo.elemID); - selectedElements.Push(elemInfo); - } - return selectedElements; -} - -void BrowserPalette::ModifySelection(const GS::UniString& elemGuidStr, BrowserPalette::SelectionModification modification) { - ACAPI_Selection_Select({ API_Neig(APIGuidFromString(elemGuidStr.ToCStr().Get())) }, modification == AddToSelection); -} - GSErrCode __ACENV_CALL BrowserPalette::PaletteControlCallBack(Int32, API_PaletteMessageID messageID, GS::IntPtr param) { switch(messageID) { case APIPalMsg_OpenPalette: diff --git a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.cpp b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.cpp index 48b5f04..c6925b4 100644 --- a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.cpp +++ b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.cpp @@ -69,12 +69,18 @@ bool SelectionSubscriber::receive(const Event& event) { return: True if the participant is able to continue --------------------------------------------------------------------*/ bool SelectionSubscriber::start() { - if (m_isStarted) - return true; - m_isStarted = true; #ifdef ARCHICAD return (ACAPI_Notification_CatchSelectionChange(selectionCallback) == NoError); #else return false; #endif } //SelectionSubscriber::start + +/*-------------------------------------------------------------------- + Stop participation (release resources etc) + --------------------------------------------------------------------*/ +void SelectionSubscriber::stop() { +#ifdef ARCHICAD + ACAPI_Notification_CatchSelectionChange(nullptr); +#endif +} diff --git a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h index 975eb0c..a5595b0 100644 --- a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h +++ b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h @@ -35,7 +35,7 @@ namespace speckle::event { Get the event subscription list @return The subscription list (an empty list will put the subscriber into a suspended state) */ - virtual Subscription subscription() const override; + Subscription subscription() const override; // MARK: - Functions (mutating) @@ -44,14 +44,21 @@ namespace speckle::event { @param event The incoming event @return True if the event should be closed */ - virtual bool receive(const active::event::Event& event) override; - - protected: + bool receive(const active::event::Event& event) override; + /*! Start the participant operation @return True if the participant is able to continue */ virtual bool start() override; + + /*! + Stop participation (release resources etc) + */ + void stop() override; + + protected: + /*! Handle the menu selection @param event The menu event diff --git a/SpeckleLib/Speckle/Event/Type/SelectionEvent.h b/SpeckleLib/Speckle/Event/Type/SelectionEvent.h index 396f698..365f70f 100644 --- a/SpeckleLib/Speckle/Event/Type/SelectionEvent.h +++ b/SpeckleLib/Speckle/Event/Type/SelectionEvent.h @@ -24,7 +24,7 @@ namespace speckle::event { Constructor @param selected A link to a selected element (nullopt if the selection is empty) */ - SelectionEvent(speckle::database::BIMLink::Option selected) : m_selectedLink{selected} {} + SelectionEvent(speckle::database::BIMLink::Option selected) : Event{ ID }, m_selectedLink{selected} {} /*! Copy constructor @param source The object to copy diff --git a/SpeckleLib/Speckle/Interface/Browser/JSObject.h b/SpeckleLib/Speckle/Interface/Browser/JSObject.h index 05732e6..46843e0 100644 --- a/SpeckleLib/Speckle/Interface/Browser/JSObject.h +++ b/SpeckleLib/Speckle/Interface/Browser/JSObject.h @@ -38,7 +38,7 @@ namespace speckle::interfac::browser { */ template explicit JSObject(const speckle::utility::String& name, const std::initializer_list& items) : base{items}, m_name{name} {} - + virtual ~JSObject() {} // MARK: - Functions (const) /*! diff --git a/SpeckleLib/Speckle/Interface/Browser/JSPortal.h b/SpeckleLib/Speckle/Interface/Browser/JSPortal.h index 14bcc26..159eeb7 100644 --- a/SpeckleLib/Speckle/Interface/Browser/JSPortal.h +++ b/SpeckleLib/Speckle/Interface/Browser/JSPortal.h @@ -48,14 +48,14 @@ namespace speckle::interfac::browser { @param object The object to install @return True if the object was successfully installed */ - bool install(std::shared_ptr> object); + std::shared_ptr> install(std::shared_ptr> object); /*! Install a JS function object @return True if the object was successfully installed @tparam T The type of object to install */ template requires std::is_base_of_v, T> - bool install() { return install(std::make_shared()); } + std::shared_ptr> install() { return install(std::make_shared()); } protected: #ifdef ARCHICAD @@ -101,12 +101,12 @@ namespace speckle::interfac::browser { return: True if the object was successfully installed --------------------------------------------------------------------*/ template - bool JSPortal::install(std::shared_ptr> object) { + std::shared_ptr> JSPortal::install(std::shared_ptr> object) { try { #ifdef ARCHICAD auto engine = getJSEngine(); if (!engine) - return false; + return nullptr; //Define the JS object JS::Object* acObject = new JS::Object(object->getName()); //Add all the functions supported by this object @@ -125,13 +125,13 @@ namespace speckle::interfac::browser { if (engine->RegisterAsynchJSObject(acObject)) { base::push_back(object); object->setPortal(*this); - return true; + return object; } #endif } catch(...) { ///TODO: Need to discuss the best course of action to notify of a failure } - return false; + return nullptr; } //JSPortal::install } From 5c1511e85076eaf3aa4f45326d4fae90e2507a79 Mon Sep 17 00:00:00 2001 From: David Kekesi Date: Wed, 16 Oct 2024 15:50:15 +0200 Subject: [PATCH 3/4] code cleanup --- SpeckleConnector/Connector.vcxproj | 2 -- SpeckleConnector/Connector.vcxproj.filters | 6 ---- SpeckleConnector/Connector/Connector.cpp | 2 -- .../Bridge/Selection/Arg/SelectionInfo.cpp | 15 ++++------ .../Bridge/Selection/Arg/SelectionInfo.h | 2 -- .../Browser/Bridge/Selection/GetSelection.cpp | 7 ++--- .../Browser/Bridge/Selection/GetSelection.h | 4 +-- .../Bridge/Selection/SelectionBridge.cpp | 9 ++++-- .../Bridge/Selection/SelectionBridge.h | 6 +++- .../Selection/SelectionChangeHandler.cpp | 28 ------------------- .../Bridge/Selection/SelectionChangeHandler.h | 28 ------------------- .../Event/Subscriber/SelectionSubscriber.h | 2 +- 12 files changed, 24 insertions(+), 87 deletions(-) delete mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp delete mode 100644 SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h diff --git a/SpeckleConnector/Connector.vcxproj b/SpeckleConnector/Connector.vcxproj index 245709b..acf33d4 100644 --- a/SpeckleConnector/Connector.vcxproj +++ b/SpeckleConnector/Connector.vcxproj @@ -114,7 +114,6 @@ - @@ -170,7 +169,6 @@ - diff --git a/SpeckleConnector/Connector.vcxproj.filters b/SpeckleConnector/Connector.vcxproj.filters index 763dc5c..374c759 100644 --- a/SpeckleConnector/Connector.vcxproj.filters +++ b/SpeckleConnector/Connector.vcxproj.filters @@ -243,9 +243,6 @@ Connector\Interface\Browser\Bridge\Selection\Arg - - Connector\Interface\Browser\Bridge\Selection - @@ -414,8 +411,5 @@ Connector\Interface\Browser\Bridge\Selection\Arg - - Connector\Interface\Browser\Bridge\Selection - \ No newline at end of file diff --git a/SpeckleConnector/Connector/Connector.cpp b/SpeckleConnector/Connector/Connector.cpp index 4343b1e..23943be 100755 --- a/SpeckleConnector/Connector/Connector.cpp +++ b/SpeckleConnector/Connector/Connector.cpp @@ -1,7 +1,6 @@ #include "Active/File/Directory.h" #include "ConnectorResource.h" #include "Connector/Connector.h" -#include "Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h" #include "Connector/Database/ModelCardDatabase.h" #include "Connector/Interface/ConnectorMenu.h" #include "Connector/Interface/ConnectorPalette.h" @@ -13,7 +12,6 @@ using namespace active::file; using namespace active::environment; using namespace connector; using namespace connector::database; -using namespace connector::interfac::browser::bridge; using namespace speckle::database; using namespace speckle::environment; using namespace speckle::utility; diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp index b7126b9..94d5453 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.cpp @@ -1,20 +1,16 @@ -#include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" - #include "Active/Serialise/Item/Wrapper/ValueWrap.h" -#include "Active/Serialise/Package/Wrapper/PackageWrap.h" #include "Active/Serialise/Package/Wrapper/ContainerWrap.h" - #include "Connector/Connector.h" - +#include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" #include "Speckle/Database/BIMElementDatabase.h" #include "Speckle/Environment/Project.h" #include "Speckle/Record/Element/Element.h" -using namespace speckle::record::element; #include using namespace active::serialise; using namespace connector::interfac::browser::bridge; +using namespace speckle::record::element; namespace { @@ -39,7 +35,8 @@ SelectionInfo::SelectionInfo() { void SelectionInfo::initialize() { auto project = connector()->getActiveProject().lock(); if (!project) { - // TODO: handle + // TODO: is thi OK? + return; } auto elementDatabase = project->getElementDatabase(); @@ -70,7 +67,7 @@ bool SelectionInfo::fillInventory(Inventory& inventory) const { }, }.withType(&typeid(SelectionInfo))); return true; -} //ConnectorConfig::fillInventory +} //SelectionInfo::fillInventory /*-------------------------------------------------------------------- @@ -92,4 +89,4 @@ Cargo::Unique SelectionInfo::getCargo(const Inventory::Item& item) const { default: return nullptr; //Requested an unknown index } -} //ConnectorConfig::getCargo +} //SelectionInfo::getCargo diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h index 12c9ec3..2ffb592 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h @@ -2,7 +2,6 @@ #define CONNECTOR_INTERFACE_BRIDGE_SELECTION_INFO #include "Active/Serialise/Package/Package.h" -#include "Speckle/Interface/Browser/Bridge/ArgumentBase.h" namespace connector::interfac::browser::bridge { @@ -43,7 +42,6 @@ namespace connector::interfac::browser::bridge { */ Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override; }; - } #endif //CONNECTOR_INTERFACE_BRIDGE_SELECTION_INFO diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp index 6385c09..37f918a 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.cpp @@ -1,5 +1,5 @@ -#include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" #include "Active/Serialise/CargoHold.h" +#include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" #include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" using namespace active::serialise; @@ -14,9 +14,8 @@ GetSelection::GetSelection() : BridgeMethod{"GetSelection", [&]() { /*-------------------------------------------------------------------- - Send a specified model - - modelCardID: The ID of the model to send + Get the current selection info + based on the ArchiCAD mdoel selection --------------------------------------------------------------------*/ std::unique_ptr GetSelection::run() const { auto selectionInfo = std::make_unique(); diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h index 8f9b73d..66e827f 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/GetSelection.h @@ -19,8 +19,8 @@ namespace connector::interfac::browser::bridge { // MARK: - Functions (const) /*! - Send a specified model - @param modelCardID The ID of the model to send + Get the current selection info + based on the ArchiCAD mdoel selection */ std::unique_ptr run() const; }; diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp index f31cc98..33ce06b 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.cpp @@ -1,6 +1,6 @@ +#include "Active/Serialise/CargoHold.h" #include "Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h" #include "Connector/Interface/Browser/Bridge/Selection/GetSelection.h" -#include "Active/Serialise/CargoHold.h" #include "Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h" using namespace active::serialise; @@ -14,9 +14,14 @@ SelectionBridge::SelectionBridge() : BrowserBridge{"selectionBinding"} { addMethod(); } //SelectionBridge::SelectionBridge +/*! +Handle the menu selection +@param event The selection event +@return True if the event should be closed +*/ bool SelectionBridge::handle(const speckle::event::SelectionEvent& event) { auto selectionInfo = std::make_unique(); auto wrapped = std::make_unique>(std::move(selectionInfo)); sendEvent("setSelection", std::move(wrapped)); return true; -} +} //SelectionBridge::handle diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h index a92f213..7da2690 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionBridge.h @@ -26,7 +26,11 @@ namespace connector::interfac::browser::bridge { SelectionBridge(); protected: - + /*! + Handle the menu selection + @param event The selection event + @return True if the event should be closed + */ bool handle(const speckle::event::SelectionEvent& event) override; }; diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp deleted file mode 100644 index 652b96d..0000000 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h" - -#include "Active/Event/Event.h" -#include "Connector/ConnectorResource.h" -#include "Connector/Event/ConnectorEventID.h" -#include "Speckle/Environment/Addon.h" - -using namespace connector::interfac::browser::bridge; - - -/*-------------------------------------------------------------------- - Default constructor - --------------------------------------------------------------------*/ -SelectionChangeHandler::SelectionChangeHandler() { - int i = 0; -} //SelectionChangeHandler::SelectionChangeHandler - -/*-------------------------------------------------------------------- - Handle the menu selection - - event: The menu event - - return: True if the event should be closed - --------------------------------------------------------------------*/ -bool SelectionChangeHandler::handle(const speckle::event::SelectionEvent& event) { - int i = 0; - return true; -} diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h deleted file mode 100644 index 38cf52b..0000000 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/SelectionChangeHandler.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER -#define CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER - -#include "Speckle/Event/Subscriber/SelectionSubscriber.h" -#include "Speckle/Event/Type/SelectionEvent.h" - -namespace connector::interfac::browser::bridge { - - /*! - Configuration settings class - */ - class SelectionChangeHandler : public speckle::event::SelectionSubscriber { - public: - // MARK: - Constructors - - /*! - Default constructor - */ - SelectionChangeHandler(); - - - protected: - bool handle(const speckle::event::SelectionEvent& event) override; - }; - -} - -#endif //CONNECTOR_INTERFACE_BRIDGE_SELECTION_CHANGE_HANDLER diff --git a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h index a5595b0..b68f2ed 100644 --- a/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h +++ b/SpeckleLib/Speckle/Event/Subscriber/SelectionSubscriber.h @@ -61,7 +61,7 @@ namespace speckle::event { /*! Handle the menu selection - @param event The menu event + @param event The selection event @return True if the event should be closed */ virtual bool handle(const SelectionEvent& event) = 0; From 3813c8740f4bc6f9259f9b17d24432daaddb7eb7 Mon Sep 17 00:00:00 2001 From: David Kekesi Date: Wed, 16 Oct 2024 15:53:59 +0200 Subject: [PATCH 4/4] SelectionInfo::initialize changed to private --- .../Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h index 2ffb592..e10bd6f 100644 --- a/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h +++ b/SpeckleConnector/Connector/Interface/Browser/Bridge/Selection/Arg/SelectionInfo.h @@ -24,8 +24,6 @@ namespace connector::interfac::browser::bridge { active::utility::String m_summary = "No objects selected"; std::vector m_selectedElementIds; - - void initialize(); // MARK: - Serialisation @@ -41,6 +39,10 @@ namespace connector::interfac::browser::bridge { @return The requested cargo (nullptr on failure) */ Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override; + + private: + + void initialize(); }; }