Commit Graph

23 Commits

Author SHA1 Message Date
bgbsww
27ca64a201 Sketcher: Do not consider missing external geometry to be an error (#16590)
* Do not consider missing external geometry to be an error; highlight in conflict color.
2024-09-18 15:18:11 -05:00
PaddleStroke
b48bbe390b Sketcher: change rendering height of internal alignment. So that bpsline appears connected. Fixes second part of #13849 2024-05-07 16:00:00 +02:00
PaddleStroke
a3344c1ab8 Sketcher: Red point if end-point perpendicular 2024-05-07 15:42:03 +02:00
PaddleStroke
c42b1f1654 Sketcher: Make coincident points the same color as constraints. 2024-04-08 17:49:46 +02:00
PaddleStroke
f5da655429 Sketcher: Points color reflect their construction state. Remove Vertex color. 2024-04-08 17:49:46 +02:00
Paddle
b140feabaf Sketcher: Edges pattern and width by type. 2024-01-22 11:12:42 -06:00
pre-commit-ci[bot]
222a2520b1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 13:02:35 -04:00
Chris Hennes
791fe02934 Sketcher: Reformat to current clang-format standard 2023-09-04 07:17:28 -05:00
0penBrain
1e130fa9c3 [Bugfix]Sketcher: fix vertex selection from backside not working anymore
Regression introduced with a6adfc58
2023-06-24 10:05:45 +02:00
Abdullah Tahiri
ec899d75c6 SketcherGui: apply clang-format 2023-05-25 17:08:03 +02:00
Florian Foinant-Willig
36a46faf07 Sketcher: add a circle overlay for arcs 2023-05-07 20:14:03 +02:00
Abdullah Tahiri
a6adfc58b6 Sketcher: Fix overlapped points not selecting/preselecting
=========================================================

Fixes an issue reported directly by Chrisb.

On overlapping points, such as due to coincidence, selection and
preselection (e.g. from the ElementsWidget) is not shown for those
points which are rendered first.

Solution: To raise the points to the highlight height.
2023-04-22 15:07:34 +02:00
Abdullah Tahiri
d01edd53a2 EditCoinManager: Refactor and extend layer support to use VisualLayerList property and ViewProviderSketchGeometryExtension 2023-03-02 20:42:48 +01:00
Abdullah Tahiri
9478870d50 EditCoinManager: Apply Visual Configuration configuration 2023-03-02 20:42:48 +01:00
Abdullah Tahiri
2f34f01c10 Sketcher: EditModeCoinManager - support to update layer configuration
=====================================================================

- Refactor scenograph creation to enable local update
- Support to perform a local update
2023-03-02 20:42:48 +01:00
Uwe
ce8816685b [Sketch] Gui: E - Short*: remove unused headers
- also some sorting
2022-12-12 02:52:33 +01:00
0penBrain
3f220f1dd8 Sketcher/BackEdit: makes sketch elements render on -Z if sketch viewed from back side 2022-09-09 16:09:42 +02:00
0penBrain
a6a8f27125 Sketcher/BackEdit: makes EditModeGeometryCoinConverter class VP & attorneys aware 2022-09-09 16:09:42 +02:00
Ajinkya Dahale
0f093f4221 [Sketcher] Safeguard against spurious pre-selection
Preselection is sometimes not updated under some circumstances
1. when deleting an object through python;
2. before autoconstraint when deleting previous pole in bspline creation mode.

When the preselected curve is the deleted object, segfault/crash can happen.
2022-03-09 16:43:47 +01:00
wmayer
86c91d71a1 Sketcher: fix crash in function 'Convert to B-Spline'
See also the forum thread: https://forum.freecadweb.org/viewtopic.php?f=19&t=66470
2022-02-24 12:54:11 +01:00
Abdullah Tahiri
6c019ac93f EditCoinManager: root point full constrained only when there is another point on top 2021-12-27 21:03:51 +01:00
Abdullah Tahiri
4bcca31b02 Sketcher: Fix root point not fully constrained when sketch is empty 2021-12-27 21:03:51 +01:00
Abdullah Tahiri
92e6094449 Sketcher: EditModeCoinManager/DrawSkechHandler refactoring
======================================================

Creation of EditModeCoinManager class and helpers.

In a nutshell:
- EditModeCoinManager gets most of the content of struct EditData
- Drawing is partly outsourced to EditModeCoinManager
- EditModeCoinManager gets a nested Observer class to deal with parameters
- A struct DrawingParameters is created to store all parameters used for drawing
- EditModeCoinManager assume responsibility for determining the drawing size of the Axes
- Preselection detection responsibility is moved to EditModeCoinManager.
- Generation of constraint nodes and constraint drawing is moved to EditModeCoinManager.
- Constraint generation parameters are refactored into ConstraintParameters.
- Text rendering functions are moved to EditModeCoinManager.
- Move HDPI resolution responsibility from VPSketch to EditModeCoinManager
- Move responsibility to create the scenograph for edit mode to EditModeCoinManager
- Move full updateColor responsibility to EditModeCoinManager
- Allows for mapping N logical layers (LayerId of GeometryFacade) to M coin Layers (M<N). This
is convenient as, unless the representation must be different, there is no point in creating coin
layers (overhead).

Refactoring of geometry drawing:
- Determination of the curve values to draw are outsourced to OCC (SRP and remove code duplications).
- Refactor specific drawing of each geometry type into a single template method, based on classes of geometry.
- Drawing of geometry and constraints made agnostic of scale factors of BSpline weights so that a uniform treatment can be provided.

Refactoring of Overlay Layer:
- A new class EditModeInformationOverlayConverter is a full rewrite of the previous overlay routines.

ViewProviderSketch:
- Major cleanup due to migration of functionalities to EditModeCoinManager
- Reduce public api of ViewProviderSketch due to refactor of DrawSketchHandler
- Major addition of documentation
- ShortcutListener implementation using new ViewProvider Attorney
- Gets a parameter handling nested class to handle all parameters (observer)
- Move rubberband to smart pointer
- Refactor selection and preselection into nested classes
- Removal of SEL_PARAMS macro. This macro was making the code unreadable as it "captured" a local stringstream that appeared unused. Substituted by local private member functions.
- Remove EditData
- Improve documentation
- Refactor Preselection struct to remove magical numbers
- Refactor Selection mechanism to remove hacks

ViewProviderSketchDrawSketchHandlerAttorney:
- new Attorney to limit access to ViewProviderSketch and reduce its public interface
- In order to enforce a certain degree of encapsulation and promote a not too tight coupling, while still allowing well
defined collaboration, DrawSketchHandler accesses ViewProviderSketch via this Attorney class.
-DrawSketchHandler has the responsibility of drawing edit temporal curves and markers necessary to enable visual feedback
to the user, as well as the UI interaction during such edits. This is its exclusive responsibility under the Single
Responsibility Principle.
- A plethora of speciliased handlers derive from DrawSketchHandler for each specialised editing (see for example all the
handlers for creation of new geometry). These derived classes do * not * have direct access to the
ViewProviderSketchDrawSketchHandlerAttorney. This is intentional to keep coupling under control. However, generic
functionality requiring access to the Attorney can be implemented in DrawSketchHandler and used from its derived classes
by virtue of the inheritance. This promotes a concentrating the coupling in a single point (and code reuse).

EditModeCoinManager:
- Refactor of updateConstraintColor
- Multifield - new struct to identify a single element in a multifield field per layer
- Move geometry management to delegate class EditModeCoinGeometryManager
- Remove refactored code that was never used in the original ViewProviderSketch.

CommandSketcherBSpline:
- EditModeCoinManager automatically tracks parameter change and triggers the necessary redraw, rendering an explicit redraw obsolete and unnecessary.

Rebase on top of master:
- Commits added to master to ViewProviderSketch applied to EditModeCoinManager.
- Memory leaks - wmayer
- Constraint Diameter Symbol - OpenBrain
- Minor bugfix to display angle constraints - syres

Architecture Description
=======================

* Encapsulation and collaboration - restricting friendship - reducing public interface

Summary:
- DrawSketchHandler to ViewProviderSketch friendship regulated via attorney.
- ShortcutListener to ViewProviderSketch friendship regulated via attorney.
- EditModeCoinManager (new class) to ViewProviderSketch friendship regulated via attorney.
- ViewProviderSketch public interface is heavily reduced.

In further detail:
While access from ViewProviderSketch to other classes is regulated via their public interface, DrawSketchHandler, ShortcutListener and EditCoinManager (new class) access
to ViewProviderSketch non-public interface via attorneys. Previously, it was an unrestricted access (friend classes). Now this interface is restricted and regulated via attorneys.
This increases the encapsulation of ViewProviderSketch, reduces the coupling between classes and promotes an ordered growth. This I call the "collaboration interface".

At the same time, ViewProviderSketch substantially reduces its public interface. Access from Command draw handlers (deriving from DrawSketchHandler) is intended to be restricted to
the functionality exposed by DrawSketchHandler to its derived classes. However, this is still only partly enforced to keep the refactoring within limits. A further refactoring of
DrawSketchHandler and derivatives is for future discussion.

* Complexity and delegation

Summary:
- Complexity of coin node management is dealt with by delegation to helper classes and specialised objects.

In further detail:

ViewProviderSketch is halved in terms of code size. Higher level ViewProviderSketch functions remain

* Automatic update of parameters - Parameter observer nested classes

Summary:
- ViewProviderSketch and CoinManager get their own observer nested classes to monitor the parameters relevant to them and automatically update on change.

The split enables that each class deals only with parameters within their own responsibilities, effectively isolating the specifics and decoupling the implementations. It is
more convenient as there is no need to leave edit mode to update parameters. It is more compact as it leverages core code.

More information:
https://forum.freecadweb.org/viewtopic.php?p=553257#p553257
2021-12-27 21:03:51 +01:00