All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
eafd18dac0
commit
25c3ba7338
@@ -22,8 +22,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
# include <GC_MakeHyperbola.hxx>
|
||||
# include <Geom_Hyperbola.hxx>
|
||||
#include <GC_MakeHyperbola.hxx>
|
||||
#include <Geom_Hyperbola.hxx>
|
||||
|
||||
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
@@ -45,7 +45,7 @@ std::string HyperbolaPy::representation() const
|
||||
return "<Hyperbola object>";
|
||||
}
|
||||
|
||||
PyObject *HyperbolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
PyObject* HyperbolaPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
|
||||
{
|
||||
// create a new instance of HyperbolaPy and the Twin object
|
||||
return new HyperbolaPy(new GeomHyperbola);
|
||||
@@ -54,123 +54,164 @@ PyObject *HyperbolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *) //
|
||||
// constructor method
|
||||
int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
{
|
||||
static const std::array<const char *, 1> keywords_n {nullptr};
|
||||
static const std::array<const char*, 1> keywords_n {nullptr};
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "", keywords_n)) {
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
hyperbola->SetMajorRadius(2.0);
|
||||
hyperbola->SetMinorRadius(1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const std::array<const char *, 2> keywords_e {"Hyperbola", nullptr};
|
||||
static const std::array<const char*, 2> keywords_e {"Hyperbola", nullptr};
|
||||
PyErr_Clear();
|
||||
PyObject *pHypr;
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(HyperbolaPy::Type), &pHypr)) {
|
||||
PyObject* pHypr;
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!", keywords_e, &(HyperbolaPy::Type), &pHypr)) {
|
||||
HyperbolaPy* pHyperbola = static_cast<HyperbolaPy*>(pHypr);
|
||||
Handle(Geom_Hyperbola) Hypr1 = Handle(Geom_Hyperbola)::DownCast
|
||||
(pHyperbola->getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) Hypr2 = Handle(Geom_Hyperbola)::DownCast
|
||||
(this->getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) Hypr1 = Handle(Geom_Hyperbola)::DownCast(
|
||||
pHyperbola->getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
Handle(Geom_Hyperbola) Hypr2 = Handle(Geom_Hyperbola)::DownCast(
|
||||
this->getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
Hypr2->SetHypr(Hypr1->Hypr());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const std::array<const char *, 4> keywords_ssc{"S1", "S2", "Center", nullptr};
|
||||
static const std::array<const char*, 4> keywords_ssc {"S1", "S2", "Center", nullptr};
|
||||
PyErr_Clear();
|
||||
PyObject *pV1, *pV2, *pV3;
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc,
|
||||
&(Base::VectorPy::Type), &pV1,
|
||||
&(Base::VectorPy::Type), &pV2,
|
||||
&(Base::VectorPy::Type), &pV3)) {
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(
|
||||
args,
|
||||
kwds,
|
||||
"O!O!O!",
|
||||
keywords_ssc,
|
||||
&(Base::VectorPy::Type),
|
||||
&pV1,
|
||||
&(Base::VectorPy::Type),
|
||||
&pV2,
|
||||
&(Base::VectorPy::Type),
|
||||
&pV3
|
||||
)) {
|
||||
Base::Vector3d v1 = static_cast<Base::VectorPy*>(pV1)->value();
|
||||
Base::Vector3d v2 = static_cast<Base::VectorPy*>(pV2)->value();
|
||||
Base::Vector3d v3 = static_cast<Base::VectorPy*>(pV3)->value();
|
||||
GC_MakeHyperbola me(gp_Pnt(v1.x,v1.y,v1.z),
|
||||
gp_Pnt(v2.x,v2.y,v2.z),
|
||||
gp_Pnt(v3.x,v3.y,v3.z));
|
||||
GC_MakeHyperbola me(
|
||||
gp_Pnt(v1.x, v1.y, v1.z),
|
||||
gp_Pnt(v2.x, v2.y, v2.z),
|
||||
gp_Pnt(v3.x, v3.y, v3.z)
|
||||
);
|
||||
if (!me.IsDone()) {
|
||||
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(me.Status()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
hyperbola->SetHypr(me.Value()->Hypr());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const std::array<const char *, 4> keywords_cmm {"Center","MajorRadius","MinorRadius",nullptr};
|
||||
static const std::array<const char*, 4> keywords_cmm {"Center", "MajorRadius", "MinorRadius", nullptr};
|
||||
PyErr_Clear();
|
||||
PyObject *pV;
|
||||
PyObject* pV;
|
||||
double major, minor;
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!dd", keywords_cmm,
|
||||
&(Base::VectorPy::Type), &pV,
|
||||
&major, &minor)) {
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(
|
||||
args,
|
||||
kwds,
|
||||
"O!dd",
|
||||
keywords_cmm,
|
||||
&(Base::VectorPy::Type),
|
||||
&pV,
|
||||
&major,
|
||||
&minor
|
||||
)) {
|
||||
Base::Vector3d c = static_cast<Base::VectorPy*>(pV)->value();
|
||||
GC_MakeHyperbola me(gp_Ax2(gp_Pnt(c.x,c.y,c.z), gp_Dir(0.0,0.0,1.0)),
|
||||
major, minor);
|
||||
GC_MakeHyperbola me(gp_Ax2(gp_Pnt(c.x, c.y, c.z), gp_Dir(0.0, 0.0, 1.0)), major, minor);
|
||||
if (!me.IsDone()) {
|
||||
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(me.Status()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
hyperbola->SetHypr(me.Value()->Hypr());
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Hyperbola constructor accepts:\n"
|
||||
PyErr_SetString(
|
||||
PyExc_TypeError,
|
||||
"Hyperbola constructor accepts:\n"
|
||||
"-- empty parameter list\n"
|
||||
"-- Hyperbola\n"
|
||||
"-- Point, double, double\n"
|
||||
"-- Point, Point, Point");
|
||||
"-- Point, Point, Point"
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Py::Float HyperbolaPy::getMajorRadius() const
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
return Py::Float(hyperbola->MajorRadius());
|
||||
}
|
||||
|
||||
void HyperbolaPy::setMajorRadius(Py::Float arg)
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
hyperbola->SetMajorRadius((double)arg);
|
||||
}
|
||||
|
||||
Py::Float HyperbolaPy::getMinorRadius() const
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
return Py::Float(hyperbola->MinorRadius());
|
||||
}
|
||||
|
||||
void HyperbolaPy::setMinorRadius(Py::Float arg)
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
hyperbola->SetMinorRadius((double)arg);
|
||||
}
|
||||
|
||||
Py::Float HyperbolaPy::getFocal() const
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
return Py::Float(hyperbola->Focal());
|
||||
}
|
||||
|
||||
Py::Object HyperbolaPy::getFocus1() const
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
gp_Pnt loc = hyperbola->Focus1();
|
||||
return Py::Vector(Base::Vector3d(loc.X(), loc.Y(), loc.Z()));
|
||||
}
|
||||
|
||||
Py::Object HyperbolaPy::getFocus2() const
|
||||
{
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle());
|
||||
Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(
|
||||
getGeomHyperbolaPtr()->handle()
|
||||
);
|
||||
gp_Pnt loc = hyperbola->Focus2();
|
||||
return Py::Vector(Base::Vector3d(loc.X(), loc.Y(), loc.Z()));
|
||||
}
|
||||
|
||||
PyObject *HyperbolaPy::getCustomAttributes(const char* /*attr*/) const
|
||||
PyObject* HyperbolaPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user