[Toponaming] create ElementMap class (#9175)

* Copypaste ElementMap
* Add MappedNameRef
* Fix missing include
* Copypaste `findTagInElementName`
* fix error introduced _somewhere_
* refactor toponaming constants
* Move `findTagInElementName` in `MappedName`
* reintroduce workaround to compile ElementMap
* Added missing functions copied from complexgeodata
* fix last compile errors, reorder and format files
* remove recursive refs to ComplexGeoData
* Add more comments
* fixed comments and added tests
* added FIXME, make functions private, misc fixes
* Move static functions from complexGeoData to PostfixStringReferences. Rename to ElementNamingUtils
* Fix broken includes due to previous change
* Revert constants from string to const char*
* added childmap tests and made hasher public
* Make functions private
* Added remaining tests
* removed bool return from `erase` functions
* fix missing appexport

Co-authored-by: John Dupuy <jdupuy98@gmail.com>
This commit is contained in:
Pesc0
2023-06-15 16:05:24 +02:00
committed by GitHub
parent 32d8029780
commit 4a8d3853ba
26 changed files with 2450 additions and 218 deletions

View File

@@ -39,6 +39,7 @@
#include <App/GroupExtension.h>
#include <App/Link.h>
#include <App/OriginFeature.h>
#include <App/ElementNamingUtils.h>
#include <Mod/Part/App/TopoShape.h>
#include "ShapeBinder.h"
@@ -382,7 +383,7 @@ App::DocumentObject* SubShapeBinder::getSubObject(const char* subname, PyObject*
auto sobj = Part::Feature::getSubObject(subname, pyObj, mat, transform, depth);
if (sobj)
return sobj;
if (Data::ComplexGeoData::findElementName(subname) == subname)
if (Data::findElementName(subname) == subname)
return nullptr;
const char* dot = strchr(subname, '.');
@@ -405,7 +406,7 @@ App::DocumentObject* SubShapeBinder::getSubObject(const char* subname, PyObject*
}
else if (!boost::equals(sobj->getNameInDocument(), name))
continue;
name = Data::ComplexGeoData::noElementName(sub.c_str());
name = Data::noElementName(sub.c_str());
name += dot + 1;
if (mat && transform)
*mat *= Placement.getValue().toMatrix();
@@ -640,7 +641,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
std::ostringstream ss;
ss << "Failed to obtain shape " <<
obj->getFullName() << '.'
<< Data::ComplexGeoData::oldElementName(sub.c_str());
<< Data::oldElementName(sub.c_str());
errMsg = ss.str();
}
}