MEPP2 Project
SimpleWindow.inl
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 
14 #include <QDebug>
15 #include <QMenuBar>
16 
17 #include <QSettings>
18 #if(FEVV_USE_QT5) // Qt6 in fact...
19  #include <QScreen>
20 #else
21  #include <QDesktopWidget>
22 #endif
23 
24 #include <QCloseEvent>
25 
26 #include <boost/assert.hpp>
27 
28 // Plugins
29 #include <QApplication> // for qApp
30 #include <QFileDialog>
31 #include <QFileInfo>
32 
33 #if(FEVV_USE_QT5)
34 //#include <QScreen> // for grabWindow (no more need here now, it was before Qt6...)
35 #endif
36 
37 #include <QPluginLoader>
40 // Plugins
41 
42 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
43  // "BOOST_JOIN" ' -> (qt4 pb with boost)
45 
46 #include "Visualization/SimpleAdapterVisu.h" // for create an adapter (a child)
47 #endif
48 
49 #include "Visualization/MdiArea.h"
50 
51 #define USE_MDI true
52 
53 #define STEP_SPACE 0. // TEMP
54 
55 #define ORGANIZATION QObject::tr("LIRIS")
56 #define APPLICATION QObject::tr("MEPP2")
57 
58 
59 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
60  // "BOOST_JOIN" ' -> (qt4 pb with boost)
63 
64 #ifdef FEVV_USE_CGAL
67 #endif //FEVV_USE_CGAL
68 
69 #ifdef FEVV_USE_PCL
72 #endif //FEVV_USE_PCL
73 #endif //Q_MOC_RUN
74 
75 
76 inline FEVV::SimpleWindow::SimpleWindow(QWidget *_parent,
77  Qt::WindowFlags _flags)
78  : BaseWindowQt(_parent, _flags)
79 {
80 #ifdef DEBUG_VISU2
81  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
82 #endif
83 
84  ui.setupUi(this);
85 
86 #ifdef DEBUG_VISU2
87  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
88 #endif
89 }
90 
92 {
93 #ifdef DEBUG_VISU2
94  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
95 #endif
96 
97  if(mdiArea != nullptr)
98  {
99  delete mdiArea;
100  }
101 
102  // DirView
103  delete tree;
104  delete proxyModel;
105  delete model;
106  delete dockDirView;
107 
108  for (int i = 0; i < MaxRecentFiles; ++i)
109  {
110  delete recentFileActs[i];
111  }
112 
113 #ifdef DEBUG_VISU2
114  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
115 #endif
116 }
117 
118 inline void
120 {
121  AdapterQt *adapter = dynamic_cast< AdapterQt * >(_adapter);
122  if(adapter)
123  {
124  attach(adapter);
125  }
126  else
127  {
128  Assert::check(false,
129  "is not implemented. See attach(AdapterQt) instead.",
130  "SimpleWindow::attach(Adapter)");
131  }
132 }
133 
134 inline void
135 FEVV::SimpleWindow::attach(AdapterQt *_adapter, const bool _useMdiWindows)
136 {
137  if(!Assert::check(_adapter != nullptr,
138  "The given adapter is null.",
139  "SimpleWindow::attach(AdapterQt,bool)"))
140  {
141  return;
142  }
143 
144  adapters.push_back(_adapter);
145  _adapter->getViewer()->attach(this);
146 
147  if(_useMdiWindows)
148  {
149  _adapter->setMinimumSize(300, 200); // default value is 300 x 200 pixels
150  mdiArea->addSubWindow(_adapter);
151  }
152  else
153  {
154  unsigned int nbAdapters = adapters.size();
155  unsigned int nbLines = (unsigned int)round(std::sqrt(nbAdapters));
156  unsigned int nbColumns = (unsigned int)ceil((double)nbAdapters / nbLines);
157 
158  for(unsigned int iLines = 0; iLines < nbLines; ++iLines)
159  {
160  for(unsigned int iColumns = 0; iColumns < nbColumns; ++iColumns)
161  {
162  unsigned int index = iLines * nbColumns + iColumns;
163  if(index >= nbAdapters)
164  {
165  break;
166  }
167  ui.gridLayout->addWidget(
168  static_cast< AdapterQt * >(adapters[index]), iLines, iColumns);
169 
170  // if( index % 2 == 0 )
171  // {
172  // ui.gridLayout->addWidget( static_cast<AdapterQt*>(adapters[index]),
173  // index, 0 );//iLines+1, iColumns+1 );
174  // }
175  // else
176  // {
177  // ui.gridLayout->addWidget( static_cast<AdapterQt*>(adapters[index]),
178  // 0, index );//iLines+1, iColumns+1 );
179  // }
180  }
181  }
182  }
183 
184  update();
185 }
186 
187 inline void
189 {
190  _plugin->addParameters(this);
191 }
192 
193 inline void
195 {
196  init(false);
197 }
198 
199 inline void
200 FEVV::SimpleWindow::init(const bool _test, const int _width, const int _height)
201 {
202  if(!Assert::check(
203  !bIsInit, "is already init. Leaving...", "SimpleWindow::init"))
204  {
205  return;
206  }
207 
208  setlocale(LC_ALL, "C"); // very important for Linux
209 
210  // --- JUST HERE FOR AUTOMATIC TEST ---
211  if(_test)
212  {
213  clean_closure = true;
214  connect(&timerQuit, SIGNAL(timeout()), this, SLOT(close()));
215  timerQuit.start(10000);
216  }
217  // --- JUST HERE FOR AUTOMATIC TEST ---
218 
219 #ifdef DEBUG_VISU
223 #endif
224 
225  setMinimumSize(_width, _height);
226  resize(_width, _height);
227 
228  readSettings();
229 
230  std::srand(std::time(0)); // @todo only for debug
231 
232  QObject::connect(
233  ui.listModels,
234  SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
235  this,
236  SLOT(onItemChanged(QListWidgetItem *, QListWidgetItem *)));
237 
238  // QMenuBar *menuBar = this->menuBar();
239  // QMenu* menu = menuBar->addMenu( "Debug" );
240  // menu->addAction( "Add Random Sphere", this, SLOT( onAddBall() ) );
241 
242  // Plugins
243  menuPlugins = ui.menuPlugins; // menuBar->addMenu("Plugins (old)");
244  menuPlugins->addAction("Plugins information", this, SLOT(aboutPlugins()));
245 
246 #if(FEVV_USE_QT5)
247  ui.menuHelp->addSeparator();
248  ui.menuHelp->addAction("Screenshot", this, SLOT(onGrab()));
249 #endif
250 
251  QObject::connect(
252  ui.applyButton, SIGNAL(clicked(bool)), this, SLOT(onApplyButton()));
253  ui.applyButton->setEnabled(false);
254 
255  ui.listParams->setVisible(false);
256 
257  // ---
258 
259  // MdiArea
260  if(USE_MDI)
261  {
262  mdiArea = new /*Q*/MdiArea(this);
263  // mdiArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); //
264  // Qt::ScrollBarAlwaysOff mdiArea->setVerticalScrollBarPolicy(
265  // Qt::ScrollBarAsNeeded ); // Qt::ScrollBarAlwaysOff
266 
267  ui.gridLayout->addWidget(mdiArea, 0, 0);
268 
269  connect(
270  ui.actionTile, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows()));
271  connect(ui.actionCascade,
272  SIGNAL(triggered()),
273  mdiArea,
274  SLOT(cascadeSubWindows()));
275 
276  // connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this,
277  // SLOT(updateMenus())); // TODO
278 
279  // only if MdiArea instead of QMdiArea
280  mdiArea->setAcceptDrops(true);
281  mdiArea->setMainWindow(this);
282  // only if MdiArea instead of QMdiArea
283  }
284 
285  // ---
286 
287  // DirView
288  dockDirView = new QDockWidget(QObject::tr(" Directory View"), this);
289  dockDirView->setObjectName("dockDirView");
290  dockDirView->setMinimumWidth(m_dockDirView_MinimumWidth);
291  this->addDockWidget(Qt::RightDockWidgetArea, dockDirView);
292 
293  model = new QFileSystemModel;
294  QStringList filters;
295  filters << "*.obj" << "*.off" << "*.coff" << "*.ply" << "*.msh"; // defaultExtensions
296 #ifdef FEVV_USE_VTK
297  filters << "*.vtk" << "*.vtp" << "*.vtu"; // vtkExtensions
298 #endif
299 #ifdef FEVV_USE_FBX
300  filters << "*.fbx"; // FBX
301 #endif
302 // Point clouds
303 #ifdef FEVV_USE_CGAL
304  filters << "*.xyz"; // CGALPOINTSET
305 #endif
306 #ifdef FEVV_USE_PCL
307  filters << "*.pcd"; // PCLPOINTCLOUD
308 #endif
309  model->setNameFilters(filters);
310  model->setNameFilterDisables(false);
311 
312  proxyModel = new QSortFilterProxyModel;
313  proxyModel->setSourceModel(model);
314 
315  tree = new QTreeView();
316  tree->setModel(proxyModel); // model
317  tree->setSortingEnabled(true);
318 
319  tree->setColumnHidden(2, true);
320  tree->setColumnWidth(0, 320);
321  tree->sortByColumn(0, Qt::AscendingOrder);
322 
323  //QString location("C:\\_mt_\\MEPP2\\MEPP2.mto-master\\Testing\\Data\\");
324  QModelIndex index = model->setRootPath(treeLocation/*location*//*model->rootPath()*/);
325  QModelIndex proxyIndex = proxyModel->mapFromSource(index);
326 
327  tree->scrollTo(proxyIndex);
328  tree->setExpanded(proxyIndex, true);
329  tree->setCurrentIndex(proxyIndex);
330 
331  tree->setSelectionMode(QAbstractItemView::ExtendedSelection); // QAbstractItemView::MultiSelection
332  tree->setDragEnabled(true);
333 
334  dockDirView->setWidget(tree);
335 
336  // ---
337 
338  for (int i = 0; i < MaxRecentFiles; ++i)
339  {
340  recentFileActs[i] = new QAction(this);
341  recentFileActs[i]->setVisible(false);
342  connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
343  }
344 
345  QMenu *menuFile = ui.menuFile;
346  separatorAct_menuFile = menuFile->addSeparator();
347  for (int i = 0; i < MaxRecentFiles; ++i)
348  menuFile->addAction(recentFileActs[i]);
349 
350  updateRecentFileActions();
351 
352  // ---
353 
354  // time
355  // TODO LATER - SPACE/TIME - FINDME
356  /*ui.actionDyn_First->setEnabled(false);
357  ui.actionDyn_Previous->setEnabled(false);
358  ui.actionDyn_Next->setEnabled(false);
359  ui.actionDyn_Last->setEnabled(false);
360 
361  ui.actionChange_viewer_mode->setEnabled(false);*/
362  // time
363 
364  // create default empty viewer
365  //createNewViewer();
366 
367  bIsInit = true;
368 }
369 
370 inline void
371 FEVV::SimpleWindow::setParam(std::string /*_name*/,
372  int * /*_value*/,
373  std::string /*_pluginName*/,
374  Plugin * /*_plugin*/)
375 {
376 #if 0
377  // @todo missing delete of next line allocation
378  QLabel* testLabel = new QLabel( ui.listParams );
379  testLabel->setObjectName(QString::fromUtf8("label"));
380  testLabel->setText(QString::fromUtf8(_name.c_str()));
381 
382  // @todo missing delete of next line allocation
383  SimpleLineEdit* testValue = new SimpleLineEdit( ui.listParams );
384 
385  testValue->setObjectName(QString::fromUtf8("value"));
386  testValue->setText(QString::fromUtf8(std::to_string(*_value).c_str()));
387  testValue->setParams(_value, _pluginName, _plugin);
388 
389  QObject::connect(testValue, SIGNAL(textChanged(QString)), testValue, SLOT(modificationSlot()));
390  QObject::connect(testValue, SIGNAL(modificationSignal(std::string, BasePlugin*)), this, SLOT(onModificationParam(std::string, BasePlugin*)));
391 
392  QObject* p = dynamic_cast< QObject* >(_plugin);
393  if (p) QObject::connect(p, SIGNAL(resetSignal()), testValue, SLOT(resetSlot()));
394 
395  ui.formLayout->addRow( testLabel, testValue );
396 #endif
397 }
398 
399 inline void
400 FEVV::SimpleWindow::setParam(std::string /*_name*/,
401  double * /*_value*/,
402  std::string /*_pluginName*/,
403  Plugin * /*_plugin*/)
404 {
405 #if 0
406  QLabel* testLabel = new QLabel( ui.listParams );
407  testLabel->setObjectName(QString::fromUtf8("label"));
408  testLabel->setText(QString::fromUtf8(_name.c_str()));
409 
410  SimpleLineEdit* testValue = new SimpleLineEdit( ui.listParams );
411  testValue->setObjectName(QString::fromUtf8("value"));
412  testValue->setText(QString::fromUtf8(std::to_string(*_value).c_str()));
413  testValue->setParams(_value, _pluginName, _plugin);
414 
415  QObject::connect(testValue, SIGNAL(textChanged(QString)), testValue, SLOT(modificationSlot()));
416  QObject::connect(testValue, SIGNAL(modificationSignal(std::string, BasePlugin*)), this, SLOT(onModificationParam(std::string, BasePlugin*)));
417 
418  QObject* p = dynamic_cast< QObject* >(_plugin);
419  if (p) QObject::connect(p, SIGNAL(resetSignal()), testValue, SLOT(resetSlot()));
420 
421  ui.formLayout->addRow( testLabel, testValue );
422 #endif
423 }
424 
425 inline void
426 FEVV::SimpleWindow::setParam(std::string /*_name*/,
427  float * /*_value*/,
428  std::string /*_pluginName*/,
429  Plugin * /*_plugin*/)
430 {
431 #if 0
432  QLabel* testLabel = new QLabel( ui.listParams );
433  testLabel->setObjectName(QString::fromUtf8("label"));
434  testLabel->setText(QString::fromUtf8(_name.c_str()));
435 
436  SimpleLineEdit* testValue = new SimpleLineEdit( ui.listParams );
437  testValue->setObjectName(QString::fromUtf8("value"));
438  testValue->setText(QString::fromUtf8(std::to_string(*_value).c_str()));
439  testValue->setParams(_value, _pluginName, _plugin);
440 
441  QObject::connect(testValue, SIGNAL(textChanged(QString)), testValue, SLOT(modificationSlot()));
442  QObject::connect(testValue, SIGNAL(modificationSignal(std::string, BasePlugin*)), this, SLOT(onModificationParam(std::string, BasePlugin*)));
443 
444  QObject* p = dynamic_cast< QObject* >(_plugin);
445  if (p) QObject::connect(p, SIGNAL(resetSignal()), testValue, SLOT(resetSlot()));
446 
447  ui.formLayout->addRow( testLabel, testValue );
448 #endif
449 }
450 
451 inline void
452 FEVV::SimpleWindow::setParam(std::string /*_name*/,
453  bool * /*_value*/,
454  std::string /*_pluginName*/,
455  Plugin * /*_plugin*/)
456 {
457 #if 0
458  QLabel* testLabel = new QLabel( ui.listParams );
459  testLabel->setObjectName(QString::fromUtf8("label"));
460  testLabel->setText(QString::fromUtf8(_name.c_str()));
461 
462  SimpleCheckBox* testValue = new SimpleCheckBox( ui.listParams );
463  testValue->setObjectName(QString::fromUtf8("value"));
464  Qt::CheckState state = (*_value) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked;
465  testValue->setCheckState(state);
466  testValue->setParams(_value, _pluginName, _plugin);
467 
468  QObject::connect(testValue, SIGNAL(stateChanged(int)), testValue, SLOT(modificationSlot()));
469  QObject::connect(testValue, SIGNAL(modificationSignal(std::string, BasePlugin*)), this, SLOT(onModificationParam(std::string, BasePlugin*)));
470 
471  QObject* p = dynamic_cast< QObject* >(_plugin);
472  if (p) QObject::connect(p, SIGNAL(resetSignal()), testValue, SLOT(resetSlot()));
473 
474  ui.formLayout->addRow( testLabel, testValue );
475 #endif
476 }
477 
478 inline void
479 FEVV::SimpleWindow::setParam(std::string /*_name*/,
480  std::string * /*_value*/,
481  std::string /*_pluginName*/,
482  Plugin * /*_plugin*/)
483 {
484 #if 0
485  QLabel* testLabel = new QLabel( ui.listParams );
486  testLabel->setObjectName(QString::fromUtf8("label"));
487  testLabel->setText(QString::fromUtf8(_name.c_str()));
488 
489  SimpleLineEdit* testValue = new SimpleLineEdit( ui.listParams );
490  testValue->setObjectName(QString::fromUtf8("value"));
491  testValue->setText(QString::fromUtf8(_value->c_str()));
492  testValue->setParams(_value, _pluginName, _plugin);
493 
494  QObject::connect(testValue, SIGNAL(textChanged(QString)), testValue, SLOT(modificationSlot()));
495  QObject::connect(testValue, SIGNAL(modificationSignal(std::string, BasePlugin*)), this, SLOT(onModificationParam(std::string, BasePlugin*)));
496 
497  QObject* p = dynamic_cast< QObject* >(_plugin);
498  if (p) QObject::connect(p, SIGNAL(resetSignal()), testValue, SLOT(resetSlot()));
499 
500  ui.formLayout->addRow( testLabel, testValue );
501 #endif
502 }
503 
504 inline void
506  Plugin *_plugin)
507 {
508  // std::cout << "onModificationParam called" << std::endl;
509  if(_pluginName == "")
510  {
511  return;
512  }
513  if(stackPlugins.find(_pluginName) == stackPlugins.end())
514  {
515  stackPlugins.insert({_pluginName, _plugin});
516  ui.applyButton->setEnabled(true);
517  }
518  // else
519  // {
520  // std::cout << "Already inside stackPlugins" << std::endl;
521  // }
522 }
523 
524 inline void
526 {
527  // if no viewer is opened, open one
528  if(!isValid())
529  createNewViewer();
530 
531  // apply plugin in current viewer
532  for(auto funct : stackPlugins)
533  {
534  for(auto w: adapters)
535  {
536  if(w->isSelected())
537  w->apply(funct.second);
538  }
539  }
540 
541  stackPlugins.clear();
542  ui.applyButton->setEnabled(false);
543 }
544 
545 // Plugins
546 inline void
548 {
549  foreach(QObject *plugin, QPluginLoader::staticInstances())
550  {
551  populateMenus(plugin);
552  }
553 
554  // std::cout << "-> loadPlugins from " <<
555  // /*qApp->*/QApplication::applicationDirPath().toStdString() << "\n";
556  pluginsDir = QDir(/*qApp->*/ QApplication::applicationDirPath());
557 
558 #if defined(Q_OS_WIN)
559  /*if (pluginsDir.dirName().toLower() == "debug" ||
560  pluginsDir.dirName().toLower() == "release") pluginsDir.cdUp();*/
561 #elif defined(Q_OS_MAC)
562  if(pluginsDir.dirName() == "MacOS")
563  {
564  pluginsDir.cdUp();
565  pluginsDir.cdUp();
566  pluginsDir.cdUp();
567  }
568 #endif
569  // pluginsDir.cd("plugins");
570 
571  foreach(QString fileName, pluginsDir.entryList(QDir::Files))
572  {
573  if(/*fileName.contains("Filter") && */ QLibrary::isLibrary(fileName))
574  {
575  QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
576  QObject *plugin = loader.instance();
577  if(plugin)
578  {
579  menuPlugins->addSeparator();
580  populateMenus(plugin);
581  pluginFileNames += fileName;
582 
583  // call plugin's init() methods
584  Generic_PluginInterface *mepp_qt_plugin =
585  qobject_cast< Generic_PluginInterface * >(plugin);
586  mepp_qt_plugin->init(this);
587 
588  FEVV::BasePlugin *mepp_plugin =
589  dynamic_cast< FEVV::BasePlugin * >(plugin);
590  mepp_plugin->init();
591  this->attachPlugin(mepp_plugin);
592  // call plugin's init() methods
593  }
594  }
595  }
596 
597  menuPlugins->setEnabled(!menuPlugins->actions().isEmpty());
598 }
599 
600 inline void
602 {
603  Generic_PluginInterface *iGeneric_Filter =
604  qobject_cast< Generic_PluginInterface * >(plugin);
605  if(iGeneric_Filter)
606  {
607  addToMenu(plugin,
608  iGeneric_Filter->Generic_plugins(),
609  menuPlugins,
610  SLOT(applyPlugin()));
611  }
612 }
613 
614 inline void
616  const QStringList &texts,
617  QMenu *menu,
618  const char *member,
619  QActionGroup *actionGroup)
620 {
621  foreach(QString text, texts)
622  {
623  QAction *action = new QAction(text, plugin);
624  connect(action, SIGNAL(triggered()), this, member);
625  menu->addAction(action);
626 
627  if(actionGroup)
628  {
629  action->setCheckable(true);
630  actionGroup->addAction(action);
631  }
632  }
633 }
634 
635 inline void
637 {
638  QAction *action = qobject_cast< QAction * >(sender());
639 
640  Generic_PluginInterface *iGeneric_Filter =
641  qobject_cast< Generic_PluginInterface * >(action->parent());
642  if(iGeneric_Filter)
643  {
644  iGeneric_Filter->Generic_plugin(action->text());
645  }
646 }
647 
648 inline void
650 {
651  PluginDialog dialog(pluginsDir.path(), pluginFileNames, this);
652  dialog.exec();
653 }
654 // Plugins
655 
656 inline void
658 {
659  ui.listModels->sortItems(Qt::AscendingOrder); // Qt::DescendingOrder
660 }
661 
662 inline void
664 {
665  if(!Assert::check(isValid(),
666  "is not valid (see init() or attach()). Leaving...",
667  "SimpleWindow::notify"))
668  {
669  return;
670  }
671 
672  update();
673 }
674 
675 inline void
677 {
678  updateModelList(pick);
679 }
680 
681 inline void
683 {
684  // TODO LATER - SPACE/TIME - FINDME
685  /*ui.actionChange_viewer_mode->setEnabled(true);
686 
687  ui.actionChange_viewer_mode->setText(QObject::tr("Change viewer mode (-> to
688  TIME mode)"));*/
689 }
690 
691 inline void
693 {
694  using Viewer = BaseViewerOSG;
695 
696  ui.listModels->clear(); //<! All items will be permanently deleted.
697  if(adapters.size() > 0)
698  {
699  for(unsigned int aa = 0; aa < adapters.size(); ++aa)
700  {
701  QListWidgetItem *pickitem = nullptr;
702 
703  Viewer *viewer = static_cast< Viewer * >(adapters[aa]->getViewer());
704  Viewer::DataModelVector *result = viewer->getDataModel();
705 
706  if(result->size() > 0)
707  {
708  for(unsigned int rr = 0; rr < result->size(); ++rr)
709  {
710  if((*result)[rr].type == Helpers::DataType::MODEL)
711  {
712  QListWidgetItem *item = new QListWidgetItem(
713  QString::fromUtf8((*result)[rr].name.c_str()));
714  QVariant variant;
715  variant.setValue((*result)[rr]);
716  item->setData(Qt::UserRole, variant);
717 
718  ui.listModels->insertItem(0, item); // addItem(item);
719 
720  // --------------------------------------------------------------------------------
721  if(pick)
722  {
723  // if ( (*result)[rr].node != nullptr ) // not necessary ?
724  {
725  // std::cout << "UPDATE : " << (*result)[rr].node->getName() <<
726  // " - " << (*result)[rr].node << std::endl;
727 
728  if((*result)[rr].viewer->isNodeSelected(
729  (*result)[rr]
730  .node)) // [PICK] : IMPORTANT test in PickHandler.h
731  // --> see keyword [PICK] - (if we re-select
732  // same node, HERE the function doesn't
733  // return TRUE ! -> why ?)
734  {
735  pickitem = item;
736  // std::cout << "pickitem" << std::endl;
737  }
738  }
739  }
740  // --------------------------------------------------------------------------------
741  }
742  }
743 
744  // ----------------------------------------------------------------------------------------
745  if(pick)
746  {
747  if(pickitem != nullptr)
748  {
749  // std::cout << "setCurrentItem pickitem" << std::endl;
750  ui.listModels->setCurrentItem(pickitem);
751  }
752  }
753  // ----------------------------------------------------------------------------------------
754  else
755  ui.listModels->setCurrentRow(0);
756 
757  // QMdiSubWindow FOCUS
758  /*if (mdiArea) // COMMENTED 01/12/17
759  {
760  BaseAdapterVisuQt *bavQt = dynamic_cast< BaseAdapterVisuQt*
761  >(adapters[aa]); QList<QMdiSubWindow *> listMdiSubW =
762  mdiArea->subWindowList();
763 
764  for (int MdiSubW = 0; MdiSubW < listMdiSubW.size(); ++MdiSubW)
765  {
766  BaseAdapterVisuQt *bavQtMdiSubW = dynamic_cast<
767  BaseAdapterVisuQt* >(listMdiSubW.at(MdiSubW)->widget()); if
768  (bavQtMdiSubW->getViewer() == bavQt->getViewer())
769  {
770  mdiArea->setActiveSubWindow(listMdiSubW.at(MdiSubW));
771  //std::cout << "updateModelList(): " <<
772  listMdiSubW.at(MdiSubW)->windowTitle().toStdString() << std::endl;
773  break;
774  }
775  }
776  }*/
777  // QMdiSubWindow FOCUS
778  }
779  }
780  }
781 }
782 
783 template< typename MeshT >
784 void
786  /*const */ MeshT *mesh,
787  /*const */ FEVV::PMapsContainer *pmaps_bag,
788  FEVV::SimpleViewer *viewer,
789  bool _redraw,
790  bool _recomputeNT_if_redraw,
791  std::string _mesh_filename,
792  bool _recreateOSGobj_if_redraw,
793  float _step)
794 {
795  // QApplication::setOverrideCursor(Qt::BusyCursor);
796  viewer->draw_or_redraw_mesh(mesh,
797  pmaps_bag,
798  _redraw,
799  _recomputeNT_if_redraw,
800  _mesh_filename,
801  _recreateOSGobj_if_redraw,
802  _step);
803  // QApplication::restoreOverrideCursor();
804 }
805 
806 inline void
808 {
809  QMessageBox::information(this, "", QObject::tr("New - Not yet implemented."));
810 }
811 
812 
813 template< typename HalfedgeGraph >
814 inline void
816 {
817  std::vector< std::string > files;
818 
819  if (!drag)
820  {
821  std::string ds_name =
822  FEVV::getDatastructureName(static_cast< HalfedgeGraph * >(nullptr));
823 
824  QString allExtensions;
825 
826  if(ds_name == "CGALPOINTSET")
827  {
828  allExtensions = "XYZ/OFF/PLY files (*.xyz *.off *.ply);;"
829  "XYZ files (*.xyz);;"
830  "OFF files (*.off);;"
831  "PLY files (*.ply)";
832  }
833  else if(ds_name == "PCLPOINTCLOUD")
834  {
835  allExtensions = "XYZ/PCD/PLY files (*.xyz *.pcd *.ply);;"
836  "XYZ files (*.xyz);;"
837  "PCD files (*.pcd);;"
838  "PLY files (*.ply)";
839  }
840  else
841  {
842  QString defaultExtensions = "OBJ/OFF files (*.obj *.off);;"
843  "OBJ files (*.obj);;"
844  "OFF files (*.off);;"
845  "COFF files (*.coff);;"
846  "PLY files (*.ply);;"
847  "MSH files (*.msh)";
848 
849  QString vtkExtensions = "VTK Files (*.vtk);;"
850  "VTP files (*.vtp);;"
851  "VTU files (*.vtu)";
852 
853  allExtensions = defaultExtensions;
854 #ifdef FEVV_USE_VTK
855  allExtensions += ";;" + vtkExtensions;
856 #endif
857 #ifdef FEVV_USE_FBX
858  allExtensions += ";;FBX files (*.fbx)";
859 #endif
860  }
861 
862  QString suffix;
863  QFileDialog::Option options = (QFileDialog::Option)0;
864 
865 #if defined(__linux__) || defined(__APPLE__)
866  options = QFileDialog::DontUseNativeDialog; // PB under LINUX !?
867 #endif
868 
869  QStringList files_qt =
870  QFileDialog::getOpenFileNames(this,
871  "Open (SPACE/TIME)",
872  /*QDir::currentPath()*/openLocation,
873  allExtensions,
874  &suffix,
875  options);
876 
877  // convert QStringList to standard type
878  for(auto qstr: files_qt)
879  files.push_back(qstr.toStdString());
880  }
881  else
882  {
883  for(auto qstr: drag_files)
884  files.push_back(qstr.toStdString());
885 
886  drag=false;
887  shift_drag=alt_drag=ctrl_drag=false;
888  }
889 
890  // open files
891  open_SPACE_TIME< HalfedgeGraph >(viewer, files);
892 }
893 
894 
895 template< typename HalfedgeGraph >
896 inline void
898  const std::vector< std::string >& files)
899 {
900  // load and draw meshes
901  int m = 0;
902  for(auto filename: files)
903  {
904  HalfedgeGraph *mesh = new HalfedgeGraph;
905  // destroyed by the viewer destructor
906  FEVV::PMapsContainer *p_pmaps_bag = new FEVV::PMapsContainer;
907  // destroyed by the viewer destructor
908 
909  QApplication::setOverrideCursor(Qt::WaitCursor);
910  statusBar()->showMessage(QObject::tr("Open mesh file...") /*, 2000*/);
911 
912  try
913  {
914  // read mesh from file
916  filename, *mesh, *p_pmaps_bag, open_only_pts_mode);
917 
918  // open a new viewer if needed
919  // and only if the mesh reading was successfull (aka no exception)
920  // to avoid empty viewer
921  if(viewer == nullptr || ctrl_pressed) // NOTE : ctrl_pressed not documented (here only for internal usage...)
922  viewer = createNewViewer();
923 
924  // draw mesh
925  draw_or_redraw_mesh(
926  mesh,
927  p_pmaps_bag,
928  viewer,
929  false,
930  false,
932  true,
933  m * STEP_SPACE);
934 
935  ++m;
936 
937  openLocation = QFileInfo(QString::fromStdString(filename)).absolutePath();
938 
939  setCurrentFile(QString::fromStdString(filename));
940  }
941  catch(const std::exception& e)
942  {
943  std::cout << e.what() << '\n';
944  QMessageBox::warning(
945  0, "", QObject::tr(e.what()));
946 
947  // reading the mesh failed, so release memory now
948  delete mesh;
949  delete p_pmaps_bag;
950  }
951 
952  updateActiveChildTitle();
953 
954  statusBar()->showMessage(QObject::tr("") /*, 2000*/);
955  QApplication::restoreOverrideCursor();
956  }
957 }
958 
959 
960 inline void
962 {
963  bool shift_pressed, alt_pressed;
964 
965  // capture keyboard state
966  if ( (drag==false) || ((drag==true) && (recent==true)) )
967  {
968  shift_pressed = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
969  alt_pressed = QApplication::keyboardModifiers().testFlag(Qt::AltModifier);
970  ctrl_pressed = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
971  }
972  else
973  {
974  shift_pressed = shift_drag;
975  alt_pressed = alt_drag;
976  ctrl_pressed = ctrl_drag;
977  }
978 
979  // for 'only_pts' mode
980  if(alt_pressed)
981  open_only_pts_mode = true;
982  else
983  open_only_pts_mode = false;
984 
985  // logic: default-mode is "add in SPACE/TIME" mode in current viewer ;
986  // if no viewer is opened, then open one in SPACE mode
987 
988  // use existing viewer unless shift is pressed
989  // note: the call to activeMdiChild() to retrieve the current viewer
990  // must come before the call to chooseDatastructureMsgBox()
991  // because the latter resets the active window
992  SimpleViewer *viewer = nullptr;
993  if( activeMdiChild() && (!shift_pressed) && (!ctrl_pressed) ) // NOTE : ctrl_pressed not documented (here only for internal usage...)
994  {
995  // open mesh in current viewer
996  BaseAdapterVisuQt *bavQt =
997  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
998  Adapter::Viewer *base_viewer = bavQt->getViewer();
999  viewer = dynamic_cast< SimpleViewer * >(base_viewer);
1000  assert(viewer != nullptr);
1001  }
1002 
1003  // ask the user for the datastructure
1004  std::string mesh_type = chooseDatastructureMsgBox();
1005  if(mesh_type == "NONE")
1006  {
1007  drag=false;
1008  shift_drag=alt_drag=ctrl_drag=false;
1009 
1010  recent=false;
1011 
1012  return; // cancel pressed, aborting
1013  }
1014 
1015  // open mesh(es)
1016 #ifdef FEVV_USE_CGAL
1017  if(mesh_type == "POLYHEDRON")
1018  on_actionOpen_SPACE_TIME< FEVV::MeshPolyhedron >(viewer);
1019  else if(mesh_type == "SURFACEMESH")
1020  on_actionOpen_SPACE_TIME< FEVV::MeshSurface >(viewer);
1021  else if(mesh_type == "LCC")
1022  on_actionOpen_SPACE_TIME< FEVV::MeshLCC >(viewer);
1023  else if(mesh_type == "CGALPOINTSET")
1024  on_actionOpen_SPACE_TIME< FEVV::CGALPointSet >(viewer);
1025 #endif
1026 
1027 #ifdef FEVV_USE_OPENMESH
1028  if(mesh_type == "OPENMESH")
1029  on_actionOpen_SPACE_TIME< FEVV::MeshOpenMesh >(viewer);
1030 #endif
1031 
1032 #ifdef FEVV_USE_AIF
1033  if(mesh_type == "AIF")
1034  on_actionOpen_SPACE_TIME< FEVV::MeshAIF >(viewer);
1035 #endif
1036 
1037 #ifdef FEVV_USE_PCL
1038  if(mesh_type == "PCLPOINTCLOUD")
1039  on_actionOpen_SPACE_TIME< FEVV::PCLPointCloud >(viewer);
1040 #endif
1041 }
1042 
1043 
1044 inline void
1046 {
1047  QAction *action = qobject_cast<QAction *>(sender());
1048  if (action)
1049  {
1050  // HERE we use 'drag' and 'drag_files' ONLY for convenience...
1051  // BUT we ADD also 'recent' flag
1052  drag=recent=true;
1053 
1054  drag_files.clear();
1055  drag_files << action->data().toString();
1056 
1057  on_actionOpen_triggered();
1058  }
1059 }
1060 
1061 inline void
1062 FEVV::SimpleWindow::setCurrentFile(const QString &fileName)
1063 {
1064  QSettings settings(QString(APPLICATION+".ini").toLower(), QSettings::IniFormat);
1065  QStringList files = settings.value("recentFileList").toStringList();
1066 
1067  QString unixFileName = QDir::fromNativeSeparators(fileName);
1068 
1069  files.removeAll(unixFileName);
1070  files.prepend(unixFileName);
1071  while (files.size() > MaxRecentFiles)
1072  files.removeLast();
1073 
1074  settings.setValue("recentFileList", files);
1075 
1076  updateRecentFileActions();
1077 }
1078 
1079 inline QString
1080 FEVV::SimpleWindow::strippedName(const QString &fullFileName)
1081 {
1082  return QFileInfo(fullFileName).fileName();
1083 }
1084 
1085 inline void
1087 {
1088  QSettings settings(QString(APPLICATION+".ini").toLower(), QSettings::IniFormat);
1089  QStringList files = settings.value("recentFileList").toStringList();
1090 
1091  int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
1092 
1093  for (int i = 0; i < numRecentFiles; ++i)
1094  {
1095  QString text = QObject::tr("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
1096  recentFileActs[i]->setText(text);
1097  recentFileActs[i]->setData(files[i]);
1098  recentFileActs[i]->setVisible(true);
1099  }
1100  for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
1101  recentFileActs[j]->setVisible(false);
1102 
1103  separatorAct_menuFile->setVisible(numRecentFiles > 0);
1104 }
1105 
1106 inline
1107 void
1109 {
1110  if(!viewer)
1111  return;
1112 
1113  QString defaultExtensions = "OBJ files (*.obj);;"
1114  "OFF files (*.off);;"
1115  "COFF files (*.coff);;"
1116  "PLY files (*.ply);;"
1117  "MSH files (*.msh)";
1118 
1119  QString vtkExtensions = "VTK files (*.vtk);;"
1120  "VTP files (*.vtp);;"
1121  "VTU files (*.vtu)";
1122 
1123  QString cgalpointsetExtensions = "XYZ files (*.xyz);;"
1124  "OFF files (*.off);;"
1125  "PLY files (*.ply)";
1126 
1127  QString pclpointcloudExtensions = "PCD files (*.pcd);;"
1128  "PLY files (*.ply)";
1129 
1130  FEVV::MixedMeshesVector meshes = viewer->getSelectedMeshes();
1131  std::vector< std::string > meshes_names = viewer->getSelectedMeshesNames();
1132  std::vector< FEVV::PMapsContainer * > properties_maps =
1133  viewer->getSelected_properties_maps();
1134 
1135  for(unsigned i = 0; i < meshes.size(); i++)
1136  {
1137  QString allExtensions;
1138 
1139  if(meshes[i].second == "CGALPOINTSET")
1140  {
1141  allExtensions = cgalpointsetExtensions;
1142  }
1143  else if(meshes[i].second == "PCLPOINTCLOUD")
1144  {
1145  allExtensions = pclpointcloudExtensions;
1146  }
1147  else
1148  {
1149  allExtensions = defaultExtensions;
1150 #ifdef FEVV_USE_VTK
1151  allExtensions += ";;" + vtkExtensions;
1152 #endif
1153  }
1154 
1155 
1156  QString suffix;
1157  QFileDialog::Option options = (QFileDialog::Option)0;
1158 
1159 #ifdef __linux__
1160  options = QFileDialog::DontUseNativeDialog; // PB under LINUX !?
1161 #endif
1162 
1163  QString fileName = QFileDialog::getSaveFileName(
1164  0,
1165  "Save As",
1166  /*QDir::currentPath()*/saveLocation,
1167  allExtensions,
1168  &suffix,
1169  options);
1170 
1171 #ifdef __linux__
1172  if(suffix.indexOf(".obj") >= 0)
1173  fileName += ".obj";
1174  else if(suffix.indexOf(".off") >= 0)
1175  fileName += ".off";
1176  else if(suffix.indexOf(".coff") >= 0)
1177  fileName += ".coff";
1178  else if(suffix.indexOf(".ply") >= 0)
1179  fileName += ".ply";
1180  else if(suffix.indexOf(".msh") >= 0)
1181  fileName += ".msh";
1182  else if(suffix.indexOf(".vtk") >= 0)
1183  fileName += ".vtk";
1184  else if(suffix.indexOf(".vtp") >= 0)
1185  fileName += ".vtp";
1186  else if(suffix.indexOf(".vtu") >= 0)
1187  fileName += ".vtu";
1188  else if(suffix.indexOf(".xyz") >= 0)
1189  fileName += ".xyz";
1190  else if(suffix.indexOf(".pcd") >= 0)
1191  fileName += ".pcd";
1192 #endif
1193 
1194  if(!fileName.isEmpty())
1195  {
1196 #ifdef FEVV_USE_CGAL
1197  if(meshes[i].second == "POLYHEDRON")
1198  {
1199  auto mesh_ptr = static_cast< FEVV::MeshPolyhedron* >(meshes[i].first);
1200  FEVV::Filters::write_mesh(fileName.toStdString(),
1201  *mesh_ptr,
1202  *(properties_maps[i]));
1203  }
1204  if(meshes[i].second == "SURFACEMESH")
1205  {
1206  auto mesh_ptr = static_cast< FEVV::MeshSurface* >(meshes[i].first);
1207  FEVV::Filters::write_mesh(fileName.toStdString(),
1208  *mesh_ptr,
1209  *(properties_maps[i]));
1210  }
1211  if(meshes[i].second == "LCC")
1212  {
1213  auto mesh_ptr = static_cast< FEVV::MeshLCC* >(meshes[i].first);
1214  FEVV::Filters::write_mesh(fileName.toStdString(),
1215  *mesh_ptr,
1216  *(properties_maps[i]));
1217  }
1218  if(meshes[i].second == "CGALPOINTSET")
1219  {
1220  auto mesh_ptr = static_cast< FEVV::CGALPointSet* >(meshes[i].first);
1221  FEVV::Filters::write_mesh(fileName.toStdString(),
1222  *mesh_ptr,
1223  *(properties_maps[i]));
1224  }
1225 #endif //FEVV_USE_CGAL
1226 
1227 #ifdef FEVV_USE_OPENMESH
1228  if(meshes[i].second == "OPENMESH")
1229  {
1230  auto mesh_ptr = static_cast< FEVV::MeshOpenMesh* >(meshes[i].first);
1231  FEVV::Filters::write_mesh(fileName.toStdString(),
1232  *mesh_ptr,
1233  *(properties_maps[i]));
1234  }
1235 #endif //FEVV_USE_OPENMESH
1236 
1237 #ifdef FEVV_USE_AIF
1238  if(meshes[i].second == "AIF")
1239  {
1240  auto mesh_ptr = static_cast< FEVV::MeshAIF* >(meshes[i].first);
1241  FEVV::Filters::write_mesh(fileName.toStdString(),
1242  *mesh_ptr,
1243  *(properties_maps[i]));
1244  }
1245 #endif //FEVV_USE_AIF
1246 
1247 #ifdef FEVV_USE_PCL
1248  if(meshes[i].second == "PCLPOINTCLOUD")
1249  {
1250  auto mesh_ptr = static_cast< FEVV::PCLPointCloud* >(meshes[i].first);
1251  FEVV::Filters::write_mesh(fileName.toStdString(),
1252  *mesh_ptr,
1253  *(properties_maps[i]));
1254  }
1255 #endif //FEVV_USE_PCL
1256 
1257  saveLocation = QFileInfo(fileName).absolutePath();
1258  }
1259  }
1260 }
1261 
1262 
1263 inline void
1265 {
1266  for(unsigned i = 0; i < adapters.size(); i++)
1267  {
1268  if(adapters[i]->isSelected())
1269  {
1270  BaseAdapterVisu *bav = adapters[i];
1271  auto viewer = dynamic_cast< SimpleViewer * >(bav->getViewer());
1272  writeHG(viewer);
1273  }
1274  }
1275 }
1276 
1277 
1278 inline void
1280 {
1281  if(mdiArea)
1282  mdiArea->closeActiveSubWindow();
1283 }
1284 
1285 inline void
1287 {
1288  clean_closure = true;
1289  close();
1290 }
1291 
1292 inline void
1294 {
1295 /*#if ( (defined(__linux__) || defined(__APPLE__)) && defined(FEVV_USE_QT5) ) // no PB with Qt4...
1296  if (!clean_closure)
1297  {
1298  event->ignore();
1299 
1300  QMessageBox::information(this, "", QObject::tr("Please, use 'File' -> 'Exit' menu to quit."));
1301  }
1302  else
1303 #endif*/
1304  {
1305  if(mdiArea)
1306  {
1307  mdiArea->closeAllSubWindows();
1308 
1309  if(activeMdiChild())
1310  {
1311  event->ignore();
1312  }
1313  else
1314  {
1315  writeSettings();
1316  event->accept();
1317  }
1318  }
1319  else
1320  {
1321  writeSettings();
1322  event->accept();
1323  }
1324  }
1325 }
1326 
1327 inline void
1329 {
1330  on_actionClose_triggered();
1331 }
1332 
1333 inline void
1335 {
1336  if(mdiArea)
1337  mdiArea->closeAllSubWindows();
1338 }
1339 
1340 inline void
1342 {
1343  if(activeMdiChild())
1344  {
1345  BaseAdapterVisuQt *bavQt =
1346  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1347 
1348  RenderMode Render = bavQt->getViewer()->m_RenderMode;
1349  unsigned int Mode = (unsigned int)bavQt->getViewer()->m_space_time +
1350  (unsigned int)bavQt->getViewer()->m_time;
1351 
1352  QString sRender, sMode;
1353 
1354  if(Render == RenderMode::RENDER_LEGACY)
1355  sRender = "LEGACY";
1356  else if(Render == RenderMode::RENDER_SHADERS_DIRECT_LIGHTING)
1357  sRender = "SHADERS (DIRECT LIGHTING)";
1359  sRender = "SHADERS (INDIRECT LIGHTING)";
1360 
1361  if(Mode == 0)
1362  sMode = "NORMAL";
1363  else if(Mode == 1)
1364  sMode = "SPACE";
1365  else if(Mode == 2)
1366  sMode = "TIME";
1367 
1368  bavQt->setWindowTitle(
1369  bavQt->windowTitle().left(bavQt->windowTitle().indexOf('>') + 1) +
1370  QObject::tr(" - Mode : %1 - Render : %2").arg(sMode).arg(sRender));
1371  }
1372 }
1373 
1374 inline void
1376 {
1377  if(mdiArea)
1378  {
1379  if(mdiArea->viewMode() == /*Q*/MdiArea::SubWindowView)
1380  {
1381  mdiArea->setViewMode(/*Q*/MdiArea::TabbedView);
1382  ui.actionChange_MDI_view_mode->setText(
1383  QObject::tr("Change MDI view mode (-> to subwindow view)"));
1384  }
1385  else
1386  {
1387  mdiArea->setViewMode(/*Q*/MdiArea::SubWindowView);
1388  ui.actionChange_MDI_view_mode->setText(
1389  QObject::tr("Change MDI view mode (-> to tabbed view)"));
1390  }
1391  }
1392 }
1393 
1394 inline void
1396 {
1397  if(activeMdiChild())
1398  {
1399  BaseAdapterVisuQt *bavQt =
1400  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1401 
1402  if(bavQt->getViewer()->m_space_time)
1403  {
1404  // TODO LATER - SPACE/TIME - FINDME
1405  /*if (!(bavQt->getViewer()->m_time))
1406  {
1407  ui.actionDyn_First->setEnabled(true);
1408  ui.actionDyn_Previous->setEnabled(true);
1409  ui.actionDyn_Next->setEnabled(true);
1410  ui.actionDyn_Last->setEnabled(true);
1411 
1412  ui.actionChange_viewer_mode->setText(QObject::tr("Change viewer mode
1413  (-> to SPACE mode)"));
1414  }
1415  else
1416  {
1417  ui.actionDyn_First->setEnabled(false);
1418  ui.actionDyn_Previous->setEnabled(false);
1419  ui.actionDyn_Next->setEnabled(false);
1420  ui.actionDyn_Last->setEnabled(false);
1421 
1422  ui.actionChange_viewer_mode->setText(QObject::tr("Change viewer mode
1423  (-> to TIME mode)"));
1424  }*/
1425 
1426  bavQt->getViewer()->m_time = !(bavQt->getViewer()->m_time);
1427  // bavQt->setWindowTitle(QObject::tr("MODE:
1428  // %1").arg(bavQt->getViewer()->m_time));
1429 
1430  // bavQt->getViewer()->m_space_time_changeColorMode = false; // useful or
1431  // not ?
1432  pre_actionHG(bavQt->getViewer(), 'M');
1433  // bavQt->getViewer()->m_space_time_changeColorMode = true; // useful or
1434  // not ?
1435 
1436  updateActiveChildTitle();
1437  }
1438  }
1439 }
1440 
1441 inline void
1443 {
1444  if(activeMdiChild())
1445  {
1446  BaseAdapterVisuQt *bavQt =
1447  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1448 
1449  if(bavQt->getViewer()->m_space_time)
1450  {
1451  bavQt->getViewer()->m_time = true;
1452 
1453  pre_actionHG(bavQt->getViewer(), 'M');
1454 
1455  updateActiveChildTitle();
1456  }
1457  }
1458 }
1459 
1460 inline void
1462 {
1463  if(activeMdiChild())
1464  {
1465  BaseAdapterVisuQt *bavQt =
1466  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1467 
1468  if(bavQt->getViewer()->m_space_time)
1469  {
1470  bavQt->getViewer()->m_time = false;
1471 
1472  pre_actionHG(bavQt->getViewer(), 'M');
1473 
1474  updateActiveChildTitle();
1475  }
1476  }
1477 }
1478 
1479 inline void
1481 {
1482  QMessageBox::about(
1483  this,
1484  QObject::tr("About MEPP2 / Help"),
1485  QObject::tr("<b>MEPP2</b><br>"
1486  "<br>"
1487  "3D MEsh Processing Platform<br>"
1488  "Copyright (c) 2016-2022 University of Lyon and CNRS (France)<br>"
1489  "<br>"
1490  "LIRIS ORIGAMI / MEPP-team<br>"
1491  "<br>"
1492  "<b>GitHub: <a href=\"https://github.com/MEPP-team/MEPP2\">see online "
1493  "repository</a></b><br>"
1494  "<br>"
1495  "<b>Developer documentation: <a "
1496  "href=\"http://liris.cnrs.fr/mepp/doc/nightly/\">see online "
1497  "help</a></b><br>"
1498  "<br>"
1499  "-<br>"
1500  "<br>"
1501  "<b>Keys:</b><br>"
1502  "<br>"
1503  "<b>OPEN</b> in a new viewer:"
1504  "<br>"
1505  " -> <b>shift + 'Open' menu</b> (or <b>shift</b>* during 'drag & drop')<br>"
1506  "<br>"
1507  "<b>*</b> on Windows, <b>shift</b> is replaced by <b>RIGHT mouse button</b> during 'drag & drop'<br>"
1508  "<br>"
1509  "<br>"
1510  "Viewer -> <b>SELECT</b> mesh : <b>shift</b><br>"
1511  "<br>"
1512  "Viewer -> <b>TRANSLATE</b> mesh : <b>T</b> (Translation "
1513  "draggers must be shown, see toolbar)<br>"
1514  "Viewer -> <b>ROTATE</b> mesh : <b>R</b> (Rotation draggers "
1515  "must be shown, see toolbar)<br>"
1516  "<br>"
1517  "Viewer -> <b>OSG</b> instrumentation : <b>S</b><br>"
1518 // "<br>"
1519 // "<b>*</b> on MacOS, the <b>ctrl</b> key is replaced by the "
1520 // "<b>command</b> key"
1521  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
1522 }
1523 
1524 inline void
1526 {
1527 #if(FEVV_USE_QT5)
1528  /*qApp->*/ QApplication::primaryScreen()->grabWindow(0).save(
1529  "screenshot.png");
1530 #endif
1531 }
1532 
1533 
1534 inline
1535 void
1537  char t,
1538  char t2)
1539 {
1540  if(!viewer)
1541  return;
1542 
1543  if(t == 'A') // 'A'xis
1544  {
1545  viewer->gizmo->setNodeMask(viewer->m_ShowAxis ? 0xffffffff : 0x0);
1546  }
1547  else if(t == 'G') // 'G'rid
1548  {
1549  viewer->grid->setNodeMask(viewer->m_ShowGrid ? 0xffffffff : 0x0);
1550  }
1551  else if(t == 'C') // 'C'opy matrix ViewPoint
1552  {
1553  matrixVP = viewer->getMatrixVP();
1554  }
1555  else if(t == 'P') // 'P'aste matrix ViewPoint
1556  {
1557  viewer->setMatrixVP(matrixVP);
1558  }
1559  else if(t == '-') // TIME-
1560  {
1561  // time
1562  if(viewer->m_time)
1563  {
1564  std::vector< osg::Geode * > geodes = viewer->getGeodes();
1565 
1566  if(viewer->current_i_time >= 1)
1567  {
1568  if(t2 == '-') // TIME--
1569  viewer->current_i_time = 0; // FIRST ONE
1570  else
1571  viewer->current_i_time--; // PREVIOUS ONE
1572 
1573  std::vector< osg::Geode * > geodesSelected =
1574  viewer->getSelectedGeodes();
1575  for(unsigned i = 0; i < geodesSelected.size(); i++)
1576  viewer->setNodeSelected(geodesSelected[i], false);
1577 
1578  viewer->setNodeSelected(geodes[viewer->current_i_time], true);
1579  update(true);
1580 
1581  // std::cout << "current_i_time--" << std::endl;
1582  }
1583  }
1584  // time
1585  }
1586  else if(t == '+') // TIME+
1587  {
1588  // time
1589  if(viewer->m_time)
1590  {
1591  std::vector< osg::Geode * > geodes = viewer->getGeodes();
1592 
1593 #ifdef __GNUC__
1594 #pragma GCC diagnostic push
1595 #pragma GCC diagnostic warning "-Wsign-compare"
1596 #endif // __GNUC__
1597  if(geodes.size() >= 1 && viewer->current_i_time < (int)(geodes.size() - 1))
1598 #ifdef __GNUC__
1599 #pragma GCC diagnostic pop
1600 #endif // __GNUC__
1601  {
1602  if(t2 == '+') // TIME++
1603  viewer->current_i_time = viewer->i_time; // LAST ONE
1604  else
1605  viewer->current_i_time++; // NEXT ONE
1606 
1607  std::vector< osg::Geode * > geodesSelected =
1608  viewer->getSelectedGeodes();
1609  for(unsigned i = 0; i < geodesSelected.size(); i++)
1610  viewer->setNodeSelected(geodesSelected[i], false);
1611 
1612  viewer->setNodeSelected(geodes[viewer->current_i_time], true);
1613  update(true);
1614 
1615  // std::cout << "current_i_time++" << std::endl;
1616  }
1617  }
1618  // time
1619  }
1620  else if(t == 'M') // switch 'M'ODE - SPACE/TIME
1621  {
1622  // if (viewer->m_space_time) // BUT already protected in
1623  // 'on_actionChange_viewer_mode_triggered'
1624  {
1625  std::vector< osg::Geode * > geodes = viewer->getGeodes();
1626 
1627  int iSel = -1;
1628  bool force = false;
1629 
1630  for(unsigned i = 0; i < geodes.size(); i++)
1631  {
1632  if(viewer->isNodeSelected(geodes[i]))
1633  {
1634  iSel = i; // CURRENT ONE
1635  break;
1636  }
1637  }
1638  if(iSel == -1) // really IMPORTANT if MDIchild is active but no mesh
1639  // selected in meshes list
1640  {
1641  if(viewer->current_i_time == -1)
1642  iSel = viewer->i_time; // LAST ONE
1643  else
1644  iSel = viewer->current_i_time; // SAVE ONE
1645 
1646  force = true;
1647  }
1648 
1649  std::vector< osg::Geode * > geodesSelected = viewer->getSelectedGeodes();
1650  for(unsigned i = 0; i < geodesSelected.size(); i++)
1651  viewer->setNodeSelected(geodesSelected[i], false);
1652 
1653  viewer->setNodeSelected(geodes[iSel], true);
1654 
1655  if((force) || (!viewer->isNodeSelected(geodes[iSel])))
1656  update(true);
1657 
1658  // ---
1659 
1660  if(viewer->m_time) // time
1661  {
1662  // std::cout << "entering in TIME MODE" << std::endl;
1663 
1664  viewer->current_i_time = iSel;
1665  }
1666  else // space
1667  {
1668  // std::cout << "entering in SPACE MODE" << std::endl;
1669 
1670  std::vector< osg::Group * > draggers1 = viewer->getDraggers1();
1671  std::vector< osg::Group * > draggers2 = viewer->getDraggers2();
1672 
1673  for(unsigned i = 0; i < geodes.size(); i++)
1674  geodes[i]->setNodeMask(0xffffffff);
1675  for(unsigned i = 0; i < draggers1.size(); i++)
1676  draggers1[i]->setNodeMask(viewer->m_ShowTranslateDragger ? 0xffffffff
1677  : 0x0);
1678  for(unsigned i = 0; i < draggers2.size(); i++)
1679  draggers2[i]->setNodeMask(viewer->m_ShowRotateDragger ? 0xffffffff
1680  : 0x0);
1681 
1682  // actionHG(viewer, 'D', '_'); // 19/03/19 - test for calling a
1683  // re-'D'raw (because of 'hide/not hide' meshes in SPACE mode)
1684  }
1685  }
1686  }
1687  else if(t == 'T') // 'T'ranslate dragger
1688  {
1689  std::vector< osg::Group * > draggers1 = viewer->getDraggers1();
1690 
1691  if(viewer->m_time && viewer->current_i_time != -1)
1692  {
1693  for(unsigned i = 0; i < draggers1.size(); i++)
1694  draggers1[i]->setNodeMask(0x0);
1695 
1696  if(draggers1.size())
1697  draggers1[viewer->current_i_time]->setNodeMask(
1698  viewer->m_ShowTranslateDragger ? 0xffffffff : 0x0);
1699  }
1700  else
1701  {
1702  for(unsigned i = 0; i < draggers1.size(); i++)
1703  draggers1[i]->setNodeMask(viewer->m_ShowTranslateDragger ? 0xffffffff
1704  : 0x0);
1705  }
1706  }
1707  else if(t == 'R') // 'R'otate dragger
1708  {
1709  std::vector< osg::Group * > draggers2 = viewer->getDraggers2();
1710 
1711  if(viewer->m_time && viewer->current_i_time != -1)
1712  {
1713  for(unsigned i = 0; i < draggers2.size(); i++)
1714  draggers2[i]->setNodeMask(0x0);
1715 
1716  if(draggers2.size())
1717  draggers2[viewer->current_i_time]->setNodeMask(
1718  viewer->m_ShowRotateDragger ? 0xffffffff : 0x0);
1719  }
1720  else
1721  {
1722  for(unsigned i = 0; i < draggers2.size(); i++)
1723  draggers2[i]->setNodeMask(viewer->m_ShowRotateDragger ? 0xffffffff
1724  : 0x0);
1725  }
1726  }
1727  else if(t == 'D') // re-'D'raw
1728  {
1729  FEVV::MixedMeshesVector meshes = viewer->getMeshes();
1730  std::vector< std::string > meshes_names = viewer->getMeshesNames();
1731  std::vector< FEVV::PMapsContainer * > properties_maps =
1732  viewer->get_properties_maps();
1733 
1734  for(unsigned i = 0; i < meshes.size(); i++)
1735  {
1736 #ifdef FEVV_USE_CGAL
1737  if(meshes[i].second == "POLYHEDRON")
1738  {
1739  auto mesh_ptr = static_cast< FEVV::MeshPolyhedron* >(meshes[i].first);
1740  draw_or_redraw_mesh(mesh_ptr,
1741  properties_maps[i],
1742  viewer,
1743  true,
1744  false,
1745  meshes_names[i],
1746  false);
1747  }
1748  if(meshes[i].second == "SURFACEMESH")
1749  {
1750  auto mesh_ptr = static_cast< FEVV::MeshSurface* >(meshes[i].first);
1751  draw_or_redraw_mesh(mesh_ptr,
1752  properties_maps[i],
1753  viewer,
1754  true,
1755  false,
1756  meshes_names[i],
1757  false);
1758  }
1759  if(meshes[i].second == "LCC")
1760  {
1761  auto mesh_ptr = static_cast< FEVV::MeshLCC* >(meshes[i].first);
1762  draw_or_redraw_mesh(mesh_ptr,
1763  properties_maps[i],
1764  viewer,
1765  true,
1766  false,
1767  meshes_names[i],
1768  false);
1769  }
1770  if(meshes[i].second == "CGALPOINTSET")
1771  {
1772  auto mesh_ptr = static_cast< FEVV::CGALPointSet* >(meshes[i].first);
1773  draw_or_redraw_mesh(mesh_ptr,
1774  properties_maps[i],
1775  viewer,
1776  true,
1777  false,
1778  meshes_names[i],
1779  false);
1780  }
1781 #endif //FEVV_USE_CGAL
1782 
1783 #ifdef FEVV_USE_OPENMESH
1784  if(meshes[i].second == "OPENMESH")
1785  {
1786  auto mesh_ptr = static_cast< FEVV::MeshOpenMesh* >(meshes[i].first);
1787  draw_or_redraw_mesh(mesh_ptr,
1788  properties_maps[i],
1789  viewer,
1790  true,
1791  false,
1792  meshes_names[i],
1793  false);
1794  }
1795 #endif //FEVV_USE_OPENMESH
1796 
1797 #ifdef FEVV_USE_AIF
1798  if(meshes[i].second == "AIF")
1799  {
1800  auto mesh_ptr = static_cast< FEVV::MeshAIF* >(meshes[i].first);
1801  draw_or_redraw_mesh(mesh_ptr,
1802  properties_maps[i],
1803  viewer,
1804  true,
1805  false,
1806  meshes_names[i],
1807  false);
1808  }
1809 #endif //FEVV_USE_AIF
1810 
1811 #ifdef FEVV_USE_PCL
1812  if(meshes[i].second == "PCLPOINTCLOUD")
1813  {
1814  auto mesh_ptr = static_cast< FEVV::PCLPointCloud* >(meshes[i].first);
1815  draw_or_redraw_mesh(mesh_ptr,
1816  properties_maps[i],
1817  viewer,
1818  true,
1819  false,
1820  meshes_names[i],
1821  false);
1822  }
1823 #endif //FEVV_USE_PCL
1824  }
1825  }
1826 }
1827 
1828 
1829 inline void
1831 {
1832  auto viewer = dynamic_cast< SimpleViewer * >(base_viewer);
1833  actionHG(viewer, t, t2);
1834 }
1835 
1836 
1837 inline void
1839 {
1840  if(activeMdiChild())
1841  {
1842  BaseAdapterVisuQt *bavQt =
1843  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1844 
1846  bavQt->getViewer()->m_space_time_changeColorMode = false;
1847  pre_actionHG(bavQt->getViewer());
1848  bavQt->getViewer()->m_space_time_changeColorMode = true;
1849  }
1850 }
1851 
1852 inline void
1854 {
1855  if(activeMdiChild())
1856  {
1857  BaseAdapterVisuQt *bavQt =
1858  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1859 
1861  bavQt->getViewer()->m_space_time_changeColorMode = false;
1862  pre_actionHG(bavQt->getViewer());
1863  bavQt->getViewer()->m_space_time_changeColorMode = true;
1864  }
1865 }
1866 
1867 inline void
1869 {
1870  if(activeMdiChild())
1871  {
1872  BaseAdapterVisuQt *bavQt =
1873  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1874 
1876  bavQt->getViewer()->m_space_time_changeColorMode = false;
1877  pre_actionHG(bavQt->getViewer());
1878  bavQt->getViewer()->m_space_time_changeColorMode = true;
1879  }
1880 }
1881 
1882 inline void
1884 {
1885  if(activeMdiChild())
1886  {
1887  BaseAdapterVisuQt *bavQt =
1888  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1889 
1892  bavQt->getViewer()->m_space_time_changeColorMode = false;
1893  pre_actionHG(bavQt->getViewer());
1894  bavQt->getViewer()->m_space_time_changeColorMode = true;
1895  }
1896 }
1897 
1898 inline void
1900 {
1901  if(activeMdiChild())
1902  {
1903  BaseAdapterVisuQt *bavQt =
1904  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1905 
1908  bavQt->getViewer()->m_space_time_changeColorMode = false;
1909  pre_actionHG(bavQt->getViewer());
1910  bavQt->getViewer()->m_space_time_changeColorMode = true;
1911  }
1912 }
1913 
1914 inline void
1916 {
1917  if(activeMdiChild())
1918  {
1919  BaseAdapterVisuQt *bavQt =
1920  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1921 
1924  bavQt->getViewer()->m_space_time_changeColorMode = false;
1925  pre_actionHG(bavQt->getViewer());
1926  bavQt->getViewer()->m_space_time_changeColorMode = true;
1927  }
1928 }
1929 
1930 inline void
1932 {
1933  if(activeMdiChild())
1934  {
1935  BaseAdapterVisuQt *bavQt =
1936  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1937 
1938  bavQt->getViewer()->m_UseVertexColor = true;
1939  bavQt->getViewer()->m_UseFaceColor = false;
1940  bavQt->getViewer()->m_UseTexture = false;
1941  pre_actionHG(bavQt->getViewer());
1942  }
1943 }
1944 
1945 inline void
1947 {
1948  if(activeMdiChild())
1949  {
1950  BaseAdapterVisuQt *bavQt =
1951  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1952 
1953  bavQt->getViewer()->m_UseVertexColor = false;
1954  bavQt->getViewer()->m_UseFaceColor = true;
1955  bavQt->getViewer()->m_UseTexture = false;
1956  pre_actionHG(bavQt->getViewer());
1957  }
1958 }
1959 
1960 inline void
1962 {
1963  if(activeMdiChild())
1964  {
1965  BaseAdapterVisuQt *bavQt =
1966  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1967 
1968  bavQt->getViewer()->m_UseVertexColor = false;
1969  bavQt->getViewer()->m_UseFaceColor = false;
1970  bavQt->getViewer()->m_UseTexture = true;
1971  pre_actionHG(bavQt->getViewer());
1972  }
1973 }
1974 
1975 inline void
1977 {
1978  if(activeMdiChild())
1979  {
1980  BaseAdapterVisuQt *bavQt =
1981  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1982 
1983  bavQt->getViewer()->m_Lighting = !(bavQt->getViewer()->m_Lighting);
1984  bavQt->getViewer()->m_space_time_changeColorMode = false;
1985  pre_actionHG(bavQt->getViewer());
1986  bavQt->getViewer()->m_space_time_changeColorMode = true;
1987  }
1988 }
1989 
1990 inline void
1992 {
1993  if(activeMdiChild())
1994  {
1995  BaseAdapterVisuQt *bavQt =
1996  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
1997 
1998  bavQt->getViewer()->m_SmoothFlat_Shading =
1999  !bavQt->getViewer()->m_SmoothFlat_Shading;
2000  bavQt->getViewer()->m_space_time_changeColorMode = false;
2001  pre_actionHG(bavQt->getViewer());
2002  bavQt->getViewer()->m_space_time_changeColorMode = true;
2003  }
2004 }
2005 
2006 inline void
2008 {
2009  if(activeMdiChild())
2010  {
2011  BaseAdapterVisuQt *bavQt =
2012  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2013 
2014 #if defined(__APPLE__)
2015  QMessageBox::information(
2016  this,
2017  "",
2018  QObject::tr("Only legacy rendering is available under OS X."));
2019 #else
2020  bavQt->getViewer()->m_RenderMode = static_cast< RenderMode >(
2021  (static_cast< size_t >(bavQt->getViewer()->m_RenderMode) + 1) % 3);
2022  bavQt->getViewer()->m_space_time_changeColorMode = false;
2023  // bool SAVE_m_recreateOSGobj_if_redraw =
2024  // bavQt->getViewer()->m_recreateOSGobj_if_redraw;
2025  // bavQt->getViewer()->m_recreateOSGobj_if_redraw = true; // NEW
2026  pre_actionHG(bavQt->getViewer());
2027  // bavQt->getViewer()->m_recreateOSGobj_if_redraw =
2028  // SAVE_m_recreateOSGobj_if_redraw; // NEW
2029  bavQt->getViewer()->m_space_time_changeColorMode = true;
2030 
2031  updateActiveChildTitle();
2032 #endif
2033  }
2034 }
2035 
2036 
2037 inline
2038 void
2040 {
2041  if(!viewer)
2042  return;
2043 
2044  FEVV::MixedMeshesVector meshes = viewer->getSelectedMeshes();
2045 
2046  for(unsigned i = 0; i < meshes.size(); i++)
2047  {
2048  viewer->centerMesh(meshes[i].first);
2049  }
2050 }
2051 
2052 
2053 inline void
2055 {
2056  for(unsigned i = 0; i < adapters.size(); i++)
2057  {
2058  if(adapters[i]->isSelected())
2059  {
2060  BaseAdapterVisu *bav = adapters[i];
2061  auto viewer = dynamic_cast< SimpleViewer * >(bav->getViewer());
2062  centerHG(viewer);
2063 
2064  }
2065  }
2066 }
2067 
2068 inline void
2070 {
2071  if(activeMdiChild())
2072  {
2073  BaseAdapterVisuQt *bavQt =
2074  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2075 
2076  pre_actionHG(bavQt->getViewer(), 'C');
2077  }
2078 }
2079 
2080 inline void
2082 {
2083  if(activeMdiChild())
2084  {
2085  BaseAdapterVisuQt *bavQt =
2086  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2087 
2088  pre_actionHG(bavQt->getViewer(), 'P');
2089  }
2090 }
2091 
2092 
2093 inline void
2095 {
2096  if(activeMdiChild())
2097  {
2098  BaseAdapterVisuQt *bavQt =
2099  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2100 
2101  bavQt->getViewer()->m_ShowAxis = !(bavQt->getViewer()->m_ShowAxis);
2102  pre_actionHG(bavQt->getViewer(), 'A');
2103  }
2104 }
2105 
2106 inline void
2108 {
2109  if(activeMdiChild())
2110  {
2111  BaseAdapterVisuQt *bavQt =
2112  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2113 
2114  bavQt->getViewer()->m_ShowGrid = !(bavQt->getViewer()->m_ShowGrid);
2115  pre_actionHG(bavQt->getViewer(), 'G');
2116  }
2117 }
2118 
2119 inline void
2121 {
2122  if(activeMdiChild())
2123  {
2124  BaseAdapterVisuQt *bavQt =
2125  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2126 
2127  bavQt->getViewer()->m_Show_Vertex_Normals =
2128  !bavQt->getViewer()->m_Show_Vertex_Normals;
2129  bavQt->getViewer()->m_space_time_changeColorMode = false;
2130  pre_actionHG(bavQt->getViewer());
2131  bavQt->getViewer()->m_space_time_changeColorMode = true;
2132  }
2133 }
2134 
2135 inline void
2137 {
2138  if(activeMdiChild())
2139  {
2140  BaseAdapterVisuQt *bavQt =
2141  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2142 
2145  bavQt->getViewer()->m_space_time_changeColorMode = false;
2146  pre_actionHG(bavQt->getViewer());
2147  bavQt->getViewer()->m_space_time_changeColorMode = true;
2148  }
2149 }
2150 
2151 #if 0 //TODO-elo-rm-?-ask_MTO
2152 template< typename HalfedgeGraph >
2153 void
2154 FEVV::SimpleWindow::showSelectedHG(FEVV::SimpleViewer *viewer)
2155 {
2156  if(!viewer)
2157  return;
2158 }
2159 #endif
2160 
2161 
2162 #if 0 //TODO-elo-rm-?-ask_MTO
2163 inline void
2164 FEVV::SimpleWindow::on_actionShow_Selected_triggered()
2165 {
2166  for(unsigned i = 0; i < adapters.size(); i++)
2167  {
2168  if(adapters[i]->isSelected())
2169  {
2170  BaseAdapterVisu *bav = adapters[i];
2171  bav->getViewer()->m_ShowSelected = !(bav->getViewer()->m_ShowSelected);
2172 
2173 #ifdef FEVV_USE_CGAL
2174  if(dynamic_cast< SimpleViewer< FEVV::MeshPolyhedron > * >(
2175  bav->getViewer()))
2176  showSelectedHG(dynamic_cast< SimpleViewer< FEVV::MeshPolyhedron > * >(
2177  bav->getViewer()));
2178  else if(dynamic_cast< SimpleViewer< FEVV::MeshSurface > * >(
2179  bav->getViewer()))
2180  showSelectedHG(dynamic_cast< SimpleViewer< FEVV::MeshSurface > * >(
2181  bav->getViewer()));
2182  else if(dynamic_cast< SimpleViewer< FEVV::MeshLCC > * >(bav->getViewer()))
2183  showSelectedHG(
2184  dynamic_cast< SimpleViewer< FEVV::MeshLCC > * >(bav->getViewer()));
2185 #endif
2186 #ifdef FEVV_USE_OPENMESH
2187  if(dynamic_cast< SimpleViewer< FEVV::MeshOpenMesh > * >(bav->getViewer()))
2188  showSelectedHG(dynamic_cast< SimpleViewer< FEVV::MeshOpenMesh > * >(
2189  bav->getViewer()));
2190 #endif
2191 #ifdef FEVV_USE_AIF
2192  if(dynamic_cast< SimpleViewer< FEVV::MeshAIF > * >(bav->getViewer()))
2193  showSelectedHG(
2194  dynamic_cast< SimpleViewer< FEVV::MeshAIF > * >(bav->getViewer()));
2195 #endif
2196  }
2197  }
2198 }
2199 #endif
2200 
2201 
2202 inline void
2204 {
2205  if(activeMdiChild())
2206  {
2207  BaseAdapterVisuQt *bavQt =
2208  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2209 
2210  bavQt->getViewer()->m_ShowTranslateDragger =
2211  !(bavQt->getViewer()->m_ShowTranslateDragger);
2212  pre_actionHG(bavQt->getViewer(), 'T');
2213  }
2214 }
2215 
2216 inline void
2218 {
2219  if(activeMdiChild())
2220  {
2221  BaseAdapterVisuQt *bavQt =
2222  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2223 
2224  bavQt->getViewer()->m_ShowRotateDragger =
2225  !(bavQt->getViewer()->m_ShowRotateDragger);
2226  pre_actionHG(bavQt->getViewer(), 'R');
2227  }
2228 }
2229 
2230 inline void
2232 {
2233  if(activeMdiChild())
2234  {
2235  BaseAdapterVisuQt *bavQt =
2236  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2237 
2238  if(bavQt->getViewer()->m_space_time)
2239  if(bavQt->getViewer()->m_time)
2240  pre_actionHG(bavQt->getViewer(), '-', '-');
2241  }
2242 }
2243 
2244 inline void
2246 {
2247  if(activeMdiChild())
2248  {
2249  BaseAdapterVisuQt *bavQt =
2250  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2251 
2252  if(bavQt->getViewer()->m_space_time)
2253  if(bavQt->getViewer()->m_time)
2254  pre_actionHG(bavQt->getViewer(), '-');
2255  }
2256 }
2257 
2258 inline void
2260 {
2261  if(activeMdiChild())
2262  {
2263  BaseAdapterVisuQt *bavQt =
2264  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2265 
2266  if(bavQt->getViewer()->m_space_time)
2267  if(bavQt->getViewer()->m_time)
2268  pre_actionHG(bavQt->getViewer(), '+');
2269  }
2270 }
2271 
2272 inline void
2274 {
2275  if(activeMdiChild())
2276  {
2277  BaseAdapterVisuQt *bavQt =
2278  dynamic_cast< BaseAdapterVisuQt * >(activeMdiChild());
2279 
2280  if(bavQt->getViewer()->m_space_time)
2281  if(bavQt->getViewer()->m_time)
2282  pre_actionHG(bavQt->getViewer(), '+', '+');
2283  }
2284 }
2285 
2286 inline void
2288 {
2289  if(!Assert::check(isValid(),
2290  "is not valid (see init() or attach()). Leaving...",
2291  "SimpleWindow::onAddBall"))
2292  {
2293  return;
2294  }
2295 
2296  if(adapters.size() > 0)
2297  {
2298  int x = (std::rand() % 20) - 10;
2299  int y = (std::rand() % 20) - 10;
2300  int z = (std::rand() % 20) - 10;
2301 
2302  std::cout << "Adding a ball in {" << x << "," << y << "," << z << "}"
2303  << std::endl;
2304 
2305  BaseAdapterVisuQt *bavQt = dynamic_cast< BaseAdapterVisuQt * >(adapters[0]);
2306  static_cast< BaseViewerOSG * >(adapters[0]->getViewer())
2307  ->addGroup(Debug::createBall(
2308  x,
2309  y,
2310  z,
2311  1,
2312  Color::Amethyst(),
2313  "Ball [" + bavQt->windowTitle().toStdString() + std::string("]")));
2314  }
2315 }
2316 
2317 inline void
2318 FEVV::SimpleWindow::onItemChanged(QListWidgetItem *_item,
2319  QListWidgetItem *_item_old)
2320 {
2321  using Viewer = BaseViewerOSG;
2322 
2324  if(_item_old != 0)
2325  {
2326  QVariant variant = _item_old->data(Qt::UserRole);
2327  Viewer::DataModel data = variant.value< Viewer::DataModel >();
2328  if(data.type == Helpers::DataType::MODEL && data.node != nullptr)
2329  {
2330  data.viewer->setNodeSelected(data.node, false);
2331  data.viewer->setSelected(false);
2332  for_each(adapters.begin(), adapters.end(), [&data](Adapter *w) {
2333  if(w->getViewer() == data.viewer)
2334  {
2335  w->setSelected(false);
2336  }
2337  });
2338  }
2339  }
2340 
2342  if(_item != 0)
2343  {
2344  QVariant variant = _item->data(Qt::UserRole);
2345  Viewer::DataModel data = variant.value< Viewer::DataModel >();
2346  if(data.type == Helpers::DataType::MODEL && data.node != nullptr)
2347  {
2348  data.viewer->setNodeSelected(data.node, true);
2349  data.viewer->setSelected(true);
2350  for_each(adapters.begin(), adapters.end(), [&data](Adapter *w) {
2351  if(w->getViewer() == data.viewer)
2352  {
2353  w->setSelected(true);
2354 
2355  // QMdiSubWindow FOCUS
2356  SimpleWindow *sw =
2357  dynamic_cast< SimpleWindow * >(w->getViewer()->getWindow());
2358  /*Q*/MdiArea *_mdiArea = sw->mdiArea;
2359  if(_mdiArea)
2360  {
2361  BaseAdapterVisuQt *bavQt = dynamic_cast< BaseAdapterVisuQt * >(w);
2362  QList< QMdiSubWindow * > listMdiSubW = _mdiArea->subWindowList();
2363 
2364  for(int MdiSubW = 0; MdiSubW < listMdiSubW.size(); ++MdiSubW)
2365  {
2366  BaseAdapterVisuQt *bavQtMdiSubW =
2367  dynamic_cast< BaseAdapterVisuQt * >(
2368  listMdiSubW.at(MdiSubW)->widget());
2369  if(bavQtMdiSubW->getViewer() == bavQt->getViewer())
2370  {
2371  _mdiArea->setActiveSubWindow(listMdiSubW.at(MdiSubW));
2372  // std::cout << "onItemChanged(): " <<
2373  // listMdiSubW.at(MdiSubW)->windowTitle().toStdString() <<
2374  // std::endl;
2375  break;
2376  }
2377  }
2378  }
2379  // QMdiSubWindow FOCUS
2380  }
2381  });
2382  }
2383  }
2384 }
2385 
2386 inline std::vector< FEVV::SimpleWindow::Adapter * >
2388 {
2389  std::vector< Adapter * > result;
2390  for_each(adapters.begin(), adapters.end(), [&result](Adapter *w) {
2391  if(w->isSelected())
2392  {
2393  result.push_back(w);
2394  }
2395  });
2396 
2397  return result;
2398 }
2399 
2400 inline std::vector< FEVV::SimpleWindow::Adapter::Viewer * >
2402 {
2403  std::vector< Adapter::Viewer * > result;
2404  for_each(adapters.begin(), adapters.end(), [&result](Adapter *w) {
2405  if(w->isSelected())
2406  {
2407  result.push_back(w->getViewer());
2408  }
2409  });
2410 
2411  return result;
2412 }
2413 
2414 inline
2417 {
2418  FEVV::SimpleAdapterVisu *adapter;
2419  adapter= new FEVV::SimpleAdapterVisu();
2420  adapter->setWindowTitle(QObject::tr("<aid: %1>")
2421  .arg((qlonglong)adapter, 0, 16));
2422  adapter->setWindowIcon(QIcon(":/logo/resources/MEPP.png"));
2423  FEVV::SimpleViewer *viewer = new FEVV::SimpleViewer();
2424  adapter->attach(viewer);
2425  adapter->init();
2426  viewer->init();
2427  viewer->setSelected(true);
2428  viewer->m_space_time = true;
2429  enableSpaceTimeMenus();
2430  this->attach(adapter, USE_MDI);
2431  adapter->show();
2432  if(this->getMdiArea())
2433  this->getMdiArea()->tileSubWindows();
2434 
2435  return viewer;
2436 }
2437 
2438 inline
2440 {
2441  if(mdiArea)
2442  {
2443  if(QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow())
2444  return qobject_cast< QWidget * >(activeSubWindow->widget());
2445  }
2446  else
2447  {
2448  for(unsigned i = 0; i < adapters.size(); i++)
2449  {
2450  if(adapters[i]->isSelected())
2451  {
2452  BaseAdapterVisuQt *bavQt =
2453  dynamic_cast< BaseAdapterVisuQt * >(adapters[i]);
2454  return qobject_cast< QWidget * >(bavQt);
2455  }
2456  }
2457  }
2458 
2459  return 0;
2460 }
2461 
2462 inline void
2464 {
2465  QSettings settings(QString(APPLICATION+".ini").toLower(), QSettings::IniFormat);
2466 
2467  QString path;
2468  QFileInfo fileInfo = model->fileInfo(proxyModel->mapToSource(tree->currentIndex()));
2469  if (fileInfo.isFile())
2470  path = fileInfo.absolutePath();
2471  else
2472  path = fileInfo.absoluteFilePath(); // why ???
2473  settings.setValue("treeLocation", path);
2474 
2475  settings.setValue("openLocation", openLocation);
2476  settings.setValue("saveLocation", saveLocation);
2477 
2478  settings.beginGroup("MainWindow");
2479  settings.setValue("pos", pos());
2480  settings.setValue("size", size());
2481 
2482  settings.setValue("state", saveState());
2483 
2484  settings.setValue("dockDirView_MinimumWidth", m_dockDirView_MinimumWidth);
2485  settings.endGroup();
2486 }
2487 
2488 inline void
2490 {
2491  // HKEY_CURRENT_USER\Software\LIRIS
2492  QSettings settings(QString(APPLICATION+".ini").toLower(), QSettings::IniFormat); // or QSettings settings(ORGANIZATION, APPLICATION);
2493 
2494  treeLocation = settings.value("treeLocation", QDir::currentPath()).toString();
2495 
2496  openLocation = settings.value("openLocation", QDir::currentPath()).toString();
2497  saveLocation = settings.value("saveLocation", QDir::currentPath()).toString();
2498 
2499  settings.beginGroup("MainWindow");
2500 #if(FEVV_USE_QT5) // Qt6 in fact...
2501  QScreen *screen = QGuiApplication::primaryScreen();
2502  QRect screen_size = screen->availableGeometry();
2503 #else
2504  QRect screen_size = QDesktopWidget().availableGeometry();
2505 #endif
2506  int win_w = screen_size.width() * 0.9;
2507  int win_h = screen_size.height() * 0.8;
2508  int pos_x = (screen_size.width() - win_w) / 2;
2509  int pos_y = (screen_size.height() - win_h) / 2;
2510 
2511  move(settings.value("pos", QPoint(pos_x, pos_y)).toPoint());
2512  resize(settings.value("size", QSize(win_w, win_h)).toSize());
2513 
2514  if(!settings.value("state").isNull())
2515  restoreState(settings.value("state").toByteArray());
2516 
2517  m_dockDirView_MinimumWidth = settings.value("dockDirView_MinimumWidth", 320).toInt(); if (m_dockDirView_MinimumWidth < 1) m_dockDirView_MinimumWidth=320;
2518  settings.endGroup();
2519 }
FEVV::SimpleWindow::on_actionChange_MDI_view_mode_triggered
void on_actionChange_MDI_view_mode_triggered()
Definition: SimpleWindow.inl:1375
FEVV::BaseViewer::m_RenderMode
RenderMode m_RenderMode
Definition: BaseViewer.h:185
FEVV::SimpleWindow::getSelectedAdapters
std::vector< Adapter * > getSelectedAdapters() override
Definition: SimpleWindow.inl:2387
FEVV::BaseViewer::m_Show_Vertex_Normals
bool m_Show_Vertex_Normals
Definition: BaseViewer.h:189
pcl_point_cloud_writer.hpp
FEVV::SimpleWindow::updateModelList
void updateModelList(bool pick)
Definition: SimpleWindow.inl:692
FEVV::SimpleWindow::draw_or_redraw_mesh
void draw_or_redraw_mesh(MeshT *mesh, FEVV::PMapsContainer *pmaps_bag, FEVV::SimpleViewer *viewer, bool _redraw=false, bool _recomputeNT_if_redraw=false, std::string _mesh_filename=std::string(""), bool _recreateOSGobj_if_redraw=true, float _step=0.)
Definition: SimpleWindow.inl:785
FEVV::RenderMode::RENDER_LEGACY
@ RENDER_LEGACY
FEVV::SimpleWindow::addToMenu
void addToMenu(QObject *plugin, const QStringList &texts, QMenu *menu, const char *member, QActionGroup *actionGroup=0)
Definition: SimpleWindow.inl:615
FEVV::SimpleWindow::SimpleWindow
SimpleWindow(QWidget *_parent=0, Qt::WindowFlags _flags=Qt::Window)
Definition: SimpleWindow.inl:76
FEVV::CGALPointSet
CGAL::Point_set_3< CGALPointSetPoint > CGALPointSet
Definition: DataStructures_cgal_point_set.h:71
FEVV::SimpleWindow::attachPlugin
void attachPlugin(Plugin *_plugin) override
Definition: SimpleWindow.inl:188
FEVV::SimpleWindow::onApplyButton
void onApplyButton()
Definition: SimpleWindow.inl:525
ChooseDatastructureMsgBox.hpp
FEVV::SimpleViewer::getSelectedMeshes
MixedMeshesVector getSelectedMeshes()
Definition: SimpleViewer.inl:402
BaseViewerOSG.h
FEVV::BaseViewer::m_SmoothFlat_Shading
bool m_SmoothFlat_Shading
Definition: BaseViewer.h:184
FEVV::SimpleViewer::getSelected_properties_maps
std::vector< PMapsContainer * > getSelected_properties_maps()
Definition: SimpleViewer.inl:456
FEVV::MeshLCC
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, CGALLCCTraits, CGALItem > MeshLCC
Definition: DataStructures_cgal_linear_cell_complex.h:43
FEVV::BaseViewer
Definition: BaseViewer.h:43
tr
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
Definition: boolops_definitions.hpp:127
FEVV::SimpleWindow::on_actionShow_Entire_Mesh_triggered
void on_actionShow_Entire_Mesh_triggered()
Definition: SimpleWindow.inl:2054
FEVV::SimpleViewer::getSelectedMeshesNames
std::vector< std::string > getSelectedMeshesNames()
Definition: SimpleViewer.inl:429
FEVV::BasePlugin::init
virtual void init()=0
FEVV::BaseViewerOSG::setNodeSelected
virtual void setNodeSelected(osg::Node *_node, bool isSelected)=0
FEVV::SimpleWindow::on_actionOpen_triggered
void on_actionOpen_triggered()
Definition: SimpleWindow.inl:961
APPLICATION
#define APPLICATION
Definition: SimpleWindow.inl:56
FEVV::SimpleAdapterVisu
SimpleAdapterVisu is a specialization of QWidget. This class is the widget added to a QMainWindow,...
Definition: SimpleAdapterVisu.h:51
generic_reader.hpp
FEVV::Helpers::changeBackgroundColor
void changeBackgroundColor(QWidget *_widget, const Color &_color)
Definition: QtHelpers.cpp:14
FEVV::SimpleViewer::getSelectedGeodes
std::vector< osg::Geode * > getSelectedGeodes()
Definition: SimpleViewer.inl:375
FEVV::SimpleWindow::writeHG
void writeHG(FEVV::SimpleViewer *viewer)
Definition: SimpleWindow.inl:1108
FEVV::BaseViewerOSG
Definition: BaseViewerOSG.h:47
FEVV::PCLPointCloud
pcl::PointCloud< PCLEnrichedPoint > PCLPointCloud
Definition: DataStructures_pcl_point_cloud.h:28
FEVV::Color::Pink
static Color Pink(void)
Definition: Color.inl:341
FEVV::BaseAdapterVisu::getViewer
virtual Viewer * getViewer()
Definition: BaseAdapterVisu.h:130
FEVV::SimpleWindow::on_actionRender_Point_triggered
void on_actionRender_Point_triggered()
Definition: SimpleWindow.inl:1838
FEVV::SimpleWindow::attach
void attach(Adapter *_adapter) override
Definition: SimpleWindow.inl:119
FEVV::SimpleWindow::on_actionQuit_triggered
void on_actionQuit_triggered()
Definition: SimpleWindow.inl:1286
FEVV::MixedMeshesVector
Functions to retrieve the name of the datastructure according to the mesh type.
Definition: SimpleViewer.h:138
FEVV::MixedMeshesVector::size
std::size_t size(void)
Definition: SimpleViewer.h:158
FEVV::RENDER_LINES
@ RENDER_LINES
Definition: BaseViewer.h:29
FEVV::MeshSurface
CGAL::Surface_mesh< CGALPoint > MeshSurface
Definition: DataStructures_cgal_surface_mesh.h:23
FEVV::BaseViewer::m_space_time
bool m_space_time
Definition: BaseViewer.h:207
FEVV::SimpleCheckBox
Definition: SimpleCheckBox.h:23
USE_MDI
#define USE_MDI
Definition: SimpleWindow.inl:51
FEVV::BaseAdapterVisu
Definition: BaseAdapterVisu.h:27
FEVV::BaseViewer::attach
void attach(Window *_window)
Definition: BaseViewer.h:131
FEVV::SimpleWindow::aboutPlugins
void aboutPlugins()
Definition: SimpleWindow.inl:649
FEVV::SimpleViewer::init
void init() override
Definition: SimpleViewer.inl:184
FEVV::SimpleWindow::on_actionSuperimpose_Edges_triggered
void on_actionSuperimpose_Edges_triggered()
Definition: SimpleWindow.inl:1915
FEVV::BaseViewer::m_Lighting
bool m_Lighting
Definition: BaseViewer.h:183
FEVV::SimpleWindow::updateRecentFileActions
void updateRecentFileActions()
Update Mepp recent files list.
Definition: SimpleWindow.inl:1086
FEVV::BaseViewer::m_UseFaceColor
bool m_UseFaceColor
Definition: BaseViewer.h:180
FEVV::BaseViewerOSG::setSelected
virtual void setSelected(const bool _isSelected)
Definition: BaseViewer.h:120
FEVV::SimpleWindow::on_actionClose_all_triggered
void on_actionClose_all_triggered()
Definition: SimpleWindow.inl:1334
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition: properties.h:99
FEVV::MdiArea
MdiArea class.
Definition: MdiArea.h:30
FEVV::BaseViewer::m_ShowGrid
bool m_ShowGrid
Definition: BaseViewer.h:188
QtHelpers.h
FEVV::SimpleViewer::draw_or_redraw_mesh
void draw_or_redraw_mesh(HalfedgeGraph *_g, PMapsContainer *_pmaps, bool _redraw=false, bool _recomputeNT_if_redraw=false, std::string _mesh_filename=std::string(""), bool _recreateOSGobj_if_redraw=true, float _step=0.)
Definition: SimpleViewer.inl:3415
FEVV::SimpleWindow::on_actionRender_Line_triggered
void on_actionRender_Line_triggered()
Definition: SimpleWindow.inl:1853
FEVV::FileUtils::get_file_full_name
std::string get_file_full_name(const std::string &file_name)
Definition: FileUtilities.hpp:152
FEVV::SimpleWindow::on_actionLighting_triggered
void on_actionLighting_triggered()
Definition: SimpleWindow.inl:1976
SimpleAdapterVisu.h
FEVV::SimpleWindow::on_actionRender_Mode_triggered
void on_actionRender_Mode_triggered()
Definition: SimpleWindow.inl:2007
FEVV::SimpleWindow::onItemChanged
void onItemChanged(QListWidgetItem *_item, QListWidgetItem *_item_old)
Definition: SimpleWindow.inl:2318
FEVV::SimpleWindow::sortModelList
void sortModelList()
Definition: SimpleWindow.inl:657
FEVV::BaseViewer::m_space_time_changeColorMode
bool m_space_time_changeColorMode
Definition: BaseViewer.h:208
FEVV::SimpleViewer::setNodeSelected
void setNodeSelected(osg::Node *_geode, bool isSelected) override
Definition: SimpleViewer.inl:3492
FEVV::SimpleLineEdit
Definition: SimpleLineEdit.h:23
FEVV::SimpleViewer
SimpleViewer is a specialization of osgViewer::CompositeViewer. This class is a widget where we are a...
Definition: SimpleViewer.h:180
FEVV::SimpleWindow::on_actionCopy_Viewpoint_triggered
void on_actionCopy_Viewpoint_triggered()
Definition: SimpleWindow.inl:2069
FEVV::SimpleWindow::on_actionClose_window_triggered
void on_actionClose_window_triggered()
Definition: SimpleWindow.inl:1328
FEVV::SimpleViewer::getDraggers2
std::vector< osg::Group * > getDraggers2()
Definition: SimpleViewer.inl:529
FEVV::SimpleViewer::getMeshes
MixedMeshesVector getMeshes()
Definition: SimpleViewer.inl:421
FEVV::SimpleWindow::onModificationParam
void onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Definition: SimpleWindow.inl:505
FEVV::SimpleWindow::on_actionShow_CustomVectors_Vertices_triggered
void on_actionShow_CustomVectors_Vertices_triggered()
Definition: SimpleWindow.inl:2136
FEVV::PluginDialog
Definition: PluginDialog.hpp:34
FEVV::SimpleWindow::setParam
void setParam(std::string _name, int *_value, std::string _pluginName, Plugin *_plugin) override
Definition: SimpleWindow.inl:371
FEVV::SimpleWindow::activate_space_mode
void activate_space_mode()
Definition: SimpleWindow.inl:1461
STEP_SPACE
#define STEP_SPACE
Definition: SimpleWindow.inl:53
FEVV::SimpleWindow::on_actionChange_viewer_mode_triggered
void on_actionChange_viewer_mode_triggered()
Definition: SimpleWindow.inl:1395
FEVV::BasePlugin::addParameters
virtual void addParameters(BaseWindow *_window)=0
FEVV::SimpleWindow::applyPlugin
void applyPlugin()
Definition: SimpleWindow.inl:636
FEVV::SimpleLineEdit::setParams
void setParams(std::string *_value, std::string _pluginName, BasePlugin *_plugin)
Definition: SimpleLineEdit.h:37
FEVV::SimpleWindow::populateMenus
void populateMenus(QObject *plugin)
Definition: SimpleWindow.inl:601
FEVV::SimpleWindow::createNewViewer
FEVV::SimpleViewer * createNewViewer(void)
Create a new empty viewer.
Definition: SimpleWindow.inl:2416
cgal_point_set_writer.hpp
FEVV::SimpleWindow::onAddBall
void onAddBall()
Definition: SimpleWindow.inl:2287
FEVV::SimpleWindow::updateActiveChildTitle
void updateActiveChildTitle()
Definition: SimpleWindow.inl:1341
FEVV::SimpleViewer::isNodeSelected
bool isNodeSelected(osg::Node *_geode) override
Definition: SimpleViewer.inl:3584
FEVV::SimpleWindow::loadQtPlugins
void loadQtPlugins()
Definition: SimpleWindow.inl:547
FEVV::SimpleWindow::pre_actionHG
void pre_actionHG(Adapter::Viewer *viewer, char t='D', char t2='_')
Definition: SimpleWindow.inl:1830
FEVV::SimpleViewer::getMatrixVP
osg::Matrix getMatrixVP()
Definition: SimpleViewer.inl:3310
FEVV::SimpleWindow::openRecentFile
void openRecentFile()
Open a recent file (from menu).
Definition: SimpleWindow.inl:1045
FEVV::BaseViewerOSG::getDataModel
virtual DataModelVector * getDataModel()=0
FEVV::Filters::read_mesh
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
Definition: cgal_point_set_reader.hpp:110
FEVV::SimpleWindow::on_actionShow_Axis_triggered
void on_actionShow_Axis_triggered()
Definition: SimpleWindow.inl:2094
pcl_point_cloud_reader.hpp
FEVV::SimpleWindow::enableSpaceTimeMenus
void enableSpaceTimeMenus()
Definition: SimpleWindow.inl:682
FEVV::SimpleWindow::on_actionNew_triggered
void on_actionNew_triggered()
Definition: SimpleWindow.inl:807
FEVV::SimpleWindow::~SimpleWindow
~SimpleWindow()
Definition: SimpleWindow.inl:91
MdiArea.h
FEVV::SimpleWindow::on_actionFace_Color_triggered
void on_actionFace_Color_triggered()
Definition: SimpleWindow.inl:1946
FEVV::Generic_PluginInterface::init
virtual void init(BaseWindowQt *bwQt)
Definition: PluginInterface.h:44
FEVV::SimpleViewer::getGeodes
std::vector< osg::Geode * > getGeodes()
Definition: SimpleViewer.inl:394
FEVV::SimpleWindow::onGrab
void onGrab()
Definition: SimpleWindow.inl:1525
FEVV::SimpleWindow::on_actionSmoothFlat_Shading_triggered
void on_actionSmoothFlat_Shading_triggered()
Definition: SimpleWindow.inl:1991
FEVV::SimpleWindow::writeSettings
void writeSettings()
Write settings: folder locations (tree/open/save), mainwindow (pos, size, state), recent files list....
Definition: SimpleWindow.inl:2463
FEVV::SimpleViewer::get_properties_maps
std::vector< PMapsContainer * > get_properties_maps()
Definition: SimpleViewer.inl:475
FEVV::BaseViewer::m_RenderSuperimposedEdges
bool m_RenderSuperimposedEdges
Definition: BaseViewer.h:177
FEVV::BaseViewer::m_RenderSuperimposedVertices
bool m_RenderSuperimposedVertices
Definition: BaseViewer.h:175
FEVV::SimpleWindow::on_actionTexture_Mode_triggered
void on_actionTexture_Mode_triggered()
Definition: SimpleWindow.inl:1961
FEVV::Assert::check
static bool check(const bool _check, const std::string &_message, const std::string &_where="")
Definition: Assert.h:70
FEVV::SimpleWindow::init
void init() override
Definition: SimpleWindow.inl:194
FEVV::RENDER_POINTS
@ RENDER_POINTS
Definition: BaseViewer.h:28
PluginDialog.hpp
FEVV::SimpleViewer::setMatrixVP
void setMatrixVP(osg::Matrix matrix)
Definition: SimpleViewer.inl:3339
FEVV::SimpleWindow::open_SPACE_TIME
void open_SPACE_TIME(FEVV::SimpleViewer *viewer, const std::vector< std::string > &filenames)
Open meshes in a viewer with datastructure HalfedgeGraph.
Definition: SimpleWindow.inl:897
FEVV::SimpleWindow::on_actionSuperimpose_Vertices_bigger_triggered
void on_actionSuperimpose_Vertices_bigger_triggered()
Definition: SimpleWindow.inl:1899
FEVV::Color::Amethyst
static Color Amethyst(void)
Definition: Color.inl:488
FEVV::BaseViewer::m_UseTexture
bool m_UseTexture
Definition: BaseViewer.h:181
FEVV::SimpleWindow::activeMdiChild
QWidget * activeMdiChild()
Definition: SimpleWindow.inl:2439
FEVV::RENDER_FILL
@ RENDER_FILL
Definition: BaseViewer.h:30
cgal_point_set_reader.hpp
FEVV::SimpleWindow::on_actionPaste_Viewpoint_triggered
void on_actionPaste_Viewpoint_triggered()
Definition: SimpleWindow.inl:2081
FEVV::SimpleWindow::on_actionClose_triggered
void on_actionClose_triggered()
Definition: SimpleWindow.inl:1279
FEVV::Filters::write_mesh
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
Definition: cgal_point_set_writer.hpp:42
generic_writer.hpp
FEVV::SimpleWindow::readSettings
void readSettings()
Read settings: folder locations (tree/open/save), mainwindow (pos, size, state), recent files list....
Definition: SimpleWindow.inl:2489
FEVV::SimpleWindow::on_actionDyn_Last_triggered
void on_actionDyn_Last_triggered()
Definition: SimpleWindow.inl:2273
FEVV::SimpleCheckBox::setParams
void setParams(bool *_value, std::string _pluginName, BasePlugin *_plugin)
Definition: SimpleCheckBox.h:33
FEVV::SimpleViewer::i_time
int i_time
Definition: SimpleViewer.h:776
FEVV::SimpleWindow::on_actionVertex_Color_triggered
void on_actionVertex_Color_triggered()
Definition: SimpleWindow.inl:1931
FEVV::SimpleWindow::centerHG
void centerHG(FEVV::SimpleViewer *viewer)
Definition: SimpleWindow.inl:2039
FEVV::BaseAdapterVisuQt
Definition: BaseAdapterVisuQt.h:22
FEVV::SimpleWindow::closeEvent
void closeEvent(QCloseEvent *event) override
Definition: SimpleWindow.inl:1293
FEVV::MeshOpenMesh
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
Definition: DataStructures_openmesh.h:51
FEVV::BaseViewer::m_UseVertexColor
bool m_UseVertexColor
Definition: BaseViewer.h:179
FEVV::BaseViewer::m_Show_CustomVectors_Vertices
bool m_Show_CustomVectors_Vertices
Definition: BaseViewer.h:190
FEVV::SimpleViewer::gizmo
osg::ref_ptr< osg::Group > gizmo
Definition: SimpleViewer.h:770
FEVV::BaseViewer::m_ShowTranslateDragger
bool m_ShowTranslateDragger
Definition: BaseViewer.h:195
FEVV::SimpleWindow::setCurrentFile
void setCurrentFile(const QString &fileName)
Set a mesh filename in recent files list.
Definition: SimpleWindow.inl:1062
FEVV::Generic_PluginInterface
Definition: PluginInterface.h:37
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition: AIFMesh.hpp:47
FEVV::Generic_PluginInterface::Generic_plugin
virtual bool Generic_plugin(const QString &plugin)=0
FEVV::SimpleWindow::on_actionSuperimpose_Vertices_triggered
void on_actionSuperimpose_Vertices_triggered()
Definition: SimpleWindow.inl:1883
FEVV::BasePlugin
Definition: BasePlugin.h:38
FEVV::BaseWindowQt
Definition: BaseWindowQt.h:21
FEVV::SimpleViewer::current_i_time
int current_i_time
Definition: SimpleViewer.h:777
FEVV::SimpleWindow::on_actionShow_Translation_Draggers_triggered
void on_actionShow_Translation_Draggers_triggered()
Definition: SimpleWindow.inl:2203
FEVV::SimpleWindow::notify
void notify() override
Definition: SimpleWindow.inl:663
FEVV::BaseViewer::m_RenderSuperimposedVertices_Big
bool m_RenderSuperimposedVertices_Big
Definition: BaseViewer.h:176
PluginInterface.h
FEVV::BaseViewer::m_ShowAxis
bool m_ShowAxis
Definition: BaseViewer.h:187
FEVV::SimpleWindow::on_actionDyn_First_triggered
void on_actionDyn_First_triggered()
Definition: SimpleWindow.inl:2231
FEVV::BaseViewer::m_ShowRotateDragger
bool m_ShowRotateDragger
Definition: BaseViewer.h:196
FEVV::SimpleWindow::on_actionDyn_Previous_triggered
void on_actionDyn_Previous_triggered()
Definition: SimpleWindow.inl:2245
FEVV::Generic_PluginInterface::Generic_plugins
virtual QStringList Generic_plugins() const =0
FEVV::SimpleWindow::strippedName
QString strippedName(const QString &fullFileName)
Return the filename of a mesh without path.
Definition: SimpleWindow.inl:1080
FEVV::SimpleViewer::grid
osg::ref_ptr< osg::Group > grid
Definition: SimpleViewer.h:771
FEVV::SimpleViewer::centerMesh
void centerMesh(HalfedgeGraph *_g)
Definition: SimpleViewer.inl:3245
FEVV::SimpleWindow::on_actionOpen_SPACE_TIME
void on_actionOpen_SPACE_TIME(FEVV::SimpleViewer *viewer)
Open button/menu callback function.
Definition: SimpleWindow.inl:815
FEVV::SimpleWindow::on_actionAbout_MEPP_Help_triggered
void on_actionAbout_MEPP_Help_triggered()
Definition: SimpleWindow.inl:1480
FEVV::SimpleViewer::getMeshesNames
std::vector< std::string > getMeshesNames()
Definition: SimpleViewer.inl:448
FEVV::SimpleWindow::ui
Ui::MainWindow ui
Definition: SimpleWindow.h:381
FEVV::BaseViewer::m_time
bool m_time
Definition: BaseViewer.h:210
FEVV::SimpleWindow::actionHG
void actionHG(FEVV::SimpleViewer *viewer, char t, char t2)
Definition: SimpleWindow.inl:1536
FEVV::SimpleWindow::getSelectedViewers
std::vector< Adapter::Viewer * > getSelectedViewers() override
Definition: SimpleWindow.inl:2401
FEVV::SimpleWindow::on_actionShow_Grid_triggered
void on_actionShow_Grid_triggered()
Definition: SimpleWindow.inl:2107
FEVV::SimpleWindow::on_actionSaveAs_triggered
void on_actionSaveAs_triggered()
Definition: SimpleWindow.inl:1264
FEVV::MeshPolyhedron
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
Definition: DataStructures_cgal_polyhedron_3.h:33
FEVV::SimpleWindow::activate_time_mode
void activate_time_mode()
Definition: SimpleWindow.inl:1442
FEVV::BaseViewer::m_RenderMethod
RenderMethod m_RenderMethod
Definition: BaseViewer.h:174
FEVV::SimpleWindow::on_actionShow_Vertex_Normals_triggered
void on_actionShow_Vertex_Normals_triggered()
Definition: SimpleWindow.inl:2120
FEVV::SimpleWindow::update
void update(bool pick=false)
Definition: SimpleWindow.inl:676
FEVV::SimpleWindow::on_actionDyn_Next_triggered
void on_actionDyn_Next_triggered()
Definition: SimpleWindow.inl:2259
FEVV::Debug::createBall
osg::ref_ptr< osg::Group > createBall(const double &_x, const double &_y, const double &_z, const double &_r, const Color &_color=Color::Amethyst(), const std::string &_name="Ball", osg::ref_ptr< osg::Group > _group=new osg::Group)
Definition: OSGDebug.inl:135
FEVV::SimpleWindow::on_actionShow_Rotation_Draggers_triggered
void on_actionShow_Rotation_Draggers_triggered()
Definition: SimpleWindow.inl:2217
FEVV::Color::Green
static Color Green(void)
Definition: Color.inl:389
FEVV::chooseDatastructureMsgBox
std::string chooseDatastructureMsgBox(void)
Definition: ChooseDatastructureMsgBox.hpp:28
FEVV::RenderMode
RenderMode
Definition: BaseViewer.h:33
FEVV::SimpleWindow::on_actionRender_Fill_triggered
void on_actionRender_Fill_triggered()
Definition: SimpleWindow.inl:1868
FEVV::SimpleViewer::getDraggers1
std::vector< osg::Group * > getDraggers1()
Definition: SimpleViewer.inl:502
FEVV::Color::Blue
static Color Blue(void)
Definition: Color.inl:365