Commit Graph

125 Commits

Author SHA1 Message Date
PaddleStroke
e4213fc10f Sketcher: Symmetry tool rework. 2024-03-25 17:48:01 +01:00
Paddle
c4720e56c1 Translate DSH : A replacement for rectangular array. 2024-02-12 17:48:22 +01:00
PaddleStroke
8afa940ca2 [Sketcher] Scale DSH : adds a tool to scale geometries. (#11265)
* Scale DSH : sketcher tool to scale geometries.
* Sketcher: Rotate and Scale : Move indexInVec to Utils.h as indexOfGeoId

---------

Co-authored-by: Paddle <PaddleStroke@users.noreply.github.com>
2024-02-01 09:08:58 +01:00
Paddle
17893d39ca Sketcher: PythonConverter: Replace useLastGeoIdVar bool by enum class 2024-01-20 06:49:32 +01:00
Paddle
8ed22b0fd8 Sketcher: copy paste : move from XML to python. 2024-01-19 11:13:53 +01:00
Paddle
fd2e35b7eb Sketcher: Add copy/cut/paste sketcher commands 2024-01-19 11:13:53 +01:00
Paddle
1526563791 Rotate DSH : Polar pattern tool for sketcher. 2023-12-20 06:59:47 +01:00
Paddle
00423deaa2 CommandSketcherTools : add local getSketchObject to avoid copy paste. 2023-12-20 06:59:47 +01:00
Roy-043
09f7446ec4 Sketcher: Sketcher_Offset: menu text and shortcut
* Menu text "Offset geometry" (singular).
* Shortcut "Z, O" was already in use. Changed to "Z, T".
2023-12-05 15:25:52 +01:00
Paddle
029fd10bf1 Offset DSH : various fixes 2023-11-07 15:36:21 +01:00
Chris Hennes
cf84c171e6 Merge pull request #10978 from FlachyJoe/modernize-type-check
Modernize type and derived type checking
2023-11-06 10:44:32 -06:00
Paddle
dc2da5aba1 Offset fix isActive function. 2023-11-04 08:58:50 +01:00
Paddle
b65b1ff8de Sketcher: Offset DSH 2023-11-03 14:02:25 +01:00
Florian Foinant-Willig
a32851073d Sketcher: modernize type checking 2023-10-23 18:09:23 +02:00
wmayer
f94b026456 modernize C++: use transparent functors 2023-08-07 16:08:35 +02:00
Abdullah Tahiri
ec899d75c6 SketcherGui: apply clang-format 2023-05-25 17:08:03 +02:00
Abdullah Tahiri
60d99ca570 Sketcher: Obey non-intrusive preferences for modal pop-ups
==========================================================

This commit turns the remaining blocking pop-ups in which the user can only click "ok"
into non-intrusive notifications, depending on the user preferences in settings.
2023-05-24 18:35:41 +02:00
Abdullah Tahiri
8569a4fb30 Sketcher: Remove references to non-existing icons
=================================================

User Syres realised that some commands that are in use by the solver messages url referenced non-existing icons, which
triggers errors in the report view while customising:
https://forum.freecad.org/viewtopic.php?p=666167&sid=16ac6777c440d632e5f60083fb4327ca#p666167

This commit removes them.
2023-03-10 18:18:58 +01:00
wandererfan
a810fa68b4 [Sketcher]fix cursor display of angles 2023-01-30 11:04:42 -08:00
Uwe
08932bd92d [Sketch] Gui: A - D: remove unused headers
- also some sorting
2022-12-11 23:47:03 +01:00
0penBrain
862c092c0b Sketcher: disable auto-constraint in Copy/Clone/Move commands 2022-11-18 08:18:58 +01:00
0penBrain
e3cd132af7 [Typo]Sketcher: 'Clone' is the first command of CompCopy, match the tooltip 2022-11-16 14:48:39 +01:00
wmayer
e2a552a9c6 Sketcher: [skip ci] remove unused includes 2022-09-25 11:09:29 +02:00
wandererfan
dd14b42829 [Sketcher]make cursor coord display unit aware 2022-08-31 16:31:27 -04:00
wmayer
a7bf7869ae Sketcher: modernize C++: replace 'typedef' with 'using' 2022-08-29 23:13:16 +02:00
berniev
6953310116 Mod: Single arg ctors must be explicit 2022-08-24 16:55:20 +02:00
berniev
ddafb98813 Mod: Use override etc 2 2022-08-09 12:52:26 +02:00
berniev
da9ebc572f Mod: redundant void 2 2022-08-08 10:27:50 +02:00
berniev
b796a0d376 Mod: use empty 2022-08-06 19:30:13 +02:00
Abdullah Tahiri
19230c83ef Remove obsolete DSH Tools - CloseShape and ConnectLines 2022-06-28 19:29:35 +02:00
Abdullah Tahiri
c6459bb7d3 Utils refactor w/o commandcreategeo 2022-06-28 19:28:06 +02:00
wmayer
ead5154b18 Sketcher: modernize C++11
* use nullptr
2022-03-23 19:26:15 +01:00
Ajinkya Dahale
76029a5b2d [Sketcher] Fix "toggle internal geo" on multi-selection
Some deleted GeoIds can stay in selection and GeoIds can change as some objects
are deleted.
2022-03-13 06:58:40 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Abdullah Tahiri
d8c052c666 DrawSketchHandler: activation and deactivation via NVI pattern
==============================================================

With the introduction of overridable default behaviour for commands, it makes sense to keep control of the execution path of the activation and deactivation.

Non-virtual interface pattern enforces execution control of the virtual functions, while allowing the behaviour to be overriden in a case by case basis.
2022-02-17 19:37:48 +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
Abdullah Tahiri
97c82a6703 Sketcher: Convert PointPos into an enum CLASS 2021-12-11 16:17:21 +01:00
Abdullah Tahiri
bb76be1371 Sketcher: GeoId, GeoElementId and GeoUndef refactor
===================================================

This commit is an independent refactor of the identifications used at Sketcher level.

It introduces a new type "GeoElementId" as a combination of GeoId and PointPos.

It moves the Undefined GeoId, previous Constraint::GeoUndef to GeoEnum, together with all
other fixed values of GeoIds.
2021-12-11 16:17:21 +01:00
Abdullah Tahiri
f29a6a0518 Sketcher: move GUI common utility functions to a new file Utils.h
=================================================================

Common utility functions used by almost all Command classes were previous in Constraint.h.

Aside from providing a very bad intent, it created unnecessary header dependencies.

This commit separates these common functions into a new header, utils.h, which is then
used in all command classes where it is necessary.
2021-12-07 16:30:55 +01:00
Abdullah Tahiri
5f0d3e22fc Sketcher: CommandSketcherTools add missing include that was indirectly satisfied 2021-12-07 16:30:53 +01:00
luz paz
0042f58e4c Make source code comments use gender neutral pronouns
The changes also include some grammatical fixes as well.
2021-12-02 16:18:04 -05:00
Abdullah Tahiri
0926a4148b Sketcher: Default Shortcuts
===========================

Following:
https://forum.freecadweb.org/viewtopic.php?p=539914#p539914

Following requests from OpenBrain and ChrisB:
https://forum.freecadweb.org/viewtopic.php?p=540015#p540015

Following request from M4X:

Recomendation to use "L" and "I" for vertical and horizontal distance constraints and "R" for radius.

https://forum.freecadweb.org/viewtopic.php?p=540049#p540049

https://forum.freecadweb.org/viewtopic.php?p=540011#p540011
2021-10-16 09:23:22 +02:00
Abdullah Tahiri
6e4a09f569 Sketcher: Copy and Array tool Snap at 5 degrees using CTRL 2021-10-12 09:41:58 +02:00
wmayer
df23ab4441 Sketcher: [skip ci] fix -Wunused-lambda-capture 2021-10-06 19:46:57 +02:00
Abdullah Tahiri
521cfcfefd Sketcher: user addSelections for group selection in SketcherTools 2021-10-06 13:44:06 +02:00
wmayer
6f6272f12b Sketcher: [skip ci] remove superfluous QT_TRANSLATE_NOOP from Sketcher commands 2021-09-29 15:46:06 +02:00
FreeCAD-Tools
2186b03fc2 Update CommandSketcherTools.cpp 2021-09-27 15:59:31 +03:00
Abdullah Tahiri
c9eaa2393d Sketcher: Rectangular Array Snap mode
=====================================

Rectangular Array gets a snap mode every 10 degrees when pressing CTRL (for consistency with Multiline arc, which also snaps using CTRL).

Request:
https://forum.freecadweb.org/viewtopic.php?p=535691#p535691
2021-09-25 21:58:14 +02:00
donovaly
438895a3be [Sketch] fix menu entry wording
all other menu entries use lower case letters, thus do so also for the new tool
2021-06-21 13:56:23 +02:00
Abdullah Tahiri
9b34d671e0 Sketcher: UI toolbar/menu remove axes alignment 2021-06-20 06:16:33 +02:00