Sketcher: Extend GeometryFacade and ExternaGeometryFacade to GeometryMode

This commit is contained in:
Abdullah Tahiri
2020-11-20 14:19:54 +01:00
committed by abdullahtahiriyo
parent 092a1ee39d
commit eb929ad217
6 changed files with 32 additions and 3 deletions

View File

@@ -36,7 +36,7 @@
using namespace Sketcher;
TYPESYSTEM_SOURCE(Sketcher::ExternalGeometryFacade,Part::GeometryExtension)
TYPESYSTEM_SOURCE(Sketcher::ExternalGeometryFacade,Base::BaseClass)
ExternalGeometryFacade::ExternalGeometryFacade(): Geo(nullptr), SketchGeoExtension(nullptr), ExternalGeoExtension(nullptr)
{

View File

@@ -83,6 +83,9 @@ public:
virtual InternalType::InternalType getInternalType() const override {return getGeoExt()->getInternalType();}
virtual void setInternalType(InternalType::InternalType type) override {getGeoExt()->setInternalType(type);}
virtual bool testGeometryMode(int flag) const override { return getGeoExt()->testGeometryMode(flag); }
virtual void setGeometryMode(int flag, bool v=true) override { getGeoExt()->setGeometryMode(flag, v); }
// Geometry Extension Information
inline const std::string &getSketchExtensionName () const {return SketchGeoExtension->getName();}
inline const std::string &getExternalExtensionName () const {return ExternalGeoExtension->getName();}

View File

@@ -36,7 +36,7 @@
using namespace Sketcher;
TYPESYSTEM_SOURCE(Sketcher::GeometryFacade,Part::GeometryExtension)
TYPESYSTEM_SOURCE(Sketcher::GeometryFacade,Base::BaseClass)
GeometryFacade::GeometryFacade(): Geo(nullptr), SketchGeoExtension(nullptr)
{

View File

@@ -125,6 +125,12 @@ public:
virtual InternalType::InternalType getInternalType() const override {return getGeoExt()->getInternalType();}
virtual void setInternalType(InternalType::InternalType type) override {getGeoExt()->setInternalType(type);}
virtual bool testGeometryMode(int flag) const override { return getGeoExt()->testGeometryMode(flag); }
virtual void setGeometryMode(int flag, bool v=true) override { getGeoExt()->setGeometryMode(flag, v); }
bool getBlocked() const { return this->testGeometryMode(GeometryMode::Blocked);}
void setBlocked(bool status = true) {this->setGeometryMode(GeometryMode::Blocked, status);}
// Geometry Extension Information
inline const std::string &getExtensionName () const {return SketchGeoExtension->getName();}

View File

@@ -26,11 +26,20 @@
<Attribute Name="InternalType" ReadOnly="false">
<Documentation>
<UserDocu>
returns the Id of the SketchGeometryExtension.
returns the Internal Type of the Geometry.
</UserDocu>
</Documentation>
<Parameter Name="InternalType" Type="String"/>
</Attribute>
<Attribute Name="Blocked" ReadOnly="false">
<Documentation>
<UserDocu>
returns whether the geometry is blocked or not.
</UserDocu>
</Documentation>
<Parameter Name="Blocked" Type="Boolean"/>
</Attribute>
<Methode Name="mirror">
<Documentation>
<UserDocu>Performs the symmetrical transformation of this geometric object</UserDocu>

View File

@@ -117,6 +117,17 @@ void GeometryFacadePy::setInternalType(Py::String arg)
throw Py::ValueError("Argument is not a valid internal geometry type.");
}
Py::Boolean GeometryFacadePy::getBlocked(void) const
{
return Py::Boolean(getGeometryFacadePtr()->getBlocked());
}
void GeometryFacadePy::setBlocked(Py::Boolean arg)
{
getGeometryFacadePtr()->setBlocked(arg);
}
PyObject* GeometryFacadePy::mirror(PyObject *args)
{
PyObject* o;