-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
473 changed files
with
54,723 additions
and
49,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "Objects/Converters/ConverterRevit/ConverterRevitTests/xUnitRevit"] | ||
path = Objects/Converters/ConverterRevit/ConverterRevitTests/xUnitRevit | ||
url = https://github.com/specklesystems/xUnitRevit.git | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
ConnectorArchicad/AddOn/Sources/AddOn/ClassificationImportManager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include "ClassificationImportManager.hpp" | ||
|
||
|
||
ClassificationImportManager* ClassificationImportManager::instance = nullptr; | ||
|
||
ClassificationImportManager* ClassificationImportManager::GetInstance () | ||
{ | ||
if (nullptr == instance) { | ||
instance = new ClassificationImportManager; | ||
} | ||
return instance; | ||
} | ||
|
||
|
||
void ClassificationImportManager::DeleteInstance () | ||
{ | ||
if (nullptr != instance) { | ||
delete instance; | ||
instance = nullptr; | ||
} | ||
} | ||
|
||
|
||
ClassificationImportManager::ClassificationImportManager () {} | ||
|
||
|
||
GSErrCode AddToCache (GS::Array<API_ClassificationItem> items, GS::HashTable<GS::UniString, API_Guid>& cache) | ||
{ | ||
for (auto& item : items) { | ||
cache.Add (item.id, item.guid); | ||
|
||
GS::Array<API_ClassificationItem> childrenItems; | ||
GSErrCode err = ACAPI_Classification_GetClassificationItemChildren (item.guid, childrenItems); | ||
if (err != NoError) | ||
return err; | ||
|
||
AddToCache (childrenItems, cache); | ||
} | ||
|
||
return NoError; | ||
} | ||
|
||
|
||
GSErrCode ClassificationImportManager::GetItem (const GS::UniString& systemName, const GS::UniString& code, API_Guid& itemGuid) | ||
{ | ||
GS::ErrCode err = NoError; | ||
|
||
if (!cache.ContainsKey (systemName)) { | ||
API_ClassificationSystem targetSystem{}; | ||
{ | ||
GS::Array<API_ClassificationSystem> systems; | ||
err = ACAPI_Classification_GetClassificationSystems (systems); | ||
if (err != NoError) | ||
return err; | ||
|
||
err = Cancel; | ||
for (auto& system : systems) { | ||
if (system.name == systemName) { | ||
targetSystem = system; | ||
err = NoError; | ||
break; | ||
} | ||
} | ||
|
||
if (err != NoError) | ||
return err; | ||
} | ||
|
||
GS::Array<API_ClassificationItem> rootItems; | ||
err = ACAPI_Classification_GetClassificationSystemRootItems (targetSystem.guid, rootItems); | ||
if (err != NoError) | ||
return err; | ||
|
||
GS::HashTable<GS::UniString, API_Guid> systemCache; | ||
AddToCache (rootItems, systemCache); | ||
cache.Add(systemName, systemCache); | ||
} | ||
|
||
if (cache[systemName].Get (code, &itemGuid)) | ||
return NoError; | ||
|
||
return Error; | ||
} |
24 changes: 24 additions & 0 deletions
24
ConnectorArchicad/AddOn/Sources/AddOn/ClassificationImportManager.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef CLASSIFICATION_IMPORT_MANAGER_HPP | ||
#define CLASSIFICATION_IMPORT_MANAGER_HPP | ||
|
||
#include "ModelInfo.hpp" | ||
|
||
class ClassificationImportManager { | ||
private: | ||
static ClassificationImportManager* instance; | ||
|
||
GS::HashTable< GS::UniString, GS::HashTable<GS::UniString, API_Guid>> cache; | ||
|
||
protected: | ||
ClassificationImportManager (); | ||
|
||
public: | ||
ClassificationImportManager (ClassificationImportManager&) = delete; | ||
void operator=(const ClassificationImportManager&) = delete; | ||
static ClassificationImportManager* GetInstance (); | ||
static void DeleteInstance (); | ||
|
||
GSErrCode GetItem (const GS::UniString& systemName, const GS::UniString& itemID, API_Guid& itemGuid); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.