Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9d669c4dd | |||
| e4e31314d6 | |||
| 82bd96de61 | |||
| 51ed951d7d | |||
| cc6c884f47 | |||
| 4afed92ba9 | |||
| ca2df4c020 | |||
| 764b548900 | |||
| 71dac48830 | |||
| 5684364119 | |||
| 45c4311d95 | |||
| ae521de698 | |||
| 0ff87576da | |||
| 63c3c9befa | |||
| 281a2654c9 | |||
| 8fdbaaa52d | |||
| 67b12ae353 | |||
| 690e527b81 | |||
| 8f2e31c16e | |||
| e9b768daec | |||
| e5bf001590 | |||
| 7c0ac2e8f6 | |||
| 0969026f39 | |||
| 3d2aab8862 | |||
| bdea330c2e | |||
| b066b4ba3c |
@@ -105,6 +105,7 @@
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationName.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationVersion.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\RemoveModel.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\UpdateModel.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.cpp" />
|
||||
@@ -161,6 +162,7 @@
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationName.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationVersion.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\RemoveModel.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\UpdateModel.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Config\Arg\ConnectorConfig.h" />
|
||||
|
||||
@@ -246,6 +246,9 @@
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.cpp">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.cpp">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Connector\ConnectorResource.h">
|
||||
@@ -417,5 +420,8 @@
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.h">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.h">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
210CC8832C80E6A300610F58 /* TriggerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 210CC8812C80E6A300610F58 /* TriggerEvent.cpp */; };
|
||||
21384BCD2CD2EE7400D4602B /* OpenUrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21384BC92CD2EE7400D4602B /* OpenUrl.cpp */; };
|
||||
213CC39C2B1101F500088049 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2151077C2AEDB9070022CD24 /* Cocoa.framework */; };
|
||||
214B7A372C764BCD00D586C1 /* UpdateConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21F69FBD2C7630B3008B6A06 /* UpdateConfig.cpp */; };
|
||||
215F082A2C947F4400CD343B /* CardMover.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08262C947F4400CD343B /* CardMover.cpp */; };
|
||||
@@ -32,6 +33,7 @@
|
||||
2192460D2CA3469D00CF5703 /* ProjectCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2192460B2CA3469D00CF5703 /* ProjectCollection.cpp */; };
|
||||
219F30422C769283009834E9 /* ConfigTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219F30402C769282009834E9 /* ConfigTests.cpp */; };
|
||||
21A0FB982CB723240023F24E /* FinishProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A0FB942CB723240023F24E /* FinishProxy.cpp */; };
|
||||
21A79EC92CCDA45C001754E4 /* HighlightModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A79EC52CCDA45C001754E4 /* HighlightModel.cpp */; };
|
||||
21A890BC2CC15C540087E732 /* SelectionInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A890B22CC15C540087E732 /* SelectionInfo.cpp */; };
|
||||
21A890BD2CC15C540087E732 /* GetSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A890B52CC15C540087E732 /* GetSelection.cpp */; };
|
||||
21A890BE2CC15C540087E732 /* SelectionBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A890B72CC15C540087E732 /* SelectionBridge.cpp */; };
|
||||
@@ -295,6 +297,8 @@
|
||||
/* Begin PBXFileReference section */
|
||||
210CC8812C80E6A300610F58 /* TriggerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TriggerEvent.cpp; sourceTree = "<group>"; };
|
||||
210CC8822C80E6A300610F58 /* TriggerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriggerEvent.h; sourceTree = "<group>"; };
|
||||
21384BC92CD2EE7400D4602B /* OpenUrl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenUrl.cpp; sourceTree = "<group>"; };
|
||||
21384BCC2CD2EE7400D4602B /* OpenUrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenUrl.h; sourceTree = "<group>"; };
|
||||
213CC3A52B1101F500088049 /* Speckle Connector.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Speckle Connector.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2151077C2AEDB9070022CD24 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
215F08262C947F4400CD343B /* CardMover.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CardMover.cpp; sourceTree = "<group>"; };
|
||||
@@ -317,6 +321,8 @@
|
||||
219F30432C7693B6009834E9 /* Connector-AC27-Debug.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Connector-AC27-Debug.xctestplan"; sourceTree = SOURCE_ROOT; };
|
||||
21A0FB942CB723240023F24E /* FinishProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FinishProxy.cpp; sourceTree = "<group>"; };
|
||||
21A0FB972CB723240023F24E /* FinishProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FinishProxy.h; sourceTree = "<group>"; };
|
||||
21A79EC52CCDA45C001754E4 /* HighlightModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightModel.cpp; sourceTree = "<group>"; };
|
||||
21A79EC82CCDA45C001754E4 /* HighlightModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HighlightModel.h; sourceTree = "<group>"; };
|
||||
21A890B22CC15C540087E732 /* SelectionInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionInfo.cpp; sourceTree = "<group>"; };
|
||||
21A890B32CC15C540087E732 /* SelectionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionInfo.h; sourceTree = "<group>"; };
|
||||
21A890B52CC15C540087E732 /* GetSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetSelection.cpp; sourceTree = "<group>"; };
|
||||
@@ -1026,6 +1032,10 @@
|
||||
21B67CA82C77329800FD64FC /* GetSourceApplicationName.h */,
|
||||
21B67CA92C77329800FD64FC /* GetSourceApplicationVersion.cpp */,
|
||||
21B67CAA2C77329800FD64FC /* GetSourceApplicationVersion.h */,
|
||||
21A79EC52CCDA45C001754E4 /* HighlightModel.cpp */,
|
||||
21A79EC82CCDA45C001754E4 /* HighlightModel.h */,
|
||||
21384BC92CD2EE7400D4602B /* OpenUrl.cpp */,
|
||||
21384BCC2CD2EE7400D4602B /* OpenUrl.h */,
|
||||
21D0BDD52C935DAE0077E104 /* RemoveModel.cpp */,
|
||||
21D0BDD62C935DAE0077E104 /* RemoveModel.h */,
|
||||
21D0BDD22C935D1A0077E104 /* UpdateModel.cpp */,
|
||||
@@ -1508,6 +1518,7 @@
|
||||
214B7A372C764BCD00D586C1 /* UpdateConfig.cpp in Sources */,
|
||||
21AEF9EC2CAB56E5000B8681 /* SendViaBrowserArgs.cpp in Sources */,
|
||||
21FF70492CA1A7F400AAD99A /* RecordCollection.cpp in Sources */,
|
||||
21A79EC92CCDA45C001754E4 /* HighlightModel.cpp in Sources */,
|
||||
21B67CC02C775A0D00FD64FC /* GetDocumentInfo.cpp in Sources */,
|
||||
21D0BDD42C935D1A0077E104 /* UpdateModel.cpp in Sources */,
|
||||
21A890BD2CC15C540087E732 /* GetSelection.cpp in Sources */,
|
||||
@@ -1520,6 +1531,7 @@
|
||||
21D0BDD72C935DAE0077E104 /* RemoveModel.cpp in Sources */,
|
||||
21A890BC2CC15C540087E732 /* SelectionInfo.cpp in Sources */,
|
||||
21AEF9EF2CAB5720000B8681 /* SendObject.cpp in Sources */,
|
||||
21384BCD2CD2EE7400D4602B /* OpenUrl.cpp in Sources */,
|
||||
21B67CDC2C78C88000FD64FC /* SayHi.cpp in Sources */,
|
||||
215F082E2C94C5C000CD343B /* FilterMover.cpp in Sources */,
|
||||
21F69F122C677BC0008B6A06 /* ConnectorMenu.cpp in Sources */,
|
||||
@@ -2065,7 +2077,7 @@
|
||||
);
|
||||
LOCALISATION_SUFFIX = "EN-GB";
|
||||
MACH_O_TYPE = mh_bundle;
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
NNA_WARNING_CPLUSPLUSFLAGS = "-Wno-deprecated";
|
||||
OBJROOT = "";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -2172,7 +2184,7 @@
|
||||
);
|
||||
LOCALISATION_SUFFIX = "EN-GB";
|
||||
MACH_O_TYPE = mh_bundle;
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
NNA_WARNING_CPLUSPLUSFLAGS = "-Wno-deprecated";
|
||||
OBJROOT = "";
|
||||
PLUGIN_FOLDER = "";
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector<Account>>, Vector<Account>>;
|
||||
using WrappedValue = CargoHold<ContainerWrap<Vector<Account>>, Vector<Account>>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
JS Function class to retrieve the user's account(s)
|
||||
*/
|
||||
class GetAccounts : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "Connector/Connector.h"
|
||||
#include "Connector/Database/ModelCardDatabase.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/Arg/DocumentInfo.h"
|
||||
|
||||
using namespace active::container;
|
||||
using namespace active::serialise;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
///Argument parameter for a model card
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Base/RemoveModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/UpdateModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/HighlightModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/OpenUrl.h"
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
|
||||
@@ -25,6 +27,7 @@ BaseBridge::BaseBridge() : BrowserBridge{"baseBinding"} {
|
||||
addMethod<RemoveModel>();
|
||||
addMethod<UpdateModel>();
|
||||
addMethod<HighlightModel>();
|
||||
addMethod<OpenUrl>();
|
||||
} //BaseBridge::BaseBridge
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -37,11 +40,11 @@ BaseBridge::BaseBridge() : BrowserBridge{"baseBinding"} {
|
||||
bool BaseBridge::handle(const speckle::event::ProjectEvent& event) {
|
||||
using enum speckle::event::ProjectEvent::Type;
|
||||
switch (event.getType()) {
|
||||
case open:
|
||||
sendEvent("documentChanged");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case open:
|
||||
sendEvent("documentChanged");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
} //BaseBridge::handle
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
|
||||
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
||||
#include "Speckle/Event/Subscriber/ProjectSubscriber.h"
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
A browser bridge to provide configuration settings
|
||||
A browser bridge to manage document settings
|
||||
*/
|
||||
class BaseBridge : public speckle::interfac::browser::bridge::BrowserBridge, public speckle::event::ProjectSubscriber {
|
||||
public:
|
||||
|
||||
@@ -25,13 +25,13 @@ GetConnectorVersion::GetConnectorVersion() : BridgeMethod{"GetConnectorVersion",
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the host application version
|
||||
Get the connector software version
|
||||
|
||||
return: The application version
|
||||
return: The connector software version
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetConnectorVersion::run() const {
|
||||
//Implement other platforms as required
|
||||
String result{active::utility::String{connector::versionMajor} + "." + active::utility::String{connector::versionMinor} + "." +
|
||||
active::utility::String{connector::versionPatch}};
|
||||
String result{String{connector::versionMajor} + "." + String{connector::versionMinor} + "." +
|
||||
String{connector::versionPatch}};
|
||||
return std::make_unique<WrappedValue>(result);
|
||||
} //GetConnectorVersion::run
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace connector::interfac::browser::bridge {
|
||||
class ConnectorConfig;
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
JS Function class to get the connector software version
|
||||
*/
|
||||
class GetConnectorVersion : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
@@ -23,8 +23,8 @@ namespace connector::interfac::browser::bridge {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the host application version
|
||||
@return The application version
|
||||
Get the connector software version
|
||||
@return The connector software version
|
||||
*/
|
||||
std::unique_ptr<active::serialise::Cargo> run() const;
|
||||
};
|
||||
|
||||
@@ -21,9 +21,9 @@ GetDocumentState::GetDocumentState() : BridgeMethod{"GetDocumentState", [&]() {
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the document info
|
||||
Get the document model cards
|
||||
|
||||
return: The document info
|
||||
return: The document model cards
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetDocumentState::run() const {
|
||||
if (auto modelCardDBase = connector()->getModelCardDatabase(); modelCardDBase != nullptr) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the information about the active document
|
||||
JS Function class to retrieve model cards stored in the current document
|
||||
*/
|
||||
class GetDocumentState : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
@@ -21,8 +21,8 @@ namespace connector::interfac::browser::bridge {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the document info
|
||||
@return The document info
|
||||
Get the document model cards
|
||||
@return The document model cards
|
||||
*/
|
||||
std::unique_ptr<active::serialise::Cargo> run() const;
|
||||
};
|
||||
|
||||
@@ -10,17 +10,11 @@
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace speckle::record::element;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace connector::record;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
@@ -30,9 +24,9 @@ HighlightModel::HighlightModel() : BridgeMethod{"HighlightModel", [&](const Send
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Higlight the model card selection
|
||||
Highlight elements linked to the model card selection
|
||||
|
||||
modelCardID: The ID of the model to send
|
||||
modelCardID: The ID of the target model card
|
||||
--------------------------------------------------------------------*/
|
||||
void HighlightModel::run(const String& modelCardID) const {
|
||||
// Find the specified model card
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace connector::interfac::browser::bridge {
|
||||
using SendArgs = speckle::interfac::browser::bridge::JSArgType<StringHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to send a specified model
|
||||
JS Function class to highlight elements from the selected model card in the open document
|
||||
*/
|
||||
class HighlightModel : public speckle::interfac::browser::bridge::BridgeMethod<SendArgs, void> {
|
||||
public:
|
||||
@@ -31,8 +31,8 @@ namespace connector::interfac::browser::bridge {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Higlight the model card selection
|
||||
@param modelCardID The ID of the model to send
|
||||
Highlight elements linked to the model card selection
|
||||
@param modelCardID The ID of the target model card
|
||||
*/
|
||||
void run(const speckle::utility::String& modelCardID) const;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Base/OpenUrl.h"
|
||||
|
||||
#include "Speckle/Environment/Platform.h"
|
||||
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::utility;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
OpenUrl::OpenUrl() : BridgeMethod{"OpenUrl", [&](const SendArgs& args) {
|
||||
run(args);
|
||||
}} {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Opens an url
|
||||
|
||||
url: The URL to open
|
||||
--------------------------------------------------------------------*/
|
||||
void OpenUrl::run(const String& url) const {
|
||||
platform()->openURL(url);
|
||||
} //OpenUrl::run
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_OPEN_URL
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_OPEN_URL
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
class ConnectorConfig;
|
||||
|
||||
///Argument parameter for a string
|
||||
using StringHold = active::serialise::CargoHold<active::serialise::ValueWrap<speckle::utility::String>, speckle::utility::String>;
|
||||
///Argument type for this method
|
||||
using SendArgs = speckle::interfac::browser::bridge::JSArgType<StringHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to highlight elements from the selected model card in the open document
|
||||
*/
|
||||
class OpenUrl : public speckle::interfac::browser::bridge::BridgeMethod<SendArgs, void> {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
*/
|
||||
OpenUrl();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Opens an url
|
||||
@param url The URL to open
|
||||
*/
|
||||
void run(const speckle::utility::String& url) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_OPEN_URL
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
///Argument parameter for a model card
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to add a model card to the document storage
|
||||
JS Function class to remove a model card from the document storage
|
||||
*/
|
||||
class RemoveModel : public speckle::interfac::browser::bridge::BridgeMethod<ModelCardEventWrapper, void> {
|
||||
public:
|
||||
@@ -29,8 +29,8 @@ namespace connector::interfac::browser::bridge {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Add a model card to document storage
|
||||
@param card The card to add
|
||||
Remove a model card from document storage
|
||||
@param card The card to remove
|
||||
*/
|
||||
void run(const connector::record::ModelCard& card) const;
|
||||
};
|
||||
|
||||
@@ -26,9 +26,9 @@ UpdateModel::UpdateModel() : BridgeMethod{"UpdateModel", [&](const ModelCardEven
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Add a model card to document storage
|
||||
Update a model card in document storage
|
||||
|
||||
card: The card to add
|
||||
card: The card to update
|
||||
--------------------------------------------------------------------*/
|
||||
void UpdateModel::run(const ModelCard& card) const {
|
||||
if (auto modelCardDBase = connector()->getModelCardDatabase(); modelCardDBase != nullptr)
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///Argument parameter for a string
|
||||
///Argument parameter for a model card
|
||||
using CardHold = active::serialise::CargoHold<connector::record::CardMover, connector::record::ModelCard>;
|
||||
///Argument type for this method
|
||||
using ModelCardEventWrapper = speckle::interfac::browser::bridge::JSArgType<CardHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to add a model card to the document storage
|
||||
JS Function class to update a model card in document storage
|
||||
*/
|
||||
class UpdateModel : public speckle::interfac::browser::bridge::BridgeMethod<ModelCardEventWrapper, void> {
|
||||
public:
|
||||
@@ -29,8 +29,8 @@ namespace connector::interfac::browser::bridge {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Add a model card to document storage
|
||||
@param card The card to add
|
||||
Update a model card in document storage
|
||||
@param card The card to update
|
||||
*/
|
||||
void run(const connector::record::ModelCard& card) const;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
JS Function class to retrieve the current display configuration settings
|
||||
*/
|
||||
class GetConfig : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
class ConnectorConfig;
|
||||
|
||||
///Argument for a JS call to update the configuration
|
||||
///Argument for a JS call to update the display configuration settings
|
||||
using UpdateArgs = speckle::interfac::browser::bridge::JSArgType<ConnectorConfig>;
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the names of the methods supported by the bridge
|
||||
JS Function class to update the display configuration settings
|
||||
*/
|
||||
class UpdateConfig : public speckle::interfac::browser::bridge::BridgeMethod<UpdateArgs, void> {
|
||||
public:
|
||||
@@ -22,7 +22,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
UpdateConfig();
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
GetSelection();
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
GetSendFilters();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
using WrappedValue = active::serialise::CargoHold<ContainerWrap<Vector<CardSetting>, PackageWrap>, Vector<CardSetting>>;
|
||||
using WrappedValue = CargoHold<ContainerWrap<Vector<CardSetting>, PackageWrap>, Vector<CardSetting>>;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ GetSendSettings::GetSendSettings() : BridgeMethod{"GetSendSettings", [&]() {
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the send filters
|
||||
Get send settings relevant to the host BIM application
|
||||
|
||||
return: The send filters
|
||||
return: The send settings
|
||||
--------------------------------------------------------------------*/
|
||||
std::unique_ptr<Cargo> GetSendSettings::run() const {
|
||||
auto filters = std::make_unique<Vector<CardSetting>>();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace connector::interfac::browser::bridge {
|
||||
class ConnectorConfig;
|
||||
|
||||
/*!
|
||||
JS Function class to retrieve the send filters
|
||||
JS Function class to retrieve the send settings relevant to the host BIM application
|
||||
*/
|
||||
class GetSendSettings : public speckle::interfac::browser::bridge::BridgeMethod<void, active::serialise::Cargo> {
|
||||
public:
|
||||
@@ -18,15 +18,14 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
GetSendSettings();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the send filters
|
||||
@return The send filters
|
||||
Get send settings relevant to the host BIM application
|
||||
@return The send settings
|
||||
*/
|
||||
std::unique_ptr<active::serialise::Cargo> run() const;
|
||||
};
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
using namespace speckle::record::element;
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace connector::record;
|
||||
@@ -29,10 +27,6 @@ using namespace speckle::database;
|
||||
using namespace speckle::serialise;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
@@ -44,7 +38,7 @@ Send::Send() : BridgeMethod{"Send", [&](const SendArgs& args) {
|
||||
/*--------------------------------------------------------------------
|
||||
Send a specified model
|
||||
|
||||
modelCardID: The ID of the model to send
|
||||
modelCardID: The ID of the model card identifying the objects to send
|
||||
--------------------------------------------------------------------*/
|
||||
void Send::run(const String& modelCardID) const {
|
||||
//Find the specified model card
|
||||
@@ -70,8 +64,7 @@ void Send::run(const String& modelCardID) const {
|
||||
std::make_unique<SendError>(connector()->getLocalString(errorString, noProjectOpenID), modelCardID));
|
||||
return;
|
||||
}
|
||||
//Build a collection from the selected elements
|
||||
auto collection = std::make_unique<ProjectCollection>(project);
|
||||
//Get the selected elements
|
||||
auto elementDatabase = project->getElementDatabase();
|
||||
auto selected = elementDatabase->getSelection();
|
||||
if (selected.empty()) {
|
||||
@@ -79,6 +72,8 @@ void Send::run(const String& modelCardID) const {
|
||||
std::make_unique<SendError>(connector()->getLocalString(errorString, noSelectedModelItemsID), modelCardID));
|
||||
return;
|
||||
}
|
||||
//Build a collection from the selected elements
|
||||
auto collection = std::make_unique<ProjectCollection>(project);
|
||||
for (const auto& link : selected) {
|
||||
if (auto element = elementDatabase->getElement(link); element)
|
||||
collection->addElement(*element);
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
Send();
|
||||
|
||||
@@ -33,7 +32,7 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Send a specified model
|
||||
@param modelCardID The ID of the model to send
|
||||
@param modelCardID The ID of the model card identifying the objects to send
|
||||
*/
|
||||
void run(const speckle::utility::String& modelCardID) const;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Send/SendBridge.h"
|
||||
|
||||
#include "Connector/Interface/Browser/Bridge/Send/GetSendFilters.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/GetSendSettings.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Send.h"
|
||||
#include "Connector/Connector.h"
|
||||
#include "Connector/ConnectorResource.h"
|
||||
#include "Connector/Database/ModelCardDatabase.h"
|
||||
#include "Speckle/Event/Type/ElementEvent.h"
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Database/Identity/RecordID.h"
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Connector/Record/Model/SenderModelCard.h"
|
||||
#include "Connector/Record/Model/Filter/SendFilter.h"
|
||||
|
||||
using namespace speckle::database;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace speckle::utility;
|
||||
using namespace speckle::event;
|
||||
using namespace active::serialise;
|
||||
using namespace connector::record;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
@@ -14,4 +30,68 @@ SendBridge::SendBridge() : BrowserBridge{"sendBinding"} {
|
||||
addMethod<GetSendFilters>();
|
||||
addMethod<GetSendSettings>();
|
||||
addMethod<Send>();
|
||||
|
||||
// POC: do we have a better place to attach observer to elements?
|
||||
#ifdef ARCHICAD
|
||||
auto project = connector()->getActiveProject().lock();
|
||||
if (!project) {
|
||||
// TODO: is this OK? should this throw?
|
||||
return;
|
||||
}
|
||||
|
||||
auto elementDatabase = project->getElementDatabase();
|
||||
auto elements = elementDatabase->getElements();
|
||||
ElementIDList elementIds;
|
||||
for (const auto& id : elementIds) {
|
||||
ACAPI_Element_AttachObserver(id);
|
||||
}
|
||||
#endif
|
||||
} //SendBridge::SendBridge
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Handle an element change
|
||||
|
||||
event: The selection event
|
||||
|
||||
return: True if the event should be closed
|
||||
--------------------------------------------------------------------*/
|
||||
bool SendBridge::handle(const ElementEvent& event) {
|
||||
using enum ElementEvent::Type;
|
||||
auto eventType = event.getEventType();
|
||||
switch (eventType) {
|
||||
case begin:
|
||||
m_changedElements.clear();
|
||||
break;
|
||||
case end: {
|
||||
auto modelCardDatabase = connector()->getModelCardDatabase();
|
||||
auto modelCards = modelCardDatabase->getCards();
|
||||
// POC: this is probably not efficient, should test, review and refactor it
|
||||
RecordIDList expiredModelCardIds;
|
||||
for (const auto& modelCard : modelCards) {
|
||||
if (auto senderCard = dynamic_cast<SenderModelCard*>(modelCard.get())) {
|
||||
auto modelCardSelection = senderCard->getFilter().getElementIDs();
|
||||
for (const auto& elemId : modelCardSelection) {
|
||||
if (std::find(m_changedElements.begin(), m_changedElements.end(), elemId) != m_changedElements.end()) {
|
||||
expiredModelCardIds.push_back(modelCard->getID());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!expiredModelCardIds.empty()) {
|
||||
auto wrapped = std::make_unique<CargoHold<ContainerWrap<RecordIDList>, RecordIDList>>(std::move(expiredModelCardIds));
|
||||
sendEvent("setModelsExpired", std::move(wrapped));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case changeElem: case editElem: case deleteElem: {
|
||||
if (event.getElmentID())
|
||||
m_changedElements.push_back(*event.getElmentID());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
} //SendBridge::handle
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_SEND_BRIDGE
|
||||
|
||||
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
||||
#include "Speckle/Event/Subscriber/ElementSubscriber.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
A browser bridge to support sending model data to a Speckle server
|
||||
*/
|
||||
class SendBridge : public speckle::interfac::browser::bridge::BrowserBridge {
|
||||
class SendBridge : public speckle::interfac::browser::bridge::BrowserBridge, public speckle::event::ElementSubscriber {
|
||||
public:
|
||||
|
||||
// MARK: - Types
|
||||
@@ -22,6 +23,14 @@ namespace connector::interfac::browser::bridge {
|
||||
Default constructor
|
||||
*/
|
||||
SendBridge();
|
||||
|
||||
protected:
|
||||
/*!
|
||||
Handle an element change
|
||||
@param event The selection event
|
||||
@return True if the event should be closed
|
||||
*/
|
||||
bool handle(const speckle::event::ElementEvent& event) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_GET_CONFIG
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_GET_CONFIG
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_GET_COMPLEX_TYPE
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_GET_COMPLEX_TYPE
|
||||
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param bridge The parent bridge object (provides access to bridge methods)
|
||||
*/
|
||||
GetComplexType();
|
||||
|
||||
@@ -30,4 +29,4 @@ namespace connector::interfac::browser::bridge {
|
||||
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_GET_CONFIG
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_GET_COMPLEX_TYPE
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Test/GoAway.h"
|
||||
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
#include "Speckle/Environment/Platform.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace speckle::environment;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
@@ -16,5 +17,5 @@ GoAway::GoAway() : BridgeMethod{"GoAway", [&]() {
|
||||
Write a message to the console
|
||||
--------------------------------------------------------------------*/
|
||||
void GoAway::run() const {
|
||||
std::cout << "Okay, going away.";
|
||||
platform()->writeToConsole("Okay, going away.");
|
||||
} //GoAway::run
|
||||
|
||||
@@ -174,7 +174,13 @@ BrowserPalette::BrowserPalette() :
|
||||
}
|
||||
|
||||
install<ConfigBridge>();
|
||||
install<SendBridge>();
|
||||
|
||||
if (auto ref = install<SendBridge>(); ref) {
|
||||
if (auto sendBridgeRef = std::dynamic_pointer_cast<SendBridge>(ref); sendBridgeRef) {
|
||||
connector::connector()->addWeak(sendBridgeRef);
|
||||
sendBridgeRef->start();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto ref = install<SelectionBridge>(); ref) {
|
||||
if (auto selectionBridgeRef = std::dynamic_pointer_cast<SelectionBridge>(ref); selectionBridgeRef) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Connector/Record/Collection/FinishProxy.h"
|
||||
#include "Speckle/Database/BIMAttributeDatabase.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Record/Attribute/Finish.h"
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
@@ -24,7 +25,7 @@ using namespace speckle::utility;
|
||||
|
||||
#ifdef ARCHICAD
|
||||
namespace connector::record {
|
||||
class ProjectCollection::FinishCache : public std::unordered_map<active::utility::Guid, Finish::Unique> {};
|
||||
class ProjectCollection::FinishCache : public std::unordered_map<active::utility::Guid, Finish> {};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -131,14 +132,11 @@ bool ProjectCollection::addMaterialProxy(const speckle::database::BIMIndex& mate
|
||||
|
||||
return: True if the material proxy was added (false typically means the record already exists)
|
||||
--------------------------------------------------------------------*/
|
||||
bool ProjectCollection::addMaterialProxy(const ModelerAPI::Material& material, const speckle::database::BIMRecordID& objectID) {
|
||||
auto finishID = Guid::fromInt(material.GenerateHashValue());
|
||||
auto iter = m_finishes->find(finishID);
|
||||
if (iter == m_finishes->end()) {
|
||||
auto finish = std::make_unique<Finish>(material);
|
||||
iter = m_finishes->insert({ finishID, std::move(finish) }).first;
|
||||
}
|
||||
return addMaterialProxy(finishID, objectID);
|
||||
bool ProjectCollection::addMaterialProxy(const Finish& finish, const speckle::database::BIMRecordID& objectID) {
|
||||
auto iter = m_finishes->find(finish.getBIMID());
|
||||
if (iter == m_finishes->end())
|
||||
iter = m_finishes->insert({finish.getBIMID(), finish}).first;
|
||||
return addMaterialProxy(speckle::database::BIMIndex{finish.getBIMID()}, objectID);
|
||||
} //ProjectCollection::addMaterialProxy
|
||||
#endif
|
||||
|
||||
@@ -181,7 +179,7 @@ Cargo::Unique ProjectCollection::getCargo(const Inventory::Item& item) const {
|
||||
std::advance(iter, item.available);
|
||||
const Finish* finish = nullptr;
|
||||
if (auto fin = m_finishes->find(iter->first); fin != m_finishes->end())
|
||||
finish = fin->second.get();
|
||||
finish = &fin->second;
|
||||
else if (auto attribute = m_project->getAttributeDatabase()->getAttribute(iter->first, iter->first.tableID); attribute)
|
||||
finish = dynamic_cast<const Finish*>(attribute.get());
|
||||
if (finish != nullptr) {
|
||||
|
||||
@@ -70,15 +70,13 @@ namespace connector::record {
|
||||
@return True if the material proxy was added (false typically means the record already exists)
|
||||
*/
|
||||
bool addMaterialProxy(const speckle::database::BIMIndex& materialIndex, const speckle::database::BIMRecordID& objectID) override;
|
||||
#ifdef ARCHICAD
|
||||
/*!
|
||||
Add a ModelerAPI material to the collection (NB: These are not persistent so need to be captured by this method)
|
||||
@param material A material
|
||||
@param finish A finish
|
||||
@param objectID The object the material is applied to
|
||||
@return True if the material proxy was added (false typically means the record already exists)
|
||||
*/
|
||||
bool addMaterialProxy(const ModelerAPI::Material& material, const speckle::database::BIMRecordID& objectID) override;
|
||||
#endif
|
||||
bool addMaterialProxy(const speckle::record::attribute::Finish& finish, const speckle::database::BIMRecordID& objectID) override;
|
||||
|
||||
// MARK: - Serialisation
|
||||
|
||||
@@ -101,11 +99,9 @@ namespace connector::record {
|
||||
std::unique_ptr<active::serialise::Management> m_management;
|
||||
///Finish proxies accumulated from meshes generated from the collection elements
|
||||
FinishProxies m_finishProxies;
|
||||
#ifdef ARCHICAD
|
||||
class FinishCache;
|
||||
///Finishes cached from ModelerAPI materials
|
||||
///Finishes cache
|
||||
std::unique_ptr<FinishCache> m_finishes;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Connector/Record/Model/ReceiverModelCard.h"
|
||||
#include "Connector/Record/Model/SenderModelCard.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace connector::record;
|
||||
|
||||
namespace {
|
||||
@@ -32,7 +33,7 @@ namespace {
|
||||
}
|
||||
|
||||
///The handler for model card packages
|
||||
std::shared_ptr<active::serialise::Handler> CardMover::m_handler = std::make_shared<active::serialise::Handler>(attributeTag);
|
||||
std::shared_ptr<Handler> CardMover::m_handler = std::make_shared<Handler>(attributeTag);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
namespace connector::record {
|
||||
|
||||
/*!
|
||||
Wrapper to box/unbox objects during (de)serialisation, including reading/writing a specified attribute to determine object type
|
||||
Wrapper to box/unbox model cards during (de)serialisation
|
||||
|
||||
Note that a derived class could also define the package handler, allowing the wrapper to be created via a default constructor that is
|
||||
automatically bound to a set of internally defined object types
|
||||
Model cards are polymorphic - this class ensures the type information is included when a card is serialised
|
||||
and the correct object type is constructed on deserialisation
|
||||
*/
|
||||
class CardMover : public active::serialise::Mover {
|
||||
public:
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
namespace connector::record {
|
||||
|
||||
/*!
|
||||
A connector send filter
|
||||
Base class for a Speckle model card
|
||||
|
||||
A model card captures key information about a model submitted to a Speckle server, e.g. the model ID, the target server
|
||||
and account, and any settings or filters applicable to the host BIM application and open document
|
||||
*/
|
||||
class ModelCard : public speckle::database::Record {
|
||||
public:
|
||||
@@ -60,13 +63,13 @@ namespace connector::record {
|
||||
*/
|
||||
const speckle::utility::String& getModelID() const { return m_modelID; }
|
||||
/*!
|
||||
Get the setting type
|
||||
@return The setting type
|
||||
Get the ID of the active BIM project
|
||||
@return The ID of the active BIM project
|
||||
*/
|
||||
const speckle::utility::String& getProjectID() const { return m_projectID; }
|
||||
/*!
|
||||
Get the setting type
|
||||
@return The setting type
|
||||
Get the user account ID
|
||||
@return The user account ID
|
||||
*/
|
||||
const speckle::utility::String& getAccountID() const { return m_accountID; }
|
||||
/*!
|
||||
@@ -75,8 +78,8 @@ namespace connector::record {
|
||||
*/
|
||||
const speckle::utility::String& getMessage() const { return m_message; }
|
||||
/*!
|
||||
Get the setting type
|
||||
@return The setting type
|
||||
Get the server URL
|
||||
@return The server URL
|
||||
*/
|
||||
const speckle::utility::String& getServerURL() const { return m_serverURL; }
|
||||
/*!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'STR#' 32500 "Connector Menu" {
|
||||
/*[ 1]*/ "Speckle Connector"
|
||||
/*[ 1]*/ "Speckle Connector^E3^EL^ES^ED^EE^EI^EW^ET^"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* --- Dockable browser palette ----------------------------------------------*/
|
||||
|
||||
'GDLG' 32500 Palette | topCaption | close | grow 0 0 450 150 "Speckle Connector" {
|
||||
/* [ 1] */ Browser 0 0 450 150
|
||||
'GDLG' 32500 Palette | topCaption | close | grow 0 0 350 150 "Speckle Connector" {
|
||||
/* [ 1] */ Browser 0 0 350 150
|
||||
}
|
||||
|
||||
'DLGH' 32500 DLG_32500_Browser_Palette {
|
||||
|
||||
@@ -14,11 +14,8 @@ BIMLink::BIMLink(const API_Neig& selected, const BIMRecordID& tableID) : base{Gu
|
||||
//More info should be extracted from API_Neig in future (as required) - extract into link settings, e.g. selection target etc
|
||||
} //Link::Link
|
||||
|
||||
|
||||
BIMLinkList::BIMLinkList(const ElementIDList& elementIDList) {
|
||||
for (const auto& id : elementIDList)
|
||||
push_back(id);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ BIMLinkList ArchicadElementDBaseEngine::getSelection() const {
|
||||
--------------------------------------------------------------------*/
|
||||
void ArchicadElementDBaseEngine::setSelection(const BIMLinkList& elementIDs) const {
|
||||
GS::Array<API_Neig> selNeigs;
|
||||
for (const auto elemID : elementIDs) {
|
||||
for (const auto& elemID : elementIDs) {
|
||||
API_Neig neig(elemID);
|
||||
selNeigs.Push(neig);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ void DocumentStoreCore::writeStore() {
|
||||
GS::HashTable<API_Guid, short> conflicts;
|
||||
if (auto statusCode = convertArchicadError(ACAPI_AddOnObject_ReserveObjects({Guid{m_id.id}}, &conflicts)); statusCode != nominal)
|
||||
throw std::system_error(makeError(statusCode));
|
||||
//TODO: Implamenent handling for conflicts
|
||||
//TODO: Implement handling for conflicts
|
||||
}
|
||||
auto toWrite = buildStore();
|
||||
//Write the new data
|
||||
|
||||
@@ -77,6 +77,7 @@ std::weak_ptr<Project> Addon::getActiveProject() const {
|
||||
void Addon::publishExternal(const active::event::Event& event) {
|
||||
if (!logCallback())
|
||||
return;
|
||||
++m_sessionCount;
|
||||
try {
|
||||
preprocessEvent(event);
|
||||
publish(event);
|
||||
@@ -165,7 +166,7 @@ bool Addon::logCallback(bool initialise) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} //Addon::publishExternalEvent
|
||||
} //Addon::logCallback
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,11 @@ namespace speckle::environment {
|
||||
@return The active project (nullptr = no open project)
|
||||
*/
|
||||
std::weak_ptr<Project> getActiveProject() const;
|
||||
/*!
|
||||
Get the session index
|
||||
@return The session index (non-recursive entries into the add-on)
|
||||
*/
|
||||
uint32_t getSession() const { return m_sessionCount; }
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
@@ -103,6 +108,8 @@ namespace speckle::environment {
|
||||
std::shared_ptr<Project> m_activeProject;
|
||||
///The depth of nested callbacks - the root call starts at depth 0 (important for some entry-point initialisation)
|
||||
uint32_t m_callDepth = 0;
|
||||
///The index of the active session (non-recursive entries into the add-on)
|
||||
uint32_t m_sessionCount = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "Speckle/Environment/Host.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include "DG.h"
|
||||
#endif
|
||||
|
||||
using namespace speckle::utility;
|
||||
using namespace speckle::environment;
|
||||
|
||||
namespace {
|
||||
|
||||
//An object representing the active host
|
||||
Host m_hostInstance;
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
Host::Host() {
|
||||
} //Host::Host
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Display an alert dialog
|
||||
|
||||
message: The alert message
|
||||
--------------------------------------------------------------------*/
|
||||
void Host::displayAlert(const String& message) const {
|
||||
#ifdef ARCHICAD
|
||||
DGAlert(DG_INFORMATION, "Notification", message.data(), "", "OK");
|
||||
#endif
|
||||
} //Host::displayAlert
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get an object representing the parent process/application
|
||||
|
||||
return: The active application instance
|
||||
--------------------------------------------------------------------*/
|
||||
speckle::environment::Host* speckle::environment::host() {
|
||||
return &m_hostInstance;
|
||||
} //speckle::environment::host
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef SPECKLE_ENVIRONMENT_HOST
|
||||
#define SPECKLE_ENVIRONMENT_HOST
|
||||
|
||||
#include "Speckle/Utility/String.h"
|
||||
|
||||
namespace speckle::environment {
|
||||
|
||||
/*!
|
||||
Class to represent a host application (for plugin contexts)
|
||||
*/
|
||||
class Host {
|
||||
public:
|
||||
|
||||
// MARK: Constructors
|
||||
|
||||
/*!
|
||||
Default constructor
|
||||
*/
|
||||
Host();
|
||||
|
||||
// MARK: Functions (const)
|
||||
|
||||
/*!
|
||||
Display an alert dialog
|
||||
@param message The alert message
|
||||
*/
|
||||
void displayAlert(const speckle::utility::String& message) const;
|
||||
|
||||
// MARK: Functions (mutating)
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
Get an object representing the host instance
|
||||
@return The active host instance (nullptr if the host is not running)
|
||||
*/
|
||||
speckle::environment::Host* host();
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_ENVIRONMENT_HOST
|
||||
@@ -27,6 +27,22 @@ void Platform::writeToConsole(const active::utility::String& message) {
|
||||
} //Platform::writeToConsole
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Open a URL
|
||||
|
||||
URL: The URL to open
|
||||
--------------------------------------------------------------------*/
|
||||
void Platform::openURL(const active::utility::String& URL) {
|
||||
#if WINDOWS
|
||||
std::system((String{"start "} + URL).data());
|
||||
#elif __APPLE__
|
||||
std::system((String{"open "} + URL).data());
|
||||
#elif __linux__
|
||||
std::system((String{"xdg-open"} + url).data());
|
||||
#endif
|
||||
} //Platform::openURL
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get an object representing the parent process/application
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace speckle::environment {
|
||||
@param message The message to write
|
||||
*/
|
||||
void writeToConsole(const active::utility::String& message);
|
||||
/*!
|
||||
Open a URL
|
||||
@param URL The URL to open
|
||||
*/
|
||||
void openURL(const active::utility::String& URL);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#include "Speckle/Event/Subscriber/ElementSubscriber.h"
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
#include "Speckle/Database/Identity/BIMLink.h"
|
||||
#include "Speckle/Database/Storage/ArchicadDBase/Element/ArchicadElementDBaseEngine.h"
|
||||
#include "Speckle/Event/Type/ElementEvent.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <ACAPinc.h>
|
||||
#endif
|
||||
|
||||
using namespace active::environment;
|
||||
using namespace active::event;
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::event;
|
||||
|
||||
namespace {
|
||||
|
||||
using enum ElementEvent::Type;
|
||||
|
||||
#ifdef ARCHICAD
|
||||
/*!
|
||||
Callback for an Archicad element change
|
||||
@param elemType Info about the last changed element
|
||||
*/
|
||||
GSErrCode __ACENV_CALL elementChangedCallback(const API_NotifyElementType* elemType) {
|
||||
if (addon() == nullptr)
|
||||
return NoError;
|
||||
|
||||
// POC: can we do this switch smater?
|
||||
switch (elemType->notifID)
|
||||
{
|
||||
case APINotifyElement_New: {
|
||||
ACAPI_Element_AttachObserver(elemType->elemHead.guid);
|
||||
addon()->publishExternal(ElementEvent{newElem, ElementID{elemType->elemHead.guid}});
|
||||
} break;
|
||||
case APINotifyElement_Change: {
|
||||
addon()->publishExternal(ElementEvent{changeElem, ElementID{elemType->elemHead.guid}});
|
||||
} break;
|
||||
case APINotifyElement_Edit: {
|
||||
addon()->publishExternal(ElementEvent{editElem, ElementID{elemType->elemHead.guid}});
|
||||
} break;
|
||||
case APINotifyElement_Delete: {
|
||||
addon()->publishExternal(ElementEvent{deleteElem, ElementID{ elemType->elemHead.guid}});
|
||||
} break;
|
||||
case APINotifyElement_BeginEvents:
|
||||
addon()->publishExternal(ElementEvent{begin});
|
||||
break;
|
||||
case APINotifyElement_EndEvents: {
|
||||
addon()->publishExternal(ElementEvent{end});
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NoError;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the event subscription list
|
||||
|
||||
return: The subscription list (an empty list will put the subscriber into a suspended state)
|
||||
--------------------------------------------------------------------*/
|
||||
Subscriber::Subscription ElementSubscriber::subscription() const {
|
||||
return { {ElementEvent::ID} };
|
||||
} //ElementSubscriber::subscription
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Receive a subscribed event
|
||||
|
||||
event: The incoming event
|
||||
|
||||
return: True if the event should be closed
|
||||
--------------------------------------------------------------------*/
|
||||
bool ElementSubscriber::receive(const Event& event) {
|
||||
//Pass a menu event to the specified handler function
|
||||
if (auto changeEvent = dynamic_cast<const ElementEvent*>(&event); changeEvent != nullptr)
|
||||
return handle(*changeEvent);
|
||||
return false;
|
||||
} //ElementSubscriber::receive
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Start the participant operation
|
||||
|
||||
return: True if the participant is able to continue
|
||||
--------------------------------------------------------------------*/
|
||||
bool ElementSubscriber::start() {
|
||||
#ifdef ARCHICAD
|
||||
GSErrCode err = ACAPI_Element_InstallElementObserver(elementChangedCallback);
|
||||
if (err != NoError)
|
||||
return false;
|
||||
|
||||
return (ACAPI_Element_CatchNewElement(nullptr, elementChangedCallback) == NoError);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
} //ElementSubscriber::start
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Stop participation (release resources etc)
|
||||
--------------------------------------------------------------------*/
|
||||
void ElementSubscriber::stop() {
|
||||
#ifdef ARCHICAD
|
||||
ACAPI_Notification_CatchSelectionChange(nullptr);
|
||||
#endif
|
||||
} //ElementSubscriber::stop
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef SPECKLE_EVENT_ELEMENT_CHANGED_SUBSCRIBER
|
||||
#define SPECKLE_EVENT_ELEMENT_CHANGED_SUBSCRIBER
|
||||
|
||||
#include "Active/Event/Subscriber.h"
|
||||
#include "Speckle/Database/Identity/RecordID.h"
|
||||
|
||||
namespace speckle::event {
|
||||
|
||||
class ElementEvent;
|
||||
|
||||
/*!
|
||||
Base class for subscribers responding to element changes
|
||||
*/
|
||||
class ElementSubscriber : public virtual active::event::Subscriber {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Default constructor
|
||||
*/
|
||||
ElementSubscriber() = default;
|
||||
/*!
|
||||
Copy constructor
|
||||
@param source The object to copy
|
||||
*/
|
||||
ElementSubscriber(const ElementSubscriber& source) = default;
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
~ElementSubscriber() = default;
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the event subscription list
|
||||
@return The subscription list (an empty list will put the subscriber into a suspended state)
|
||||
*/
|
||||
Subscription subscription() const override;
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
/*!
|
||||
Receive a subscribed event
|
||||
@param event The incoming event
|
||||
@return True if the event should be closed
|
||||
*/
|
||||
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 an element change
|
||||
@param event The element change event
|
||||
@return True if the event should be closed
|
||||
*/
|
||||
virtual bool handle(const ElementEvent& event) = 0;
|
||||
|
||||
speckle::database::ElementIDList m_changedElements;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_EVENT_ELEMENT_CHANGED_SUBSCRIBER
|
||||
@@ -81,4 +81,4 @@ void SelectionSubscriber::stop() {
|
||||
#ifdef ARCHICAD
|
||||
ACAPI_Notification_CatchSelectionChange(nullptr);
|
||||
#endif
|
||||
}
|
||||
} //SelectionSubscriber::stop
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef SPECKLE_EVENT_ELEMENT_EVENT
|
||||
#define SPECKLE_EVENT_ELEMENT_EVENT
|
||||
|
||||
#include "Active/Event/Event.h"
|
||||
|
||||
#include "Active/Utility/Guid.h"
|
||||
#include "Active/Utility/String.h"
|
||||
|
||||
namespace speckle::event {
|
||||
|
||||
/*!
|
||||
Class representing an event signaling a database transaction operating on a BIM element, e.g. adding, editing, deleting etc
|
||||
*/
|
||||
class ElementEvent : public active::event::Event {
|
||||
public:
|
||||
|
||||
enum Type {
|
||||
newElem, ///<A new element has been created
|
||||
begin, ///<An element database transaction has started - subsequent events will detail specific actions
|
||||
end, ///<The current element database transaction has ended - any handling based on the transaction events should be fone now
|
||||
changeElem, ///<An element has been changed
|
||||
editElem, ///<An element has been edited
|
||||
deleteElem ///<An element has been deleted
|
||||
};
|
||||
|
||||
static const inline active::utility::NameID ID{active::utility::String{"element transaction"},
|
||||
active::utility::Guid{active::utility::String{"ac9366d5-90fd-497e-b7f7-a7b4c8d97c91"}}};
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param eventType An event type identifier
|
||||
@param targetID The ID of the element targeted by the database transaction (nullopt = undefined, e.g. for a begin/end event)
|
||||
*/
|
||||
ElementEvent(Type eventType, database::ElementID::Option targetID = std::nullopt) : Event{ID}, m_elementID{targetID}, m_eventType{eventType} {}
|
||||
/*!
|
||||
Copy constructor
|
||||
@param source The object to copy
|
||||
*/
|
||||
ElementEvent(const ElementEvent& source) = default;
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
~ElementEvent() = default;
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the ID of the database transaction target element
|
||||
@return The target element ID (nullopt = no target, e.g. a begin/end event)
|
||||
*/
|
||||
database::ElementID::Option getElmentID() const { return m_elementID; }
|
||||
Type getEventType() const { return m_eventType; }
|
||||
|
||||
private:
|
||||
///The ID of the target element (nullopt = undefined)
|
||||
database::ElementID::Option m_elementID;
|
||||
///The specific database operation performed
|
||||
Type m_eventType;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_EVENT_ELEMENT_EVENT
|
||||
@@ -62,12 +62,17 @@ namespace speckle::interfac::browser::bridge {
|
||||
@return The number of parameters
|
||||
*/
|
||||
virtual uint32_t parameterCount() const { return 1; }
|
||||
|
||||
/*!
|
||||
Get any error message relating to the arguments
|
||||
@return The error message (nullopt if no errors occurred)
|
||||
*/
|
||||
speckle::utility::String::Option errorMessage() const { return m_errorMessage; }
|
||||
/*!
|
||||
Write the item data to a string
|
||||
@param dest The string to write the data to
|
||||
@return True if the data was successfully written
|
||||
*/
|
||||
bool write(active::utility::String& dest) const override { return true; }
|
||||
/*!
|
||||
Fill an inventory with the cargo items
|
||||
@param inventory The inventory to receive the cargo items
|
||||
@@ -83,6 +88,12 @@ namespace speckle::interfac::browser::bridge {
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
/*!
|
||||
Read the cargo data from the specified string
|
||||
@param source The string to read
|
||||
@return True if the data was successfully read
|
||||
*/
|
||||
bool read(const active::utility::String& source) override { return true; }
|
||||
/*!
|
||||
Set to the default package content
|
||||
*/
|
||||
@@ -121,12 +132,24 @@ namespace speckle::interfac::browser::bridge {
|
||||
*/
|
||||
JSArgType(const JSArgType& source) : BridgeArgument{source}, T{source} {}
|
||||
|
||||
/*!
|
||||
/*!
|
||||
Write the item data to a string
|
||||
@param dest The string to write the data to
|
||||
@return True if the data was successfully written
|
||||
*/
|
||||
bool write(active::utility::String& dest) const override { return true; }
|
||||
/*!
|
||||
Get the number of parameters in the argument
|
||||
@return The number of parameters
|
||||
*/
|
||||
uint32_t parameterCount() const override { return Params; }
|
||||
|
||||
/*!
|
||||
Read the cargo data from the specified string
|
||||
@param source The string to read
|
||||
@return True if the data was successfully read
|
||||
*/
|
||||
bool read(const active::utility::String& source) override { return true; }
|
||||
/*!
|
||||
Set to the default package content
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Active/Serialise/JSON/JSONTransport.h"
|
||||
#include "Active/Utility/BufferOut.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
||||
#include "Speckle/Record/Element/ModelElement.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -45,5 +46,6 @@ std::unique_ptr<WrappedResultArg> GetCallResult::getResult(const WrappedResultAr
|
||||
return nullptr;
|
||||
String jsonOutput;
|
||||
JSONTransport().send(std::forward<Cargo&&>(*item), Identity{}, jsonOutput);
|
||||
record::element::ModelElement::resetCache();
|
||||
return std::make_unique<WrappedResultArg>(jsonOutput);
|
||||
} //GetCallResult::getResult
|
||||
|
||||
@@ -19,6 +19,10 @@ namespace {
|
||||
vertexID,
|
||||
faceID,
|
||||
colorID,
|
||||
pointID,
|
||||
closedID,
|
||||
lengthID,
|
||||
areaID,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
@@ -26,6 +30,10 @@ namespace {
|
||||
Identity{"vertices"},
|
||||
Identity{"faces"},
|
||||
Identity{"colors"},
|
||||
Identity{"value"},
|
||||
Identity{"closed"},
|
||||
Identity{"length"},
|
||||
Identity{"area"},
|
||||
};
|
||||
|
||||
}
|
||||
@@ -53,6 +61,13 @@ void Mesh::appendFace(const std::vector<double>& vertices) {
|
||||
return: True if the package has added items to the inventory
|
||||
--------------------------------------------------------------------*/
|
||||
bool Mesh::fillInventory(Inventory& inventory) const {
|
||||
if (isPolyline)
|
||||
return fillInventoryPolyline(inventory);
|
||||
else
|
||||
return fillInventoryMesh(inventory);
|
||||
} //Mesh::fillInventory
|
||||
|
||||
bool Mesh::fillInventoryMesh(Inventory& inventory) const {
|
||||
using enum Entry::Type;
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
@@ -60,9 +75,22 @@ bool Mesh::fillInventory(Inventory& inventory) const {
|
||||
{ fieldID[faceID], faceID, element },
|
||||
{ fieldID[colorID], colorID, element },
|
||||
},
|
||||
}.withType(&typeid(Mesh)));
|
||||
}.withType(&typeid(Mesh)));
|
||||
return base::fillInventory(inventory);
|
||||
} //Mesh::fillInventory
|
||||
}
|
||||
|
||||
bool Mesh::fillInventoryPolyline(Inventory& inventory) const {
|
||||
using enum Entry::Type;
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ fieldID[pointID], pointID, element },
|
||||
{ fieldID[closedID], closedID, element },
|
||||
{ fieldID[lengthID], lengthID, element },
|
||||
{ fieldID[areaID], areaID, element },
|
||||
},
|
||||
}.withType(&typeid(Mesh)));
|
||||
return base::fillInventory(inventory);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -73,20 +101,46 @@ bool Mesh::fillInventory(Inventory& inventory) const {
|
||||
return: The requested cargo (nullptr on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
Cargo::Unique Mesh::getCargo(const Inventory::Item& item) const {
|
||||
if (isPolyline)
|
||||
return getCargoPolyline(item);
|
||||
else
|
||||
return getCargoMesh(item);
|
||||
|
||||
} //Mesh::getCargo
|
||||
|
||||
Cargo::Unique Mesh::getCargoMesh(const Inventory::Item& item) const {
|
||||
if (item.ownerType != &typeid(Mesh))
|
||||
return base::getCargo(item);
|
||||
using namespace active::serialise;
|
||||
switch (item.index) {
|
||||
case vertexID:
|
||||
return std::make_unique<ContainerWrap<std::vector<double>>>(m_vertices);
|
||||
case faceID:
|
||||
return std::make_unique<ContainerWrap<std::vector<int>>>(m_faces);
|
||||
case colorID:
|
||||
return std::make_unique<ContainerWrap<std::vector<int>>>(m_colors);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
return std::make_unique<ContainerWrap<std::vector<double>>>(m_vertices);
|
||||
case faceID:
|
||||
return std::make_unique<ContainerWrap<std::vector<int>>>(m_faces);
|
||||
case colorID:
|
||||
return std::make_unique<ContainerWrap<std::vector<int>>>(m_colors);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
} //Mesh::getCargo
|
||||
}
|
||||
|
||||
Cargo::Unique Mesh::getCargoPolyline(const Inventory::Item& item) const {
|
||||
if (item.ownerType != &typeid(Mesh))
|
||||
return base::getCargo(item);
|
||||
using namespace active::serialise;
|
||||
switch (item.index) {
|
||||
case pointID:
|
||||
return std::make_unique<ContainerWrap<std::vector<double>>>(m_points);
|
||||
case closedID:
|
||||
return std::make_unique<ValueWrap<bool>>(isClosed);
|
||||
case lengthID:
|
||||
return std::make_unique<ValueWrap<double>>(length);
|
||||
case areaID:
|
||||
return std::make_unique<ValueWrap<double>>(area);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -98,6 +152,6 @@ void Mesh::useManagement(Management* management) const {
|
||||
//NB: This object only exists to populate the finish collection - it doesn't carry any serialisable content
|
||||
if (management != nullptr) {
|
||||
if (auto collector = management->get<FinishCollector>(); collector != nullptr)
|
||||
collector->addMaterialProxy(m_material, getBIMID());
|
||||
collector->addMaterialProxy(m_finish, getBIMID());
|
||||
}
|
||||
} //Mesh::useManagement
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
|
||||
#include "Speckle/Database/Content/BIMRecord.h"
|
||||
#include "Speckle/Utility/String.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include "ModelMaterial.hpp"
|
||||
#endif
|
||||
#include "Speckle/Record/Attribute/Finish.h"
|
||||
|
||||
namespace speckle::primitive {
|
||||
|
||||
@@ -30,30 +27,40 @@ namespace speckle::primitive {
|
||||
/*!
|
||||
Constructor
|
||||
@param unit The mesh unit type
|
||||
@param material The mesh material
|
||||
@param finish The mesh finish
|
||||
*/
|
||||
Mesh(const ModelerAPI::Material& material,
|
||||
Mesh(const record::attribute::Finish& finish,
|
||||
active::measure::LengthType unit = active::measure::LengthType::metre) :
|
||||
base{ utility::Guid{true}, utility::Guid{}, unit }, m_material{ material } {}
|
||||
base{ utility::Guid{true}, utility::Guid{}, unit }, m_finish{ finish } {}
|
||||
/*!
|
||||
Constructor
|
||||
@param unit The mesh unit type
|
||||
@param vertices The mesh vertices
|
||||
@param faces The mesh faces (the number of indices in the face followed by the vertex indices)
|
||||
@param colors The mesh face colours
|
||||
@param material The mesh material
|
||||
@param finish The mesh material
|
||||
@param unit The mesh unit type
|
||||
*/
|
||||
Mesh(std::vector<double>&& vertices, std::vector<int>&& faces, std::vector<int>&& colors, const ModelerAPI::Material& material,
|
||||
Mesh(std::vector<double>&& vertices, std::vector<int>&& faces, std::vector<int>&& colors, const record::attribute::Finish& finish,
|
||||
active::measure::LengthType unit = active::measure::LengthType::metre) :
|
||||
base{utility::Guid{true}, utility::Guid{}, unit}, m_vertices{std::move(vertices)}, m_faces{std::move(faces)}, m_colors{std::move(colors)}, m_material{material} {}
|
||||
base{utility::Guid{true}, utility::Guid{}, unit}, m_vertices{std::move(vertices)}, m_faces{std::move(faces)}, m_colors{std::move(colors)}, m_finish{finish} {}
|
||||
|
||||
Mesh(std::vector<double>&& points, const record::attribute::Finish& finish,
|
||||
active::measure::LengthType unit = active::measure::LengthType::metre) :
|
||||
base{ utility::Guid{true}, utility::Guid{}, unit }, m_points{ std::move(points) }, m_finish{ finish } {}
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the speckle type identifier
|
||||
@return The speckle type (relevant objects should override as required)
|
||||
*/
|
||||
speckle::utility::String getSpeckleType() const override { return "Objects.Geometry.Mesh"; }
|
||||
speckle::utility::String getSpeckleType() const override
|
||||
{
|
||||
if (isPolyline)
|
||||
return "Objects.Geometry.Polyline";
|
||||
else
|
||||
return "Objects.Geometry.Mesh";
|
||||
}
|
||||
|
||||
/*!
|
||||
Append a single face to the Mesh given by the vertices
|
||||
@@ -69,25 +76,35 @@ namespace speckle::primitive {
|
||||
@return True if the package has added items to the inventory
|
||||
*/
|
||||
bool fillInventory(active::serialise::Inventory& inventory) const override;
|
||||
bool fillInventoryMesh(active::serialise::Inventory& inventory) const;
|
||||
bool fillInventoryPolyline(active::serialise::Inventory& inventory) const;
|
||||
/*!
|
||||
Get the specified cargo
|
||||
@param item The inventory item to retrieve
|
||||
@return The requested cargo (nullptr on failure)
|
||||
*/
|
||||
active::serialise::Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
|
||||
active::serialise::Cargo::Unique getCargoMesh(const active::serialise::Inventory::Item& item) const;
|
||||
active::serialise::Cargo::Unique getCargoPolyline(const active::serialise::Inventory::Item& item) const;
|
||||
/*!
|
||||
Use a manager in (de)serialisation processes
|
||||
@param management The management to use
|
||||
*/
|
||||
void useManagement(active::serialise::Management* management) const override;
|
||||
|
||||
void setToPolyline() { isPolyline = true; }
|
||||
|
||||
private:
|
||||
std::vector<double> m_vertices;
|
||||
std::vector<double> m_points;
|
||||
std::vector<int> m_faces;
|
||||
std::vector<int> m_colors;
|
||||
#ifdef ARCHICAD
|
||||
ModelerAPI::Material m_material;
|
||||
#endif
|
||||
record::attribute::Finish m_finish;
|
||||
|
||||
bool isPolyline = false;
|
||||
bool isClosed = false;
|
||||
double length = 2.0;
|
||||
double area = 0.0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -156,6 +156,22 @@ Finish::Finish(const Finish& source) : base{source} {
|
||||
Finish::~Finish() {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Assignment operator
|
||||
|
||||
source: The object to assign
|
||||
|
||||
return: A reference to this
|
||||
--------------------------------------------------------------------*/
|
||||
Finish& Finish::operator=(const Finish& source) {
|
||||
if (this != &source) {
|
||||
base::operator=(source);
|
||||
m_data = source.m_data ? std::make_unique<Data>(*source.m_data) : nullptr;
|
||||
}
|
||||
return *this;
|
||||
} //Finish::operator=
|
||||
|
||||
|
||||
#ifdef ARCHICAD
|
||||
/*--------------------------------------------------------------------
|
||||
Get the (immutable) API attribute header data
|
||||
|
||||
@@ -77,7 +77,15 @@ namespace speckle::record::attribute {
|
||||
@return A clone of this object
|
||||
*/
|
||||
Finish* clonePtr() const override { return new Finish{*this}; }
|
||||
|
||||
|
||||
// MARK: - Operators
|
||||
|
||||
/*!
|
||||
Assignment operator
|
||||
@param source The object to assign
|
||||
@return A reference to this
|
||||
*/
|
||||
Finish& operator=(const Finish& source);
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
|
||||
@@ -10,17 +10,20 @@
|
||||
#include "Speckle/Utility/Guid.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <Sight.hpp>
|
||||
#include <Model.hpp>
|
||||
#include <ModelMaterial.hpp>
|
||||
#include <ModelElement.hpp>
|
||||
#include <exp.h>
|
||||
#include <ModelMeshBody.hpp>
|
||||
#include <AttributeIndex.hpp>
|
||||
#include <ConvexPolygon.hpp>
|
||||
#include <Model.hpp>
|
||||
#include <ModelElement.hpp>
|
||||
#include <ModelMaterial.hpp>
|
||||
#include <ModelMeshBody.hpp>
|
||||
#include <ModelEdge.hpp>
|
||||
#include <Sight.hpp>
|
||||
#endif
|
||||
|
||||
using namespace active::measure;
|
||||
using namespace active::serialise;
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::record::attribute;
|
||||
using namespace speckle::record::element;
|
||||
@@ -30,6 +33,8 @@ using namespace speckle::utility;
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include <stack>
|
||||
|
||||
namespace speckle::record::element {
|
||||
|
||||
class ModelElement::Data {
|
||||
@@ -45,6 +50,39 @@ namespace speckle::record::element {
|
||||
std::unique_ptr<ModelElement::Body> m_cache;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
Cache for materials in Archicad
|
||||
|
||||
NB: This has been implemented because looking up materials through the API is very slow (can easily triple processing time)
|
||||
This can be eliminated in future if this problem is remedied
|
||||
*/
|
||||
class ModelElement::FinishCache : public std::unordered_map<Guid, Finish> {
|
||||
public:
|
||||
using base = std::unordered_map<Guid, Finish>;
|
||||
using base::base;
|
||||
|
||||
FinishCache() : base{} { activeSession = addon()->getSession(); }
|
||||
|
||||
///The active session value when the cache was created - enables the content to be reset between sessions
|
||||
uint32_t activeSession = 0;
|
||||
|
||||
/*!
|
||||
Validate the cache (ensure matches the active session)
|
||||
@return True if the content is valid
|
||||
*/
|
||||
bool validate() {
|
||||
if (activeSession != addon()->getSession()) {
|
||||
m_finishCache.reset();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
std::unique_ptr<ModelElement::FinishCache> ModelElement::m_finishCache;
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -61,6 +99,70 @@ namespace {
|
||||
Identity{"properties"},
|
||||
};
|
||||
|
||||
#ifdef ARCHICAD
|
||||
template<typename T>
|
||||
void getSubElementIds(T* ptr, std::set<API_Guid>& subIds)
|
||||
{
|
||||
GSSize nSubElements = BMGetPtrSize(reinterpret_cast<GSPtr>(ptr)) / sizeof(T);
|
||||
for (Int32 idx = 0; idx < nSubElements; ++idx)
|
||||
subIds.insert(ptr[idx].head.guid);
|
||||
}
|
||||
|
||||
std::set<API_Guid> collectSubIds(API_Guid elemId)
|
||||
{
|
||||
API_Element elem{};
|
||||
elem.header.guid = elemId;
|
||||
ACAPI_Element_Get(&elem);
|
||||
API_ElementMemo memo{};
|
||||
ACAPI_Element_GetMemo(elemId, &memo);
|
||||
|
||||
std::set<API_Guid> subIds{};
|
||||
subIds.insert(elemId);
|
||||
|
||||
if (elem.header.type.typeID == API_StairID)
|
||||
{
|
||||
getSubElementIds(memo.stairRisers, subIds);
|
||||
getSubElementIds(memo.stairTreads, subIds);
|
||||
getSubElementIds(memo.stairStructures, subIds);
|
||||
}
|
||||
|
||||
if (elem.header.type.typeID == API_RailingID)
|
||||
{
|
||||
// segments
|
||||
getSubElementIds(memo.railingSegments, subIds);
|
||||
getSubElementIds(memo.railingPatterns, subIds);
|
||||
getSubElementIds(memo.railingRails, subIds);
|
||||
getSubElementIds(memo.railingHandrails, subIds);
|
||||
getSubElementIds(memo.railingToprails, subIds);
|
||||
getSubElementIds(memo.railingBalusterSets, subIds);
|
||||
getSubElementIds(memo.railingBalusters, subIds);
|
||||
getSubElementIds(memo.railingPanels, subIds);
|
||||
getSubElementIds(memo.railingInnerPosts, subIds);
|
||||
|
||||
// nodes
|
||||
getSubElementIds(memo.railingNodes, subIds);
|
||||
getSubElementIds(memo.railingRailConnections, subIds);
|
||||
getSubElementIds(memo.railingHandrailConnections, subIds);
|
||||
getSubElementIds(memo.railingToprailConnections, subIds);
|
||||
getSubElementIds(memo.railingPosts, subIds);
|
||||
getSubElementIds(memo.railingRailEnds, subIds);
|
||||
getSubElementIds(memo.railingHandrailEnds, subIds);
|
||||
getSubElementIds(memo.railingToprailEnds, subIds);
|
||||
}
|
||||
|
||||
if (elem.header.type.typeID == API_CurtainWallID)
|
||||
{
|
||||
getSubElementIds(memo.cWallSegments, subIds);
|
||||
getSubElementIds(memo.cWallFrames, subIds);
|
||||
getSubElementIds(memo.cWallPanels, subIds);
|
||||
getSubElementIds(memo.cWallJunctions, subIds);
|
||||
getSubElementIds(memo.cWallAccessories, subIds);
|
||||
}
|
||||
|
||||
return subIds;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -97,6 +199,43 @@ ModelElement::ModelElement(const ModelElement& source) : base{source}, Classifie
|
||||
ModelElement::~ModelElement() {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get mesh finish from the cache
|
||||
|
||||
finishID: The finish ID
|
||||
|
||||
return: A pointer to the requested material (nullptr on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
Finish* ModelElement::getFinish(const Guid& finishID) {
|
||||
if (!m_finishCache || !m_finishCache->validate())
|
||||
return nullptr;
|
||||
if (auto iter = m_finishCache->find(finishID); iter != m_finishCache->end())
|
||||
return &iter->second;
|
||||
return nullptr;
|
||||
} //ModelElement::getFinish
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Add a mesh finish to the cache
|
||||
|
||||
finishID: The finish ID
|
||||
finish: The mesh finish
|
||||
--------------------------------------------------------------------*/
|
||||
Finish* ModelElement::cacheFinish(const Guid& finishID, const Finish& finish) {
|
||||
if (!m_finishCache || !m_finishCache->validate())
|
||||
m_finishCache = std::make_unique<ModelElement::FinishCache>();
|
||||
return &m_finishCache->insert({finishID, finish}).first->second;
|
||||
} //ModelElement::cacheFinish
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Reset the Archicad material cache
|
||||
--------------------------------------------------------------------*/
|
||||
void ModelElement::resetCache() {
|
||||
m_finishCache.reset();
|
||||
} //ModelElement::resetCache
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the element body as a list of faces or Meshes
|
||||
|
||||
@@ -104,89 +243,131 @@ ModelElement::~ModelElement() {}
|
||||
--------------------------------------------------------------------*/
|
||||
ModelElement::Body* ModelElement::getBody() const {
|
||||
#ifdef ARCHICAD
|
||||
if (m_data && m_data->m_cache) {
|
||||
return m_data->m_cache.get();
|
||||
}
|
||||
ModelerAPI::Material tmpmat{};
|
||||
|
||||
if (m_data && m_data->m_cache)
|
||||
return m_data->m_cache.get();
|
||||
void* dummy = nullptr;
|
||||
GSErrCode err = ACAPI_Sight_GetCurrentWindowSight(&dummy);
|
||||
if (err != NoError)
|
||||
{
|
||||
if (err != NoError) {
|
||||
// TODO: should this throw?
|
||||
}
|
||||
|
||||
Modeler::SightPtr currentSightPtr((Modeler::Sight*)dummy); // init the shared ptr with the raw pointer
|
||||
ModelerAPI::Model acModel;
|
||||
Modeler::IAttributeReader* attrReader = ACAPI_Attribute_GetCurrentAttributeSetReader();
|
||||
|
||||
err = EXPGetModel(currentSightPtr, &acModel, attrReader);
|
||||
if (err != NoError)
|
||||
{
|
||||
if (err != NoError) {
|
||||
// TODO: should this throw?
|
||||
}
|
||||
|
||||
auto elementBody = new ModelElement::Body();
|
||||
|
||||
// Map to collect meshes per material name
|
||||
std::map<GS::UniString, primitive::Mesh> materialMeshMap;
|
||||
|
||||
std::unordered_map<String, primitive::Mesh> materialMeshMap;
|
||||
auto subIds = collectSubIds(getHead().guid);
|
||||
Int32 nElements = acModel.GetElementCount();
|
||||
for (Int32 iElement = 1; iElement <= nElements; iElement++)
|
||||
{
|
||||
for (Int32 iElement = 1; iElement <= nElements; iElement++) {
|
||||
ModelerAPI::Element elem{};
|
||||
acModel.GetElement(iElement, &elem);
|
||||
if (elem.GetElemGuid() != getHead().guid)
|
||||
API_Guid apiGuid{GSGuid2APIGuid(elem.GetElemGuid())};
|
||||
if (subIds.find(apiGuid) == subIds.end())
|
||||
continue;
|
||||
|
||||
Int32 nBodies = elem.GetTessellatedBodyCount();
|
||||
for (Int32 bodyIndex = 1; bodyIndex <= nBodies; ++bodyIndex)
|
||||
{
|
||||
ModelerAPI::Material material{};
|
||||
for (Int32 bodyIndex = 1; bodyIndex <= nBodies; ++bodyIndex) {
|
||||
ModelerAPI::MeshBody body{};
|
||||
elem.GetTessellatedBody(bodyIndex, &body);
|
||||
|
||||
Int32 polyCount = body.GetPolygonCount();
|
||||
for (Int32 polyIndex = 1; polyIndex <= polyCount; ++polyIndex)
|
||||
|
||||
if (polyCount == 0)
|
||||
{
|
||||
std::vector<int> vertexIndices;
|
||||
|
||||
Int32 edgeCount = body.GetEdgeCount();
|
||||
ModelerAPI::Edge edge{};
|
||||
for (Int32 edgeIndex = 1; edgeIndex <= edgeCount; ++edgeIndex)
|
||||
{
|
||||
body.GetEdge(edgeIndex, &edge);
|
||||
vertexIndices.push_back(edge.GetVertexIndex1());
|
||||
vertexIndices.push_back(edge.GetVertexIndex2());
|
||||
}
|
||||
vertexIndices.push_back(edge.GetVertexIndex2());
|
||||
vertexIndices.push_back(edge.GetVertexIndex2());
|
||||
|
||||
for (int i = 0; i < vertexIndices.size(); i += 2) {
|
||||
ModelerAPI::Vertex v1{};
|
||||
ModelerAPI::Vertex v2{};
|
||||
body.GetVertex(vertexIndices[i], &v1);
|
||||
body.GetVertex(vertexIndices[i + 1], &v2);
|
||||
|
||||
std::vector<double> points{};
|
||||
|
||||
points.push_back(v1.x);
|
||||
points.push_back(v1.y);
|
||||
points.push_back(v1.z);
|
||||
|
||||
points.push_back(v2.x);
|
||||
points.push_back(v2.y);
|
||||
points.push_back(v2.z);
|
||||
|
||||
points.push_back(v2.x);
|
||||
points.push_back(v2.y);
|
||||
points.push_back(v2.z);
|
||||
|
||||
record::attribute::Finish f(tmpmat);
|
||||
primitive::Mesh mesh(std::move(points), f);
|
||||
mesh.setToPolyline();
|
||||
elementBody->push_back(mesh);
|
||||
|
||||
points.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (Int32 polyIndex = 1; polyIndex <= polyCount; ++polyIndex) {
|
||||
ModelerAPI::Polygon polygon{};
|
||||
body.GetPolygon(polyIndex, &polygon);
|
||||
|
||||
ModelerAPI::Material material{};
|
||||
polygon.GetMaterial(&material);
|
||||
auto materialName = material.GetName();
|
||||
if (materialMeshMap.find(materialName) == materialMeshMap.end()) {
|
||||
materialMeshMap[materialName] = primitive::Mesh(material);
|
||||
ModelerAPI::AttributeIndex attrIndex{};
|
||||
polygon.GetMaterialIndex(attrIndex);
|
||||
Guid finishID{Guid::fromInt(attrIndex.GetIndex())};
|
||||
auto faceFinish = ModelElement::getFinish(finishID);
|
||||
if (faceFinish == nullptr) {
|
||||
ModelerAPI::Material material{};
|
||||
polygon.GetMaterial(&material);
|
||||
///
|
||||
tmpmat = material;
|
||||
Finish finish{material};
|
||||
faceFinish = ModelElement::cacheFinish(finishID, finish);
|
||||
}
|
||||
|
||||
auto materialName = faceFinish->getName();
|
||||
if (materialMeshMap.find(materialName) == materialMeshMap.end())
|
||||
materialMeshMap[materialName] = primitive::Mesh(*faceFinish);
|
||||
Int32 convexPolyCount = polygon.GetConvexPolygonCount();
|
||||
|
||||
for (Int32 convPolyIndex = 1; convPolyIndex <= convexPolyCount; ++convPolyIndex)
|
||||
{
|
||||
for (Int32 convPolyIndex = 1; convPolyIndex <= convexPolyCount; ++convPolyIndex) {
|
||||
std::vector<double> vertices;
|
||||
ModelerAPI::ConvexPolygon convexPolygon{};
|
||||
polygon.GetConvexPolygon(convPolyIndex, &convexPolygon);
|
||||
Int32 vertexCount = convexPolygon.GetVertexCount();
|
||||
|
||||
for (Int32 vertexIndex = 1; vertexIndex <= vertexCount; ++vertexIndex)
|
||||
{
|
||||
for (Int32 vertexIndex = 1; vertexIndex <= vertexCount; ++vertexIndex) {
|
||||
ModelerAPI::Vertex vertex{};
|
||||
body.GetVertex(convexPolygon.GetVertexIndex(vertexIndex), &vertex);
|
||||
|
||||
// Collect vertices (as doubles for now, but should be changed to Vertex type)
|
||||
// Collect vertices (as doubles for now, but should be changed to Vertex type)
|
||||
vertices.push_back(vertex.x);
|
||||
vertices.push_back(vertex.y);
|
||||
vertices.push_back(vertex.z);
|
||||
}
|
||||
|
||||
materialMeshMap[materialName].appendFace(std::move(vertices));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& [materialName, mesh] : materialMeshMap)
|
||||
{
|
||||
for (auto& [materialName, mesh] : materialMeshMap)
|
||||
elementBody->push_back(std::move(mesh));
|
||||
}
|
||||
|
||||
/*std::vector<double> points = {0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0};
|
||||
record::attribute::Finish f(tmpmat);
|
||||
primitive::Mesh mesh(std::move(points), f);
|
||||
mesh.setToPolyline();
|
||||
elementBody->push_back(mesh);*/
|
||||
|
||||
m_data = std::make_unique<Data>();
|
||||
m_data->m_cache.reset(elementBody);
|
||||
return m_data->m_cache.get();
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
#include "Speckle/Record/Property/Propertied.h"
|
||||
|
||||
namespace speckle::record::attribute {
|
||||
class Finish;
|
||||
}
|
||||
|
||||
namespace speckle::record::element {
|
||||
|
||||
/*!
|
||||
@@ -25,7 +29,27 @@ namespace speckle::record::element {
|
||||
using Option = std::optional<ModelElement>;
|
||||
///A model element 3D body primitive
|
||||
using Body = std::vector<primitive::Mesh>;
|
||||
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Get a mesh finish from the cache
|
||||
@param finishID A finish ID
|
||||
@return A pointer to the requested finish (nullptr on failure)
|
||||
*/
|
||||
static record::attribute::Finish* getFinish(const utility::Guid& finishID);
|
||||
/*!
|
||||
Add a mesh finish to the cache
|
||||
@param finishID A finish ID
|
||||
@param finish The mesh finish
|
||||
@return A pointer to the cached finish
|
||||
*/
|
||||
static record::attribute::Finish* cacheFinish(const utility::Guid& finishID, const record::attribute::Finish& finish);
|
||||
/*!
|
||||
Reset the Archicad material cache
|
||||
*/
|
||||
static void resetCache();
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
using base::base;
|
||||
@@ -87,6 +111,9 @@ namespace speckle::record::element {
|
||||
class Data;
|
||||
///The element data
|
||||
mutable std::unique_ptr<Data> m_data;
|
||||
class FinishCache;
|
||||
///Cached finishes (API lookup is very slow)
|
||||
static std::unique_ptr<FinishCache> m_finishCache;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace {
|
||||
Identity{"name"},
|
||||
Identity{"group"},
|
||||
Identity{"value"},
|
||||
Identity{"applicationID"},
|
||||
Identity{"applicationId"},
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
#include "Active/Serialise/Management/Manager.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
namespace ModelerAPI {
|
||||
class Material;
|
||||
namespace speckle::record::attribute {
|
||||
class Finish;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace speckle::serialise {
|
||||
|
||||
@@ -32,15 +30,13 @@ namespace speckle::serialise {
|
||||
@return True if the material proxy was added (false typically means the record already exists)
|
||||
*/
|
||||
virtual bool addMaterialProxy(const speckle::database::BIMIndex& materialIndex, const speckle::database::BIMRecordID& objectID) = 0;
|
||||
#ifdef ARCHICAD
|
||||
/*!
|
||||
Add a ModelerAPI material to the collection (NB: These are not persistent so need to be captured by this method)
|
||||
@param material A material
|
||||
@param finish A finish
|
||||
@param objectID The object the material is applied to
|
||||
@return True if the material proxy was added (false typically means the record already exists)
|
||||
*/
|
||||
virtual bool addMaterialProxy(const ModelerAPI::Material& material, const speckle::database::BIMRecordID& objectID) = 0;
|
||||
#endif
|
||||
virtual bool addMaterialProxy(const record::attribute::Finish& finish, const speckle::database::BIMRecordID& objectID) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
#include "Active/Serialise/XML/Item/XMLDateTime.h"
|
||||
#include "Speckle/Environment/Platform.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include "Active/Serialise/JSON/JSONTransport.h"
|
||||
#include "Active/Utility/BufferOut.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <JSON/JDOMWriter.hpp>
|
||||
#include <JSON/Value.hpp>
|
||||
|
||||
@@ -189,14 +195,14 @@ namespace {
|
||||
switch (item.type().value_or(Item::text)) {
|
||||
case Item::boolean: {
|
||||
BoolValue value;
|
||||
if (!item.write(value))
|
||||
if (!item.writeSetting(value))
|
||||
throw std::system_error(makeJSBaseError(badValue));
|
||||
newValue = new JS::Value(value.operator bool());
|
||||
break;
|
||||
}
|
||||
case Item::number: {
|
||||
DoubleValue value;
|
||||
if (!item.write(value))
|
||||
if (!item.writeSetting(value))
|
||||
throw std::system_error(makeJSBaseError(badValue));
|
||||
newValue = new JS::Value(value.operator double());
|
||||
break;
|
||||
@@ -208,6 +214,9 @@ namespace {
|
||||
newValue = new JS::Value(value);
|
||||
break;
|
||||
}
|
||||
case Item::package: {
|
||||
break; //Not currently considered relevant
|
||||
}
|
||||
}
|
||||
if (destination)
|
||||
addJSBase(newValue, tag, destination);
|
||||
@@ -271,19 +280,19 @@ namespace {
|
||||
throw std::system_error(makeJSBaseError(badSource)); //The source isn't a value
|
||||
switch (value->GetType()) {
|
||||
case JS::Value::ValueType::BOOL:
|
||||
item->read(BoolValue{value->GetBool()});
|
||||
item->readSetting(BoolValue{value->GetBool()});
|
||||
break;
|
||||
case JS::Value::ValueType::INTEGER:
|
||||
item->read(Int32Value{value->GetInteger()});
|
||||
item->readSetting(Int32Value{value->GetInteger()});
|
||||
break;
|
||||
case JS::Value::ValueType::UINTEGER:
|
||||
item->read(UInt32Value{value->GetUInteger()});
|
||||
item->readSetting(UInt32Value{value->GetUInteger()});
|
||||
break;
|
||||
case JS::Value::ValueType::DOUBLE:
|
||||
item->read(DoubleValue{value->GetDouble()});
|
||||
item->readSetting(DoubleValue{value->GetDouble()});
|
||||
break;
|
||||
case JS::Value::ValueType::STRING:
|
||||
item->read(StringValue{String{value->GetString()}});
|
||||
item->readSetting(StringValue{String{value->GetString()}});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
210CC89F2C81E34400610F58 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 210CC89D2C81E34400610F58 /* Platform.cpp */; };
|
||||
210CC8A02C81E34400610F58 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 210CC89E2C81E34400610F58 /* Platform.h */; };
|
||||
212A88132AE48821001EAFE7 /* libArchicad27.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 21379E082AE47A6400A1584C /* libArchicad27.a */; platformFilters = (macos, ); };
|
||||
21384BAB2CCDA9B400D4602B /* Host.h in Headers */ = {isa = PBXBuildFile; fileRef = 21384BA92CCDA9B400D4602B /* Host.h */; };
|
||||
21384BAC2CCDA9B400D4602B /* Host.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21384BAA2CCDA9B400D4602B /* Host.cpp */; };
|
||||
21384BC52CD24AB200D4602B /* ElementSubscriber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21384BC12CD24AB200D4602B /* ElementSubscriber.cpp */; };
|
||||
21384BC62CD24AB200D4602B /* ElementSubscriber.h in Headers */ = {isa = PBXBuildFile; fileRef = 21384BC42CD24AB200D4602B /* ElementSubscriber.h */; };
|
||||
21384BC82CD24ADC00D4602B /* ElementEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 21384BC72CD24ADC00D4602B /* ElementEvent.h */; };
|
||||
215F08552C99DA8D00CD343B /* Project.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08512C99DA8D00CD343B /* Project.cpp */; };
|
||||
215F08562C99DA8D00CD343B /* Project.h in Headers */ = {isa = PBXBuildFile; fileRef = 215F08542C99DA8D00CD343B /* Project.h */; };
|
||||
215F08662C9B006800CD343B /* ProjectEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08652C9B006700CD343B /* ProjectEvent.cpp */; };
|
||||
@@ -196,6 +201,11 @@
|
||||
21329F632BFD452C00B5C7AF /* Environment.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Environment.md; sourceTree = "<group>"; };
|
||||
21329F642BFD457000B5C7AF /* Event.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Event.md; sourceTree = "<group>"; };
|
||||
21379E082AE47A6400A1584C /* libArchicad27.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libArchicad27.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
21384BA92CCDA9B400D4602B /* Host.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Host.h; sourceTree = "<group>"; };
|
||||
21384BAA2CCDA9B400D4602B /* Host.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Host.cpp; sourceTree = "<group>"; };
|
||||
21384BC12CD24AB200D4602B /* ElementSubscriber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ElementSubscriber.cpp; sourceTree = "<group>"; };
|
||||
21384BC42CD24AB200D4602B /* ElementSubscriber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementSubscriber.h; sourceTree = "<group>"; };
|
||||
21384BC72CD24ADC00D4602B /* ElementEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementEvent.h; sourceTree = "<group>"; };
|
||||
214EA4C52BA374FD008E5358 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
214EA4C62BA3762D008E5358 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = SOURCE_ROOT; };
|
||||
215F08512C99DA8D00CD343B /* Project.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Project.cpp; sourceTree = "<group>"; };
|
||||
@@ -493,13 +503,6 @@
|
||||
path = ArchicadDBase;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
218953A92C0F29FB0078F182 /* EventTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = EventTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
219246062CA2D22D00CF5703 /* Element */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -540,6 +543,8 @@
|
||||
children = (
|
||||
21D0BDBB2C90F2830077E104 /* DocStoreSubscriber.cpp */,
|
||||
21D0BDBA2C90F2830077E104 /* DocStoreSubscriber.h */,
|
||||
21384BC12CD24AB200D4602B /* ElementSubscriber.cpp */,
|
||||
21384BC42CD24AB200D4602B /* ElementSubscriber.h */,
|
||||
219351782C624FC100E5A69C /* MenuSubscriber.cpp */,
|
||||
219351792C624FC100E5A69C /* MenuSubscriber.h */,
|
||||
21D0BDC22C9241940077E104 /* ProjectSubscriber.cpp */,
|
||||
@@ -554,6 +559,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21D0BDBE2C90F36B0077E104 /* DocStoreMergeEvent.h */,
|
||||
21384BC72CD24ADC00D4602B /* ElementEvent.h */,
|
||||
219351892C62655700E5A69C /* MenuEvent.h */,
|
||||
215F08652C9B006700CD343B /* ProjectEvent.cpp */,
|
||||
21D0BDC62C9245E40077E104 /* ProjectEvent.h */,
|
||||
@@ -613,7 +619,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
210CC8912C81AEBB00610F58 /* Guid32Tests.cpp */,
|
||||
218953A92C0F29FB0078F182 /* EventTests */,
|
||||
);
|
||||
path = SpeckleLibDoctest;
|
||||
sourceTree = "<group>";
|
||||
@@ -911,6 +916,8 @@
|
||||
2167E2782C4911E2000827D3 /* CMakeLists.txt */,
|
||||
21F93AEA2B2F406D009A2C5B /* Addon.cpp */,
|
||||
21F93AE92B2F406D009A2C5B /* Addon.h */,
|
||||
21384BAA2CCDA9B400D4602B /* Host.cpp */,
|
||||
21384BA92CCDA9B400D4602B /* Host.h */,
|
||||
210CC89D2C81E34400610F58 /* Platform.cpp */,
|
||||
210CC89E2C81E34400610F58 /* Platform.h */,
|
||||
215F08512C99DA8D00CD343B /* Project.cpp */,
|
||||
@@ -957,6 +964,7 @@
|
||||
21AE19802CC7D265004DBCFC /* PropertiedWrapper.h in Headers */,
|
||||
21A0FC0B2CBE5E220023F24E /* Segment.h in Headers */,
|
||||
215F088D2CA195EC00CD343B /* ArchicadElementDBaseEngine.h in Headers */,
|
||||
21384BC82CD24ADC00D4602B /* ElementEvent.h in Headers */,
|
||||
2196F2F42CB483D600450DFC /* Finish.h in Headers */,
|
||||
21A0FBED2CBD6B1A0023F24E /* Part.h in Headers */,
|
||||
21B67D002C7CE15100FD64FC /* Exception.h in Headers */,
|
||||
@@ -985,10 +993,12 @@
|
||||
21D0BDB52C8F8AB60077E104 /* DocumentStoreEngine.h in Headers */,
|
||||
21A890D02CC1B87C0087E732 /* GenericModelElement.h in Headers */,
|
||||
21A890C52CC171D80087E732 /* ArchicadPropertyDBaseEngine.h in Headers */,
|
||||
21384BAB2CCDA9B400D4602B /* Host.h in Headers */,
|
||||
21D0BDC52C9241940077E104 /* ProjectSubscriber.h in Headers */,
|
||||
21AE196A2CC57832004DBCFC /* Propertied.h in Headers */,
|
||||
2196F2EC2CB4816B00450DFC /* ArchicadAttributeDBaseEngine.h in Headers */,
|
||||
21AE19582CC27DB3004DBCFC /* Value.h in Headers */,
|
||||
21384BC62CD24AB200D4602B /* ElementSubscriber.h in Headers */,
|
||||
21D0BD312C86FE090077E104 /* Index.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1175,8 +1185,10 @@
|
||||
215F08552C99DA8D00CD343B /* Project.cpp in Sources */,
|
||||
21AE19882CC7FF5F004DBCFC /* Group.cpp in Sources */,
|
||||
21F69F3B2C6B880C008B6A06 /* JSBaseTransport.cpp in Sources */,
|
||||
21384BC52CD24AB200D4602B /* ElementSubscriber.cpp in Sources */,
|
||||
2196F2EB2CB4816B00450DFC /* ArchicadAttributeDBaseEngine.cpp in Sources */,
|
||||
21AE19532CC273F1004DBCFC /* Template.cpp in Sources */,
|
||||
21384BAC2CCDA9B400D4602B /* Host.cpp in Sources */,
|
||||
21A0FC042CBE59A80023F24E /* SegmentedColumn.cpp in Sources */,
|
||||
210CC89F2C81E34400610F58 /* Platform.cpp in Sources */,
|
||||
21D0BD202C86F0280077E104 /* AccountDatabase.cpp in Sources */,
|
||||
@@ -1317,7 +1329,7 @@
|
||||
LOCALISATION_SUFFIX = "EN-GB";
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
NNA_WARNING_CPLUSPLUSFLAGS = "-Wno-deprecated";
|
||||
@@ -1414,7 +1426,7 @@
|
||||
LOCALISATION_SUFFIX = "EN-GB";
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
NNA_WARNING_CPLUSPLUSFLAGS = "-Wno-deprecated";
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
<ClInclude Include="Speckle\Database\Storage\DocumentStore\DocumentStoreCore.h" />
|
||||
<ClInclude Include="Speckle\Database\Storage\DocumentStore\DocumentStoreEngine.h" />
|
||||
<ClInclude Include="Speckle\Environment\Addon.h" />
|
||||
<ClInclude Include="Speckle\Environment\Host.h" />
|
||||
<ClInclude Include="Speckle\Environment\Platform.h" />
|
||||
<ClInclude Include="Speckle\Environment\Project.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\DocStoreSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\ElementSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\MenuSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\ProjectSubscriber.h" />
|
||||
<ClInclude Include="Speckle\Event\Subscriber\SelectionSubscriber.h" />
|
||||
@@ -135,9 +137,11 @@
|
||||
<ClCompile Include="Speckle\Database\Storage\ArchicadDBase\Property\ArchicadPropertyDBaseEngine.cpp" />
|
||||
<ClCompile Include="Speckle\Database\Storage\DocumentStore\DocumentStoreCore.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Addon.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Host.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Platform.cpp" />
|
||||
<ClCompile Include="Speckle\Environment\Project.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\DocStoreSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\ElementSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\MenuSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\ProjectSubscriber.cpp" />
|
||||
<ClCompile Include="Speckle\Event\Subscriber\SelectionSubscriber.cpp" />
|
||||
|
||||
@@ -415,6 +415,12 @@
|
||||
<ClInclude Include="Speckle\Record\Element\BeamSegment.h">
|
||||
<Filter>Speckle\Record\Element</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Environment\Host.h">
|
||||
<Filter>Speckle\Environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Event\Subscriber\ElementSubscriber.h">
|
||||
<Filter>Speckle\Event\Subscriber</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Speckle\Environment\Addon.cpp">
|
||||
@@ -630,6 +636,12 @@
|
||||
<ClCompile Include="Speckle\Record\Element\BeamSegment.cpp">
|
||||
<Filter>Speckle\Record\Element</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Environment\Host.cpp">
|
||||
<Filter>Speckle\Environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Event\Subscriber\ElementSubscriber.cpp">
|
||||
<Filter>Speckle\Event\Subscriber</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="Speckle\CMakeLists.txt">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ActiveLibDoctest/TestingPlatforms.h"
|
||||
|
||||
#include "Speckle/Utility/Guid32.h"
|
||||
#include "Speckle/Utility/Guid64.h"
|
||||
|
||||
using namespace speckle::utility;
|
||||
|
||||
@@ -8,8 +8,8 @@ TEST_SUITE(TESTQ(GuidTests)) TEST_SUITE_OPEN
|
||||
|
||||
///Tests for creating/modifying guids
|
||||
TEST_CASE(TESTQ(testGuidContent)) {
|
||||
Guid32 badGuid{String{"abcd"}};
|
||||
CHECK_MESSAGE(!badGuid, TEST_MESSAGE(Guid32 created from bad data));
|
||||
Guid64 badGuid{String{"abcd"}};
|
||||
CHECK_MESSAGE(!badGuid, TEST_MESSAGE(Guid64 created from bad data));
|
||||
}
|
||||
|
||||
TEST_SUITE_CLOSE
|
||||
|
||||
Reference in New Issue
Block a user