Merge branch 'master' into FixPathSort
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();
|
||||
|
||||
@@ -1503,7 +1503,7 @@ StdCmdEdit::StdCmdEdit()
|
||||
sToolTipText = QT_TR_NOOP("Toggles the selected object's edit mode");
|
||||
sWhatsThis = "Std_Edit";
|
||||
sStatusTip = QT_TR_NOOP("Activates or Deactivates the selected object's edit mode");
|
||||
sAccel = "Shift+E";
|
||||
sAccel = "";
|
||||
#if QT_VERSION >= 0x040200
|
||||
sPixmap = "edit-edit";
|
||||
#endif
|
||||
|
||||
@@ -214,6 +214,45 @@ but slower response to any scene changes.</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="transparentRenderLabel">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Transparent objects:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="Gui::PrefComboBox" name="comboTransparentRender">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Render types of transparent objects</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>TransparentObjectRenderType</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>View</cstring>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>One pass</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Backface pass</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="markerSizeLabel">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
@@ -223,7 +262,7 @@ but slower response to any scene changes.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="3" column="4">
|
||||
<widget class="QComboBox" name="boxMarkerSize">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -236,14 +275,14 @@ but slower response to any scene changes.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Eye to eye distance for stereo modes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<item row="4" column="4">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="FloatSpinBox_EyeDistance">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -279,7 +318,7 @@ bounding box size of the 3D object that is currently displayed. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxBacklight">
|
||||
<property name="toolTip">
|
||||
<string>Backlight is enabled with the defined color</string>
|
||||
@@ -295,7 +334,7 @@ bounding box size of the 3D object that is currently displayed. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="backlightColor">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -318,7 +357,7 @@ bounding box size of the 3D object that is currently displayed. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -331,7 +370,7 @@ bounding box size of the 3D object that is currently displayed. </string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="backlightLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -347,7 +386,7 @@ bounding box size of the 3D object that is currently displayed. </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<item row="5" column="4">
|
||||
<widget class="Gui::PrefSlider" name="sliderIntensity">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
||||
@@ -83,6 +83,8 @@ void DlgSettings3DViewImp::saveSettings()
|
||||
index = ui->renderCache->currentIndex();
|
||||
hGrp->SetInt("RenderCache", index);
|
||||
|
||||
ui->comboTransparentRender->onSave();
|
||||
|
||||
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
|
||||
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
|
||||
|
||||
@@ -124,6 +126,8 @@ void DlgSettings3DViewImp::loadSettings()
|
||||
index = hGrp->GetInt("RenderCache", 0);
|
||||
ui->renderCache->setCurrentIndex(index);
|
||||
|
||||
ui->comboTransparentRender->onRestore();
|
||||
|
||||
int const current = hGrp->GetInt("MarkerSize", 9L);
|
||||
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
|
||||
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
|
||||
|
||||
@@ -189,6 +189,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
|
||||
OnChange(*hGrp,"Dimensions3dVisible");
|
||||
OnChange(*hGrp,"DimensionsDeltaVisible");
|
||||
OnChange(*hGrp,"PickRadius");
|
||||
OnChange(*hGrp,"TransparentObjectRenderType");
|
||||
|
||||
stopSpinTimer = new QTimer(this);
|
||||
connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating()));
|
||||
@@ -414,6 +415,17 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
||||
else if (strcmp(Reason, "PickRadius") == 0) {
|
||||
_viewer->setPickRadius(rGrp.GetFloat("PickRadius", 5.0f));
|
||||
}
|
||||
else if (strcmp(Reason, "TransparentObjectRenderType") == 0) {
|
||||
long renderType = rGrp.GetInt("TransparentObjectRenderType", 0);
|
||||
if (renderType == 0) {
|
||||
_viewer->getSoRenderManager()->getGLRenderAction()
|
||||
->setTransparentDelayedObjectRenderType(SoGLRenderAction::ONE_PASS);
|
||||
}
|
||||
else if (renderType == 1) {
|
||||
_viewer->getSoRenderManager()->getGLRenderAction()
|
||||
->setTransparentDelayedObjectRenderType(SoGLRenderAction::NONSOLID_SEPARATE_BACKFACE_PASS);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
|
||||
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
|
||||
|
||||
@@ -1332,22 +1332,27 @@ bool View3DInventorViewer::isEnabledVBO() const
|
||||
|
||||
void View3DInventorViewer::setRenderCache(int mode)
|
||||
{
|
||||
if(mode<0) {
|
||||
if (mode<0) {
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View");
|
||||
int setting = hGrp->GetInt("RenderCache",0);
|
||||
if(mode==-2) {
|
||||
if(pcViewProviderRoot && setting!=1)
|
||||
|
||||
int setting = hGrp->GetInt("RenderCache", 0);
|
||||
if (mode == -2) {
|
||||
if (pcViewProviderRoot && setting != 1)
|
||||
pcViewProviderRoot->renderCaching = SoSeparator::ON;
|
||||
mode = 2;
|
||||
}else{
|
||||
if(pcViewProviderRoot)
|
||||
}
|
||||
else {
|
||||
if (pcViewProviderRoot)
|
||||
pcViewProviderRoot->renderCaching = SoSeparator::AUTO;
|
||||
mode = setting;
|
||||
}
|
||||
}
|
||||
|
||||
SoFCSeparator::setCacheMode(
|
||||
mode==0?SoSeparator::AUTO:(mode==1?SoSeparator::ON:SoSeparator::OFF));
|
||||
mode == 0 ? SoSeparator::AUTO :
|
||||
(mode == 1 ? SoSeparator::ON : SoSeparator::OFF)
|
||||
);
|
||||
}
|
||||
|
||||
void View3DInventorViewer::setEnabledNaviCube(bool on)
|
||||
|
||||
@@ -212,6 +212,11 @@ void Cloud::CloudWriter::createBucket()
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
#endif
|
||||
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
@@ -390,6 +395,10 @@ Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const ch
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
#endif
|
||||
if ( curl )
|
||||
{
|
||||
// Let's build our own header
|
||||
@@ -577,6 +586,10 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch
|
||||
std::string s;
|
||||
RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->SecretKey, NULL, 0);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
#endif
|
||||
if ( curl )
|
||||
{
|
||||
// Let's build our own header
|
||||
@@ -661,6 +674,10 @@ void Cloud::CloudReader::DownloadFile(Cloud::CloudReader::FileEntry *entry)
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
#endif
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
@@ -771,6 +788,10 @@ void Cloud::CloudWriter::pushCloud(const char *FileName, const char *data, long
|
||||
// Let's build the Header and call to curl
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
#ifdef ALLOW_SELF_SIGNED_CERTIFICATE
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
#endif
|
||||
if ( curl )
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#----------------------------- Control certificate validation ------------
|
||||
option(ALLOW_SELF_SIGNED_CERTIFICATE "Allow self signed certificate" OFF)
|
||||
if (ALLOW_SELF_SIGNED_CERTIFICATE)
|
||||
add_compile_options("-DALLOW_SELF_SIGNED_CERTIFICATE")
|
||||
endif ()
|
||||
#------------------------------ OpenSSL and CURL -------------------------
|
||||
if (APPLE)
|
||||
set(OPENSSL_ROOT_DIR ${HOMEBREW_PREFIX}/Cellar/openssl/*)
|
||||
endif(APPLE)
|
||||
if (UNIX AND NOT APPLE)
|
||||
if (UNIX AND APPLE)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(OPENSSL REQUIRED openssl)
|
||||
elseif(WIN32 AND LIBPACK_FOUND)
|
||||
@@ -27,8 +29,8 @@ elseif(WIN32 AND LIBPACK_FOUND)
|
||||
set(OPENSSL_VERSION ${openssl_version_str})
|
||||
endif ()
|
||||
else()
|
||||
find_package(OPENSSL REQUIRED)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif(UNIX AND APPLE)
|
||||
if(OPENSSL_FOUND)
|
||||
message(STATUS "openssl-${OPENSSL_VERSION} has been found\n")
|
||||
else()
|
||||
|
||||
@@ -13,7 +13,6 @@ SET(Draft_SRCS_base
|
||||
DraftVecUtils.py
|
||||
DraftGeomUtils.py
|
||||
DraftLayer.py
|
||||
DraftEdit.py
|
||||
DraftFillet.py
|
||||
WorkingPlane.py
|
||||
getSVG.py
|
||||
@@ -85,6 +84,7 @@ SET(Draft_GUI_tools
|
||||
draftguitools/gui_snaps.py
|
||||
draftguitools/gui_snapper.py
|
||||
draftguitools/gui_trackers.py
|
||||
draftguitools/gui_edit.py
|
||||
draftguitools/README.md
|
||||
)
|
||||
|
||||
|
||||
@@ -1619,7 +1619,7 @@ class DraftToolBar:
|
||||
"""this function sends the entered text to the active draft command
|
||||
if enter has been pressed twice. Otherwise it blanks the line.
|
||||
"""
|
||||
self.sourceCmd.text = self.textValue.toPlainText().split()
|
||||
self.sourceCmd.text = self.textValue.toPlainText().splitlines()
|
||||
self.sourceCmd.createObject()
|
||||
|
||||
def displayPoint(self, point=None, last=None, plane=None, mask=None):
|
||||
|
||||
@@ -36,7 +36,7 @@ __url__ = "https://www.freecadweb.org"
|
||||
# Generic stuff
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import sys, os, FreeCAD, FreeCADGui, WorkingPlane, math, re, Draft, Draft_rc, DraftVecUtils
|
||||
import sys, FreeCAD, FreeCADGui, WorkingPlane, math, Draft, Draft_rc, DraftVecUtils
|
||||
from FreeCAD import Vector
|
||||
from PySide import QtCore,QtGui
|
||||
import DraftGui
|
||||
@@ -56,9 +56,9 @@ if not hasattr(FreeCAD, "DraftWorkingPlane"):
|
||||
# Commands that have been migrated to their own modules
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import DraftEdit
|
||||
# import DraftFillet
|
||||
import draftguitools.gui_edit
|
||||
import draftguitools.gui_selectplane
|
||||
# import DraftFillet
|
||||
import drafttaskpanels.task_shapestring as task_shapestring
|
||||
import drafttaskpanels.task_scale as task_scale
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
# -*- coding: utf8 -*-
|
||||
"""Provide the Draft_Edit command used by the Draft workbench."""
|
||||
## @package gui_edit
|
||||
# \ingroup DRAFT
|
||||
# \brief Provide the Draft_Edit command used by the Draft workbench
|
||||
|
||||
#***************************************************************************
|
||||
#* Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
|
||||
#* Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
|
||||
@@ -38,7 +38,7 @@ class DraftImportTools(unittest.TestCase):
|
||||
|
||||
def test_import_gui_draftedit(self):
|
||||
"""Import Draft Edit."""
|
||||
module = "DraftEdit"
|
||||
module = "draftguitools.gui_edit"
|
||||
if not App.GuiUp:
|
||||
aux._no_gui(module)
|
||||
self.assertTrue(True)
|
||||
|
||||
@@ -251,6 +251,9 @@
|
||||
<property name="text">
|
||||
<string>Two-side rendering</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>TwoSideRendering</cstring>
|
||||
</property>
|
||||
|
||||
@@ -246,7 +246,7 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
("User parameter:BaseApp/Preferences/Mod/Part");
|
||||
NormalsFromUV = hPart->GetBool("NormalsFromUVNodes", NormalsFromUV);
|
||||
|
||||
long twoside = hPart->GetBool("TwoSideRendering", false) ? 1 : 0;
|
||||
long twoside = hPart->GetBool("TwoSideRendering", true) ? 1 : 0;
|
||||
|
||||
// Let the user define a custom lower limit but a value less than
|
||||
// OCCT's epsilon is not allowed
|
||||
|
||||
@@ -59,8 +59,7 @@ def toolDepthAndOffset(width, extraDepth, tool):
|
||||
toolOffset = float(tool.FlatRadius)
|
||||
extraOffset = float(tool.Diameter) / 2 - width if 180 == angle else extraDepth / tan
|
||||
offset = toolOffset + extraOffset
|
||||
if offset < 0.0001:
|
||||
offset = 0.01
|
||||
|
||||
return (depth, offset)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user