MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshProcessSelection.hpp
1 #ifndef MESH_PROCESS_SELECTION_HPP
2 #define MESH_PROCESS_SELECTION_HPP
3 
4 #include <Process.hpp>
5 
6 namespace mgx {
7 namespace process {
10 
15 class mgxBase_EXPORT MeshSelectAll : public MeshProcess {
16 public:
17  MeshSelectAll(const MeshProcess& process)
18  : Process(process)
19  , MeshProcess(process)
20  {
21  }
22 
23  bool operator()(const QStringList& )
24  {
25  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
26  return false;
27  return (*this)(currentMesh());
28  }
29 
30  bool operator()(Mesh* m);
31 
32  QString folder() const {
33  return "Selection";
34  }
35  QString name() const {
36  return "Select All";
37  }
38  QString description() const {
39  return "Select all vertices of the current mesh";
40  }
42  return QStringList();
43  }
45  return QStringList();
46  }
47  QIcon icon() const {
48  return QIcon();
49  }
50 };
51 
57 class mgxBase_EXPORT MeshSelectBadNormals : public MeshProcess {
58 public:
59  MeshSelectBadNormals(const MeshProcess& process)
60  : Process(process)
61  , MeshProcess(process)
62  {
63  }
64 
65  bool operator()(const QStringList& )
66  {
67  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
68  return false;
69  return (*this)(currentMesh());
70  }
71 
72  bool operator()(Mesh* m);
73 
74  QString folder() const {
75  return "Selection";
76  }
77  QString name() const {
78  return "Select Bad Normals";
79  }
81  {
82  return "Select all vertices of the current mesh with bad normals (i.e. normals is not opf size 1)";
83  }
85  return QStringList();
86  }
88  return QStringList();
89  }
90  QIcon icon() const {
91  return QIcon();
92  }
93 };
94 
100 class mgxBase_EXPORT MeshUnselect : public MeshProcess {
101 public:
102  MeshUnselect(const MeshProcess& process)
103  : Process(process)
104  , MeshProcess(process)
105  {
106  }
107 
108  bool operator()(const QStringList& )
109  {
110  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
111  return false;
112  return (*this)(currentMesh());
113  }
114 
115  bool operator()(Mesh* m);
116 
117  QString folder() const {
118  return "Selection";
119  }
120  QString name() const {
121  return "Unselect";
122  }
124  return "Unselect the vertices of the current mesh";
125  }
127  return QStringList();
128  }
130  return QStringList();
131  }
132  QIcon icon() const {
133  return QIcon();
134  }
135 };
136 
142 class mgxBase_EXPORT MeshInvertSelection : public MeshProcess {
143 public:
144  MeshInvertSelection(const MeshProcess& process)
145  : Process(process)
146  , MeshProcess(process)
147  {
148  }
149 
150  bool operator()(const QStringList& )
151  {
152  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
153  return false;
154  return (*this)(currentMesh());
155  }
156 
157  bool operator()(Mesh* m);
158 
159  QString folder() const {
160  return "Selection";
161  }
162  QString name() const {
163  return "Invert Selection";
164  }
166  return "Invert the selection of the current mesh.";
167  }
169  return QStringList();
170  }
172  return QStringList();
173  }
174  QIcon icon() const {
175  return QIcon();
176  }
177 };
178 
185 class mgxBase_EXPORT MeshSelectUnlabeled : public MeshProcess {
186 public:
187  MeshSelectUnlabeled(const MeshProcess& process)
188  : Process(process)
189  , MeshProcess(process)
190  {
191  }
192 
193  bool operator()(const QStringList& parms)
194  {
195  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
196  return false;
197  bool replace = stringToBool(parms[0]);
198  return (*this)(currentMesh(), replace);
199  }
200 
201  bool operator()(Mesh* m, bool replace);
202 
203  QString folder() const {
204  return "Selection";
205  }
206  QString name() const {
207  return "Select Unlabeled";
208  }
210  return "Add to or replace the selection with the unlabeled vertices.";
211  }
213  return QStringList() << "Replace selection";
214  }
216  return QStringList() << "Replace selection";
217  }
219  return QStringList() << "No";
220  }
222  {
223  ParmChoiceMap map;
224  map[0] = booleanChoice();
225  return map;
226  }
227  QIcon icon() const {
228  return QIcon();
229  }
230 };
231 
237 class mgxBase_EXPORT MeshSelectLabeled : public MeshProcess {
238 public:
239  MeshSelectLabeled(const MeshProcess& process)
240  : Process(process)
241  , MeshProcess(process)
242  {
243  }
244 
245  bool operator()(const QStringList& parms)
246  {
247  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
248  return false;
249  bool replace = stringToBool(parms[0]);
250  return (*this)(currentMesh(), replace);
251  }
252 
253  bool operator()(Mesh* m, bool replace);
254 
255  QString folder() const {
256  return "Selection";
257  }
258  QString name() const {
259  return "Select Labeled";
260  }
262  return "Add to or replace the selection with the labeled vertices.";
263  }
265  return QStringList() << "Replace selection";
266  }
268  return QStringList() << "Replace selection";
269  }
271  return QStringList() << "No";
272  }
274  {
275  ParmChoiceMap map;
276  map[0] = booleanChoice();
277  return map;
278  }
279  QIcon icon() const {
280  return QIcon();
281  }
282 };
283 
287 class mgxBase_EXPORT MeshSelectLabel : public MeshProcess {
288 public:
289  MeshSelectLabel(const MeshProcess& process)
290  : Process(process)
291  , MeshProcess(process)
292  {
293  }
294 
295  bool operator()(const QStringList& parms)
296  {
297  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
298  return false;
299  bool replace = stringToBool(parms[0]);
300  return (*this)(currentMesh(), replace, parms[1].toInt());
301  }
302 
303  bool operator()(Mesh* m, bool replace, int label);
304 
305  QString folder() const {
306  return "Selection";
307  }
308  QString name() const {
309  return "Select Label";
310  }
312  {
313  return "Add to or replace the selection with the vertices of a given label (0 for current label).";
314  }
316  {
317  return QStringList() << "Replace selection"
318  << "Label (0 for current)";
319  }
321  {
322  return QStringList() << "No"
323  << "0";
324  }
326  {
327  ParmChoiceMap map;
328  map[0] = booleanChoice();
329  return map;
330  }
331  QIcon icon() const {
332  return QIcon();
333  }
334 };
335 
341 class mgxBase_EXPORT MeshUnselectLabel : public MeshProcess {
342 public:
343  MeshUnselectLabel(const MeshProcess& process)
344  : Process(process)
345  , MeshProcess(process)
346  {
347  }
348 
349  bool operator()(const QStringList& parms)
350  {
351  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
352  return false;
353  return (*this)(currentMesh(), parms[0].toInt());
354  }
355 
356  bool operator()(Mesh* m, int label);
357 
358  QString folder() const {
359  return "Selection";
360  }
361  QString name() const {
362  return "Unselect Label";
363  }
365  {
366  return "Remove the vertices of a given label (0 for current label) from the selection.";
367  }
369  return QStringList() << "Label (0 for current)";
370  }
372  return QStringList() << "Label (0 for current)";
373  }
375  return QStringList() << "0";
376  }
377  QIcon icon() const {
378  return QIcon();
379  }
380 };
381 
387 class mgxBase_EXPORT MeshSelectClip : public MeshProcess {
388 public:
389  MeshSelectClip(const MeshProcess& process)
390  : Process(process)
391  , MeshProcess(process)
392  {
393  }
394 
395  bool operator()(const QStringList& )
396  {
397  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
398  return false;
399  return (*this)(currentMesh());
400  }
401 
402  bool operator()(Mesh* m);
403 
404  QString folder() const {
405  return "Selection";
406  }
407  QString name() const {
408  return "Select Clip Region";
409  }
411  return "Add vertices in clip region to selection.";
412  }
414  return QStringList();
415  }
417  return QStringList();
418  }
419  QIcon icon() const {
420  return QIcon();
421  }
422 };
423 
430 class mgxBase_EXPORT MeshSelectWholeLabelExtend : public MeshProcess {
431 public:
433  : Process(process)
434  , MeshProcess(process)
435  {
436  }
437 
438  bool operator()(const QStringList& )
439  {
440  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
441  return false;
442  return (*this)(currentMesh());
443  }
444 
445  bool operator()(Mesh* m);
446 
447  QString folder() const {
448  return "Selection";
449  }
450  QString name() const {
451  return "Extend to Whole Cells";
452  }
454  return "Extend Selection to Whole Cells";
455  }
457  return QStringList();
458  }
460  return QStringList();
461  }
462  QIcon icon() const {
463  return QIcon();
464  }
465 };
466 
472 class mgxBase_EXPORT MeshSelectDuplicateCells : public MeshProcess {
473 public:
474  MeshSelectDuplicateCells(const MeshProcess& process)
475  : Process(process)
476  , MeshProcess(process)
477  {
478  }
479 
480  bool operator()(const QStringList& )
481  {
482  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SHOW_MESH))
483  return false;
484  return (*this)(currentMesh());
485  }
486 
487  bool operator()(Mesh* m);
488 
489  QString folder() const {
490  return "Selection";
491  }
492  QString name() const {
493  return "Select Duplicate Cells";
494  }
496  return "Select cells with duplicate labels.";
497  }
499  return QStringList();
500  }
502  return QStringList();
503  }
504  QIcon icon() const {
505  return QIcon();
506  }
507 };
508 
516 public:
517  ExtendByConnectivity(const MeshProcess& process)
518  : Process(process)
519  , MeshProcess(process)
520  {
521  }
522 
523  bool operator()(const QStringList& )
524  {
526  return false;
527  return operator()(currentMesh());
528  }
529 
530  bool operator()(Mesh* m);
531 
532  QString folder() const {
533  return "Selection";
534  }
535  QString name() const {
536  return "Extend by Connectivity";
537  }
539  return "Extend the selection to connected regions";
540  }
542  return QStringList();
543  }
545  return QStringList();
546  }
547  QIcon icon() const {
548  return QIcon(":/images/SelectConnected.png");
549  }
550 };
552 } // namespace process
553 } // namespace mgx
554 
555 #endif
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:108
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:453
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:456
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:84
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:264
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:368
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:438
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:23
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessSelection.hpp:374
Select all vertices within the clipped region.
Definition: MeshProcessSelection.hpp:387
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:407
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:90
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:480
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:193
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessSelection.hpp:273
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:258
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:358
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:162
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:174
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:305
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:295
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:315
Select all the vertices with invalid normals in the current mesh.
Definition: MeshProcessSelection.hpp:57
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:32
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:65
Ensure no vertex is selected in the current mesh.
Definition: MeshProcessSelection.hpp:100
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:245
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessSelection.hpp:221
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:168
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:364
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:450
Process()
Default constructor.
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:544
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:255
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:150
Invert the selection status of all the vertices in the current mesh.
Definition: MeshProcessSelection.hpp:142
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:413
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:227
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:41
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:419
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:462
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:80
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:261
CheckState checkState()
Call this function and convert the result to a boolean.
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessSelection.hpp:320
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:492
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:532
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:410
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:489
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:212
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:459
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:361
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessSelection.hpp:270
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:331
Unselect all the vertices having a given label.
Definition: MeshProcessSelection.hpp:341
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:117
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:308
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:279
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:38
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:215
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:541
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:165
File containing the definition of a Process.
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:416
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:77
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:447
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:267
Mesh * mesh(int i)
Returns the ith mesh.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:248
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:535
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:123
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:371
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:311
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:206
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:74
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:132
Select all labeled vertices in the current mesh.
Definition: MeshProcessSelection.hpp:237
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
Select all the unlabel vertices of the current mesh.
Definition: MeshProcessSelection.hpp:185
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:501
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:171
Select vertices if the region with their label is not contiguous (e.g.
Definition: MeshProcessSelection.hpp:472
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:35
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:47
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:504
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:498
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:547
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:209
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:44
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:87
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:495
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:349
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessSelection.hpp:325
Select all the vertices in the current mesh.
Definition: MeshProcessSelection.hpp:15
Non-empty mesh.
Definition: Process.hpp:664
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:203
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:404
Definition: MeshProcessSelection.hpp:287
Extend the current selection to all vertices that are connected to a currently selected vertex...
Definition: MeshProcessSelection.hpp:515
Mesh * currentMesh()
Returns the current mesh (i.e.
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessSelection.hpp:126
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessSelection.hpp:377
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:523
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessSelection.hpp:129
QString folder() const
Folder in which to place the process.
Definition: MeshProcessSelection.hpp:159
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessSelection.hpp:218
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:855
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessSelection.hpp:395
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessSelection.hpp:538
QString name() const
Returns the name of the process.
Definition: MeshProcessSelection.hpp:120
Extent the current selection so each label having at least one vertex selected will be fully selected...
Definition: MeshProcessSelection.hpp:430