Base: remove explicit namespace-name qualifier from *PyImp.cpp
Explicit Base namespace-name is used randomly across PyImp sources. Remove it.
This commit is contained in:
committed by
Benjamin Nauck
parent
24d55dc616
commit
47c1565edf
@@ -68,8 +68,8 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "O!", &(Base::RotationPy::Type), &o)) {
|
||||
Base::Rotation* rot = static_cast<Base::RotationPy*>(o)->getRotationPtr();
|
||||
if (PyArg_ParseTuple(args, "O!", &(RotationPy::Type), &o)) {
|
||||
Rotation* rot = static_cast<RotationPy*>(o)->getRotationPtr();
|
||||
getRotationPtr()->setValue(rot->getValue());
|
||||
return 0;
|
||||
}
|
||||
@@ -77,39 +77,39 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
PyErr_Clear();
|
||||
double angle {};
|
||||
static const std::array<const char*, 3> kw_deg {"Axis", "Degree", nullptr};
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args,
|
||||
if (Wrapped_ParseTupleAndKeywords(args,
|
||||
kwds,
|
||||
"O!d",
|
||||
kw_deg,
|
||||
&(Base::VectorPy::Type),
|
||||
&(VectorPy::Type),
|
||||
&o,
|
||||
&angle)) {
|
||||
// NOTE: The last parameter defines the rotation angle in degree.
|
||||
getRotationPtr()->setValue(static_cast<Base::VectorPy*>(o)->value(),
|
||||
Base::toRadians<double>(angle));
|
||||
getRotationPtr()->setValue(static_cast<VectorPy*>(o)->value(),
|
||||
toRadians<double>(angle));
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
static const std::array<const char*, 3> kw_rad {"Axis", "Radian", nullptr};
|
||||
if (Base::Wrapped_ParseTupleAndKeywords(args,
|
||||
if (Wrapped_ParseTupleAndKeywords(args,
|
||||
kwds,
|
||||
"O!d",
|
||||
kw_rad,
|
||||
&(Base::VectorPy::Type),
|
||||
&(VectorPy::Type),
|
||||
&o,
|
||||
&angle)) {
|
||||
getRotationPtr()->setValue(static_cast<Base::VectorPy*>(o)->value(), angle);
|
||||
getRotationPtr()->setValue(static_cast<VectorPy*>(o)->value(), angle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type), &o)) {
|
||||
if (PyArg_ParseTuple(args, "O!", &(MatrixPy::Type), &o)) {
|
||||
try {
|
||||
getRotationPtr()->setValue(static_cast<Base::MatrixPy*>(o)->value());
|
||||
getRotationPtr()->setValue(static_cast<MatrixPy*>(o)->value());
|
||||
return 0;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
catch (const Exception& e) {
|
||||
PyErr_SetString(e.getPyExceptionType(), e.what());
|
||||
return -1;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
getRotationPtr()->setValue(mtx);
|
||||
return 0;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
catch (const Exception& e) {
|
||||
PyErr_SetString(e.getPyExceptionType(), e.what());
|
||||
return -1;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
getRotationPtr()->setValue(mtx);
|
||||
return 0;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
catch (const Exception& e) {
|
||||
PyErr_SetString(e.getPyExceptionType(), e.what());
|
||||
return -1;
|
||||
}
|
||||
@@ -202,8 +202,8 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
PyObject* v2 {};
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O!O!",
|
||||
&(Base::VectorPy::Type), &v1,
|
||||
&(Base::VectorPy::Type), &v2)) {
|
||||
&(VectorPy::Type), &v1,
|
||||
&(VectorPy::Type), &v2)) {
|
||||
Py::Vector from(v1, false);
|
||||
Py::Vector to(v2, false);
|
||||
getRotationPtr()->setValue(from.toVector(), to.toVector());
|
||||
@@ -215,9 +215,9 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
const char* priority = nullptr;
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O!O!O!|s",
|
||||
&(Base::VectorPy::Type), &v1,
|
||||
&(Base::VectorPy::Type), &v2,
|
||||
&(Base::VectorPy::Type), &v3,
|
||||
&(VectorPy::Type), &v1,
|
||||
&(VectorPy::Type), &v2,
|
||||
&(VectorPy::Type), &v3,
|
||||
&priority)) {
|
||||
Py::Vector xdir(v1, false);
|
||||
Py::Vector ydir(v2, false);
|
||||
@@ -231,12 +231,12 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
zdir.toVector(),
|
||||
priority));
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
catch (Exception& e) {
|
||||
std::string str;
|
||||
str += "FreeCAD exception thrown (";
|
||||
str += e.what();
|
||||
str += ")";
|
||||
PyErr_SetString(Base::PyExc_FC_GeneralError, str.c_str());
|
||||
PyErr_SetString(PyExc_FC_GeneralError, str.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -262,8 +262,8 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
PyObject* RotationPy::richCompare(PyObject* v, PyObject* w, int op)
|
||||
{
|
||||
if (PyObject_TypeCheck(v, &(RotationPy::Type)) && PyObject_TypeCheck(w, &(RotationPy::Type))) {
|
||||
Base::Rotation r1 = *static_cast<RotationPy*>(v)->getRotationPtr();
|
||||
Base::Rotation r2 = *static_cast<RotationPy*>(w)->getRotationPtr();
|
||||
Rotation r1 = *static_cast<RotationPy*>(v)->getRotationPtr();
|
||||
Rotation r2 = *static_cast<RotationPy*>(w)->getRotationPtr();
|
||||
|
||||
PyObject* res = nullptr;
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
@@ -318,7 +318,7 @@ PyObject* RotationPy::multVec(PyObject* args) const
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj)) {
|
||||
return nullptr;
|
||||
}
|
||||
Base::Vector3d vec(static_cast<VectorPy*>(obj)->value());
|
||||
Vector3d vec(static_cast<VectorPy*>(obj)->value());
|
||||
getRotationPtr()->multVec(vec, vec);
|
||||
return new VectorPy(new Vector3d(vec));
|
||||
}
|
||||
@@ -379,7 +379,7 @@ PyObject* RotationPy::setEulerAngles(PyObject* args)
|
||||
getRotationPtr()->setEulerAngles(Rotation::eulerSequenceFromName(seq), A, B, C);
|
||||
Py_Return;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
catch (const Exception& e) {
|
||||
e.setPyException();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -420,7 +420,7 @@ PyObject* RotationPy::toMatrix(PyObject* args) const
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
Base::Matrix4D mat;
|
||||
Matrix4D mat;
|
||||
getRotationPtr()->getValue(mat);
|
||||
return new MatrixPy(new Matrix4D(mat));
|
||||
}
|
||||
@@ -432,8 +432,8 @@ PyObject* RotationPy::isSame(PyObject* args)
|
||||
if (!PyArg_ParseTuple(args, "O!|d", &(RotationPy::Type), &rot, &tol)) {
|
||||
return nullptr;
|
||||
}
|
||||
Base::Rotation rot1 = *getRotationPtr();
|
||||
Base::Rotation rot2 = *static_cast<RotationPy*>(rot)->getRotationPtr();
|
||||
Rotation rot1 = *getRotationPtr();
|
||||
Rotation rot2 = *static_cast<RotationPy*>(rot)->getRotationPtr();
|
||||
bool same = tol > 0.0 ? rot1.isSame(rot2, tol) : rot1.isSame(rot2);
|
||||
return Py_BuildValue("O", (same ? Py_True : Py_False));
|
||||
}
|
||||
@@ -484,7 +484,7 @@ void RotationPy::setQ(Py::Tuple arg)
|
||||
|
||||
Py::Object RotationPy::getRawAxis() const
|
||||
{
|
||||
Base::Vector3d axis;
|
||||
Vector3d axis;
|
||||
double angle {};
|
||||
this->getRotationPtr()->getRawValue(axis, angle);
|
||||
return Py::Vector(axis); // NOLINT
|
||||
@@ -492,7 +492,7 @@ Py::Object RotationPy::getRawAxis() const
|
||||
|
||||
Py::Object RotationPy::getAxis() const
|
||||
{
|
||||
Base::Vector3d axis;
|
||||
Vector3d axis;
|
||||
double angle {};
|
||||
this->getRotationPtr()->getValue(axis, angle);
|
||||
return Py::Vector(axis); // NOLINT
|
||||
@@ -500,7 +500,7 @@ Py::Object RotationPy::getAxis() const
|
||||
|
||||
void RotationPy::setAxis(Py::Object arg)
|
||||
{
|
||||
Base::Vector3d axis;
|
||||
Vector3d axis;
|
||||
double angle {};
|
||||
this->getRotationPtr()->getValue(axis, angle);
|
||||
axis = Py::Vector(arg).toVector();
|
||||
@@ -509,7 +509,7 @@ void RotationPy::setAxis(Py::Object arg)
|
||||
|
||||
Py::Float RotationPy::getAngle() const
|
||||
{
|
||||
Base::Vector3d axis;
|
||||
Vector3d axis;
|
||||
double angle {};
|
||||
this->getRotationPtr()->getValue(axis, angle);
|
||||
return Py::Float(angle);
|
||||
@@ -517,7 +517,7 @@ Py::Float RotationPy::getAngle() const
|
||||
|
||||
void RotationPy::setAngle(Py::Float arg)
|
||||
{
|
||||
Base::Vector3d axis;
|
||||
Vector3d axis;
|
||||
double angle {};
|
||||
this->getRotationPtr()->getRawValue(axis, angle);
|
||||
angle = static_cast<double>(arg);
|
||||
@@ -568,7 +568,7 @@ int RotationPy::setCustomAttributes(const char* attr, PyObject* obj)
|
||||
this->getRotationPtr()->setValue(*static_cast<MatrixPy*>(obj)->getMatrixPtr());
|
||||
return 1;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
catch (const Exception& e) {
|
||||
PyErr_SetString(e.getPyExceptionType(), e.what());
|
||||
return -1;
|
||||
}
|
||||
@@ -582,8 +582,8 @@ int RotationPy::setCustomAttributes(const char* attr, PyObject* obj)
|
||||
Py::Object vec2 = sequence.getItem(1);
|
||||
if (PyObject_TypeCheck(vec1.ptr(), &(VectorPy::Type))
|
||||
&& PyObject_TypeCheck(vec2.ptr(), &(VectorPy::Type))) {
|
||||
Base::Vector3d* pt1 = static_cast<VectorPy*>(vec1.ptr())->getVectorPtr();
|
||||
Base::Vector3d* pt2 = static_cast<VectorPy*>(vec2.ptr())->getVectorPtr();
|
||||
Vector3d* pt1 = static_cast<VectorPy*>(vec1.ptr())->getVectorPtr();
|
||||
Vector3d* pt2 = static_cast<VectorPy*>(vec2.ptr())->getVectorPtr();
|
||||
this->getRotationPtr()->setValue(*pt1, *pt2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user