Sketcher: Adapt GeometryFacade and ExternalGeometryFacade to new SketchGeometryExtension
This commit is contained in:
committed by
abdullahtahiriyo
parent
858d29f163
commit
72fa70add8
@@ -80,6 +80,9 @@ public:
|
||||
inline virtual long getId() const override {return getGeoExt()->getId();}
|
||||
virtual void setId(long id) override {getGeoExt()->setId(id);}
|
||||
|
||||
virtual InternalType::InternalType getInternalType() const override {return getGeoExt()->getInternalType();}
|
||||
virtual void setInternalType(InternalType::InternalType type) override {getGeoExt()->setInternalType(type);}
|
||||
|
||||
// Geometry Extension Information
|
||||
inline const std::string &getSketchExtensionName () const {return SketchGeoExtension->getName();}
|
||||
inline const std::string &getExternalExtensionName () const {return ExternalGeoExtension->getName();}
|
||||
|
||||
@@ -122,6 +122,9 @@ public:
|
||||
inline virtual long getId() const override {return getGeoExt()->getId();}
|
||||
virtual void setId(long id) override {getGeoExt()->setId(id);}
|
||||
|
||||
virtual InternalType::InternalType getInternalType() const override {return getGeoExt()->getInternalType();}
|
||||
virtual void setInternalType(InternalType::InternalType type) override {getGeoExt()->setInternalType(type);}
|
||||
|
||||
// Geometry Extension Information
|
||||
inline const std::string &getExtensionName () const {return SketchGeoExtension->getName();}
|
||||
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
</Documentation>
|
||||
<Parameter Name="Id" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="InternalType" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
returns the Id of the SketchGeometryExtension.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="InternalType" Type="String"/>
|
||||
</Attribute>
|
||||
<Methode Name="mirror">
|
||||
<Documentation>
|
||||
<UserDocu>Performs the symmetrical transformation of this geometric object</UserDocu>
|
||||
|
||||
@@ -92,6 +92,38 @@ void GeometryFacadePy::setId(Py::Long Id)
|
||||
this->getGeometryFacadePtr()->setId(long(Id));
|
||||
}
|
||||
|
||||
Py::String GeometryFacadePy::getInternalType(void) const
|
||||
{
|
||||
int internaltypeindex = (int)this->getGeometryFacadePtr()->getInternalType();
|
||||
|
||||
if(internaltypeindex >= InternalType::NumInternalGeometryType)
|
||||
throw Py::NotImplementedError("String name of enum not implemented");
|
||||
|
||||
std::string typestr = SketchGeometryExtension::internaltype2str[internaltypeindex];
|
||||
|
||||
return Py::String(typestr);
|
||||
}
|
||||
|
||||
void GeometryFacadePy::setInternalType(Py::String arg)
|
||||
{
|
||||
std::string argstr = arg;
|
||||
|
||||
auto pos = std::find_if( SketchGeometryExtension::internaltype2str.begin(),
|
||||
SketchGeometryExtension::internaltype2str.end(),
|
||||
[argstr](const char * val) {
|
||||
return strcmp(val,argstr.c_str())==0;}
|
||||
);
|
||||
|
||||
if( pos != SketchGeometryExtension::internaltype2str.end()) {
|
||||
int index = std::distance( SketchGeometryExtension::internaltype2str.begin(), pos );
|
||||
|
||||
this->getGeometryFacadePtr()->setInternalType((InternalType::InternalType)index);
|
||||
return;
|
||||
}
|
||||
|
||||
throw Py::ValueError("Argument is not a valid internal geometry type.");
|
||||
}
|
||||
|
||||
PyObject* GeometryFacadePy::mirror(PyObject *args)
|
||||
{
|
||||
PyObject* o;
|
||||
|
||||
Reference in New Issue
Block a user