Skip to content

Commit

Permalink
Toponaming: bring in code to fix delExternal breakage.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgbsww authored and chennes committed Aug 2, 2024
1 parent 58241e0 commit e4b2bf7
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/Mod/Sketcher/App/SketchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7763,7 +7763,36 @@ int SketchObject::addExternal(App::DocumentObject *Obj, const char* SubName, boo
solverNeedsUpdate = true;
return ExternalGeometry.getValues().size() - 1;
}
#ifdef FC_USE_TNP_FIX
int SketchObject::delExternal(int ExtGeoId)
{
return delExternal(std::vector<int>{ExtGeoId});
}

int SketchObject::delExternal(const std::vector<int>& ExtGeoIds)
{
std::set<long> geoIds;
for (int ExtGeoId : ExtGeoIds) {
int GeoId = GeoEnum::RefExt - ExtGeoId;
if (GeoId > GeoEnum::RefExt || -GeoId - 1 >= ExternalGeo.getSize())
return -1;

auto geo = getGeometry(GeoId);
if (!geo)
return -1;

auto egf = ExternalGeometryFacade::getFacade(geo);
geoIds.insert(egf->getId());
if (egf->getRef().size()) {
auto& refs = externalGeoRefMap[egf->getRef()];
geoIds.insert(refs.begin(), refs.end());
}
}

delExternalPrivate(geoIds, true);
return 0;
}
#else
int SketchObject::delExternal(int ExtGeoId)
{
// no need to check input data validity as this is an sketchobject managed operation.
Expand Down Expand Up @@ -7829,7 +7858,7 @@ int SketchObject::delExternal(int ExtGeoId)
acceptGeometry();// This may need to be refactored into OnChanged for ExternalGeometry.
return 0;
}

#endif
void SketchObject::delExternalPrivate(const std::set<long> &ids, bool removeRef) {

Base::StateLocker lock(managedoperation, true); // no need to check input data validity as this is an sketchobject managed operation.
Expand Down

0 comments on commit e4b2bf7

Please sign in to comment.