It provides all the funcionality of GeometryFacade (derives from it), but in addition allows to indicate the type of a Part::Geometry derived class. More...
#include <GeometryFacade.h>
Public Member Functions | |
GeometryT * | getTypedGeometry () |
GeometryT * | getTypedGeometry () const |
Public Member Functions inherited from Sketcher::GeometryFacade | |
Part::Geometry * | clone (void) const |
Part::Geometry * | copy (void) const |
void | deleteExtension (Base::Type type) |
void | deleteExtension (const std::string &name) |
GeometryFacade (const GeometryFacade &)=delete | |
GeometryFacade (GeometryFacade &&)=default | |
bool | getBlocked () const |
bool | getConstruction (void) const |
std::weak_ptr< const Part::GeometryExtension > | getExtension (Base::Type type) const |
std::weak_ptr< const Part::GeometryExtension > | getExtension (std::string name) const |
const std::string & | getExtensionName () const |
std::vector< std::weak_ptr< const Part::GeometryExtension > > | getExtensions () const |
template<typename GeometryT = Part::Geometry, typename = typename std::enable_if< std::is_base_of<Part::Geometry, typename std::decay<GeometryT>::type>::value >::type> | |
GeometryT * | getGeometry () |
template<typename GeometryT = Part::Geometry, typename = typename std::enable_if< std::is_base_of<Part::Geometry, typename std::decay<GeometryT>::type>::value >::type> | |
const GeometryT * | getGeometry () const |
virtual int | getGeometryLayerId () const override |
virtual long | getId () const override |
virtual InternalType::InternalType | getInternalType () const override |
bool | getOwner () const |
virtual PyObject * | getPyObject (void) override |
This method returns the Python wrapper for a C++ object. More... | |
boost::uuids::uuid | getTag () const |
const | Handle (Geom_Geometry) &handle() const |
bool | hasExtension (Base::Type type) const |
bool | hasExtension (const std::string &name) const |
bool | isGeoType (const Base::Type &type) const |
bool | isInternalAligned () const |
void | mirror (const Base::Vector3d &point) |
void | mirror (const Base::Vector3d &point, Base::Vector3d dir) |
GeometryFacade & | operator= (const GeometryFacade &)=delete |
GeometryFacade & | operator= (GeometryFacade &&)=default |
void | rotate (const Base::Placement &plm) |
void | scale (const Base::Vector3d &vec, double scale) |
void | setBlocked (bool status=true) |
void | setConstruction (bool construction) |
void | setExtension (std::unique_ptr< Part::GeometryExtension > &&geo) |
void | setGeometry (Part::Geometry *geometry) |
virtual void | setGeometryLayerId (int geolayer) override |
virtual void | setGeometryMode (int flag, bool v=true) override |
virtual void | setId (long id) override |
virtual void | setInternalType (InternalType::InternalType type) override |
void | setOwner (bool owner) |
virtual bool | testGeometryMode (int flag) const override |
TopoDS_Shape | toShape () const |
void | transform (const Base::Matrix4D &mat) |
void | translate (const Base::Vector3d &vec) |
~GeometryFacade () | |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
template<typename... Args> | |
static std::unique_ptr< GeometryTypedFacade< GeometryT > > | getTypedFacade (Args &&... args) |
static std::unique_ptr< const GeometryTypedFacade< GeometryT > > | getTypedFacade (const GeometryT *geometry) |
static std::unique_ptr< GeometryTypedFacade< GeometryT > > | getTypedFacade (GeometryT *geometry, bool owner=false) |
Static Public Member Functions inherited from Sketcher::GeometryFacade | |
static void | copyId (const Part::Geometry *src, Part::Geometry *dst) |
static void | ensureSketchGeometryExtension (Part::Geometry *geometry) |
static bool | getBlocked (const Part::Geometry *geometry) |
static bool | getConstruction (const Part::Geometry *geometry) |
static std::unique_ptr< const GeometryFacade > | getFacade (const Part::Geometry *geometry) |
static std::unique_ptr< GeometryFacade > | getFacade (Part::Geometry *geometry, bool owner=false) |
static bool | isInternalType (const Part::Geometry *geometry, InternalType::InternalType type) |
static void | setConstruction (Part::Geometry *geometry, bool construction) |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create () |
static Type | getClassTypeId () |
static void | init () |
Additional Inherited Members | |
Protected Member Functions inherited from Sketcher::GeometryFacade | |
GeometryFacade () | |
GeometryFacade (const Part::Geometry *geometry, bool owner=false) | |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
It provides all the funcionality of GeometryFacade (derives from it), but in addition allows to indicate the type of a Part::Geometry derived class.
auto HLineF = GeometryTypedFacade<Part::GeomLineSegment>::getTypedFacade(HLine);
Then it is possible to get the typed geometry directly via:
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). In this case the facade takes ownership of the newly created Part::Geometry object.
Example of seamless operation with a GeomLineSegment:
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());
|
static |
|
static |
|
static |
Referenced by Sketcher::GeometryTypedFacade< GeometryT >::getTypedFacade().
GeometryT * Sketcher::GeometryTypedFacade< GeometryT >::getTypedGeometry | ( | ) |
GeometryT * Sketcher::GeometryTypedFacade< GeometryT >::getTypedGeometry | ( | ) | const |