mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
The visual links between functions are recovered. The demo is synchronized with a corresponding demo from Qt (qt486-vc10-32\examples\graphicsview\elasticnodes). It may be successfully compiled by any further versions of Qt including 5.10.1 Also, because Open CASCADE (and OCAF in particular) is improved for usage in multi-threading mode, usage of mutexes is added in this sample (for access to the sharing TNaming_UsedShapes attribute, for example).
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#ifndef _FTHREAD_H_
|
|
#define _FTHREAD_H_
|
|
|
|
#include <Standard_WarningsDisable.hxx>
|
|
#include <QThread>
|
|
#include <Standard_WarningsRestore.hxx>
|
|
|
|
#include <TFunction_Logbook.hxx>
|
|
#include <TFunction_Iterator.hxx>
|
|
#include <TFunction_Driver.hxx>
|
|
#include <Standard_Mutex.hxx>
|
|
|
|
class GraphWidget; // shows graphically execution of functions
|
|
|
|
class FThread : public QThread
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
FThread(QObject* parent = 0);
|
|
~FThread();
|
|
|
|
void setIterator(const TFunction_Iterator& ); // to iterate and call functions
|
|
void setLogbook(const Handle(TFunction_Logbook)& ); // to set logbook with modifications
|
|
void setGraph(GraphWidget* ); // to change color of a graph circle
|
|
void setThreadIndex(const int ); // to set the index of the thread
|
|
void setMutex(Standard_Mutex* );
|
|
|
|
protected:
|
|
|
|
void run();
|
|
virtual TDF_Label getFreeFunction(); // Returns any free (not executed yet) function
|
|
|
|
private:
|
|
|
|
TFunction_Iterator itr;
|
|
Handle(TFunction_Logbook) log;
|
|
Standard_Mutex* pmutex;
|
|
int thread_index;
|
|
|
|
GraphWidget* graph;
|
|
};
|
|
|
|
#endif // _FTHREAD_H_
|