Commit Graph

36 Commits

Author SHA1 Message Date
Chris Hennes
5f623390fb Merge pull request #20142 from bofdahof/ranges
Apply C++20 std::ranges (mainly to std::find)
2025-03-17 03:08:27 -05:00
bofdahof
34881bc82e Sketcher: apply std::ranges 2025-03-16 17:18:12 -05:00
Andrew Shkolik
1155182ac3 Sketcher: Preference pattern and width added for External defining geometry 2025-03-03 23:51:26 -06:00
Andrew Shkolik
411cdadf49 Sketcher: Preference color added for External defining geometry 2025-02-27 00:28:20 -06:00
PaddleStroke
e2f998f301 Sketcher: External: Change style to : defining are solid lines. Non-defining dashed. Both use external color. 2024-11-29 11:36:55 -05:00
Florian Foinant-Willig
5969df37f4 Sketcher infinite axes 2024-11-25 18:27:10 +01:00
liukaiwen
4c6b7dadeb refactor: move some nodes to Inventor folder 2024-07-20 01:07:04 +08:00
FEA-eng
e09d8c58f7 Sketcher: Increase default width of dashed lines (#15075)
* Sketcher: Update SketcherSettingsAppearance.ui

* Sketcher: Update EditModeCoinManager.cpp
2024-07-08 11:06:55 -05: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
Abdullah Tahiri
ec899d75c6 SketcherGui: apply clang-format 2023-05-25 17:08:03 +02:00
Abdullah Tahiri
fdd3525424 SketcherGui: Separate user and developer errors
===============================================

Revisiting all console calls:
- Using the Notification Framework when the user needs to be notified
- Turning them into DeveloperError/DeveloperWarnings when messages are intended only for developers
2023-05-25 14:09:06 +02:00
Florian Foinant-Willig
6765afd12b Set helper default hidden 2023-05-07 20:14:03 +02:00
Florian Foinant-Willig
36a46faf07 Sketcher: add a circle overlay for arcs 2023-05-07 20:14:03 +02:00
luzpaz
129d5882a7 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
Paddle
66ab1e3bf3 Sketcher: Add parameter observer for system unit, such that the view is updated when user change the unit system through the sizeLabel widget. 2023-03-17 14:04:24 +00: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
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
Abdullah Tahiri
d586ea6238 Sketcher/Part: Grid - Architecture
==================================

- Move all grid specific code out of ViewProviderSketch and EditModeCoinManager.
- The code in made into a new extension in Part - ViewProviderGridExtension
- ViewProviderSketch starts deriving from this new extension
- ViewProviderSketch configures the extension according to its Grid preferences
- Grid code refactored to remove hardcoded sketcher preference parameters.
- ViewProviderGridExtension handles property name/type changes within its competence.
2023-02-25 23:13:55 +01:00
Paddle
2cba01586a Sketcher: Grid rework. Include:
- Adding 'auto spacing' option.
    - Drawing grid dynamically on viewer area only.
    - Moving code to coinManager.
    - Adding a 'grid tool' to sketcher-edit-mode toolbar.
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
e566daa1af Sketcher: Correct font sizes and updates
========================================

Fonts:
- SoDatumLabel internally uses QFont and thus points. It was being fed pixels, for which the configured size in preferences did not match the actual on screen size. This is corrected.
- Font sizes fed directly from parameters to the coin nodes skeleton were not being updated, as the parameter observer is initialised after the nodes are created, and the parameter
observer was not configured to update this nodes. This is corrected.

Colors:
- Some color parameters were not being being updated by the parameter observer. This is corrected.
2023-02-15 17:29:46 +01:00
Syres916
f6b3399848 [Sketcher] Fix cursor coordinates text size...
...to stay in proportion to the constraint text size. Fixes https://github.com/FreeCAD/FreeCAD/issues/7080
2023-02-14 15:07:01 +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
7d1e4186cc Sketcher/BackEdit: makes EditModeInformationOverlayCoinConverter class VP & attorneys aware 2022-09-09 16:09:42 +02:00
wandererfan
dd14b42829 [Sketcher]make cursor coord display unit aware 2022-08-31 16:31:27 -04:00
berniev
da9ebc572f Mod: redundant void 2 2022-08-08 10:27:50 +02:00
Abdullah Tahiri
89bf7f3d0b Sketcher: DrawSketchHandler draw multiple edit curves
=====================================================

Extension of the framework to draw an arbitrary curve in draw sketch handlers, so that
a plurality of curves can be handled.

DrawSketchHandler is extended to additionally offer drawing several curves:
- void drawEdit(const std::list<std::vector<Base::Vector2d>> &list);
- void drawEdit(const std::vector<Part::Geometry *> &geometries);

A new class, CurveConverter, enables to convert individual Part::Geometry or vectors of them
to appropriate vectors or list of vectors of Vector2d representing the curves. This can be
used in a specific DrawSketchHandler to combine Part::Geometries and arbritary curves.
2022-03-14 16:02:49 +01:00
Abdullah Tahiri
8a20f1a071 Sketcher: Coverity 350641 - unhandled exception in noexcept destructor 2022-03-12 21:14:19 +01:00
wmayer
6193fc9cdb Sketch: [skip ci] fix linking error with MSVC
For more details see: https://forum.freecadweb.org/viewtopic.php?f=10&t=66939
2022-03-09 01:11:15 +01:00
0penBrain
34106f49e7 [Sketcher] Disable constraints selection when geometry/constraint handler is active 2022-02-17 16:17:04 +01:00
wmayer
0c0239571b Sketcher: avoid attaching to/detaching from the same parameter group twice 2022-01-06 00:35:36 +01:00
Abdullah Tahiri
f04d5171da EditCoinManager: Additional refactoring 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