Commit Graph

23 Commits

Author SHA1 Message Date
Paddle
f877de3015 GeometryFacade : Add static getInternalType and setInternalType 2023-12-20 06:59:47 +01:00
pre-commit-ci[bot]
e92ed45df9 [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
fcedce3c42 Sketcher: Reformat to current clang-format standard 2023-09-04 07:17:28 -05:00
Abdullah Tahiri
0f14065d0a Sketcher: App - Clang-format 2023-05-20 07:55:05 +02:00
Uwe
1a365e881f [Sketch] App A - G: remove unused headers
- also some sorting
2022-12-11 18:53:45 +01:00
Uwe
b4bb7c42b3 [Sketch] App: improve PreCompiled.h handling 2022-12-08 01:33:24 +01:00
Abdullah Tahiri
bcc1b621b9 Sketcher: GeometryFacade - new static function to check for internal alignment 2022-10-29 20:25:34 +02:00
berniev
f4ffd15864 Mod: redundant void 2 2022-08-08 10:27:50 +02:00
Uwe
763a575b23 Mod: remove some unnecessary nullptr checks 2022-07-18 12:58:12 +02:00
Uwe
0399b3f087 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
Abdullah Tahiri
bbf9c34c2f Sketcher: GeometryFacade improvements
=====================================

- GeometryFacade will throw when instantiated with a const Part::Geometry * that does not have a SketchGeometryExtension. It
cannot create it because it is not supposed to modify a pointer to a const object.

- Static functions will check the passed Part::Geometry * parameters and will throw if nullptr.

- GeometryTypedFacade constructor and factory methods to take owner parameter (defaulted to false) for consistency with GeometryFacade.

- The emplace style factory method will make the GeometryFacade take ownership of the emplaced Part::Geometry *. This should avoid memory leaks. The
user shall setOwner(false) if it needs to release() the underlying Part::Geometry * (to transfer ownership).

- Code comments made into doxygen documentation.
2021-12-27 21:03:51 +01:00
Abdullah Tahiri
bc6e4c1355 Sketcher: GeometryFacade - Add ownership parameter to factory method 2021-12-27 21:03:51 +01:00
luz paz
430aadb791 Fix various typos and grammatical refinements 2021-12-09 08:57:52 -06:00
Abdullah Tahiri
cc94820a06 Sketcher: GeometryFacade Improvements
===============================================

1. Correct GeometryFacade getGeometry for const objects.
2. Modifications to avoid exceptions on the constructors.
3. Add default move constructor and move assignment operator.
4. Delete default copy constructor and copy assigment operator.
2021-12-07 16:30:53 +01:00
wmayer
0ff70c61ed Sketcher: [skip ci] fix memory leak in GeometryFacade 2021-04-27 00:20:57 +02:00
Abdullah Tahiri
dc4c464115 Sketcher: GeometryFacade - convenience method to check if a geometry is blocked 2020-12-21 05:57:42 +01:00
Abdullah Tahiri
366f63d9f9 Sketcher: GeometryFacade - Remove Debuging code 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
bb64e15c14 Sketcher: GeometryFacade - isInternalType static convenience function 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
57a1df83d7 Sketcher: Extend GeometryFacade and ExternaGeometryFacade to GeometryMode 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
f3595f1058 Sketcher: GeometryFacade and ExternalGeometryFacade nullptr creation
====================================================================

If the Part::Geometry * is nullptr, then it is convenient to have a
std::unique<GeometryFacade> that contains a nullptr too, because many
functions check for a Part::Geometry being a nullptr.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
279346cbf2 Sketcher: GeometryTypedFacade and GeometryFacade convenience functions
======================================================================

GeometryFacade is added the ability to get the construction status via static function, for
convenience in situations where only the construction status is necessary and a geometry facade
would not be otherwise necessary.

A new type GeometryTypedFacade is added, for situations in which the specific Part::Geometry derived
type is known (or is to be created). This Typed version enables to directly access the Geometry derived
class without the need for casting, as well as the SketchGeometryExtension information.

For example, this is possible:

auto HLineF = GeometryTypedFacade<Part::GeomLineSegment>::getTypedFacade(HLine);
HLine->getTypedGeometry()->setPoints(Base::Vector3d(0,0,0),Base::Vector3d(1,0,0));

If a facade is requested without passing an Part::Geometry derived object, the constructor
of the indicated geometry type is called with any parameter passed as argument (emplace style):

auto HLine = GeometryTypedFacade<Part::GeomLineSegment>::getTypedFacade();
HLine->getTypedGeometry()->setPoints(Base::Vector3d(0,0,0),Base::Vector3d(1,0,0));
HLine->setConstruction(true);
ExternalGeo.push_back(HLine->getGeometry());

Using either GeometryFacade or GeometryTypedFacade is probably a matter of style and of the specific situation.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
74ff589fd0 Sketcher: Utility functions to simplify common operations with GeometryFacade 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
d994e2fe3b Sketcher: Geometry Facade interface for Geometry and SketchGeometryExtension 2020-11-03 12:01:22 +01:00