Commit Graph

18 Commits

Author SHA1 Message Date
Uwe
ffe5c754af [Sketch] App: improve PreCompiled.h handling 2022-12-08 01:33:24 +01:00
Abdullah Tahiri
bad35fe26c Sketcher: GeometryFacade - new static function to check for internal alignment 2022-10-29 20:25:34 +02:00
berniev
da9ebc572f Mod: redundant void 2 2022-08-08 10:27:50 +02:00
Uwe
88a06f8f10 Mod: remove some unnecessary nullptr checks 2022-07-18 12:58:12 +02:00
Uwe
16c86a6d08 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
Abdullah Tahiri
344a2470d7 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
62bb8f67c8 Sketcher: GeometryFacade - Add ownership parameter to factory method 2021-12-27 21:03:51 +01:00
luz paz
b6f9f39ffc Fix various typos and grammatical refinements 2021-12-09 08:57:52 -06:00
Abdullah Tahiri
1e66792cf9 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
5a5b20df56 Sketcher: [skip ci] fix memory leak in GeometryFacade 2021-04-27 00:20:57 +02:00
Abdullah Tahiri
ea006076e4 Sketcher: GeometryFacade - convenience method to check if a geometry is blocked 2020-12-21 05:57:42 +01:00
Abdullah Tahiri
2c0faabb6f Sketcher: GeometryFacade - Remove Debuging code 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
00cf07d1dd Sketcher: GeometryFacade - isInternalType static convenience function 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
eb929ad217 Sketcher: Extend GeometryFacade and ExternaGeometryFacade to GeometryMode 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
2b35a7eec4 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
858abd99ca 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
10102f45f7 Sketcher: Utility functions to simplify common operations with GeometryFacade 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
0fd808dfc1 Sketcher: Geometry Facade interface for Geometry and SketchGeometryExtension 2020-11-03 12:01:22 +01:00