Toponaming: Transfer in missing Code for BaseFeatures and Sketches

This commit is contained in:
Zheng, Lei
2024-06-27 16:56:16 -04:00
committed by Chris Hennes
parent cc93d99f49
commit 3dbc1d7393
6 changed files with 240 additions and 37 deletions

View File

@@ -387,10 +387,11 @@ App::DocumentObject* Feature::getSubObject(const char* subname,
TopoShape ts(Shape.getShape());
bool doTransform = mat != ts.getTransform();
if (doTransform) {
ts.setShape(ts.getShape().Located(TopLoc_Location()));
ts.setShape(ts.getShape().Located(TopLoc_Location()), false);
}
if (subname && *subname && !ts.isNull()) {
ts = ts.getSubShape(subname);
// ts = ts.getSubShape(subname); // TODO WAS THIS WRONG?
ts = ts.getSubTopoShape(subname,true);
}
if (doTransform && !ts.isNull()) {
static int sCopy = -1;
@@ -483,13 +484,12 @@ static std::vector<std::pair<long, Data::MappedName>> getElementSource(App::Docu
break;
}
}
// TODO: 02/24 Toponaming project: It appears that getElementOwner is always nullptr.
// if (owner->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
// auto o =
// static_cast<App::GeoFeature*>(owner)->getElementOwner(ret.back().second);
// if (o)
// doc = o->getDocument();
// }
if (owner->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
auto o =
static_cast<App::GeoFeature*>(owner)->getElementOwner(ret.back().second);
if (o)
doc = o->getDocument();
}
obj = doc->getObjectByID(tag < 0 ? -tag : tag);
if (type) {
for (auto& hist : history) {
@@ -586,13 +586,12 @@ std::list<Data::HistoryItem> Feature::getElementHistory(App::DocumentObject* fea
break;
}
}
// TODO: 02/24 Toponaming project: It appears that getElementOwner is always nullptr.
// if(feature->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
// auto owner =
// static_cast<App::GeoFeature*>(feature)->getElementOwner(element);
// if(owner)
// doc = owner->getDocument();
// }
if(feature->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
auto owner =
static_cast<App::GeoFeature*>(feature)->getElementOwner(element);
if(owner)
doc = owner->getDocument();
}
obj = doc->getObjectByID(std::abs(tag));
}
if (!recursive) {