[Sketcher] Refactor internal geometry operations

* Use range-for and rearrange for understandability.
* Break down into individual functions by geomtype.
* Also refactor `exposeInternalGeometryForType<Part::GeomBSplineCurve>`
* Use `Constraint::involves...()` in delete internal

Suppress clang-tidy/clazy warnings by using `[[maybe_unused]]`.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
Ajinkya Dahale
2024-12-22 04:00:53 +05:30
parent 23cd6cb54e
commit 5a01d438f2
2 changed files with 907 additions and 798 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -482,6 +482,11 @@ public:
* \return -1 on error
*/
int exposeInternalGeometry(int GeoId);
template<class GeomType>
int exposeInternalGeometryForType([[maybe_unused]] const int GeoId)
{
return -1; // By default internal geometry is not supported
}
/*!
\brief Deletes all unused (not further constrained) internal geometry
\param GeoId - the geometry having the internal geometry to delete
@@ -899,6 +904,15 @@ protected:
void buildShape();
/// get called by the container when a property has changed
void onChanged(const App::Property* /*prop*/) override;
/// Helper functions for `deleteUnusedInternalGeometry` by cases
/// two foci for ellipses and arcs of ellipses and hyperbolas
int deleteUnusedInternalGeometryWhenTwoFoci(int GeoId, bool delgeoid = false);
/// one focus for parabolas
int deleteUnusedInternalGeometryWhenOneFocus(int GeoId, bool delgeoid = false);
/// b-splines need their own treatment
int deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeoid = false);
void onDocumentRestored() override;
void restoreFinished() override;