[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

@@ -55,6 +55,7 @@
#include <App/FeaturePythonPyImp.h>
#include <App/Link.h>
#include <App/GeoFeatureGroupExtension.h>
#include <App/ElementNamingUtils.h>
#include <Base/Exception.h>
#include <Base/Placement.h>
#include <Base/Rotation.h>
@@ -65,7 +66,6 @@
#include "PartPyCXX.h"
#include "TopoShapePy.h"
using namespace Part;
namespace bp = boost::placeholders;
@@ -121,7 +121,7 @@ App::DocumentObject *Feature::getSubObject(const char *subname,
{
// having '.' inside subname means it is referencing some children object,
// instead of any sub-element from ourself
if(subname && !Data::ComplexGeoData::isMappedElement(subname) && strchr(subname,'.'))
if(subname && !Data::isMappedElement(subname) && strchr(subname,'.'))
return App::DocumentObject::getSubObject(subname,pyObj,pmat,transform,depth);
Base::Matrix4D _mat;
@@ -280,7 +280,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
if(powner) *powner = nullptr;
std::string _subname;
auto subelement = Data::ComplexGeoData::findElementName(subname);
auto subelement = Data::findElementName(subname);
if(!needSubElement && subname) {
// strip out element name if not needed
if(subelement && *subelement) {
@@ -413,7 +413,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
continue;
}else{
if(link && !link->getShowElementValue())
shape = baseShape.makeTransform(mat,(TopoShape::indexPostfix()+childName).c_str());
shape = baseShape.makeTransform(mat,(Data::POSTFIX_INDEX + childName).c_str());
else {
shape = baseShape.makeTransform(mat);
}