GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBTraceManager.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __QGoDBTraceManager_h
36 #define __QGoDBTraceManager_h
37 
38 #include <QObject>
39 #include <QMessageBox>
40 #include <QMenu>
41 #include "QGoTableWidget.h"
42 #include "GoDBCollectionOfTraces.h"
44 #include "QGoGUILibConfigure.h"
45 #include "ContourMeshContainer.h"
46 #include "QGoColorCodingDialog.h"
47 #include "vtkLookupTable.h"
48 #include "vtkLookupTableManager.h"
49 
55 class QGOGUILIB_EXPORT QGoDBTraceManager:public QObject
56 {
57  Q_OBJECT
58 public:
59  explicit QGoDBTraceManager( QObject* iParent = NULL );
60  virtual ~QGoDBTraceManager();
61 
63  typedef std::pair< std::string, QColor > NameWithColorData;
64  typedef std::pair< unsigned int, QColor > IDWithColorData;
65 
70  QGoTableWidget * GetTableWidget();
71 
75  void SetDatabaseConnection(vtkMySQLDatabase *iDatabaseConnector);
76 
86  virtual std::list< NameWithColorData > GetAllTraceIDsWithColor(
87  vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect);
88 
94  void UpdateTWAndContainerForDeletedTraces(
95  const std::list< unsigned int > & iTraceIDs);
96 
104  virtual void UpdateTWAndContainerForImportedTraces(
105  const std::vector< int > & iVectorImportedTraces,
106  vtkMySQLDatabase *iDatabaseConnector) = 0;
107 
113  virtual std::list< unsigned int > GetListHighlightedIDs()= 0;
114 
124  virtual std::list< unsigned int > UpdateTheTracesColor(
125  vtkMySQLDatabase *iDatabaseConnector) = 0;
126 
132  virtual void DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector) = 0;
133 
143  void UpdateCollectionID(vtkMySQLDatabase *iDatabaseConnector,
144  const std::list< unsigned int > & iListTracesIDs,
145  int iCollectionID);
146 
156  virtual void UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector,
157  const std::list< unsigned int > & iListTracesIDs,
158  bool UpdateTW = true);
159 
169  std::list< unsigned int > GetListCollectionIDs(
170  vtkMySQLDatabase *iDatabaseConnector,
171  const std::list< unsigned int > & iListTracesIDs);
172 
181  std::list< unsigned int > GetListTracesIDsFromThisCollectionOf(
182  vtkMySQLDatabase *iDatabaseConnector,
183  const std::list< unsigned int > & iListTraces);
184 
191  std::list< unsigned int > GetListTracesIDsBelongingToCollectionIDs(
192  vtkMySQLDatabase *iDatabaseConnector,
193  const std::list<unsigned int>& iListCollectionIDs);
194 
201  void DisplayInfoForExistingTraces(vtkMySQLDatabase *iDatabaseConnector,
202  const std::list< unsigned int >& iListTraces);
209  std::list< unsigned int > GetLastCreatedTracesIDs(
210  vtkMySQLDatabase *iDatabaseConnector, int iNumberOfTracesIDs);
211 
216  void SetSelectedCollection (NameWithColorData* iCollectionData);
217 
222  void SetCurrentTimePoint(int* iTimePoint);
223 
228  void SetSelectedColor(NameWithColorData* iColorData);
235  void CheckShowRows();
236 
237  void UpdateLastSelectedOneAsCollection();
238 
239 signals:
244  void TraceColorToChange();
245 
250  void CheckedTracesToDelete();
251 
256  void NeedToGoToTheLocation(int XCoord, int YCoord, int ZCoord, int TCoord);
257 
262  void NewCollectionFromCheckedTraces(std::list< unsigned int > );
263 
264  void CheckedTracesToAddToSelectedCollection(std::list< unsigned int > );
265 
266  void NeedToGetDatabaseConnection();
267 
268  void DBConnectionNotNeededAnymore();
269 
275  void AddNewTraceIDInTS(std::pair<std::string, QColor> iTraceToAddData);
276 
277  void PrintMessage(QString iMessage, int iTimeOut = 0);
278 
279 protected:
280  std::string m_TraceName;
281  std::string m_TraceNameID;
282  std::string m_CollectionName;
283  std::string m_CollectionNameID;
284  std::string m_CollectionOf;
285  std::string m_CollectionOfID;
286 
291 
295  vtkMySQLDatabase * m_DatabaseConnector;
299 
305  virtual void DisplayInfoForAllTraces(vtkMySQLDatabase *iDatabaseConnector) = 0;
306 
307  virtual void DisplayInfoForTracesForSpecificTPs(
308  vtkMySQLDatabase *iDatabaseConnector,
309  const std::list<unsigned int>& iListTPs) = 0;
310 
316  virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector) = 0;
317 
324  virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector,
325  int iTraceID) = 0;
326 
332  std::string GetTheNameIDFromName(std::string iName);
333 
339  void SetInfo(unsigned int iImgSessionID, QWidget *iParent);
340 
344  virtual void SetCollectionsTraceNames() = 0;
345 
351  int GetLastCreatedTraceID(vtkMySQLDatabase *iDatabaseConnector);
352 
358  double * GetVectorFromQColor(QColor iColor);
359 
368  GoDBCoordinateRow GetCoordinateFromInt(int iXCoord, int iYCoord, int iZCoord,
369  int iTCoord);
370 
371  template< typename C, typename S >
373  vtkMySQLDatabase* iDatabaseConnector, std::vector<int> iVectIDs,
374  C *iContainerForVisu)
375  {
376  std::list<S> list_of_traces =
377  GetTracesInfoFromDBForVisuContainer( list_of_traces,
378  iDatabaseConnector, this->m_TraceName, this->m_CollectionName,
379  this->m_ImgSessionID, -1, iVectIDs);
380 
381  typename std::list<S>::iterator it = list_of_traces.begin();
382 
383  while ( it != list_of_traces.end() )
384  {
385  iContainerForVisu->Insert(*it);
386  ++it;
387  }
388  }
389 
402  template< typename T >
403  void DisplayInfoForAllTracesTemplate(T *iTWContainer,
404  vtkMySQLDatabase *iDatabaseConnector,
405  Qt::CheckState iState,
406  int iIndexShowColumn = 0)
407  {
408  TWContainerType RowContainer =
409  iTWContainer->GetContainerLoadedWithAllFromDB(iDatabaseConnector);
410 
411  std::list< std::pair< std::string, std::string > > ColumnNamesAndToolTips =
412  iTWContainer->GetListColumnsNamesAndToolTipsForTableWidget();
413  this->m_Table->DisplayInitialContent(
414  RowContainer,
415  iTWContainer->GetIndexForGroupColor(this->m_TraceName),
416  iTWContainer->GetIndexForGroupColor(this->m_CollectionName),
417  this->m_TraceName, this->m_CollectionName, ColumnNamesAndToolTips,
418  iState, iIndexShowColumn);
419  }
420 
421  template< typename T >
423  vtkMySQLDatabase *iDatabaseConnector,
424  Qt::CheckState iState,
425  const std::list<unsigned int> & iListTPs,
426  int iIndexShowColumn = 0)
427  {
428  //load the container with the traces infos for the TW for the TimePoints contained
429  //in iListTPs:
430  TWContainerType RowContainer =
431  iTWContainer->GetContainerLoadedWithAllFromDB(iDatabaseConnector, iListTPs);
432 
433  std::list< std::pair< std::string, std::string > > ColumnNamesAndToolTips =
434  iTWContainer->GetListColumnsNamesAndToolTipsForTableWidget();
435 
436  //to load the column names and display the content of the TWContainer:
437  this->m_Table->DisplayInitialContent(
438  RowContainer,
439  iTWContainer->GetIndexForGroupColor(this->m_TraceName),
440  iTWContainer->GetIndexForGroupColor(this->m_CollectionName),
441  this->m_TraceName, this->m_CollectionName, ColumnNamesAndToolTips,
442  iState, iIndexShowColumn);
443  }
444 
454  template< typename T >
456  vtkMySQLDatabase *iDatabaseConnector)
457  {
458  int TraceID = this->GetLastCreatedTraceID(iDatabaseConnector);
459  TWContainerType RowContainer =
460  iTWContainer->GetContainerForOneSpecificTrace(iDatabaseConnector,
461  TraceID);
462 
463  // insert is buggy on sorted table
464  // 1- unsort (if sorted)
465  // 2- insert
466  // 3- sort (if sorted)
467  bool sorting = this->m_Table->isSortingEnabled();
468  if(sorting)
469  {
470  this->m_Table->setSortingEnabled(false);
471  }
472 
473  this->m_Table->InsertOnlyOneNewRow(RowContainer,
474  iTWContainer->GetIndexForGroupColor(this->m_TraceName),
475  iTWContainer->GetIndexForGroupColor(this->m_CollectionName),
476  this->m_TraceName, this->m_CollectionName);
477 
478  if(sorting)
479  {
480  this->m_Table->setSortingEnabled(true);
481  }
482  }
483 
494  template< typename T >
496  vtkMySQLDatabase *iDatabaseConnector,
497  int iTraceID)
498  {
499  if (iTraceID != 0)
500  {
501  TWContainerType RowContainer =
502  iTWContainer->GetContainerForOneSpecificTrace(iDatabaseConnector,
503  iTraceID);
504  this->m_Table->UpdateRow(RowContainer,
505  iTWContainer->GetIndexForGroupColor(this->m_TraceName),
506  iTWContainer->GetIndexForGroupColor(this->m_CollectionName),
507  this->m_TraceName, this->m_CollectionName, iTraceID);
508  }
509  }
510 
530  template< typename T >
532  unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin,
533  unsigned int iTCoord, unsigned int iXCoordMax, unsigned int iYCoordMax,
534  unsigned int iZCoordMax, vtkPolyData *iTraceNodes, NameWithColorData iColor,
535  vtkMySQLDatabase *iDatabaseConnector, T & iTrace, unsigned int iCollectionID,
536  unsigned int iTCoordMax = 0)
537  {
538  this->SetTraceBoundingBoxAndPoints< T >(iXCoordMin, iYCoordMin, iZCoordMin, iTCoord,
539  iXCoordMax, iYCoordMax, iZCoordMax, iTraceNodes, iDatabaseConnector, iTrace,
540  iTCoordMax);
541 
542  return this->m_CollectionOfTraces->CreateNewTraceInDB< T >(iTrace,
543  iDatabaseConnector, iColor, iCollectionID);
544  }
545 
546  template< typename T >
547  void SetTraceBoundingBoxAndPoints(unsigned int iXCoordMin,
548  unsigned int iYCoordMin,
549  unsigned int iZCoordMin,
550  unsigned int iTCoord,
551  unsigned int iXCoordMax,
552  unsigned int iYCoordMax,
553  unsigned int iZCoordMax,
554  vtkPolyData *iTraceNodes,
555  vtkMySQLDatabase *iDatabaseConnector,
556  T & iTrace,
557  unsigned int iTCoordMax = 0)
558  {
559  GoDBCoordinateRow coord_min = this->GetCoordinateFromInt(iXCoordMin,
560  iYCoordMin, iZCoordMin, iTCoord);
561  unsigned int TCoord;
562 
563  if ( iTCoordMax == 0 )
564  {
565  TCoord = iTCoord;
566  }
567  else
568  {
569  TCoord = iTCoordMax;
570  }
571  GoDBCoordinateRow coord_max = this->GetCoordinateFromInt(iXCoordMax,
572  iYCoordMax, iZCoordMax, TCoord);
573  iTrace.SetTheDataFromTheVisu(iDatabaseConnector, iTraceNodes,
574  coord_min, coord_max);
575  }
576 
586  template< typename T >
588  vtkMySQLDatabase *iDatabaseConnector)
589  {
590  this->DisplayInfoForAllTraces(iDatabaseConnector);
592  std::vector< int > VectorIDs = iTWContainer->GetAllTraceIDsInContainer();
593  std::list<unsigned int> ListIDs(VectorIDs.begin(), VectorIDs.end());
594  this->GetTracesInfoFromDBAndModifyContainerForVisu(iDatabaseConnector,ListIDs);
595  }
596 
597 
598 
599  template< typename C>
601  vtkMySQLDatabase *iDatabaseConnector,
602  C* iContainerForVisu,
603  const std::list<unsigned int> & iListTPs)
604  {
605  this->DisplayInfoForTracesForSpecificTPs( iDatabaseConnector, iListTPs);
606 
607  std::list<unsigned int> ListIDs =
608  this->m_CollectionOfTraces->GetTraceIDsBelongingToListTimePoints(
609  iDatabaseConnector, iListTPs);
610 
611  if(ListIDs.size() > 0)
612  {
613  this->GetTracesInfoFromDBAndModifyContainerForVisu(iDatabaseConnector,ListIDs);
614  }
615  }
616 
617  template< typename C>
619  vtkMySQLDatabase *iDatabaseConnector,
620  C* iContainerForVisu,
621  const std::list<unsigned int> & iListTPs)
622  {
623  std::list<unsigned int> ListIDs =
624  this->m_CollectionOfTraces->GetTraceIDsBelongingToListTimePoints(
625  iDatabaseConnector, iListTPs);
626 
627  iContainerForVisu->Clear(ListIDs);
628 
629  QStringList StrgListTPs;
630  std::list<unsigned int>::const_iterator iter = iListTPs.begin();
631 
632  while (iter != iListTPs.end() )
633  {
634  QString temp;
635  temp.setNum(static_cast<int>(*iter));
636  StrgListTPs << temp;
637  ++iter;
638  }
639  //erase in the table widget:
640  this->m_Table->DeleteRowsWithSpecificTimePoints(StrgListTPs);
641 
642  }
653  template< typename T >
655  const std::vector< int > & iVectorTraceIDs,
656  vtkMySQLDatabase *iDatabaseConnector)
657  {
658  this->m_Table->setSortingEnabled(false);
659 
660  //insert the info from the database for the traces into the container
661  //for visu:
663  std::list< unsigned int > ListTraceIDs(iVectorTraceIDs.begin(), iVectorTraceIDs.end() );
664  this->GetTracesInfoFromDBAndModifyContainerForVisu(
665  iDatabaseConnector, ListTraceIDs);
666 
667  //insert the new rows into the TW:
668  std::list< unsigned int >::iterator iter = ListTraceIDs.begin();
669 
670  while ( iter != ListTraceIDs.end() )
671  {
672  TWContainerType RowContainer =
673  iTWContainer->GetContainerForOneSpecificTrace(iDatabaseConnector,
674  *iter);
675  this->m_Table->InsertOnlyOneNewRow(RowContainer,
676  iTWContainer->GetIndexForGroupColor(this->m_TraceName),
677  iTWContainer->GetIndexForGroupColor(this->m_CollectionName),
678  this->m_TraceName, this->m_CollectionName);
679  ++iter;
680  }
681  this->m_Table->setSortingEnabled(true);
682  this->m_Table->resizeColumnsToContents();
683  }
684 
695  template< typename T,typename C >
696  std::list< unsigned int > UpdateTheTracesColorTemplate(
697  vtkMySQLDatabase *iDatabaseConnector, C *iContainerInfoForVisu)
698  {
699  std::list< unsigned int > oListOfCollectionOfIDs = std::list< unsigned int >();
700  std::list< unsigned int > ListTracesIDs;
701  ListTracesIDs = iContainerInfoForVisu->
702  UpdateAllHighlightedElementsWithGivenColor(this->m_SelectedColorData->second);
703  if ( ListTracesIDs.empty() )
704  {
705  QMessageBox msgBox;
706  msgBox.setText(
707  tr("Please select at least one %1 for the color to be changed")
708  .arg( this->m_TraceName.c_str() ) );
709  msgBox.exec();
710  }
711  else
712  {
713  std::list< unsigned int >::iterator iter = ListTracesIDs.begin();
714  while ( iter != ListTracesIDs.end() )
715  {
716  this->m_CollectionOfTraces->ChangeColorForTrace< T >(*iter,
717  *this->m_SelectedColorData,
718  iDatabaseConnector);
719  this->DisplayInfoForExistingTrace(iDatabaseConnector, *iter);
720  ++iter;
721  }
722  oListOfCollectionOfIDs = this->m_CollectionOfTraces->
723  GetListTracesIDsFromThisCollectionOf(iDatabaseConnector, ListTracesIDs);
724  }
725  return oListOfCollectionOfIDs;
726  }
727 
735  template< typename T >
736  void SetTracesInfoContainerForVisuTemplate(T *iContainerForVisu,
737  T **iMemberContainerForVisu)
738  {
739  *iMemberContainerForVisu = iContainerForVisu;
740  QObject::connect( *iMemberContainerForVisu,
741  SIGNAL( TracePicked(uint, Qt::CheckState) ),
742  this,
743  SLOT( CheckTheTraceInTW(uint, Qt::CheckState) ) );
744 
745  QObject::connect( *iMemberContainerForVisu,
746  SIGNAL( TraceVisibilityChanged(uint, Qt::CheckState) ),
747  this,
748  SLOT ( ShowTheTraceInTW(uint, Qt::CheckState) ) );
749 
750  QObject::connect( this->m_Table,
751  SIGNAL( ModifyHighlightListTraces(QStringList,Qt::CheckState) ),
752  *iMemberContainerForVisu,
753  SLOT ( UpdateElementHighlightingWithGivenTraceIDs(QStringList,
754  Qt::CheckState) ) );
755  QObject::connect( this->m_Table,
756  SIGNAL( ModifyVisibilityListTraces(QStringList,Qt::CheckState) ),
757  *iMemberContainerForVisu,
758  SLOT ( UpdateElementVisibilityWithGivenTraceIDs(QStringList,
759  Qt::CheckState) ) );
760  }
761 
773  // TODO Nico- useless bool, should test lenght of list instead...!
774  template<typename T>
775  void DeleteTracesTemplate(vtkMySQLDatabase *iDatabaseConnector,
776  T *iContainerForVisu,
777  std::list<unsigned int> iListTracesToDelete = std::list<unsigned int>(),
778  bool DeleteHighlightedTraces = true)
779  {
780  std::list< unsigned int > ListTracesIDsToDelete;
781  if (DeleteHighlightedTraces) //case where the traces to be deleted are the ones highlighted in the visu
782  {
783  ListTracesIDsToDelete = iContainerForVisu->GetHighlightedElementsTraceID();
784  iContainerForVisu->DeleteAllHighlightedElements();
785  }
786  else //case where specific traces need to be deleted, not the highlighted ones
787  {
788  ListTracesIDsToDelete = iListTracesToDelete;
789  std::list<unsigned int>::iterator iter = iListTracesToDelete.begin();
790  while( iter != iListTracesToDelete.end() )
791  {
792  iContainerForVisu->DeleteElement(*iter);
793  ++iter;
794  }
795  }
796  this->m_CollectionOfTraces->DeleteTracesInDB(
797  ListTracesIDsToDelete, iDatabaseConnector);
798  this->m_Table->DeleteCheckedRows(this->m_TraceNameID, ListTracesIDsToDelete);
799  }
800 
809  template<typename T>
810  void SetColorCodingTemplate( T* iContainerForVisu, bool IsChecked)
811  {
812  std::string ColumnName = "";
813  std::map<unsigned int, std::string> Values;
814  m_IsColorCodingOn = IsChecked;
815 
816  if (IsChecked)
817  {
818  Values = this->m_Table->GetTraceIDAndColumnsValues(
819  this->m_TraceNameID, ColumnName);
820 
821  vtkLookupTable* LUT = NULL;
822 
823  bool IsRandomIncluded =
824  (ColumnName == this->m_TraceNameID) ||
825  (ColumnName == this->m_CollectionNameID);
826 
827  QGoColorCodingDialog::ColorWay UserColorway =
828  QGoColorCodingDialog::GetColorWay( this->m_TraceName, &LUT,
829  IsRandomIncluded, this->m_Table );
830 
831  switch ( UserColorway )
832  {
834  iContainerForVisu->SetColorCode( ColumnName,Values );
835  break;
836 
838  iContainerForVisu->SetRandomColor(ColumnName,Values );
839  break;
840 
842  iContainerForVisu->SetColorCode( ColumnName,Values );
843  iContainerForVisu->SetLookupTableForColorCoding(LUT);
844  break;
845 
846  default:
848  m_IsColorCodingOn = !IsChecked;
849  break;
850  }
851  }
852  else
853  {
854  m_IsColorCodingOn = IsChecked;
855  iContainerForVisu->SetColorCode( ColumnName, Values );
856  }
857  }
858 
865  template<typename T>
867  T* iContainerForVisu, vtkMySQLDatabase* iDatabaseConnector,
868  const std::list<unsigned int> & iListTraceIDs)
869  {
870  typedef typename T::MultiIndexContainerElementType Structure;
871  std::list<Structure> list_of_traces =
872  this->m_CollectionOfTraces->GetListStructureFromDB<Structure>(
873  iDatabaseConnector, this->m_ImgSessionID, iListTraceIDs);
874  typename std::list< Structure >::iterator it = list_of_traces.begin();
875 
876  while ( it != list_of_traces.end() )
877  {
878  iContainerForVisu->Insert(*it);
879  ++it;
880  }
881  }
882 
883  virtual void AddActionsContextMenu(QMenu *iMenu);
884 
885  void AddGeneralActionsContextMenu(QMenu *iMenu);
886 
887  void AddSpecificActionsForContourMesh(QMenu *iMenu);
888 
889  virtual void AddActionForAddingCheckedTracesToCollection();
890 
895  virtual void GetTracesInfoFromDBAndModifyContainerForVisu(
896  vtkMySQLDatabase* iDatabaseConnector,
897  std::list<unsigned int> iListTraceIDs = std::list< unsigned int >())= 0;
898 
899 
900  bool CheckThatThereAreTracesToDelete(const std::list<unsigned int> & iListTracesIDToDelete);
901 
902 protected slots:
903  //context menu:
908  void CreateContextMenu(const QPoint & iPos);
909 
910  void CheckSelectedRows();
911 
912  void UncheckSelectedRows();
913 
914  void ShowSelectedRows();
915 
916  void HideSelectedRows();
917 
923  virtual void ChangeTraceColor();
924 
925  void DeleteTracesFromContextMenu();
926 
933  void CheckTheTraceInTW(unsigned int iTraceID, Qt::CheckState iState);
934 
941  void ShowTheTraceInTW(unsigned int iTraceID, Qt::CheckState iState);
942 
943  void GoToTheTrace();
944 
950  virtual void CreateCorrespondingCollection();
951 
952  virtual void AddToSelectedCollection();
953 
959  virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID) = 0;
960 
966  virtual void UpdateVisibleElementsInVisuContainer(int iTraceID) = 0;
967 
974  virtual void SetColorCoding(bool IsChecked)= 0;
975 
983  void ShowOnlyRowsForCurrentTimePoint(bool IsChecked);
984 };
985 #endif
std::string m_CollectionNameID
void SetColorCodingTemplate(T *iContainerForVisu, bool IsChecked)
get a map with the tracesIDs as keys and the values of the selected columns as values for all traces ...
void DisplayInfoAndLoadVisuContainerWithAllTraces(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector)
get all the data from the database to load all the traces for the imagingsession into the table widge...
std::string m_CollectionName
void DisplayInfoAndLoadVisuContainerWithAllTracesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, C *iContainerForVisu, const std::list< unsigned int > &iListTPs)
Abstract class inherited by QGoDBContourManager,Mesh,Track,Lineage.
NameWithColorData * m_SelectedColorData
manages a map with keys matching fields of the gofiguredatabase Coordinate table and values of the ma...
QString tr(const char *sourceText, const char *disambiguation, int n)
std::string m_CollectionOf
void DisplayInfoForLastCreatedTraceTemplate(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector)
fill the TWContainer with the data needed from the database for the last created trace and insert a n...
NameWithColorData * m_SelectedCollectionData
void DisplayInfoForTracesForSpecificTPsTemplate(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector, Qt::CheckState iState, const std::list< unsigned int > &iListTPs, int iIndexShowColumn=0)
std::vector< std::pair< GoDBTraceInfoForTableWidget, std::vector< std::string > > > TWContainerType
void UpdateTWAndContainerWithImportedTracesTemplate(T *iTWContainer, const std::vector< int > &iVectorTraceIDs, vtkMySQLDatabase *iDatabaseConnector)
update for the imported traces the table widget and the database info of the container for visu...
inherits from the Qt class QTableWidget, manages all the interactions between the user and the data r...
void setText(const QString &text)
void GetTracesInfoFromDBAndModifyContainerForVisuTemplate(T *iContainerForVisu, vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTraceIDs)
get the info needed from the database to fill the container for visu
void DeleteTracesTemplate(vtkMySQLDatabase *iDatabaseConnector, T *iContainerForVisu, std::list< unsigned int > iListTracesToDelete=std::list< unsigned int >(), bool DeleteHighlightedTraces=true)
delete the traces from the database, the TW and the container for visu
void RemoveTracesFromTWAndContainerForVisuForSpecificTPsTemplate(vtkMySQLDatabase *iDatabaseConnector, C *iContainerForVisu, const std::list< unsigned int > &iListTPs)
void DisplayInfoForExistingTraceTemplate(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
fill the TWContainer with the data needed from the database for the trace with the iTraceID and updat...
std::list< unsigned int > UpdateTheTracesColorTemplate(vtkMySQLDatabase *iDatabaseConnector, C *iContainerInfoForVisu)
update the visu container, the database and the TW with the user selected color for the highlighted t...
void SetTraceBoundingBoxAndPoints(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iTCoord, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iTraceNodes, vtkMySQLDatabase *iDatabaseConnector, T &iTrace, unsigned int iTCoordMax=0)
unsigned int CreateNewTraceInDBFromVisu(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iTCoord, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iTraceNodes, NameWithColorData iColor, vtkMySQLDatabase *iDatabaseConnector, T &iTrace, unsigned int iCollectionID, unsigned int iTCoordMax=0)
create the trace row with the related data provided by the visu, iTCoordMax is equal to 0 as for cont...
std::string m_CollectionOfID
void GetTracesInfoFromDBAndModifyContainerForVisu(vtkMySQLDatabase *iDatabaseConnector, std::vector< int > iVectIDs, C *iContainerForVisu)
QString & setNum(short n, int base)
std::string m_TraceNameID
std::string m_LastSelectedTraceAsCollection
static ColorWay GetColorWay(std::string iTraceName, vtkLookupTable **ioLUT, bool iRandomIncluded, QWidget *iiParent=0)
get the way the user wants its traces to be colorcoded and the LUT if he chooses the LUT ...
std::pair< std::string, QColor > NameWithColorData
std::pair< unsigned int, QColor > IDWithColorData
GoDBTableWidgetContainer::TWContainerType TWContainerType
QGoTableWidget * m_Table
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
vtkMySQLDatabase * m_DatabaseConnector
void DisplayInfoForAllTracesTemplate(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector, Qt::CheckState iState, int iIndexShowColumn=0)
fill the TWContainer with all the data needed from the database and display them into the m_Table ...
this class handles the interaction between the database and the children of QGoDBTraceManager ...
iterator begin()
GoDBCollectionOfTraces * m_CollectionOfTraces
void SetTracesInfoContainerForVisuTemplate(T *iContainerForVisu, T **iMemberContainerForVisu)
set the iMemberContainerInfoForVisu to the iContainerForVisu and create the connections SLOT/SIGNAL ...