FreeCAD: master 1d56289c

Author Committer Branch Timestamp Parent
abdullah abdullahtahiriyo master 2020-12-25 08:01:21 master 8e3b6be0
Changeset Sketcher: restric ViewProviderSketch access to the solver

=========================================================

-> Split read and read/write operations

New interface to access the solver object (Sketch) of SketchObject is now read only (const):

const Sketcher::Sketch &getSolvedSketch(void) const;

-> Encapsulate solver r/w access in SketchObject

Rationale:

- r/w access (access to non-const functions of the solver) leads to unsynchronised solver status.

- Before this commit there was a non-enforceable shared responsibility between ViewProviderSketch
and SketchObject.

- This commit centralises r/w access in SketchObject and SketchObject takes responsibility for doing whatever
necessary so that the solver is synchronised as appropriate.

- For read-only access (const functions) it is possible to use at ViewProviderSketch getSolvedSketch() returning
a const reference to the solver object.

- As it regards the advanced solver configuration dialog, it has been modified to configure by const-casting that reference. This
is not optimal, but it is deemed acceptable, because it should be rewritten sooner or later to include only useful information
and the configuration probably centralised in an individual configuration object, possibly compatible with several solvers
(e.g. DeepSOIC's ConstraintSolver too).
mod - src/Mod/Sketcher/App/SketchObject.h Diff File
mod - src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp Diff File
mod - src/Mod/Sketcher/Gui/ViewProviderSketch.cpp Diff File
mod - src/Mod/Sketcher/Gui/ViewProviderSketch.h Diff File