Part/Toponaming: clang-tidy cleanup of cache calls

This commit is contained in:
Chris Hennes
2023-12-23 11:39:57 -06:00
committed by Chris Hennes
parent ee2be48cd7
commit a2c1d9ff8e
3 changed files with 6 additions and 25 deletions

View File

@@ -79,14 +79,14 @@ public:
/// Inverse of location
TopLoc_Location locationInverse;
struct AncestorInfo
struct PartExport AncestorInfo
{
bool initialized = false;
TopTools_IndexedDataMapOfShapeListOfShape shapes;
};
/// Class for caching the ancestor and children shapes mapping
class Ancestry
class PartExport Ancestry
{
private:
TopoShapeCache* owner = nullptr;

View File

@@ -138,22 +138,21 @@ int TopoShape::findShape(const TopoDS_Shape& subshape) const
return _cache->findShape(_Shape, subshape);
}
static const std::string _SubShape("SubShape");
TopoDS_Shape TopoShape::findShape(const char* name) const
{
if (!name) {
return TopoDS_Shape();
return {};
}
Data::MappedElement res = getElementName(name);
if (!res.index) {
return TopoDS_Shape();
return {};
}
auto idx = shapeTypeAndIndex(name);
if (!idx.second) {
return TopoDS_Shape();
if (idx.second == 0) {
return {};
}
initCache();
return _cache->findShape(_Shape, idx.first, idx.second);

View File

@@ -8,9 +8,7 @@
#include <gp_Quaternion.hxx>
#include <TopoDS_TVertex.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <TopoDS_Edge.hxx>
@@ -62,22 +60,6 @@ private:
App::StringHasherRef _hasher;
};
/*
Methods to test
-------------
DONE - explicit TopoShapeCache(const TopoDS_Shape& tds);
DONE - void insertRelation(const ShapeRelationKey& key, const QVector<Data::MappedElement>& value);
DONE - bool isTouched(const TopoDS_Shape& tds) const;
DONE Ancestry& getAncestry(TopAbs_ShapeEnum type);
DONE int countShape(TopAbs_ShapeEnum type);
DONE int findShape(const TopoDS_Shape& parent, const TopoDS_Shape& subShape);
DONE TopoDS_Shape findShape(const TopoDS_Shape& parent, TopAbs_ShapeEnum type, int index);
TopoDS_Shape findAncestor(const TopoDS_Shape& parent,
const TopoDS_Shape& subShape,
TopAbs_ShapeEnum type,
std::vector<TopoDS_Shape>* ancestors = nullptr);
*/
TEST_F(TopoShapeCacheTest, ConstructionFromTopoDS_Shape)
{
// Arrange - create a TopoDS shape with some location transformation applied