mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
#1475 IfcFile::recalculate_id_counter()
This commit is contained in:
@@ -228,6 +228,8 @@ public:
|
||||
|
||||
unsigned int FreshId() { return ++MaxId; }
|
||||
|
||||
void recalculate_id_counter();
|
||||
|
||||
IfcUtil::IfcBaseClass* addEntity(IfcUtil::IfcBaseClass* entity);
|
||||
void addEntities(IfcEntityList::ptr es);
|
||||
|
||||
|
||||
@@ -1494,6 +1494,16 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
|
||||
return;
|
||||
}
|
||||
|
||||
void IfcFile::recalculate_id_counter() {
|
||||
entity_by_id_t::key_type k = 0;
|
||||
for (auto& p : byid) {
|
||||
if (p.first > k) {
|
||||
k = p.first;
|
||||
}
|
||||
}
|
||||
MaxId = (unsigned int)k;
|
||||
}
|
||||
|
||||
class traversal_visitor {
|
||||
private:
|
||||
std::set<IfcUtil::IfcBaseClass*>& visited_;
|
||||
|
||||
Reference in New Issue
Block a user