Skip to content

Commit

Permalink
Merge pull request FreeCAD#15734 from bgbsww/bgbsww-toponamingFixTopo…
Browse files Browse the repository at this point in the history
…ShapeToHaveHasher

Toponaming: make sure TopoShapes have Hashers
  • Loading branch information
chennes authored Aug 5, 2024
2 parents 9b5b9cc + 19b6363 commit 4801300
Show file tree
Hide file tree
Showing 4 changed files with 331 additions and 305 deletions.
10 changes: 10 additions & 0 deletions src/App/ComplexGeoData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ ComplexGeoData::getElementMappedNames(const IndexedName& element, bool needUnmap
return {std::make_pair(MappedName(element), ElementIDRefs())};
}

ElementMapPtr ComplexGeoData::resetElementMap(ElementMapPtr elementMap)
{
_elementMap.swap(elementMap);
// We expect that if the ComplexGeoData ( TopoShape ) has a hasher, then its elementMap will
// have the same one. Make sure that happens.
if ( _elementMap && ! _elementMap->hasher )
_elementMap->hasher = Hasher;
return elementMap;
}

std::vector<MappedElement> ComplexGeoData::getElementMap() const
{
flushElementMap();
Expand Down
6 changes: 1 addition & 5 deletions src/App/ComplexGeoData.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,7 @@ class AppExport ComplexGeoData: public Base::Persistence, public Base::Handled
*
* @return Returns the existing element map.
*/
virtual ElementMapPtr resetElementMap(ElementMapPtr elementMap = ElementMapPtr())
{
_elementMap.swap(elementMap);
return elementMap;
}
virtual ElementMapPtr resetElementMap(ElementMapPtr elementMap = ElementMapPtr());

/// Get the entire element map
std::vector<MappedElement> getElementMap() const;
Expand Down
1 change: 0 additions & 1 deletion src/App/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,6 @@ std::pair<bool,int> Document::addStringHasher(const StringHasherRef & hasher) co

StringHasherRef Document::getStringHasher(int idx) const {
if(idx<0) {
return d->Hasher;
return d->Hasher;
}
StringHasherRef hasher;
Expand Down
Loading

0 comments on commit 4801300

Please sign in to comment.