Trivial code formatting for some {.cpp,.h} files
This commit is contained in:
@@ -78,7 +78,7 @@ public:
|
||||
DocumentObjectExecReturn(const char* sWhy, DocumentObject* WhichObject=0)
|
||||
: Which(WhichObject)
|
||||
{
|
||||
if(sWhy)
|
||||
if (sWhy)
|
||||
Why = sWhy;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,13 +74,13 @@ Extension::~Extension()
|
||||
void Extension::initExtensionType(Base::Type type) {
|
||||
|
||||
m_extensionType = type;
|
||||
if(m_extensionType.isBad())
|
||||
if (m_extensionType.isBad())
|
||||
throw Base::RuntimeError("Extension: Extension type not set");
|
||||
}
|
||||
|
||||
void Extension::initExtension(ExtensionContainer* obj) {
|
||||
|
||||
if(m_extensionType.isBad())
|
||||
if (m_extensionType.isBad())
|
||||
throw Base::RuntimeError("Extension: Extension type not set");
|
||||
|
||||
//all properties are initialised without PropertyContainer father. Now that we know it we can
|
||||
@@ -107,13 +107,13 @@ PyObject* Extension::getExtensionPyObject(void) {
|
||||
|
||||
std::string Extension::name() const {
|
||||
|
||||
if(m_extensionType.isBad())
|
||||
if (m_extensionType.isBad())
|
||||
throw Base::RuntimeError("Extension::name: Extension type not set");
|
||||
|
||||
std::string temp(m_extensionType.getName());
|
||||
std::string::size_type pos = temp.find_last_of(':');
|
||||
|
||||
if(pos != std::string::npos)
|
||||
if (pos != std::string::npos)
|
||||
return temp.substr(pos+1);
|
||||
else
|
||||
return std::string();
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
* before, and only then will it call the property's aboutToSetValue().
|
||||
*/
|
||||
void aboutToChange() {
|
||||
if(!mProp.hasChanged) {
|
||||
if (!mProp.hasChanged) {
|
||||
mProp.hasChanged = true;
|
||||
mProp.aboutToSetValue();
|
||||
}
|
||||
@@ -350,12 +350,12 @@ public:
|
||||
// Must make sure to not throw in a destructor
|
||||
try {
|
||||
mProp.hasSetValue();
|
||||
}catch(Base::Exception &e) {
|
||||
} catch(Base::Exception &e) {
|
||||
e.ReportException();
|
||||
}catch(...) {}
|
||||
} catch(...) {}
|
||||
mProp.hasChanged = false;
|
||||
}
|
||||
if(mProp.signalCounter>0)
|
||||
if (mProp.signalCounter>0)
|
||||
mProp.signalCounter--;
|
||||
}
|
||||
|
||||
@@ -367,9 +367,9 @@ public:
|
||||
// Destructor cannot throw. So we provide this function to allow error
|
||||
// propagation.
|
||||
void tryInvoke() {
|
||||
if(mProp.signalCounter==1 && mProp.hasChanged) {
|
||||
if (mProp.signalCounter==1 && mProp.hasChanged) {
|
||||
mProp.hasSetValue();
|
||||
if(mProp.signalCounter>0)
|
||||
if (mProp.signalCounter>0)
|
||||
--mProp.signalCounter;
|
||||
mProp.hasChanged = false;
|
||||
}
|
||||
@@ -500,14 +500,14 @@ public:
|
||||
|
||||
virtual void set1Value(int index, const_reference value) {
|
||||
int size = getSize();
|
||||
if(index<-1 || index>size)
|
||||
if (index<-1 || index>size)
|
||||
throw Base::RuntimeError("index out of bound");
|
||||
|
||||
atomic_change guard(*this);
|
||||
if(index==-1 || index == size) {
|
||||
if (index==-1 || index == size) {
|
||||
index = size;
|
||||
setSize(index+1,value);
|
||||
}else
|
||||
} else
|
||||
_lValueList[index] = value;
|
||||
this->_touchList.insert(index);
|
||||
guard.tryInvoke();
|
||||
@@ -517,17 +517,17 @@ protected:
|
||||
|
||||
void setPyValues(const std::vector<PyObject*> &vals, const std::vector<int> &indices) override
|
||||
{
|
||||
if(indices.empty()) {
|
||||
if (indices.empty()) {
|
||||
ListT values;
|
||||
values.resize(vals.size());
|
||||
for(std::size_t i=0,count=vals.size();i<count;++i)
|
||||
for (std::size_t i=0,count=vals.size();i<count;++i)
|
||||
values[i] = getPyValue(vals[i]);
|
||||
setValues(std::move(values));
|
||||
return;
|
||||
}
|
||||
assert(vals.size()==indices.size());
|
||||
atomic_change guard(*this);
|
||||
for(int i=0,count=indices.size();i<count;++i)
|
||||
for (int i=0,count=indices.size();i<count;++i)
|
||||
set1Value(indices[i],getPyValue(vals[i]));
|
||||
guard.tryInvoke();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ ConsoleSingleton::ConsoleSingleton(void)
|
||||
ConsoleSingleton::~ConsoleSingleton()
|
||||
{
|
||||
ConsoleOutput::destruct();
|
||||
for(std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter)
|
||||
for (std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter)
|
||||
delete (*Iter);
|
||||
}
|
||||
|
||||
@@ -383,32 +383,32 @@ void ConsoleSingleton::DetachObserver(ILogger *pcObserver)
|
||||
|
||||
void ConsoleSingleton::NotifyMessage(const char *sMsg)
|
||||
{
|
||||
for(std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if((*Iter)->bMsg)
|
||||
for (std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if ((*Iter)->bMsg)
|
||||
(*Iter)->SendLog(sMsg, LogStyle::Message); // send string to the listener
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleSingleton::NotifyWarning(const char *sMsg)
|
||||
{
|
||||
for(std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if((*Iter)->bWrn)
|
||||
for (std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if ((*Iter)->bWrn)
|
||||
(*Iter)->SendLog(sMsg, LogStyle::Warning); // send string to the listener
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleSingleton::NotifyError(const char *sMsg)
|
||||
{
|
||||
for(std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if((*Iter)->bErr)
|
||||
for (std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if ((*Iter)->bErr)
|
||||
(*Iter)->SendLog(sMsg, LogStyle::Error); // send string to the listener
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleSingleton::NotifyLog(const char *sMsg)
|
||||
{
|
||||
for(std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if((*Iter)->bLog)
|
||||
for (std::set<ILogger * >::iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
if ((*Iter)->bLog)
|
||||
(*Iter)->SendLog(sMsg, LogStyle::Log); // send string to the listener
|
||||
}
|
||||
}
|
||||
@@ -416,26 +416,26 @@ void ConsoleSingleton::NotifyLog(const char *sMsg)
|
||||
ILogger *ConsoleSingleton::Get(const char *Name) const
|
||||
{
|
||||
const char* OName;
|
||||
for(std::set<ILogger * >::const_iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
for (std::set<ILogger * >::const_iterator Iter=_aclObservers.begin();Iter!=_aclObservers.end();++Iter) {
|
||||
OName = (*Iter)->Name(); // get the name
|
||||
if(OName && strcmp(OName,Name) == 0)
|
||||
if (OName && strcmp(OName,Name) == 0)
|
||||
return *Iter;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int *ConsoleSingleton::GetLogLevel(const char *tag, bool create) {
|
||||
if(!tag) tag = "";
|
||||
if(_logLevels.find(tag) != _logLevels.end())
|
||||
if (!tag) tag = "";
|
||||
if (_logLevels.find(tag) != _logLevels.end())
|
||||
return &_logLevels[tag];
|
||||
if(!create) return 0;
|
||||
if (!create) return 0;
|
||||
int &ret = _logLevels[tag];
|
||||
ret = -1;
|
||||
return &ret;
|
||||
}
|
||||
|
||||
void ConsoleSingleton::Refresh() {
|
||||
if(_bCanRefresh)
|
||||
if (_bCanRefresh)
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ void ConsoleSingleton::Destruct(void)
|
||||
ConsoleSingleton & ConsoleSingleton::Instance(void)
|
||||
{
|
||||
// not initialized?
|
||||
if(!_pcSingleton)
|
||||
if (!_pcSingleton)
|
||||
{
|
||||
_pcSingleton = new ConsoleSingleton();
|
||||
}
|
||||
@@ -681,19 +681,19 @@ PyObject *ConsoleSingleton::sPyGetStatus(PyObject * /*self*/, PyObject *args)
|
||||
PY_TRY{
|
||||
bool b=false;
|
||||
ILogger *pObs = Instance().Get(pstr1);
|
||||
if(!pObs)
|
||||
if (!pObs)
|
||||
{
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
if(strcmp(pstr2,"Log") == 0)
|
||||
if (strcmp(pstr2,"Log") == 0)
|
||||
b = pObs->bLog;
|
||||
else if(strcmp(pstr2,"Wrn") == 0)
|
||||
else if (strcmp(pstr2,"Wrn") == 0)
|
||||
b = pObs->bWrn;
|
||||
else if(strcmp(pstr2,"Msg") == 0)
|
||||
else if (strcmp(pstr2,"Msg") == 0)
|
||||
b = pObs->bMsg;
|
||||
else if(strcmp(pstr2,"Err") == 0)
|
||||
else if (strcmp(pstr2,"Err") == 0)
|
||||
b = pObs->bErr;
|
||||
|
||||
return Py_BuildValue("i",b?1:0);
|
||||
@@ -710,22 +710,23 @@ PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
PY_TRY{
|
||||
ILogger *pObs = Instance().Get(pstr1);
|
||||
if(pObs)
|
||||
if (pObs)
|
||||
{
|
||||
if(strcmp(pstr2,"Log") == 0)
|
||||
if (strcmp(pstr2,"Log") == 0)
|
||||
pObs->bLog = (Bool==0)?false:true;
|
||||
else if(strcmp(pstr2,"Wrn") == 0)
|
||||
else if (strcmp(pstr2,"Wrn") == 0)
|
||||
pObs->bWrn = (Bool==0)?false:true;
|
||||
else if(strcmp(pstr2,"Msg") == 0)
|
||||
else if (strcmp(pstr2,"Msg") == 0)
|
||||
pObs->bMsg = (Bool==0)?false:true;
|
||||
else if(strcmp(pstr2,"Err") == 0)
|
||||
else if (strcmp(pstr2,"Err") == 0)
|
||||
pObs->bErr = (Bool==0)?false:true;
|
||||
else
|
||||
Py_Error(Base::BaseExceptionFreeCADError,"Unknown Message Type (use Log, Err, Msg or Wrn)");
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Py_Error(Base::BaseExceptionFreeCADError,"Unknown Console Type");
|
||||
}
|
||||
|
||||
@@ -948,8 +949,8 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
|
||||
{
|
||||
static FC_TIME_POINT s_tstart;
|
||||
static bool s_timing = false;
|
||||
if(print_time) {
|
||||
if(!s_timing) {
|
||||
if (print_time) {
|
||||
if (!s_timing) {
|
||||
s_timing = true;
|
||||
_FC_TIME_INIT(s_tstart);
|
||||
}
|
||||
@@ -957,10 +958,10 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
|
||||
auto d = std::chrono::duration_cast<FC_DURATION>(tnow-s_tstart);
|
||||
str << d.count() << ' ';
|
||||
}
|
||||
if(print_tag) str << '<' << tag << "> ";
|
||||
if(print_src==2) {
|
||||
if (print_tag) str << '<' << tag << "> ";
|
||||
if (print_src==2) {
|
||||
PyFrameObject* frame = PyEval_GetFrame();
|
||||
if(frame) {
|
||||
if (frame) {
|
||||
line = PyFrame_GetLineNumber(frame);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
src = PyUnicode_AsUTF8(frame->f_code->co_filename);
|
||||
@@ -969,7 +970,7 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(print_src && src && src[0]) {
|
||||
if (print_src && src && src[0]) {
|
||||
#ifdef FC_OS_WIN32
|
||||
const char *_f = std::strrchr(src, '\\');
|
||||
#else
|
||||
|
||||
@@ -91,14 +91,14 @@ void Exception::ReportException (void) const
|
||||
{
|
||||
if (!_isReported) {
|
||||
const char *msg;
|
||||
if(_sErrMsg.empty())
|
||||
if (_sErrMsg.empty())
|
||||
msg = typeid(*this).name();
|
||||
else
|
||||
msg = _sErrMsg.c_str();
|
||||
#ifdef FC_DEBUG
|
||||
if(_function.size()) {
|
||||
if (_function.size()) {
|
||||
_FC_ERR(_file.c_str(),_line, _function << " -- " << msg);
|
||||
}else
|
||||
} else
|
||||
#endif
|
||||
_FC_ERR(_file.c_str(),_line,msg);
|
||||
_isReported = true;
|
||||
@@ -319,14 +319,14 @@ void FileException::ReportException (void) const
|
||||
{
|
||||
if (!_isReported) {
|
||||
const char *msg;
|
||||
if(_sErrMsgAndFileName.empty())
|
||||
if (_sErrMsgAndFileName.empty())
|
||||
msg = typeid(*this).name();
|
||||
else
|
||||
msg = _sErrMsgAndFileName.c_str();
|
||||
#ifdef FC_DEBUG
|
||||
if(_function.size()) {
|
||||
if (_function.size()) {
|
||||
_FC_ERR(_file.c_str(),_line, _function << " -- " << msg);
|
||||
}else
|
||||
} else
|
||||
#endif
|
||||
_FC_ERR(_file.c_str(),_line,msg);
|
||||
_isReported = true;
|
||||
|
||||
@@ -82,7 +82,7 @@ PyException::PyException(void)
|
||||
|
||||
_exceptionType = PP_last_exception_type;
|
||||
|
||||
if(PP_last_exception_type) {
|
||||
if (PP_last_exception_type) {
|
||||
// WARNING: we are assuming that python type object will never be
|
||||
// destroyed, so we don't keep reference here to save book-keeping in
|
||||
// our copy constructor and destructor
|
||||
@@ -123,7 +123,7 @@ void PyException::raiseException() {
|
||||
if (_exceptionType == Base::BaseExceptionFreeCADAbort)
|
||||
edict.setItem("sclassname",
|
||||
Py::String(typeid(Base::AbortException).name()));
|
||||
if(_isReported)
|
||||
if (_isReported)
|
||||
edict.setItem("breported", Py::True());
|
||||
Base::ExceptionFactory::Instance().raiseException(edict.ptr());
|
||||
}
|
||||
|
||||
@@ -178,10 +178,10 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb
|
||||
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
|
||||
|
||||
long b = Py::Int(other);
|
||||
if(!b)
|
||||
if (!b)
|
||||
return new MatrixPy(Matrix4D());
|
||||
|
||||
if(b < 0) {
|
||||
if (b < 0) {
|
||||
if (fabs(a.determinant()) > DBL_EPSILON)
|
||||
a.inverseGauss();
|
||||
else {
|
||||
@@ -192,7 +192,7 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb
|
||||
}
|
||||
|
||||
auto res = a;
|
||||
for(--b;b;--b)
|
||||
for (--b;b;--b)
|
||||
res *= a;
|
||||
return new MatrixPy(res);
|
||||
}
|
||||
@@ -303,7 +303,7 @@ PyObject* MatrixPy::scale(PyObject * args)
|
||||
PyObject* MatrixPy::hasScale(PyObject * args)
|
||||
{
|
||||
double tol=0;
|
||||
if(!PyArg_ParseTuple(args, "|d", &tol))
|
||||
if (!PyArg_ParseTuple(args, "|d", &tol))
|
||||
return 0;
|
||||
return Py::new_reference_to(Py::Int(getMatrixPtr()->hasScale(tol)));
|
||||
}
|
||||
|
||||
@@ -396,11 +396,11 @@ double num_change(char* yytext,char dez_delim,char grp_delim)
|
||||
double ret_val;
|
||||
char temp[40];
|
||||
int i = 0;
|
||||
for(char* c=yytext;*c!='\0';c++){
|
||||
for (char* c=yytext;*c!='\0';c++){
|
||||
// skip group delimiter
|
||||
if(*c==grp_delim) continue;
|
||||
if (*c==grp_delim) continue;
|
||||
// check for a dez delimiter other then dot
|
||||
if(*c==dez_delim && dez_delim !='.')
|
||||
if (*c==dez_delim && dez_delim !='.')
|
||||
temp[i++] = '.';
|
||||
else
|
||||
temp[i++] = *c;
|
||||
|
||||
@@ -121,7 +121,7 @@ void Rotation::evaluateVector()
|
||||
// Taken from <http://de.wikipedia.org/wiki/Quaternionen>
|
||||
//
|
||||
// Note: -1 < w < +1 (|w| == 1 not allowed, with w:=quat[3])
|
||||
if((this->quat[3] > -1.0) && (this->quat[3] < 1.0)) {
|
||||
if ((this->quat[3] > -1.0) && (this->quat[3] < 1.0)) {
|
||||
double rfAngle = acos(this->quat[3]) * 2.0;
|
||||
double scale = sin(rfAngle / 2.0);
|
||||
// Get a normalized vector
|
||||
@@ -287,7 +287,7 @@ void Rotation::setValue(const Vector3d & rotateFrom, const Vector3d & rotateTo)
|
||||
else {
|
||||
// We can use any axis perpendicular to u (and v)
|
||||
Vector3d t = u % Vector3d(1.0, 0.0, 0.0);
|
||||
if(t.Length() < Base::Vector3d::epsilon())
|
||||
if (t.Length() < Base::Vector3d::epsilon())
|
||||
t = u % Vector3d(0.0, 1.0, 0.0);
|
||||
this->setValue(t.x, t.y, t.z, 0.0);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ Rotation Rotation::slerp(const Rotation & q0, const Rotation & q1, double t)
|
||||
double scale1 = t;
|
||||
double dot = q0.quat[0]*q1.quat[0]+q0.quat[1]*q1.quat[1]+q0.quat[2]*q1.quat[2]+q0.quat[3]*q1.quat[3];
|
||||
bool neg=false;
|
||||
if(dot < 0.0) {
|
||||
if (dot < 0.0) {
|
||||
dot = -dot;
|
||||
neg = true;
|
||||
}
|
||||
@@ -495,10 +495,10 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
};
|
||||
|
||||
//convert priorityOrder string into a sequence of ints.
|
||||
if(strlen(priorityOrder)!=3)
|
||||
if (strlen(priorityOrder)!=3)
|
||||
THROWM(ValueError, "makeRotationByAxes: length of priorityOrder is not 3");
|
||||
int order[3];
|
||||
for(int i = 0; i < 3; ++i){
|
||||
for (int i = 0; i < 3; ++i){
|
||||
order[i] = priorityOrder[i] - 'X';
|
||||
if (order[i] < 0 || order[i] > 2)
|
||||
THROWM(ValueError, "makeRotationByAxes: characters in priorityOrder must be uppercase X, Y, or Z. Some other character encountered.")
|
||||
@@ -531,7 +531,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
|
||||
//pick up the strict direction
|
||||
Vector3d mainDir;
|
||||
for(int i = 0; i < 3; ++i){
|
||||
for (int i = 0; i < 3; ++i){
|
||||
mainDir = *(dirs[order[0]]);
|
||||
if (mainDir.Length() > tol)
|
||||
break;
|
||||
@@ -544,7 +544,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
|
||||
//pick up the 2nd priority direction, "hint" direction.
|
||||
Vector3d hintDir;
|
||||
for(int i = 0; i < 2; ++i){
|
||||
for (int i = 0; i < 2; ++i){
|
||||
hintDir = *(dirs[order[1]]);
|
||||
if ((hintDir.Cross(mainDir)).Length() > tol)
|
||||
break;
|
||||
@@ -619,7 +619,7 @@ Rotation Rotation::makeRotationByAxes(Vector3d xdir, Vector3d ydir, Vector3d zdi
|
||||
//build the rotation, by constructing a matrix first.
|
||||
Matrix4D m;
|
||||
m.setToUnity();
|
||||
for(int i = 0; i < 3; ++i){
|
||||
for (int i = 0; i < 3; ++i){
|
||||
//matrix indexing: [row][col]
|
||||
m[0][i] = finaldirs[i].x;
|
||||
m[1][i] = finaldirs[i].y;
|
||||
|
||||
@@ -202,12 +202,12 @@ struct FlagToggler {
|
||||
FlagToggler(Flag &_flag, Flag check)
|
||||
:flag(_flag),toggled(check==_flag)
|
||||
{
|
||||
if(toggled)
|
||||
if (toggled)
|
||||
flag = !flag;
|
||||
}
|
||||
|
||||
~FlagToggler() {
|
||||
if(toggled)
|
||||
if (toggled)
|
||||
flag = !flag;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -425,29 +425,29 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list<Polygon2d> &rc
|
||||
}
|
||||
|
||||
bool Polygon2d::Intersect (const Polygon2d &other) const {
|
||||
if(other.GetCtVectors()<2 || GetCtVectors() < 2)
|
||||
if (other.GetCtVectors()<2 || GetCtVectors() < 2)
|
||||
return false;
|
||||
|
||||
for(auto &v : _aclVct) {
|
||||
if(other.Contains(v))
|
||||
for (auto &v : _aclVct) {
|
||||
if (other.Contains(v))
|
||||
return true;
|
||||
}
|
||||
|
||||
if(Contains(other[0]))
|
||||
if (Contains(other[0]))
|
||||
return true;
|
||||
|
||||
for(size_t j=1; j<other.GetCtVectors(); ++j) {
|
||||
for (size_t j=1; j<other.GetCtVectors(); ++j) {
|
||||
auto &v0 = other[j-1];
|
||||
auto &v1 = other[j];
|
||||
|
||||
if(Contains(v1))
|
||||
if (Contains(v1))
|
||||
return true;
|
||||
|
||||
Line2d line(v0, v1);
|
||||
for(size_t i=0; i<GetCtVectors(); ++i) {
|
||||
for (size_t i=0; i<GetCtVectors(); ++i) {
|
||||
Line2d line2(At(i), At((i+1)%GetCtVectors()));
|
||||
Vector2d v;
|
||||
if(line.IntersectAndContain(line2, v))
|
||||
if (line.IntersectAndContain(line2, v))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,12 +91,12 @@ void *Type::createInstance(void)
|
||||
void *Type::createInstanceByName(const char* TypeName, bool bLoadModule)
|
||||
{
|
||||
// if not already, load the module
|
||||
if(bLoadModule)
|
||||
if (bLoadModule)
|
||||
importModule(TypeName);
|
||||
|
||||
// now the type should be in the type map
|
||||
Type t = fromName(TypeName);
|
||||
if(t == badType())
|
||||
if (t == badType())
|
||||
return 0;
|
||||
|
||||
return t.createInstance();
|
||||
@@ -125,7 +125,7 @@ string Type::getModuleName(const char* ClassName)
|
||||
string temp(ClassName);
|
||||
std::string::size_type pos = temp.find_first_of("::");
|
||||
|
||||
if(pos != std::string::npos)
|
||||
if (pos != std::string::npos)
|
||||
return string(temp,0,pos);
|
||||
else
|
||||
return string();
|
||||
@@ -178,7 +178,7 @@ Type Type::fromName(const char *name)
|
||||
std::map<std::string,unsigned int>::const_iterator pos;
|
||||
|
||||
pos = typemap.find(name);
|
||||
if(pos != typemap.end())
|
||||
if (pos != typemap.end())
|
||||
return typedata[pos->second]->type;
|
||||
else
|
||||
return Type::badType();
|
||||
@@ -186,7 +186,7 @@ Type Type::fromName(const char *name)
|
||||
|
||||
Type Type::fromKey(unsigned int key)
|
||||
{
|
||||
if(key < typedata.size())
|
||||
if (key < typedata.size())
|
||||
return typedata[key]->type;
|
||||
else
|
||||
return Type::badType();
|
||||
@@ -207,7 +207,7 @@ bool Type::isDerivedFrom(const Type type) const
|
||||
|
||||
Type temp(*this);
|
||||
do {
|
||||
if(temp == type)
|
||||
if (temp == type)
|
||||
return true;
|
||||
temp = temp.getParent();
|
||||
} while (temp != badType());
|
||||
@@ -221,7 +221,7 @@ int Type::getAllDerivedFrom(const Type type, std::vector<Type> & List)
|
||||
|
||||
for(std::vector<TypeData*>::const_iterator it = typedata.begin();it!= typedata.end();++it)
|
||||
{
|
||||
if((*it)->type.isDerivedFrom(type))
|
||||
if ((*it)->type.isDerivedFrom(type))
|
||||
{
|
||||
List.push_back((*it)->type);
|
||||
cnt++;
|
||||
|
||||
@@ -355,7 +355,7 @@ QString Unit::getString(void) const
|
||||
}
|
||||
|
||||
if (Sig.Mass < 0) {
|
||||
if(mult)
|
||||
if (mult)
|
||||
ret<<'*';
|
||||
mult = true;
|
||||
ret << "kg";
|
||||
@@ -364,7 +364,7 @@ QString Unit::getString(void) const
|
||||
}
|
||||
|
||||
if (Sig.Time < 0) {
|
||||
if(mult)
|
||||
if (mult)
|
||||
ret<<'*';
|
||||
mult = true;
|
||||
ret << "s";
|
||||
@@ -373,7 +373,7 @@ QString Unit::getString(void) const
|
||||
}
|
||||
|
||||
if (Sig.ElectricCurrent < 0) {
|
||||
if(mult)
|
||||
if (mult)
|
||||
ret<<'*';
|
||||
mult = true;
|
||||
ret << "A";
|
||||
|
||||
@@ -26,7 +26,7 @@ std::string UnitPy::representation(void) const
|
||||
ret << Sig.LuminousIntensity << ",";
|
||||
ret << Sig.Angle << ")";
|
||||
std::string type = getUnitPtr()->getTypeString().toUtf8().constData();
|
||||
if(! type.empty())
|
||||
if (! type.empty())
|
||||
ret << " [" << type << "]";
|
||||
|
||||
return ret.str();
|
||||
|
||||
Reference in New Issue
Block a user