FreeCAD: master 858abd99
Author | Committer | Branch | Timestamp | Parent |
---|---|---|---|---|
abdullah | abdullahtahiriyo | master | 2020-12-03 13:13:39 | master 6b05767a |
Changeset | 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. |
|||
mod - src/Mod/Sketcher/App/GeometryFacade.cpp | Diff File | |||
mod - src/Mod/Sketcher/App/GeometryFacade.h | Diff File |