Skip to content

Commit

Permalink
Sketcher: Extend GeometryFacade and ExternaGeometryFacade to Geometry…
Browse files Browse the repository at this point in the history
…Mode
  • Loading branch information
abdullahtahiriyo committed Dec 10, 2020
1 parent 092a1ee commit eb929ad
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/App/ExternalGeometryFacade.cpp
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Sketcher/App/ExternalGeometryFacade.h
Expand Up @@ -83,6 +83,9 @@ TYPESYSTEM_HEADER_WITH_OVERRIDE();
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();}
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sketcher/App/GeometryFacade.cpp
Expand Up @@ -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)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Mod/Sketcher/App/GeometryFacade.h
Expand Up @@ -125,6 +125,12 @@ TYPESYSTEM_HEADER_WITH_OVERRIDE();
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();}

Expand Down
11 changes: 10 additions & 1 deletion src/Mod/Sketcher/App/GeometryFacadePy.xml
Expand Up @@ -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>
Expand Down
11 changes: 11 additions & 0 deletions src/Mod/Sketcher/App/GeometryFacadePyImp.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit eb929ad

Please sign in to comment.