MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Process.hpp
Go to the documentation of this file.
1 #ifndef PROCESS_HPP
2 #define PROCESS_HPP
3 
10 #include <Config.hpp>
11 #include <GL.hpp>
12 
13 #include <Clip.hpp>
14 #include <CuttingSurface.hpp>
15 #include <Forall.hpp>
16 #include <Information.hpp>
17 #include <Mesh.hpp>
18 #include <Stack.hpp>
19 #include <Store.hpp>
20 #include <Vector.hpp>
21 
22 #include <algorithm>
23 #include <iostream>
24 #include <QIcon>
25 #include <QSharedPointer>
26 #include <QStringList>
27 #include <QTextStream>
28 #include <typeinfo>
29 
30 class QWidget;
31 class MorphoGraphX;
32 
42 #define PROCESS_VERSION 1243
43 
93 namespace mgx { namespace process {
214 
215  #ifndef DOXYGEN
216  enum SystemCommand { LOAD_VIEW = 1, SAVE_VIEW, UPDATE_STRUCTURE, SET_CURRENT_STACK, TAKE_SNAPSHOT, RESET_PROJECT };
217 
218  class PrivateProcess;
219  class SetupProcess;
220  class GlobalProcess;
221  #endif
222 
230  class mgx_EXPORT UserCancelException : public std::exception {
231  public:
232  UserCancelException() : std::exception() {}
233 
234  const char* what() const throw() {
235  return "Process canceled by user.";
236  }
237  };
238 
248  class mgx_EXPORT Process {
249  public:
250  static unsigned int processVersion;
251 
252  typedef std::vector<Stack*>::iterator stack_iterator;
253  typedef std::vector<Stack*>::const_iterator const_stack_iterator;
254 
255  typedef std::vector<Mesh*>::iterator mesh_iterator;
256  typedef std::vector<Mesh*>::const_iterator const_mesh_iterator;
257 
261  Process();
268  Process(const Process& p);
272  virtual ~Process() {}
273 
282  void actingFile(const QString& filename, bool project_file = false);
283 
287  QString actingFile() const;
288 
292  QString pythonCall(const QStringList& parms) const;
293 
297  int stackCount() const;
301  Stack* stack(int i);
305  Stack* currentStack();
309  int currentStackId() const;
313  void setCurrentStackId(int i);
314 
316  std::pair<stack_iterator, stack_iterator> stacks();
318  std::pair<const_stack_iterator, const_stack_iterator> stacks() const;
319 
323  Stack* addStack();
324 
330  bool deleteStack(int i);
331 
335  int meshCount() const;
339  Mesh* mesh(int i);
343  Mesh* currentMesh();
347  int currentMeshId() const;
351  void setCurrentMeshId(int i);
352 
354  std::pair<mesh_iterator, mesh_iterator> meshes();
356  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const;
357 
361  Mesh* addMesh(const Stack* stack);
362 
366  bool deleteMesh(int i);
367 
371  int selectedLabel() const;
372 
376  void setSelectedLabel(int label);
377 
381  float globalBrightness();
382 
386  float globalContrast();
387 
393  void setGlobalBrightness(float value);
394 
400  void setGlobalContrast(float value);
401 
405  bool meshSelection() const;
409  bool lineBorderSelection() const;
410 
415  void updateState();
419  void updateViewer();
420 
424  bool setErrorMessage(const QString& str);
425 
429  QString errorMessage() const;
430 
434  void setWarningMessage(const QString& str);
438  QString warningMessage() const;
439 
443  void userCancel() const {
444  throw UserCancelException();
445  }
446 
450  const QString& file() const;
451 
455  Clip* clip1();
459  Clip* clip2();
463  Clip* clip3();
464 
468  const Clip* clip1() const;
472  const Clip* clip2() const;
476  const Clip* clip3() const;
477 
481  CuttingSurface* cuttingSurface();
485  const CuttingSurface* cuttingSurface() const;
486 
488  //\name Methods needed to launch other processes
489 
493  Process* makeProcess(const QString& processType, const QString& processName);
494 
500  bool RunProcess(Process& proc, const QStringList& parms) throw();
501 
507  bool RunProcess(const QString& processType, const QString& processName, const QStringList& parms) throw();
509 
513  virtual QString type() const = 0;
514 
515  // @{ Functions to be defined by the user
516 
522  virtual bool operator()(const QStringList& parms) = 0;
527  virtual QString name() const = 0;
531  virtual QString description() const = 0;
540  virtual QString folder() const {
541  return QString();
542  }
548  virtual QStringList parmNames() const = 0;
554  virtual QStringList parmDescs() const {
555  return QStringList();
556  }
560  virtual QStringList parmDefaults() const {
561  return QStringList();
562  }
568  virtual ParmChoiceMap parmChoice() const {
569  return ParmChoiceMap();
570  }
577  virtual QIcon icon() const {
578  return QIcon();
579  }
591  virtual bool initialize(QStringList& /*parms*/, QWidget* /*parent*/) {
592  return true;
593  }
594  // @}
595 
600  {
601  return QStringList() << "Yes"
602  << "No";
603  }
608  {
609  return QStringList() << "Main"
610  << "Work";
611  }
612 
616  virtual uint numParms() const {
617  return parmDefaults().size();
618  }
619 
621  //\name Methods to get and check elements
622 
627  STACK_ANY = 0,
628  STACK_NON_EMPTY = 0x01,
629  STACK_VISIBLE = 0x02,
630  STACK_EMPTY = 0x04,
631 
632  STACK_SCALED = 0x08,
633  STACK_TRANSFORMED = 0x10,
634  STACK_NON_SCALED = 0x20,
635  STACK_NON_TRANSFORMED = 0x40,
636  };
637 
642  STORE_ANY = 0,
643  STORE_NON_EMPTY = 0x0001,
644  STORE_VISIBLE = 0x0002,
645  STORE_EMPTY = 0x0004,
646 
647  STORE_LABEL = 0x0008,
648  STORE_NON_LABEL = 0x0010,
649 
650  STORE_SCALED = 0x0020,
651  STORE_TRANSFORMED = 0x0040,
652  STORE_NON_SCALED = 0x0080,
653  STORE_NON_TRANSFORMED = 0x0100,
654 
655  STORE_WORK = 0x1000,
656  STORE_MAIN = 0x2000
657  };
658 
663  MESH_ANY = 0,
664  MESH_NON_EMPTY = 0x000001,
665  MESH_VISIBLE = 0x000002,
666 
667  MESH_HEAT = 0x000004,
668  MESH_LABEL = 0x000008,
669  MESH_NORMAL = 0x000010,
670 
671  MESH_SIGNAL = 0x000020,
672  MESH_TEXTURE = 0x000040,
673  MESH_IMAGE = 0x000080,
674 
675  MESH_SHOW_MESH = 0x000100,
676  MESH_SHOW_SURF = 0x000200,
677 
678  MESH_ALL = 0x000400,
679  MESH_BORDER = 0x000800,
680  MESH_CELLMAP = 0x001000,
681 
682  MESH_CELLS = 0x002000,
683  MESH_IMG_TEX = 0x004000,
684  MESH_SCALED = 0x008000,
685  MESH_TRANSFORMED = 0x010000,
686 
687  MESH_EMPTY = 0x020000,
688  MESH_NON_CELLS = 0x040000,
689  MESH_NON_IMG_TEX = 0x080000,
690  MESH_NON_SCALED = 0x100000,
691  MESH_NON_TRANSFORMED = 0x200000,
692 
693  MESH_PARENT = 0x400000,
694  MESH_LABEL_PARENT = 0x800000
695  };
696 
700  enum CheckType {
701  CHECK_STACK = 0,
702  CHECK_STORE = 1,
703  CHECK_MESH = 2
704  };
705 
706  enum CheckWhich {
707  CHECK_CURRENT = -1
708  };
709 
715  class mgx_EXPORT CheckState {
716  public:
717  CheckState(const CheckState& copy);
718  CheckState(Process* process);
719 
723  CheckState& store(int checks = STORE_ANY, int which = CHECK_CURRENT);
727  CheckState& stack(int checks = STACK_ANY, int which = CHECK_CURRENT);
731  CheckState& mesh(int checks = MESH_ANY, int which = CHECK_CURRENT);
732 
736  operator bool();
737 
738  protected:
739  void setError();
740 
741  struct ProcessReqs {
742  int type;
743  int checks;
744  int which;
745  };
746 
747  QList<ProcessReqs> reqs;
748  Process* process;
749  };
750 
751  friend class Process::CheckState;
752 
769  CheckState checkState();
771 
772  PrivateProcess* p;
773 
774  protected:
776 
782  bool systemCommand(SystemCommand cmd, const QStringList& parms);
786  bool stackCheck(int checks, int which);
790  bool storeCheck(int checks, int which);
794  bool meshCheck(int checks, int which);
795 
799  QString stackError(int checks, int which);
803  QString storeError(int checks, int which);
807  QString meshError(int checks, int which);
809  };
810 
819  class mgx_EXPORT StackProcess : public virtual Process {
820  friend class SetupProcess;
821  friend class GlobalProcess;
822  StackProcess() {
823  }
824 
825  public:
831  StackProcess(const StackProcess& copy) : Process(copy) {}
832 
833  virtual QString type() const {
834  return "Stack";
835  }
836  const Mesh* mesh(int i) {
837  return Process::mesh(i);
838  }
839  const Mesh* currentMesh() {
840  return Process::currentMesh();
841  }
842  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const {
843  return Process::meshes();
844  }
845  };
846 
855  class mgx_EXPORT MeshProcess : public virtual Process {
856  friend class SetupProcess;
857  friend class GlobalProcess;
858  MeshProcess() {
859  }
860 
861  public:
868  : Process(copy)
869  {
870  }
871 
872  virtual QString type() const {
873  return "Mesh";
874  }
875  const Stack* stack(int i) {
876  return Process::stack(i);
877  }
878  const Stack* currentStack() {
879  return Process::currentStack();
880  }
881  std::pair<const_stack_iterator, const_stack_iterator> stacks() const {
882  return Process::stacks();
883  }
884  };
885 
894  class mgx_EXPORT GlobalProcess : public MeshProcess, public StackProcess {
895  friend class SetupProcess;
896  GlobalProcess() {}
897 
898  public:
905  : Process(copy) , MeshProcess(copy) , StackProcess(copy) {}
906 
907  virtual QString type() const {
908  return "Global";
909  }
910  Mesh* mesh(int i) {
911  return Process::mesh(i);
912  }
913  Mesh* currentMesh() {
914  return Process::currentMesh();
915  }
916  Stack* stack(int i) {
917  return Process::stack(i);
918  }
919  Stack* currentStack() {
920  return Process::currentStack();
921  }
922  std::pair<stack_iterator, stack_iterator> stacks() {
923  return Process::stacks();
924  }
925  std::pair<const_stack_iterator, const_stack_iterator> stacks() const {
926  return Process::stacks();
927  }
928  std::pair<mesh_iterator, mesh_iterator> meshes() {
929  return Process::meshes();
930  }
931  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const {
932  return Process::meshes();
933  }
934 
935  bool setCurrentStack(int id, bool is_main);
936 
937  bool resetProject();
938 
939  bool takeSnapshot(QString filename, float overSampling = 1.0f, int width = 0, int height = 0, int quality = 95,
940  bool expand_frustum = false);
941 
942  using Process::systemCommand; //(SystemCommand cmd, const QStringList& parms);
943  };
944 
945  #ifndef DOXYGEN
946 
947  template <typename P> struct ProcessFactory {
948  typedef P ProcessType;
949 
950  ProcessFactory() : cnt(0) {}
951  ProcessFactory(const ProcessFactory&) : cnt(0) {}
952  virtual ~ProcessFactory() {}
953 
954  virtual ProcessType* operator()(const ProcessType& process) const = 0;
955 
956  int cnt;
957  };
958 
959  # ifdef WIN32
960  template struct mgx_EXPORT ProcessFactory<StackProcess>;
961  template struct mgx_EXPORT ProcessFactory<MeshProcess>;
962  template struct mgx_EXPORT ProcessFactory<GlobalProcess>;
963  # endif
964 
965  template <typename P, typename Process> struct ClassProcessFactory : public ProcessFactory<P> {
966  ClassProcessFactory() : ProcessFactory<P>() {}
967  ClassProcessFactory(const ClassProcessFactory& copy) : ProcessFactory<P>(copy) {}
968 
969  typedef P ProcessType;
970  virtual ProcessType* operator()(const ProcessType& process) const {
971  return new Process(process);
972  }
973  };
974 
975  template <typename X> struct FactoryPointer {
976  typedef X ProcessType;
977  typedef ProcessFactory<X> value;
978  typedef ProcessFactory<X>* pointer;
979  typedef ProcessFactory<X>& reference;
980  typedef const ProcessFactory<X>* const_pointer;
981  typedef const ProcessFactory<X>& const_reference;
982 
983  FactoryPointer() : p(0) {}
984 
985  FactoryPointer(pointer ptr) : p(ptr)
986  {
987  acquire();
988  }
989 
990  template <typename T>
991  FactoryPointer(T* ptr) : p(ptr)
992  {
993  acquire();
994  }
995 
996  FactoryPointer(const FactoryPointer& other) : p(other.p)
997  {
998  acquire();
999  }
1000 
1001  template <typename T>
1002  FactoryPointer(const FactoryPointer<T>& other) : p(other.p)
1003  {
1004  acquire();
1005  }
1006 
1007  ~FactoryPointer() {
1008  release();
1009  }
1010 
1011  operator bool() const { return bool(p); }
1012 
1013  ProcessType* operator()(const ProcessType& process) const {
1014  return (*p)(process);
1015  }
1016 
1017  template <typename T> FactoryPointer& operator=(const T* other)
1018  {
1019  if(p != other) {
1020  release();
1021  p = other;
1022  acquire();
1023  }
1024  return *this;
1025  }
1026 
1027  FactoryPointer& operator=(const FactoryPointer& other)
1028  {
1029  if(p != other.p) {
1030  release();
1031  p = other.p;
1032  acquire();
1033  }
1034  return *this;
1035  }
1036 
1037  template <typename T> FactoryPointer& operator=(const FactoryPointer<T>& other)
1038  {
1039  if(p != other.p) {
1040  release();
1041  p = other.p;
1042  acquire();
1043  }
1044  return *this;
1045  }
1046 
1047  bool operator==(const FactoryPointer& other) const {
1048  return p == other.p;
1049  }
1050 
1051  bool operator!=(const FactoryPointer& other) const {
1052  return p != other.p;
1053  }
1054 
1055  reference operator*() {
1056  return *p;
1057  }
1058  pointer operator->() {
1059  return p;
1060  }
1061 
1062  const_reference operator*() const {
1063  return *p;
1064  }
1065  const_pointer operator->() const {
1066  return p;
1067  }
1068 
1069  uintptr_t id() const {
1070  return (uintptr_t)p;
1071  }
1072 
1073  private:
1074  void release()
1075  {
1076  if(p) {
1077  p->cnt--;
1078  if(p->cnt == 0) {
1079  if(DEBUG)
1080  Information::out << "Deleting factory for " << util::qdemangle(typeid(*p).name())
1081  << " at address 0x" << QString::number(id(), 16) << endl;
1082  delete p;
1083  }
1084  p = 0;
1085  }
1086  }
1087 
1088  void acquire()
1089  {
1090  if(p)
1091  p->cnt++;
1092  }
1093 
1094  pointer p;
1095  };
1096 
1097  template <typename P> struct Registration {
1098  typedef P ProcessType;
1099  typedef FactoryPointer<P> processFactory;
1100  typedef QList<processFactory> factoryList;
1101 
1102  Registration(processFactory f, const char* class_name, unsigned int compiledVersion);
1103  ~Registration();
1104  static factoryList& processFactories();
1105 
1106  processFactory factory;
1107  const char* classname;
1108 
1109  private:
1110  static factoryList factories;
1111  };
1112 
1113  template <typename P>
1114  Registration<P>::Registration(processFactory f, const char* class_name, unsigned int compiledVersion)
1115  : factory(), classname(class_name)
1116  {
1117  if(DEBUG) {
1118  Information::out << "Registration of process " << util::qdemangle(classname) << " at address 0x"
1119  << QString::number(f.id(), 16) << endl
1120  << " Type of data: " << util::qdemangle(typeid(*f).name()) << endl;
1121  }
1122  if(Process::processVersion != compiledVersion) {
1123  QTextStream err(stderr);
1124  err << "Error registering factory " << util::qdemangle(class_name) << endl
1125  << " It has been compiled against a different revision of MorphoGraphX:" << QString::number(compiledVersion)
1126  << endl << " and MorphoGraphX is running process revision:" << QString::number(Process::processVersion)
1127  << endl;
1128  } else {
1129  factory = f;
1130  if(!factory and DEBUG)
1131  Information::out << "Storing null factory!" << endl;
1132  processFactories() << factory;
1133  }
1134  }
1135 
1136  template <typename P> Registration<P>::~Registration()
1137  {
1138  if(factory) {
1139  if(DEBUG) {
1140  Information::out << "Unregistration of process " << util::qdemangle(classname) << " at address 0x"
1141  << QString::number(factory.id(), 16) << endl
1142  << " Type of data: " << util::qdemangle(typeid(*factory).name()) << endl;
1143  }
1144  QList<processFactory>& list = processFactories();
1145  int size_before = list.size();
1146  for(int i = 0; i < list.size(); ++i) {
1147  if(list[i] == factory) {
1148  list.removeAt(i);
1149  break;
1150  }
1151  }
1152  if(DEBUG and list.size() == size_before) {
1153  Information::out << "Error, could not find processFactory to remove" << endl;
1154  }
1155  }
1156  }
1157 
1158  template <typename P> QList<typename Registration<P>::processFactory>& Registration<P>::processFactories()
1159  {
1160  return factories;
1161  }
1162 
1163  # ifdef WIN32
1164  template struct mgx_EXPORT Registration<StackProcess>;
1165  template struct mgx_EXPORT Registration<MeshProcess>;
1166  template struct mgx_EXPORT Registration<GlobalProcess>;
1167  # else
1168  template <typename P> typename Registration<P>::factoryList Registration<P>::factories;
1169  # endif
1170 
1171  typedef Registration<StackProcess> StackRegistration;
1172  typedef Registration<MeshProcess> MeshRegistration;
1173  typedef Registration<GlobalProcess> GlobalRegistration;
1174 
1175  typedef StackRegistration::processFactory stackProcessFactory;
1176  typedef MeshRegistration::processFactory meshProcessFactory;
1177  typedef GlobalRegistration::processFactory globalProcessFactory;
1178 
1179  inline QList<stackProcessFactory>& stackProcessFactories() {
1180  return StackRegistration::processFactories();
1181  }
1182  inline QList<meshProcessFactory>& meshProcessFactories() {
1183  return MeshRegistration::processFactories();
1184  }
1185  inline QList<globalProcessFactory>& globalProcessFactories() {
1186  return GlobalRegistration::processFactories();
1187  }
1188  #endif
1189 
1197  #define REGISTER_STACK_PROCESS(ClassName) \
1198  mgx::process::StackRegistration ClassName ## registration(new ClassProcessFactory<StackProcess, ClassName>(), \
1199  typeid(ClassName).name(), PROCESS_VERSION)
1200 
1208  #define REGISTER_MESH_PROCESS(ClassName) \
1209  mgx::process::MeshRegistration ClassName ## registration(new ClassProcessFactory<MeshProcess, ClassName>(), \
1210  typeid(ClassName).name(), PROCESS_VERSION)
1211 
1219  #define REGISTER_GLOBAL_PROCESS(ClassName) \
1220  mgx::process::GlobalRegistration ClassName ## registration(new ClassProcessFactory<GlobalProcess, ClassName>(), \
1221  typeid(ClassName).name(), PROCESS_VERSION)
1222 
1229  struct mgx_EXPORT BaseProcessDefinition {
1237  // uint nbNamedStrings; ///< Number of named string parameters
1238  // uint nbNamedValues; ///< Number of named value parameters
1240  };
1241 
1248  template <typename P> struct ProcessDefinition : public BaseProcessDefinition {
1254  typedef P process_t;
1258  typedef FactoryPointer<P> processFactory;
1262  processFactory factory;
1263  };
1264 
1265  #ifndef DOXYGEN
1266  typedef QMap<QString, ProcessDefinition<StackProcess> > stackProcessesMap_t;
1267  typedef QMap<QString, ProcessDefinition<MeshProcess> > meshProcessesMap_t;
1268  typedef QMap<QString, ProcessDefinition<GlobalProcess> > globalProcessesMap_t;
1269 
1270  mgx_EXPORT extern stackProcessesMap_t stackProcesses;
1271  mgx_EXPORT extern meshProcessesMap_t meshProcesses;
1272  mgx_EXPORT extern globalProcessesMap_t globalProcesses;
1273  #endif
1274 
1277 
1280  mgx_EXPORT BaseProcessDefinition* getBaseProcessDefinition(const QString& processType, const QString& processName);
1281 
1283  mgx_EXPORT bool getLastParms(const Process& proc, QStringList& parms);
1285  mgx_EXPORT bool getDefaultParms(const Process& proc, QStringList& parms);
1287  mgx_EXPORT bool saveDefaultParms(const Process& proc, const QStringList& parms);
1289  mgx_EXPORT bool checkProcessParms(const Process& proc, const QStringList& parms, size_t* nbParms = 0);
1291  mgx_EXPORT bool getLastParms(const QString& processType, const QString& processName, QStringList& parms);
1293  mgx_EXPORT bool getDefaultParms(const QString& processType, const QString& processName, QStringList& parms);
1295  mgx_EXPORT bool saveDefaultParms(const QString& processType, const QString& processName, const QStringList& parms);
1297  mgx_EXPORT bool checkProcessParms(const QString& processType, const QString& processName, const QStringList& parms,
1298  size_t* nbParms = 0);
1300  mgx_EXPORT BaseProcessDefinition* getBaseProcessDefinition(const QString& processThread, const QString& processName);
1301 
1305  mgx_EXPORT QStringList listProcesses(const QString& processType);
1306 
1310  mgx_EXPORT bool validProcessType(const QString& processType);
1314  mgx_EXPORT bool validProcessName(const QString& processType, const QString& processName);
1315 
1317  mgx_EXPORT bool stringToBool(const QString& string);
1319  mgx_EXPORT bool stringToWorkStore(const QString& string);
1321  mgx_EXPORT bool stringToMainStore(const QString& string);
1322 
1324  inline QString boolToString(bool b) {
1325  return (b ? "Yes" : "No");
1326  }
1327 
1329 }}
1330 #endif
StackProcess(const StackProcess &copy)
Copy constructor.
Definition: Process.hpp:831
Definition: CuttingSurface.hpp:18
virtual uint numParms() const
Returns the number of named string for this process.
Definition: Process.hpp:616
Stack * currentStack()
Returns the current stack (i.e.
This file contains the defines the forall loops.
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:833
AttribBase(const QString &name) const QString & name()
Default constructor of named attribute.
Definition: Attributes.hpp:54
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:872
virtual QStringList parmDescs() const
List of parameters descriptions.
Definition: Process.hpp:554
removeAt(int i)
QStringList parmNames
List of named parameters of the process.
Definition: Process.hpp:1232
Definition of a process, without the process factory.
Definition: Process.hpp:1229
MeshCheckType
Enumeration for the bitfield that identifies mesh properties.
Definition: Process.hpp:662
mgx_EXPORT bool validProcessName(const QString &processType, const QString &processName)
Check if the processName exist in the list of processType.
std::pair< mesh_iterator, mesh_iterator > meshes()
Iterate over all the meshs.
QString name
Name of the process.
Definition: Process.hpp:1230
mgx_EXPORT bool stringToWorkStore(const QString &string)
Returns true if string correspond to the work store, false otherwise.
mgx_EXPORT bool checkProcessParms(const QString &processType, const QString &processName, const QStringList &parms, size_t *nbParms=0)
Check if the parameters have enough defaults.
number(long n, int base=10)
Exception launched when a user clicks the Cancel button.
Definition: Process.hpp:230
std::pair< stack_iterator, stack_iterator > stacks()
Iterate over all the stacks.
QIcon icon
Icon of the process.
Definition: Process.hpp:1236
Definition of a process, including the process factory.
Definition: Process.hpp:1248
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
Definition: MorphoGraphX.hpp:43
mgx_EXPORT bool saveDefaultParms(const QString &processType, const QString &processName, const QStringList &parms)
Save the default parameters in memory.
StackCheckType
Enumeration for the bitfield that identifies stack properties.
Definition: Process.hpp:626
Stack * stack(int i)
Returns the ith stack, or 0 if there is no such stack.
virtual QString folder() const
Folder in which to place the process.
Definition: Process.hpp:540
GlobalProcess(const GlobalProcess &copy)
Copy constructor.
Definition: Process.hpp:904
CheckType
Enumeration of the type of checks that can be performed.
Definition: Process.hpp:700
QStringList parms
List of parameters/parameter defaults.
Definition: Process.hpp:1234
virtual QStringList parmDefaults() const
List of default parms.
Definition: Process.hpp:560
QStringList storeChoice() const
Helper function that provides a list of choices for choosing from the main or work stack...
Definition: Process.hpp:607
QString description
Description of the process.
Definition: Process.hpp:1231
StoreCheckType
Enumeration for the bitfield that identifies store properties.
Definition: Process.hpp:641
virtual ~Process()
Virtual destructor.
Definition: Process.hpp:272
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:907
void userCancel() const
Throw an exception informing the system that the user canceled the current process.
Definition: Process.hpp:443
processFactory factory
Process factory.
Definition: Process.hpp:1262
CheckWhich
Definition: Process.hpp:706
Mesh * mesh(int i)
Returns the ith mesh.
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:25
This is the main process class, the one all process inherit from.
Definition: Process.hpp:248
virtual bool initialize(QStringList &, QWidget *)
This is an optional method that is called only when a process is launched from the GUI...
Definition: Process.hpp:591
Global processes have full mutable access to all properties of the process.
Definition: Process.hpp:894
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
virtual QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: Process.hpp:577
mgx_EXPORT QStringList listProcesses(const QString &processType)
Returns the list of names of the processes of a given type.
mgx_EXPORT bool getLastParms(const QString &processType, const QString &processName, QStringList &parms)
Get the parameters for a given process.
QHash< int, QStringList > ParmChoiceMap
Type of the dictionary giving the list of possible strings for each argument.
Definition: Process.hpp:213
mgx_EXPORT BaseProcessDefinition * getBaseProcessDefinition(const QString &processType, const QString &processName)
Retrieves the process definition from the type and name of the process.
Definition: Clip.hpp:11
QStringList parmDescs
List of descriptions of named parameters.
Definition: Process.hpp:1233
mgx_EXPORT bool validProcessType(const QString &processType)
Check if processType is a valid type (i.e.
Class that construct a state check on the current process.
Definition: Process.hpp:715
mgx_EXPORT bool getDefaultParms(const QString &processType, const QString &processName, QStringList &parms)
Get the default parameters for a given process (i.e. the ones defined by the process) ...
bool systemCommand(SystemCommand cmd, const QStringList &parms)
Method that can be used to launch a system command.
This files contains the definition of a mesh for the Process API.
P process_t
Type of the generated process.
Definition: Process.hpp:1254
Stack processes have non-mutable access to meshes and mutable access to stacks.
Definition: Process.hpp:819
QStringList booleanChoice() const
Helper function that provides a list of choices for a boolean argument.
Definition: Process.hpp:599
QString folder
Folder in which to place the process.
Definition: Process.hpp:1235
Mesh * currentMesh()
Returns the current mesh (i.e.
QString boolToString(bool b)
Helper function converting a boolean into a string.
Definition: Process.hpp:1324
MeshProcess(const MeshProcess &copy)
Copy constructor.
Definition: Process.hpp:867
ParmChoiceMap parmChoice
Map of choices for parameters.
Definition: Process.hpp:1239
Defines the Vector class template This file is shared by cuda, do not include headers that nvcc can't...
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:855
mgx_EXPORT bool stringToMainStore(const QString &string)
Returns true if string correspond to the main store, false otherwise.
virtual ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: Process.hpp:568