Toposhape/Part:: fix, relocate and test element methods in ComplexGeoData and TopoShape
This commit is contained in:
@@ -211,7 +211,7 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
|
||||
shapes.push_back(sh);
|
||||
}
|
||||
|
||||
TopoShape res {};
|
||||
TopoShape res {0};
|
||||
res.makeElementBoolean(Part::OpCodes::Common, shapes);
|
||||
if (res.isNull()) {
|
||||
throw Base::RuntimeError("Resulting shape is null");
|
||||
|
||||
@@ -1240,6 +1240,14 @@ public:
|
||||
|
||||
void copyElementMap(const TopoShape & topoShape, const char *op=nullptr);
|
||||
bool canMapElement(const TopoShape &other) const;
|
||||
void cacheRelatedElements(const Data::MappedName & name,
|
||||
HistoryTraceType sameType,
|
||||
const QVector<Data::MappedElement> & names) const;
|
||||
|
||||
bool getRelatedElementsCached(const Data::MappedName & name,
|
||||
HistoryTraceType sameType,
|
||||
QVector<Data::MappedElement> &names) const;
|
||||
|
||||
void mapSubElement(const TopoShape &other,const char *op=nullptr, bool forceHasher=false);
|
||||
void mapSubElement(const std::vector<TopoShape> &shapes, const char *op=nullptr);
|
||||
void mapSubElementsTo(std::vector<TopoShape>& shapes, const char* op = nullptr) const;
|
||||
|
||||
@@ -5002,23 +5002,22 @@ bool TopoShape::isSame(const Data::ComplexGeoData &_other) const
|
||||
&& Hasher == other.Hasher
|
||||
&& _Shape.IsEqual(other._Shape);
|
||||
}
|
||||
|
||||
void TopoShape::cacheRelatedElements(const Data::MappedName &name,
|
||||
bool sameType,
|
||||
HistoryTraceType sameType,
|
||||
const QVector<Data::MappedElement> & names) const
|
||||
{
|
||||
INIT_SHAPE_CACHE();
|
||||
_Cache->insertRelation(ShapeRelationKey(name,sameType), names);
|
||||
initCache();
|
||||
_cache->insertRelation(ShapeRelationKey(name,sameType), names);
|
||||
}
|
||||
|
||||
bool TopoShape::getRelatedElementsCached(const Data::MappedName &name,
|
||||
bool sameType,
|
||||
HistoryTraceType sameType,
|
||||
QVector<Data::MappedElement> &names) const
|
||||
{
|
||||
if(!_Cache)
|
||||
if(!_cache)
|
||||
return false;
|
||||
auto it = _Cache->relations.find(ShapeRelationKey(name,sameType));
|
||||
if(it == _Cache->relations.end())
|
||||
auto it = _cache->relations.find(ShapeRelationKey(name,sameType));
|
||||
if(it == _cache->relations.end())
|
||||
return false;
|
||||
names = it->second;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user