Toponaming: Transfer in getLinksTo
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Writer.h>
|
||||
@@ -1079,3 +1080,46 @@ void PropertyExpressionEngine::onRelabeledDocument(const App::Document &doc)
|
||||
e.second.expression->visit(v);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyExpressionEngine::getLinksTo(std::vector<App::ObjectIdentifier> &identifiers,
|
||||
App::DocumentObject *obj,
|
||||
const char *subname,
|
||||
bool all) const
|
||||
{
|
||||
Expression::DepOption option = all ? Expression::DepOption::DepAll
|
||||
: Expression::DepOption::DepNormal;
|
||||
|
||||
App::SubObjectT objT(obj, subname);
|
||||
auto sobj = objT.getSubObject();
|
||||
auto subElement = objT.getOldElementName();
|
||||
|
||||
for(auto &v : expressions) {
|
||||
const auto &deps = v.second.expression->getDeps(option);
|
||||
auto it = deps.find(obj);
|
||||
if(it==deps.end())
|
||||
continue;
|
||||
for(auto &dep : it->second) {
|
||||
if (!subname) {
|
||||
identifiers.push_back(v.first);
|
||||
break;
|
||||
}
|
||||
bool found = false;
|
||||
for (const auto &path : dep.second) {
|
||||
if (path.getSubObjectName() == subname) {
|
||||
identifiers.push_back(v.first);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
App::SubObjectT sobjT(obj, path.getSubObjectName().c_str());
|
||||
if (sobjT.getSubObject() == sobj
|
||||
&& sobjT.getOldElementName() == subElement) {
|
||||
identifiers.push_back(v.first);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user