fix readability-identifier-length
This commit is contained in:
@@ -38,9 +38,9 @@ void Axis::reverse()
|
||||
|
||||
Axis Axis::reversed() const
|
||||
{
|
||||
Axis a(*this);
|
||||
a.reverse();
|
||||
return a;
|
||||
Axis axis(*this);
|
||||
axis.reverse();
|
||||
return axis;
|
||||
}
|
||||
|
||||
void Axis::move(const Vector3d& MovVec)
|
||||
@@ -58,16 +58,16 @@ bool Axis::operator!=(const Axis& that) const
|
||||
return !(*this == that);
|
||||
}
|
||||
|
||||
Axis& Axis::operator*=(const Placement& p)
|
||||
Axis& Axis::operator*=(const Placement& plm)
|
||||
{
|
||||
p.multVec(this->_base, this->_base);
|
||||
p.getRotation().multVec(this->_dir, this->_dir);
|
||||
plm.multVec(this->_base, this->_base);
|
||||
plm.getRotation().multVec(this->_dir, this->_dir);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Axis Axis::operator*(const Placement& p) const
|
||||
Axis Axis::operator*(const Placement& plm) const
|
||||
{
|
||||
Axis a(*this);
|
||||
a *= p;
|
||||
return a;
|
||||
Axis axis(*this);
|
||||
axis *= plm;
|
||||
return axis;
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ public:
|
||||
|
||||
/** Operators. */
|
||||
//@{
|
||||
Axis& operator*=(const Placement& p);
|
||||
Axis operator*(const Placement& p) const;
|
||||
Axis& operator*=(const Placement& plm);
|
||||
Axis operator*(const Placement& plm) const;
|
||||
bool operator==(const Axis&) const;
|
||||
bool operator!=(const Axis&) const;
|
||||
Axis& operator=(const Axis&) = default;
|
||||
|
||||
@@ -191,10 +191,10 @@ public:
|
||||
*
|
||||
*/
|
||||
template<typename T>
|
||||
T* freecad_dynamic_cast(Base::BaseClass* t)
|
||||
T* freecad_dynamic_cast(Base::BaseClass* type)
|
||||
{
|
||||
if (t && t->isDerivedFrom(T::getClassTypeId())) {
|
||||
return static_cast<T*>(t);
|
||||
if (type && type->isDerivedFrom(T::getClassTypeId())) {
|
||||
return static_cast<T*>(type);
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
@@ -207,10 +207,10 @@ T* freecad_dynamic_cast(Base::BaseClass* t)
|
||||
*
|
||||
*/
|
||||
template<typename T>
|
||||
const T* freecad_dynamic_cast(const Base::BaseClass* t)
|
||||
const T* freecad_dynamic_cast(const Base::BaseClass* type)
|
||||
{
|
||||
if (t && t->isDerivedFrom(T::getClassTypeId())) {
|
||||
return static_cast<const T*>(t);
|
||||
if (type && type->isDerivedFrom(T::getClassTypeId())) {
|
||||
return static_cast<const T*>(type);
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
@endcode
|
||||
*/
|
||||
|
||||
// NOLINTBEGIN
|
||||
// clang-format off
|
||||
// Based on https://stackoverflow.com/questions/1448396/how-to-use-enums-as-flags-in-c
|
||||
template<class T = void> struct enum_traits {};
|
||||
@@ -130,5 +131,6 @@ public:
|
||||
};
|
||||
}
|
||||
// clang-format on
|
||||
// NOLINTEND
|
||||
|
||||
#endif
|
||||
|
||||
@@ -212,9 +212,9 @@ public:
|
||||
{
|
||||
return spaces;
|
||||
}
|
||||
friend std::ostream& operator<<(std::ostream& os, Indentation m)
|
||||
friend std::ostream& operator<<(std::ostream& os, Indentation ind)
|
||||
{
|
||||
for (int i = 0; i < m.count(); i++) {
|
||||
for (int i = 0; i < ind.count(); i++) {
|
||||
os << " ";
|
||||
}
|
||||
return os;
|
||||
|
||||
@@ -176,9 +176,9 @@ ConsoleSingleton::~ConsoleSingleton()
|
||||
/**
|
||||
* sets the console in a special mode
|
||||
*/
|
||||
void ConsoleSingleton::SetConsoleMode(ConsoleMode m)
|
||||
void ConsoleSingleton::SetConsoleMode(ConsoleMode mode)
|
||||
{
|
||||
if (m & Verbose) {
|
||||
if (mode & Verbose) {
|
||||
_bVerbose = true;
|
||||
}
|
||||
}
|
||||
@@ -186,9 +186,9 @@ void ConsoleSingleton::SetConsoleMode(ConsoleMode m)
|
||||
/**
|
||||
* unsets the console from a special mode
|
||||
*/
|
||||
void ConsoleSingleton::UnsetConsoleMode(ConsoleMode m)
|
||||
void ConsoleSingleton::UnsetConsoleMode(ConsoleMode mode)
|
||||
{
|
||||
if (m & Verbose) {
|
||||
if (mode & Verbose) {
|
||||
_bVerbose = false;
|
||||
}
|
||||
}
|
||||
@@ -211,47 +211,47 @@ void ConsoleSingleton::UnsetConsoleMode(ConsoleMode m)
|
||||
* switches off warnings and error messages and restore the state before the modification.
|
||||
* If the observer \a sObs doesn't exist then nothing happens.
|
||||
*/
|
||||
ConsoleMsgFlags ConsoleSingleton::SetEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool b)
|
||||
ConsoleMsgFlags ConsoleSingleton::SetEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool on)
|
||||
{
|
||||
ILogger* pObs = Get(sObs);
|
||||
if (pObs) {
|
||||
ConsoleMsgFlags flags = 0;
|
||||
|
||||
if (type & MsgType_Err) {
|
||||
if (pObs->bErr != b) {
|
||||
if (pObs->bErr != on) {
|
||||
flags |= MsgType_Err;
|
||||
}
|
||||
pObs->bErr = b;
|
||||
pObs->bErr = on;
|
||||
}
|
||||
if (type & MsgType_Wrn) {
|
||||
if (pObs->bWrn != b) {
|
||||
if (pObs->bWrn != on) {
|
||||
flags |= MsgType_Wrn;
|
||||
}
|
||||
pObs->bWrn = b;
|
||||
pObs->bWrn = on;
|
||||
}
|
||||
if (type & MsgType_Txt) {
|
||||
if (pObs->bMsg != b) {
|
||||
if (pObs->bMsg != on) {
|
||||
flags |= MsgType_Txt;
|
||||
}
|
||||
pObs->bMsg = b;
|
||||
pObs->bMsg = on;
|
||||
}
|
||||
if (type & MsgType_Log) {
|
||||
if (pObs->bLog != b) {
|
||||
if (pObs->bLog != on) {
|
||||
flags |= MsgType_Log;
|
||||
}
|
||||
pObs->bLog = b;
|
||||
pObs->bLog = on;
|
||||
}
|
||||
if (type & MsgType_Critical) {
|
||||
if (pObs->bCritical != b) {
|
||||
if (pObs->bCritical != on) {
|
||||
flags |= MsgType_Critical;
|
||||
}
|
||||
pObs->bCritical = b;
|
||||
pObs->bCritical = on;
|
||||
}
|
||||
if (type & MsgType_Notification) {
|
||||
if (pObs->bNotification != b) {
|
||||
if (pObs->bNotification != on) {
|
||||
flags |= MsgType_Notification;
|
||||
}
|
||||
pObs->bNotification = b;
|
||||
pObs->bNotification = on;
|
||||
}
|
||||
|
||||
return flags;
|
||||
|
||||
@@ -487,12 +487,12 @@ namespace Base
|
||||
{
|
||||
|
||||
#ifndef FC_LOG_NO_TIMING
|
||||
inline FC_DURATION GetDuration(FC_TIME_POINT& t)
|
||||
inline FC_DURATION GetDuration(FC_TIME_POINT& tp)
|
||||
{
|
||||
auto tnow = std::chrono::FC_TIME_CLOCK::now();
|
||||
auto d = std::chrono::duration_cast<FC_DURATION>(tnow - t);
|
||||
t = tnow;
|
||||
return d;
|
||||
auto dc = std::chrono::duration_cast<FC_DURATION>(tnow - tp);
|
||||
tp = tnow;
|
||||
return dc;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -805,11 +805,11 @@ public:
|
||||
};
|
||||
|
||||
/// Change mode
|
||||
void SetConsoleMode(ConsoleMode m);
|
||||
void SetConsoleMode(ConsoleMode mode);
|
||||
/// Change mode
|
||||
void UnsetConsoleMode(ConsoleMode m);
|
||||
void UnsetConsoleMode(ConsoleMode mode);
|
||||
/// Enables or disables message types of a certain console observer
|
||||
ConsoleMsgFlags SetEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool b);
|
||||
ConsoleMsgFlags SetEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool on);
|
||||
/// Checks if message types of a certain console observer are enabled
|
||||
bool IsMsgTypeEnabled(const char* sObs, FreeCAD_ConsoleMsgType type) const;
|
||||
void SetConnectionMode(ConnectionMode mode);
|
||||
@@ -957,9 +957,9 @@ public:
|
||||
, refresh(refresh)
|
||||
{}
|
||||
|
||||
bool isEnabled(int l)
|
||||
bool isEnabled(int lev) const
|
||||
{
|
||||
return l <= level();
|
||||
return lev <= level();
|
||||
}
|
||||
|
||||
int level() const
|
||||
|
||||
@@ -248,12 +248,12 @@ RedirectStdOutput::RedirectStdOutput()
|
||||
buffer.reserve(80);
|
||||
}
|
||||
|
||||
int RedirectStdOutput::overflow(int c)
|
||||
int RedirectStdOutput::overflow(int ch)
|
||||
{
|
||||
if (c != EOF) {
|
||||
buffer.push_back(static_cast<char>(c));
|
||||
if (ch != EOF) {
|
||||
buffer.push_back(static_cast<char>(ch));
|
||||
}
|
||||
return c;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int RedirectStdOutput::sync()
|
||||
@@ -271,12 +271,12 @@ RedirectStdLog::RedirectStdLog()
|
||||
buffer.reserve(80);
|
||||
}
|
||||
|
||||
int RedirectStdLog::overflow(int c)
|
||||
int RedirectStdLog::overflow(int ch)
|
||||
{
|
||||
if (c != EOF) {
|
||||
buffer.push_back(static_cast<char>(c));
|
||||
if (ch != EOF) {
|
||||
buffer.push_back(static_cast<char>(ch));
|
||||
}
|
||||
return c;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int RedirectStdLog::sync()
|
||||
@@ -294,12 +294,12 @@ RedirectStdError::RedirectStdError()
|
||||
buffer.reserve(80);
|
||||
}
|
||||
|
||||
int RedirectStdError::overflow(int c)
|
||||
int RedirectStdError::overflow(int ch)
|
||||
{
|
||||
if (c != EOF) {
|
||||
buffer.push_back(static_cast<char>(c));
|
||||
if (ch != EOF) {
|
||||
buffer.push_back(static_cast<char>(ch));
|
||||
}
|
||||
return c;
|
||||
return ch;
|
||||
}
|
||||
|
||||
int RedirectStdError::sync()
|
||||
@@ -323,8 +323,8 @@ std::stringstream& LogLevel::prefix(std::stringstream& str, const char* src, int
|
||||
_FC_TIME_INIT(s_tstart);
|
||||
}
|
||||
auto tnow = std::chrono::FC_TIME_CLOCK::now();
|
||||
auto d = std::chrono::duration_cast<FC_DURATION>(tnow - s_tstart);
|
||||
str << d.count() << ' ';
|
||||
auto dc = std::chrono::duration_cast<FC_DURATION>(tnow - s_tstart);
|
||||
str << dc.count() << ' ';
|
||||
}
|
||||
if (print_tag) {
|
||||
str << '<' << tag << "> ";
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
RedirectStdOutput();
|
||||
|
||||
protected:
|
||||
int overflow(int c = EOF) override;
|
||||
int overflow(int ch = EOF) override;
|
||||
int sync() override;
|
||||
|
||||
private:
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
RedirectStdError();
|
||||
|
||||
protected:
|
||||
int overflow(int c = EOF) override;
|
||||
int overflow(int ch = EOF) override;
|
||||
int sync() override;
|
||||
|
||||
private:
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
RedirectStdLog();
|
||||
|
||||
protected:
|
||||
int overflow(int c = EOF) override;
|
||||
int overflow(int ch = EOF) override;
|
||||
int sync() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -42,8 +42,8 @@ struct vec_traits<Vector3f>
|
||||
{
|
||||
using vec_type = Vector3f;
|
||||
using float_type = float;
|
||||
vec_traits(const vec_type& v)
|
||||
: v(v)
|
||||
explicit vec_traits(const vec_type& vec)
|
||||
: v(vec)
|
||||
{}
|
||||
inline std::tuple<float_type, float_type, float_type> get() const
|
||||
{
|
||||
@@ -59,8 +59,8 @@ struct vec_traits<Vector3d>
|
||||
{
|
||||
using vec_type = Vector3d;
|
||||
using float_type = double;
|
||||
vec_traits(const vec_type& v)
|
||||
: v(v)
|
||||
explicit vec_traits(const vec_type& vec)
|
||||
: v(vec)
|
||||
{}
|
||||
inline std::tuple<float_type, float_type, float_type> get() const
|
||||
{
|
||||
@@ -76,8 +76,8 @@ struct vec_traits<Rotation>
|
||||
{
|
||||
using vec_type = Rotation;
|
||||
using float_type = double;
|
||||
vec_traits(const vec_type& v)
|
||||
: v(v)
|
||||
explicit vec_traits(const vec_type& vec)
|
||||
: v(vec)
|
||||
{}
|
||||
inline std::tuple<float_type, float_type, float_type, float_type> get() const
|
||||
{
|
||||
@@ -92,34 +92,34 @@ private:
|
||||
|
||||
// type with three floats
|
||||
template<class _Vec, typename float_type>
|
||||
_Vec make_vec(const std::tuple<float_type, float_type, float_type>&& t)
|
||||
_Vec make_vec(const std::tuple<float_type, float_type, float_type>&& ft)
|
||||
{
|
||||
using traits_type = vec_traits<_Vec>;
|
||||
using float_traits_type = typename traits_type::float_type;
|
||||
return _Vec(float_traits_type(std::get<0>(t)),
|
||||
float_traits_type(std::get<1>(t)),
|
||||
float_traits_type(std::get<2>(t)));
|
||||
return _Vec(float_traits_type(std::get<0>(ft)),
|
||||
float_traits_type(std::get<1>(ft)),
|
||||
float_traits_type(std::get<2>(ft)));
|
||||
}
|
||||
|
||||
// type with four floats
|
||||
template<class _Vec, typename float_type>
|
||||
_Vec make_vec(const std::tuple<float_type, float_type, float_type, float_type>&& t)
|
||||
_Vec make_vec(const std::tuple<float_type, float_type, float_type, float_type>&& ft)
|
||||
{
|
||||
using traits_type = vec_traits<_Vec>;
|
||||
using float_traits_type = typename traits_type::float_type;
|
||||
return _Vec(float_traits_type(std::get<0>(t)),
|
||||
float_traits_type(std::get<1>(t)),
|
||||
float_traits_type(std::get<2>(t)),
|
||||
float_traits_type(std::get<3>(t)));
|
||||
return _Vec(float_traits_type(std::get<0>(ft)),
|
||||
float_traits_type(std::get<1>(ft)),
|
||||
float_traits_type(std::get<2>(ft)),
|
||||
float_traits_type(std::get<3>(ft)));
|
||||
}
|
||||
|
||||
template<class _Vec1, class _Vec2>
|
||||
inline _Vec1 convertTo(const _Vec2& v)
|
||||
inline _Vec1 convertTo(const _Vec2& vec)
|
||||
{
|
||||
using traits_type = vec_traits<_Vec2>;
|
||||
using float_type = typename traits_type::float_type;
|
||||
traits_type t(v);
|
||||
auto tuple = t.get();
|
||||
traits_type tt(vec);
|
||||
auto tuple = tt.get();
|
||||
return make_vec<_Vec1, float_type>(std::move(tuple));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,21 +38,21 @@ CoordinateSystem::CoordinateSystem()
|
||||
|
||||
CoordinateSystem::~CoordinateSystem() = default;
|
||||
|
||||
void CoordinateSystem::setAxes(const Axis& v, const Vector3d& xd)
|
||||
void CoordinateSystem::setAxes(const Axis& vec, const Vector3d& xd)
|
||||
{
|
||||
if (xd.Sqr() < Base::Vector3d::epsilon()) {
|
||||
throw Base::ValueError("Direction is null vector");
|
||||
}
|
||||
Vector3d yd = v.getDirection() % xd;
|
||||
Vector3d yd = vec.getDirection() % xd;
|
||||
if (yd.Sqr() < Base::Vector3d::epsilon()) {
|
||||
throw Base::ValueError("Direction is parallel to Z direction");
|
||||
}
|
||||
ydir = yd;
|
||||
ydir.Normalize();
|
||||
xdir = ydir % v.getDirection();
|
||||
xdir = ydir % vec.getDirection();
|
||||
xdir.Normalize();
|
||||
axis.setBase(v.getBase());
|
||||
Base::Vector3d zdir = v.getDirection();
|
||||
axis.setBase(vec.getBase());
|
||||
Base::Vector3d zdir = vec.getDirection();
|
||||
zdir.Normalize();
|
||||
axis.setDirection(zdir);
|
||||
}
|
||||
@@ -75,9 +75,9 @@ void CoordinateSystem::setAxes(const Vector3d& n, const Vector3d& xd)
|
||||
axis.setDirection(zdir);
|
||||
}
|
||||
|
||||
void CoordinateSystem::setAxis(const Axis& v)
|
||||
void CoordinateSystem::setAxis(const Axis& axis)
|
||||
{
|
||||
setAxes(v, xdir);
|
||||
setAxes(axis, xdir);
|
||||
}
|
||||
|
||||
void CoordinateSystem::setXDirection(const Vector3d& dir)
|
||||
@@ -111,6 +111,7 @@ void CoordinateSystem::setZDirection(const Vector3d& dir)
|
||||
|
||||
Placement CoordinateSystem::displacement(const CoordinateSystem& cs) const
|
||||
{
|
||||
// NOLINTBEGIN
|
||||
const Base::Vector3d& a = axis.getBase();
|
||||
const Base::Vector3d& zdir = axis.getDirection();
|
||||
Base::Matrix4D At;
|
||||
@@ -148,36 +149,37 @@ Placement CoordinateSystem::displacement(const CoordinateSystem& cs) const
|
||||
Placement PB(B);
|
||||
Placement C = PB * PAt;
|
||||
return C;
|
||||
// NOLINTEND
|
||||
}
|
||||
|
||||
void CoordinateSystem::transformTo(Vector3d& p)
|
||||
void CoordinateSystem::transformTo(Vector3d& pnt)
|
||||
{
|
||||
return p.TransformToCoordinateSystem(axis.getBase(), xdir, ydir);
|
||||
return pnt.TransformToCoordinateSystem(axis.getBase(), xdir, ydir);
|
||||
}
|
||||
|
||||
void CoordinateSystem::transform(const Placement& p)
|
||||
void CoordinateSystem::transform(const Placement& plm)
|
||||
{
|
||||
axis *= p;
|
||||
p.getRotation().multVec(this->xdir, this->xdir);
|
||||
p.getRotation().multVec(this->ydir, this->ydir);
|
||||
axis *= plm;
|
||||
plm.getRotation().multVec(this->xdir, this->xdir);
|
||||
plm.getRotation().multVec(this->ydir, this->ydir);
|
||||
}
|
||||
|
||||
void CoordinateSystem::transform(const Rotation& r)
|
||||
void CoordinateSystem::transform(const Rotation& rot)
|
||||
{
|
||||
Vector3d zdir = axis.getDirection();
|
||||
r.multVec(zdir, zdir);
|
||||
rot.multVec(zdir, zdir);
|
||||
axis.setDirection(zdir);
|
||||
r.multVec(this->xdir, this->xdir);
|
||||
r.multVec(this->ydir, this->ydir);
|
||||
rot.multVec(this->xdir, this->xdir);
|
||||
rot.multVec(this->ydir, this->ydir);
|
||||
}
|
||||
|
||||
void CoordinateSystem::setPlacement(const Placement& p)
|
||||
void CoordinateSystem::setPlacement(const Placement& plm)
|
||||
{
|
||||
Vector3d zdir(0, 0, 1);
|
||||
p.getRotation().multVec(zdir, zdir);
|
||||
axis.setBase(p.getPosition());
|
||||
plm.getRotation().multVec(zdir, zdir);
|
||||
axis.setBase(plm.getPosition());
|
||||
axis.setDirection(zdir);
|
||||
|
||||
p.getRotation().multVec(Vector3d(1, 0, 0), this->xdir);
|
||||
p.getRotation().multVec(Vector3d(0, 1, 0), this->ydir);
|
||||
plm.getRotation().multVec(Vector3d(1, 0, 0), this->xdir);
|
||||
plm.getRotation().multVec(Vector3d(0, 1, 0), this->ydir);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/** Sets the main axis. X and Y dir are adjusted accordingly.
|
||||
* The main axis \a v must not be parallel to the X axis
|
||||
*/
|
||||
void setAxis(const Axis& v);
|
||||
void setAxis(const Axis& axis);
|
||||
/** Sets the main axis. X and Y dir are adjusted accordingly.
|
||||
* The main axis must not be parallel to \a xd
|
||||
*/
|
||||
@@ -85,9 +85,9 @@ public:
|
||||
{
|
||||
return axis.getDirection();
|
||||
}
|
||||
inline void setPosition(const Vector3d& p)
|
||||
inline void setPosition(const Vector3d& pos)
|
||||
{
|
||||
axis.setBase(p);
|
||||
axis.setBase(pos);
|
||||
}
|
||||
inline const Vector3d& getPosition() const
|
||||
{
|
||||
@@ -99,17 +99,17 @@ public:
|
||||
*/
|
||||
Placement displacement(const CoordinateSystem& cs) const;
|
||||
|
||||
/** Transform the point \a p to be in this coordinate system */
|
||||
void transformTo(Vector3d& p);
|
||||
/** Transform the point \a pnt to be in this coordinate system */
|
||||
void transformTo(Vector3d& pnt);
|
||||
|
||||
/** Apply the placement \a p to the coordinate system. */
|
||||
void transform(const Placement& p);
|
||||
/** Apply the placement \a plm to the coordinate system. */
|
||||
void transform(const Placement& plm);
|
||||
|
||||
/** Apply the rotation \a r to the coordinate system. */
|
||||
void transform(const Rotation& r);
|
||||
/** Apply the rotation \a rot to the coordinate system. */
|
||||
void transform(const Rotation& rot);
|
||||
|
||||
/** Set the placement \a p to the coordinate system. */
|
||||
void setPlacement(const Placement& p);
|
||||
/** Set the placement \a plm to the coordinate system. */
|
||||
void setPlacement(const Placement& plm);
|
||||
|
||||
private:
|
||||
Axis axis;
|
||||
|
||||
@@ -76,20 +76,20 @@ PyObject* CoordinateSystemPy::displacement(PyObject* args)
|
||||
if (!PyArg_ParseTuple(args, "O!", &(CoordinateSystemPy::Type), &cs)) {
|
||||
return nullptr;
|
||||
}
|
||||
Placement p = getCoordinateSystemPtr()->displacement(
|
||||
Placement plm = getCoordinateSystemPtr()->displacement(
|
||||
*static_cast<CoordinateSystemPy*>(cs)->getCoordinateSystemPtr());
|
||||
return new PlacementPy(new Placement(p));
|
||||
return new PlacementPy(new Placement(plm));
|
||||
}
|
||||
|
||||
PyObject* CoordinateSystemPy::transformTo(PyObject* args)
|
||||
{
|
||||
PyObject* vec {};
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vec)) {
|
||||
PyObject* vecpy {};
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &vecpy)) {
|
||||
return nullptr;
|
||||
}
|
||||
Vector3d v = static_cast<VectorPy*>(vec)->value();
|
||||
getCoordinateSystemPtr()->transformTo(v);
|
||||
return new VectorPy(new Vector3d(v));
|
||||
Vector3d vec = static_cast<VectorPy*>(vecpy)->value();
|
||||
getCoordinateSystemPtr()->transformTo(vec);
|
||||
return new VectorPy(new Vector3d(vec));
|
||||
}
|
||||
|
||||
PyObject* CoordinateSystemPy::transform(PyObject* args)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-length)
|
||||
namespace Base
|
||||
{
|
||||
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
|
||||
public:
|
||||
DualNumber() = default;
|
||||
DualNumber(double re, double du = 0.0)
|
||||
DualNumber(double re, double du = 0.0) // NOLINT
|
||||
: re(re)
|
||||
, du(du)
|
||||
{}
|
||||
@@ -107,6 +108,7 @@ inline DualNumber pow(DualNumber a, double pw)
|
||||
return {std::pow(a.re, pw), pw * std::pow(a.re, pw - 1.0) * a.du};
|
||||
}
|
||||
} // namespace Base
|
||||
// NOLINTEND(readability-identifier-length)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "DualQuaternion.h"
|
||||
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-length)
|
||||
Base::DualQuat Base::operator+(Base::DualQuat a, Base::DualQuat b)
|
||||
{
|
||||
return {a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w};
|
||||
@@ -131,3 +132,4 @@ Base::DualQuat Base::DualQuat::pow(double t, bool shorten) const
|
||||
m * sin(theta / 2) + pitch / 2 * cos(theta / 2) * l
|
||||
+ DualQuat(0, 0, 0, -pitch / 2 * sin(theta / 2))};
|
||||
}
|
||||
// NOLINTEND(readability-identifier-length)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "DualNumber.h"
|
||||
#include <FCGlobal.h>
|
||||
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-length)
|
||||
namespace Base
|
||||
{
|
||||
|
||||
@@ -146,5 +146,6 @@ BaseExport DualQuat operator*(DualNumber a, DualQuat b);
|
||||
|
||||
|
||||
} // namespace Base
|
||||
// NOLINTEND(readability-identifier-length)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -79,10 +79,10 @@ public:
|
||||
|
||||
void raiseException(PyObject* pydict) const override
|
||||
{
|
||||
CLASS c;
|
||||
c.setPyObject(pydict);
|
||||
CLASS cls;
|
||||
cls.setPyObject(pydict);
|
||||
|
||||
throw c;
|
||||
throw cls;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -218,13 +218,13 @@ boost::filesystem::path FileInfo::stringToPath(const std::string& str)
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string FileInfo::pathToString(const boost::filesystem::path& p)
|
||||
std::string FileInfo::pathToString(const boost::filesystem::path& path)
|
||||
{
|
||||
#if defined(FC_OS_WIN32)
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
return converter.to_bytes(p.wstring());
|
||||
return converter.to_bytes(path.wstring());
|
||||
#else
|
||||
return p.string();
|
||||
return path.string();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
/// Get the path to the dir which is considered to temp files
|
||||
static const std::string& getTempPath();
|
||||
/// Convert from filesystem path to string
|
||||
static std::string pathToString(const boost::filesystem::path& p);
|
||||
static std::string pathToString(const boost::filesystem::path& path);
|
||||
/// Convert from string to filesystem path
|
||||
static boost::filesystem::path stringToPath(const std::string& str);
|
||||
//@}
|
||||
|
||||
@@ -35,12 +35,12 @@ FutureWatcherProgress::FutureWatcherProgress(const char* text, unsigned int step
|
||||
|
||||
FutureWatcherProgress::~FutureWatcherProgress() = default;
|
||||
|
||||
void FutureWatcherProgress::progressValueChanged(int v)
|
||||
void FutureWatcherProgress::progressValueChanged(int value)
|
||||
{
|
||||
if (steps == 0) {
|
||||
return;
|
||||
}
|
||||
unsigned int step = (100 * static_cast<unsigned int>(v)) / steps;
|
||||
unsigned int step = (100 * static_cast<unsigned int>(value)) / steps;
|
||||
if (step > current) {
|
||||
current = step;
|
||||
seq.next();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "VectorPy.h"
|
||||
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-length)
|
||||
int Py::Vector::Vector_TypeCheck(PyObject* obj)
|
||||
{
|
||||
return PyObject_TypeCheck(obj, &(Base::VectorPy::Type));
|
||||
@@ -47,15 +48,15 @@ bool Py::Vector::accepts(PyObject* obj) const
|
||||
return false;
|
||||
}
|
||||
|
||||
Py::Vector::Vector(const Base::Vector3d& v)
|
||||
Py::Vector::Vector(const Base::Vector3d& vec)
|
||||
{
|
||||
set(new Base::VectorPy(v), true);
|
||||
set(new Base::VectorPy(vec), true);
|
||||
validate();
|
||||
}
|
||||
|
||||
Py::Vector::Vector(const Base::Vector3f& v)
|
||||
Py::Vector::Vector(const Base::Vector3f& vec)
|
||||
{
|
||||
set(new Base::VectorPy(v), true);
|
||||
set(new Base::VectorPy(vec), true);
|
||||
validate();
|
||||
}
|
||||
|
||||
@@ -68,15 +69,15 @@ Py::Vector& Py::Vector::operator=(PyObject* rhsp)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Py::Vector& Py::Vector::operator=(const Base::Vector3d& v)
|
||||
Py::Vector& Py::Vector::operator=(const Base::Vector3d& vec)
|
||||
{
|
||||
set(new Base::VectorPy(v), true);
|
||||
set(new Base::VectorPy(vec), true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Py::Vector& Py::Vector::operator=(const Base::Vector3f& v)
|
||||
Py::Vector& Py::Vector::operator=(const Base::Vector3f& vec)
|
||||
{
|
||||
set(new Base::VectorPy(v), true);
|
||||
set(new Base::VectorPy(vec), true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -103,48 +104,48 @@ PyTypeObject* Vector2dPy::type_object()
|
||||
return Py::PythonClass<Vector2dPy>::type_object();
|
||||
}
|
||||
|
||||
bool Vector2dPy::check(PyObject* p)
|
||||
bool Vector2dPy::check(PyObject* py)
|
||||
{
|
||||
return Py::PythonClass<Vector2dPy>::check(p);
|
||||
return Py::PythonClass<Vector2dPy>::check(py);
|
||||
}
|
||||
|
||||
Py::PythonClassObject<Vector2dPy> Vector2dPy::create(const Vector2d& v)
|
||||
Py::PythonClassObject<Vector2dPy> Vector2dPy::create(const Vector2d& vec)
|
||||
{
|
||||
return create(v.x, v.y);
|
||||
return create(vec.x, vec.y);
|
||||
}
|
||||
|
||||
Py::PythonClassObject<Vector2dPy> Vector2dPy::create(double x, double y)
|
||||
Py::PythonClassObject<Vector2dPy> Vector2dPy::create(double vx, double vy)
|
||||
{
|
||||
Py::Callable class_type(type());
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::Float(x));
|
||||
arg.setItem(1, Py::Float(y));
|
||||
Py::PythonClassObject<Vector2dPy> o =
|
||||
arg.setItem(0, Py::Float(vx));
|
||||
arg.setItem(1, Py::Float(vy));
|
||||
Py::PythonClassObject<Vector2dPy> py =
|
||||
Py::PythonClassObject<Vector2dPy>(class_type.apply(arg, Py::Dict()));
|
||||
return o;
|
||||
return py;
|
||||
}
|
||||
|
||||
Vector2dPy::Vector2dPy(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds)
|
||||
: Py::PythonClass<Vector2dPy>::PythonClass(self, args, kwds)
|
||||
{
|
||||
double x = 0, y = 0;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|dd", &x, &y)) {
|
||||
double vx = 0, vy = 0;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|dd", &vx, &vy)) {
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
v.x = x;
|
||||
v.y = y;
|
||||
v.x = vx;
|
||||
v.y = vy;
|
||||
}
|
||||
|
||||
Vector2dPy::~Vector2dPy() = default;
|
||||
|
||||
Py::Object Vector2dPy::repr()
|
||||
{
|
||||
Py::Float x(v.x);
|
||||
Py::Float y(v.y);
|
||||
Py::Float vx(v.x);
|
||||
Py::Float vy(v.y);
|
||||
std::stringstream str;
|
||||
str << "Vector2 (";
|
||||
str << static_cast<std::string>(x.repr()) << ", " << static_cast<std::string>(y.repr());
|
||||
str << static_cast<std::string>(vx.repr()) << ", " << static_cast<std::string>(vy.repr());
|
||||
str << ")";
|
||||
|
||||
return Py::String(str.str());
|
||||
@@ -223,28 +224,28 @@ Py::Object Vector2dPy::number_float()
|
||||
|
||||
Py::Object Vector2dPy::number_add(const Py::Object& py)
|
||||
{
|
||||
Vector2d u(Py::toVector2d(py));
|
||||
u = v + u;
|
||||
return create(u);
|
||||
Vector2d vec(Py::toVector2d(py));
|
||||
vec = v + vec;
|
||||
return create(vec);
|
||||
}
|
||||
|
||||
Py::Object Vector2dPy::number_subtract(const Py::Object& py)
|
||||
{
|
||||
Vector2d u(Py::toVector2d(py));
|
||||
u = v - u;
|
||||
return create(u);
|
||||
Vector2d vec(Py::toVector2d(py));
|
||||
vec = v - vec;
|
||||
return create(vec);
|
||||
}
|
||||
|
||||
Py::Object Vector2dPy::number_multiply(const Py::Object& py)
|
||||
{
|
||||
if (PyObject_TypeCheck(py.ptr(), Vector2dPy::type_object())) {
|
||||
Vector2d u(Py::toVector2d(py));
|
||||
double d = v * u;
|
||||
return Py::Float(d);
|
||||
Vector2d vec(Py::toVector2d(py));
|
||||
double scalar = v * vec;
|
||||
return Py::Float(scalar);
|
||||
}
|
||||
else if (py.isNumeric()) {
|
||||
double d = static_cast<double>(Py::Float(py));
|
||||
return create(v * d);
|
||||
double scale = static_cast<double>(Py::Float(py));
|
||||
return create(v * scale);
|
||||
}
|
||||
else {
|
||||
throw Py::TypeError("Argument must be Vector2d or Float");
|
||||
@@ -321,16 +322,16 @@ PYCXX_VARARGS_METHOD_DECL(Vector2dPy, square)
|
||||
|
||||
Py::Object Vector2dPy::scale(const Py::Tuple& args)
|
||||
{
|
||||
double f = static_cast<double>(Py::Float(args[0]));
|
||||
v.Scale(f);
|
||||
double value = static_cast<double>(Py::Float(args[0]));
|
||||
v.Scale(value);
|
||||
return Py::None();
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, scale)
|
||||
|
||||
Py::Object Vector2dPy::rotate(const Py::Tuple& args)
|
||||
{
|
||||
double f = static_cast<double>(Py::Float(args[0]));
|
||||
v.Rotate(f);
|
||||
double value = static_cast<double>(Py::Float(args[0]));
|
||||
v.Rotate(value);
|
||||
return Py::None();
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, rotate)
|
||||
@@ -344,42 +345,43 @@ PYCXX_VARARGS_METHOD_DECL(Vector2dPy, normalize)
|
||||
|
||||
Py::Object Vector2dPy::perpendicular(const Py::Tuple& args)
|
||||
{
|
||||
bool f = static_cast<bool>(Py::Boolean(args[0]));
|
||||
Base::Vector2d p = v.Perpendicular(f);
|
||||
return create(p);
|
||||
bool value = static_cast<bool>(Py::Boolean(args[0]));
|
||||
Base::Vector2d pnt = v.Perpendicular(value);
|
||||
return create(pnt);
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, perpendicular)
|
||||
|
||||
Py::Object Vector2dPy::distance(const Py::Tuple& args)
|
||||
{
|
||||
Base::Vector2d p = Py::toVector2d(args[0]);
|
||||
return Py::Float(p.Distance(v));
|
||||
Base::Vector2d pnt = Py::toVector2d(args[0]);
|
||||
return Py::Float(pnt.Distance(v));
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, distance)
|
||||
|
||||
Py::Object Vector2dPy::isEqual(const Py::Tuple& args)
|
||||
{
|
||||
Base::Vector2d p = Py::toVector2d(args[0]);
|
||||
double f = static_cast<double>(Py::Float(args[1]));
|
||||
return Py::Boolean(v.IsEqual(p, f));
|
||||
Base::Vector2d pnt = Py::toVector2d(args[0]);
|
||||
double tol = static_cast<double>(Py::Float(args[1]));
|
||||
return Py::Boolean(v.IsEqual(pnt, tol));
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, isEqual)
|
||||
|
||||
Py::Object Vector2dPy::getAngle(const Py::Tuple& args)
|
||||
{
|
||||
Base::Vector2d p = Py::toVector2d(args[0]);
|
||||
return Py::Float(v.GetAngle(p));
|
||||
Base::Vector2d vec = Py::toVector2d(args[0]);
|
||||
return Py::Float(v.GetAngle(vec));
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, getAngle)
|
||||
|
||||
Py::Object Vector2dPy::projectToLine(const Py::Tuple& args)
|
||||
{
|
||||
Base::Vector2d p = Py::toVector2d(args[0]);
|
||||
Base::Vector2d d = Py::toVector2d(args[1]);
|
||||
v.ProjectToLine(p, d);
|
||||
Base::Vector2d pnt1 = Py::toVector2d(args[0]);
|
||||
Base::Vector2d pnt2 = Py::toVector2d(args[1]);
|
||||
v.ProjectToLine(pnt1, pnt2);
|
||||
return Py::None();
|
||||
}
|
||||
PYCXX_VARARGS_METHOD_DECL(Vector2dPy, projectToLine)
|
||||
// NOLINTEND(readability-identifier-length)
|
||||
|
||||
void Vector2dPy::init_type()
|
||||
{
|
||||
|
||||
@@ -40,18 +40,18 @@
|
||||
namespace Base
|
||||
{
|
||||
template<typename T>
|
||||
inline Vector3<T> getVectorFromTuple(PyObject* o)
|
||||
inline Vector3<T> getVectorFromTuple(PyObject* py)
|
||||
{
|
||||
Py::Sequence tuple(o);
|
||||
Py::Sequence tuple(py);
|
||||
if (tuple.size() != 3) {
|
||||
throw Py::ValueError("Expected sequence of size 3");
|
||||
}
|
||||
|
||||
T x = static_cast<T>(Py::Float(tuple[0]));
|
||||
T y = static_cast<T>(Py::Float(tuple[1]));
|
||||
T z = static_cast<T>(Py::Float(tuple[2]));
|
||||
T vx = static_cast<T>(Py::Float(tuple[0]));
|
||||
T vy = static_cast<T>(Py::Float(tuple[1]));
|
||||
T vz = static_cast<T>(Py::Float(tuple[2]));
|
||||
|
||||
return Vector3<T>(x, y, z);
|
||||
return Vector3<T>(vx, vy, vz);
|
||||
}
|
||||
|
||||
class BaseExport Vector2dPy: public Py::PythonClass<Vector2dPy> // NOLINT
|
||||
@@ -59,10 +59,10 @@ class BaseExport Vector2dPy: public Py::PythonClass<Vector2dPy> // NOLINT
|
||||
public:
|
||||
static Py::PythonType& behaviors();
|
||||
static PyTypeObject* type_object();
|
||||
static bool check(PyObject* p);
|
||||
static bool check(PyObject* py);
|
||||
|
||||
static Py::PythonClassObject<Vector2dPy> create(const Vector2d&);
|
||||
static Py::PythonClassObject<Vector2dPy> create(double x, double y);
|
||||
static Py::PythonClassObject<Vector2dPy> create(double vx, double vy);
|
||||
Vector2dPy(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds);
|
||||
~Vector2dPy() override;
|
||||
|
||||
@@ -78,10 +78,10 @@ public:
|
||||
{
|
||||
v = n;
|
||||
}
|
||||
inline void setValue(double x, double y)
|
||||
inline void setValue(double vx, double vy)
|
||||
{
|
||||
v.x = x;
|
||||
v.y = y;
|
||||
v.x = vx;
|
||||
v.y = vy;
|
||||
}
|
||||
|
||||
/** @name methods for group handling */
|
||||
@@ -220,9 +220,9 @@ public:
|
||||
set(new PyT(new T()), true);
|
||||
validate();
|
||||
}
|
||||
explicit GeometryT(const T& v)
|
||||
explicit GeometryT(const T& val)
|
||||
{
|
||||
set(new PyT(new T(v)), true);
|
||||
set(new PyT(new T(val)), true);
|
||||
validate();
|
||||
}
|
||||
GeometryT(const Object& other)
|
||||
@@ -246,9 +246,9 @@ public:
|
||||
set(rhsp, false);
|
||||
return *this;
|
||||
}
|
||||
GeometryT& operator=(const T& v)
|
||||
GeometryT& operator=(const T& val)
|
||||
{
|
||||
set(new PyT(v), true);
|
||||
set(new PyT(val), true);
|
||||
return *this;
|
||||
}
|
||||
const T& getValue() const
|
||||
@@ -256,8 +256,8 @@ public:
|
||||
// cast the PyObject pointer to the matching sub-class
|
||||
// and call then the defined member function
|
||||
PyT* py = static_cast<PyT*>(ptr());
|
||||
T* v = (py->*valuePtr)();
|
||||
return *v;
|
||||
T* val = (py->*valuePtr)();
|
||||
return *val;
|
||||
}
|
||||
operator T() const
|
||||
{
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
: _toHandle(nullptr)
|
||||
{}
|
||||
|
||||
Reference(T* p)
|
||||
: _toHandle(p)
|
||||
Reference(T* pointer)
|
||||
: _toHandle(pointer)
|
||||
{
|
||||
if (_toHandle) {
|
||||
_toHandle->ref();
|
||||
@@ -61,8 +61,8 @@ public:
|
||||
}
|
||||
|
||||
/** Copy constructor */
|
||||
Reference(const Reference<T>& p)
|
||||
: _toHandle(p._toHandle)
|
||||
Reference(const Reference<T>& ref)
|
||||
: _toHandle(ref._toHandle)
|
||||
{
|
||||
if (_toHandle) {
|
||||
_toHandle->ref();
|
||||
@@ -85,16 +85,16 @@ public:
|
||||
// operator implementation
|
||||
|
||||
/** Assign operator from a pointer */
|
||||
Reference<T>& operator=(T* p)
|
||||
Reference<T>& operator=(T* pointer)
|
||||
{
|
||||
// check if we want to reassign the same object
|
||||
if (_toHandle == p) {
|
||||
if (_toHandle == pointer) {
|
||||
return *this;
|
||||
}
|
||||
if (_toHandle) {
|
||||
_toHandle->unref();
|
||||
}
|
||||
_toHandle = p;
|
||||
_toHandle = pointer;
|
||||
if (_toHandle) {
|
||||
_toHandle->ref();
|
||||
}
|
||||
@@ -102,16 +102,16 @@ public:
|
||||
}
|
||||
|
||||
/** Assign operator from a handle */
|
||||
Reference<T>& operator=(const Reference<T>& p)
|
||||
Reference<T>& operator=(const Reference<T>& ref)
|
||||
{
|
||||
// check if we want to reassign the same object
|
||||
if (_toHandle == p._toHandle) {
|
||||
if (_toHandle == ref._toHandle) {
|
||||
return *this;
|
||||
}
|
||||
if (_toHandle) {
|
||||
_toHandle->unref();
|
||||
}
|
||||
_toHandle = p._toHandle;
|
||||
_toHandle = ref._toHandle;
|
||||
if (_toHandle) {
|
||||
_toHandle->ref();
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ void PyException::raiseException()
|
||||
}
|
||||
|
||||
if (_exceptionType == Base::PyExc_FC_FreeCADAbort) {
|
||||
Base::AbortException e(_sErrMsg.c_str());
|
||||
e.setReported(_isReported);
|
||||
throw e;
|
||||
Base::AbortException exc(_sErrMsg.c_str());
|
||||
exc.setReported(_isReported);
|
||||
throw exc;
|
||||
}
|
||||
|
||||
throw *this;
|
||||
|
||||
@@ -53,9 +53,9 @@ PyTypeObject* ProgressIndicatorPy::type_object()
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::type_object();
|
||||
}
|
||||
|
||||
bool ProgressIndicatorPy::check(PyObject* p)
|
||||
bool ProgressIndicatorPy::check(PyObject* py)
|
||||
{
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::check(p);
|
||||
return Py::PythonExtension<ProgressIndicatorPy>::check(py);
|
||||
}
|
||||
|
||||
PyObject* ProgressIndicatorPy::PyMake(struct _typeobject*, PyObject*, PyObject*)
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
static void init_type(); // announce properties and methods
|
||||
static Py::PythonType& behaviors();
|
||||
static PyTypeObject* type_object();
|
||||
static bool check(PyObject* p);
|
||||
static bool check(PyObject* py);
|
||||
|
||||
ProgressIndicatorPy();
|
||||
~ProgressIndicatorPy() override;
|
||||
|
||||
@@ -44,14 +44,14 @@ struct SequencerP
|
||||
/** Sets a global sequencer object.
|
||||
* Access to the last registered object is performed by @see Sequencer().
|
||||
*/
|
||||
static void appendInstance(SequencerBase* s)
|
||||
static void appendInstance(SequencerBase* sb)
|
||||
{
|
||||
_instances.push_back(s);
|
||||
_instances.push_back(sb);
|
||||
}
|
||||
static void removeInstance(SequencerBase* s)
|
||||
static void removeInstance(SequencerBase* sb)
|
||||
{
|
||||
std::vector<SequencerBase*>::iterator it;
|
||||
it = std::find(_instances.begin(), _instances.end(), s);
|
||||
it = std::find(_instances.begin(), _instances.end(), sb);
|
||||
_instances.erase(it);
|
||||
}
|
||||
static SequencerBase& getInstance()
|
||||
|
||||
@@ -117,10 +117,10 @@ bool SmartPtr::isNull() const
|
||||
return p == nullptr;
|
||||
}
|
||||
|
||||
BaseExport PyObject* new_reference_to(const SmartPtr& g)
|
||||
BaseExport PyObject* new_reference_to(const SmartPtr& ptr)
|
||||
{
|
||||
PyObject* p = g.ptr();
|
||||
Py::_XINCREF(p);
|
||||
return p;
|
||||
PyObject* py = ptr.ptr();
|
||||
Py::_XINCREF(py);
|
||||
return py;
|
||||
}
|
||||
} // namespace Py
|
||||
|
||||
@@ -59,10 +59,10 @@ TimeInfo::~TimeInfo() = default;
|
||||
void TimeInfo::setCurrent()
|
||||
{
|
||||
#if defined(FC_OS_BSD) || defined(FC_OS_LINUX) || defined(__MINGW32__)
|
||||
struct timeval t;
|
||||
gettimeofday(&t, nullptr);
|
||||
timebuffer.time = t.tv_sec;
|
||||
timebuffer.millitm = t.tv_usec / 1000;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
timebuffer.time = tv.tv_sec;
|
||||
timebuffer.millitm = tv.tv_usec / 1000;
|
||||
#elif defined(FC_OS_WIN32)
|
||||
_ftime(&timebuffer);
|
||||
#else
|
||||
|
||||
@@ -160,9 +160,9 @@ size_t Polygon3<float_type>::GetSize() const
|
||||
}
|
||||
|
||||
template<typename float_type>
|
||||
void Polygon3<float_type>::Add(const Vector3<float_type>& p)
|
||||
void Polygon3<float_type>::Add(const Vector3<float_type>& pnt)
|
||||
{
|
||||
points.push_back(p);
|
||||
points.push_back(pnt);
|
||||
}
|
||||
|
||||
template<typename float_type>
|
||||
|
||||
@@ -84,19 +84,19 @@ public:
|
||||
/*!
|
||||
* \brief Contains
|
||||
* Checks if the point \a p is part of the line segment.
|
||||
* \param p
|
||||
* \param pt
|
||||
* \return
|
||||
*/
|
||||
bool Contains(const Vector3<float_type>& p) const;
|
||||
bool Contains(const Vector3<float_type>& pt) const;
|
||||
/*!
|
||||
* \brief Contains
|
||||
* Checks if the distance of point \a p to the line segment is
|
||||
* less than \a eps
|
||||
* \param p
|
||||
* \param pt
|
||||
* \param eps
|
||||
* \return
|
||||
*/
|
||||
bool Contains(const Vector3<float_type>& p, float_type eps) const;
|
||||
bool Contains(const Vector3<float_type>& pt, float_type eps) const;
|
||||
Vector3<float_type> FromPos(float_type distance) const;
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
Polygon3& operator=(Polygon3<float_type>&& poly) = default;
|
||||
|
||||
size_t GetSize() const;
|
||||
void Add(const Vector3<float_type>& p);
|
||||
void Add(const Vector3<float_type>& pnt);
|
||||
const Vector3<float_type>& operator[](size_t pos) const;
|
||||
const Vector3<float_type>& At(size_t pos) const;
|
||||
Vector3<float_type>& operator[](size_t pos);
|
||||
|
||||
@@ -85,12 +85,12 @@ Py::Object Translate::translate(const Py::Tuple& args)
|
||||
char* context = nullptr;
|
||||
char* source = nullptr;
|
||||
char* disambiguation = nullptr;
|
||||
int n = -1;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "ss|zi", &context, &source, &disambiguation, &n)) {
|
||||
int num = -1;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "ss|zi", &context, &source, &disambiguation, &num)) {
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
QString str = QCoreApplication::translate(context, source, disambiguation, n);
|
||||
QString str = QCoreApplication::translate(context, source, disambiguation, num);
|
||||
return Py::asObject(PyUnicode_FromString(str.toUtf8()));
|
||||
}
|
||||
|
||||
|
||||
@@ -74,12 +74,12 @@ void* Type::createInstanceByName(const char* TypeName, bool bLoadModule)
|
||||
}
|
||||
|
||||
// now the type should be in the type map
|
||||
Type t = fromName(TypeName);
|
||||
if (t == badType()) {
|
||||
Type type = fromName(TypeName);
|
||||
if (type == badType()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return t.createInstance();
|
||||
return type.createInstance();
|
||||
}
|
||||
|
||||
void Type::importModule(const char* TypeName)
|
||||
|
||||
@@ -97,8 +97,8 @@ PyObject* TypePy::isBad(PyObject* args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool v = getBaseTypePtr()->isBad();
|
||||
return PyBool_FromLong(v ? 1 : 0);
|
||||
bool val = getBaseTypePtr()->isBad();
|
||||
return PyBool_FromLong(val ? 1 : 0);
|
||||
}
|
||||
|
||||
PyObject* TypePy::isDerivedFrom(PyObject* args)
|
||||
@@ -113,9 +113,9 @@ PyObject* TypePy::isDerivedFrom(PyObject* args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject* t {};
|
||||
if (PyArg_ParseTuple(args, "O!", &TypePy::Type, &t)) {
|
||||
type = *static_cast<TypePy*>(t)->getBaseTypePtr();
|
||||
PyObject* py {};
|
||||
if (PyArg_ParseTuple(args, "O!", &TypePy::Type, &py)) {
|
||||
type = *static_cast<TypePy*>(py)->getBaseTypePtr();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ PyObject* TypePy::isDerivedFrom(PyObject* args)
|
||||
return nullptr;
|
||||
} while (false);
|
||||
|
||||
bool v = (type != Base::Type::badType() && getBaseTypePtr()->isDerivedFrom(type));
|
||||
return PyBool_FromLong(v ? 1 : 0);
|
||||
bool val = (type != Base::Type::badType() && getBaseTypePtr()->isDerivedFrom(type));
|
||||
return PyBool_FromLong(val ? 1 : 0);
|
||||
}
|
||||
|
||||
PyObject* TypePy::getAllDerivedFrom(PyObject* args)
|
||||
@@ -139,9 +139,9 @@ PyObject* TypePy::getAllDerivedFrom(PyObject* args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject* t {};
|
||||
if (PyArg_ParseTuple(args, "O!", &TypePy::Type, &t)) {
|
||||
type = *static_cast<TypePy*>(t)->getBaseTypePtr();
|
||||
PyObject* py {};
|
||||
if (PyArg_ParseTuple(args, "O!", &TypePy::Type, &py)) {
|
||||
type = *static_cast<TypePy*>(py)->getBaseTypePtr();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,14 +158,14 @@ PyObject* UnitsApi::sSetSchema(PyObject* /*self*/, PyObject* args)
|
||||
|
||||
PyObject* UnitsApi::sSchemaTranslate(PyObject* /*self*/, PyObject* args)
|
||||
{
|
||||
PyObject* q {};
|
||||
PyObject* py {};
|
||||
int index {};
|
||||
if (!PyArg_ParseTuple(args, "O!i", &(QuantityPy::Type), &q, &index)) {
|
||||
if (!PyArg_ParseTuple(args, "O!i", &(QuantityPy::Type), &py, &index)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Quantity quant;
|
||||
quant = *static_cast<Base::QuantityPy*>(q)->getQuantityPtr();
|
||||
quant = *static_cast<Base::QuantityPy*>(py)->getQuantityPtr();
|
||||
|
||||
std::unique_ptr<UnitsSchema> schema(createSchema(static_cast<UnitSystem>(index)));
|
||||
if (!schema.get()) {
|
||||
@@ -192,9 +192,9 @@ PyObject* UnitsApi::sToNumber(PyObject* /*self*/, PyObject* args)
|
||||
int decimals {};
|
||||
|
||||
do {
|
||||
PyObject* q {};
|
||||
if (PyArg_ParseTuple(args, "O!|si", &(QuantityPy::Type), &q, &format, &decimals)) {
|
||||
value = static_cast<QuantityPy*>(q)->getQuantityPtr()->getValue();
|
||||
PyObject* py {};
|
||||
if (PyArg_ParseTuple(args, "O!|si", &(QuantityPy::Type), &py, &format, &decimals)) {
|
||||
value = static_cast<QuantityPy*>(py)->getQuantityPtr()->getValue();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,11 +120,11 @@ void perspectiveTransform(const Base::Matrix4D& mat, Vec& pnt)
|
||||
double m31 = mat[3][1];
|
||||
double m32 = mat[3][2];
|
||||
double m33 = mat[3][3];
|
||||
double w = (static_cast<double>(pnt.x) * m30 + static_cast<double>(pnt.y) * m31
|
||||
+ static_cast<double>(pnt.z) * m32 + m33);
|
||||
double ww = (static_cast<double>(pnt.x) * m30 + static_cast<double>(pnt.y) * m31
|
||||
+ static_cast<double>(pnt.z) * m32 + m33);
|
||||
|
||||
mat.multVec(pnt, pnt);
|
||||
pnt /= static_cast<typename Vec::num_type>(w);
|
||||
pnt /= static_cast<typename Vec::num_type>(ww);
|
||||
}
|
||||
|
||||
Vector3f ViewProjMatrix::operator()(const Vector3f& inp) const
|
||||
|
||||
@@ -51,12 +51,12 @@ struct cdata_filter
|
||||
using category = boost::iostreams::output_filter_tag;
|
||||
|
||||
template<typename Device>
|
||||
inline bool put(Device& dev, char c)
|
||||
inline bool put(Device& dev, char ch)
|
||||
{
|
||||
switch (state) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (c == ']') {
|
||||
if (ch == ']') {
|
||||
++state;
|
||||
}
|
||||
else {
|
||||
@@ -64,14 +64,14 @@ struct cdata_filter
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (c == '>') {
|
||||
if (ch == '>') {
|
||||
static const char escape[] = "]]><![CDATA[";
|
||||
boost::iostreams::write(dev, escape, sizeof(escape) - 1);
|
||||
}
|
||||
state = 0;
|
||||
break;
|
||||
}
|
||||
return boost::iostreams::put(dev, c);
|
||||
return boost::iostreams::put(dev, ch);
|
||||
}
|
||||
|
||||
int state = 0;
|
||||
@@ -127,9 +127,9 @@ std::ostream& Writer::charStream()
|
||||
return *CharStream;
|
||||
}
|
||||
|
||||
void Writer::insertText(const std::string& s)
|
||||
void Writer::insertText(const std::string& str)
|
||||
{
|
||||
beginCharStream() << s;
|
||||
beginCharStream() << str;
|
||||
endCharStream();
|
||||
}
|
||||
|
||||
@@ -177,9 +177,9 @@ bool Writer::isForceXML()
|
||||
return forceXML;
|
||||
}
|
||||
|
||||
void Writer::setFileVersion(int v)
|
||||
void Writer::setFileVersion(int version)
|
||||
{
|
||||
fileVersion = v;
|
||||
fileVersion = version;
|
||||
}
|
||||
|
||||
int Writer::getFileVersion() const
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
/// insert a binary file BASE64 coded as CDATA section in the XML file
|
||||
void insertBinFile(const char* FileName);
|
||||
/// insert text string as CDATA
|
||||
void insertText(const std::string& s);
|
||||
void insertText(const std::string& str);
|
||||
|
||||
/** @name additional file writing */
|
||||
//@{
|
||||
|
||||
Reference in New Issue
Block a user