GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBTraceManager.cxx
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 #include "QGoDBTraceManager.h"
36 #include <iostream>
37 #include <sstream>
38 #include <QMenu>
39 #include <QMessageBox>
40 
42  QObject(iParent), m_SelectedCollectionData(NULL),
43  m_SelectedColorData(NULL), m_CurrentTimePoint(NULL), m_Table(NULL),
44  m_CollectionOfTraces(NULL), m_DatabaseConnector(NULL),
45  m_IsColorCodingOn(false), m_IsShowOnlyCurrentTimePointOn(false)
46 {
47 }
48 //-------------------------------------------------------------------------
49 
50 //-------------------------------------------------------------------------
52 {
53  if ( this->m_CollectionOfTraces )
54  {
55  delete this->m_CollectionOfTraces;
56  }
57 }
58 //-------------------------------------------------------------------------
59 
60 //-------------------------------------------------------------------------
61 void QGoDBTraceManager::SetInfo(unsigned int iImgSessionID, QWidget *iParent)
62 {
64  this->m_TraceNameID = this->GetTheNameIDFromName(this->m_TraceName);
67 
69  this->m_TraceName,
70  this->m_CollectionOf,
71  iImgSessionID);
72 
73  this->m_Table = new QGoTableWidget(iParent);
74  QObject::connect( this->m_Table, SIGNAL( CheckedRowsChanged(int) ),
75  this, SLOT( UpdateHighlightedElementsInVisuContainer(int) ) );
76  QObject::connect( this->m_Table, SIGNAL( VisibleRowsChanged(int) ),
77  this, SLOT( UpdateVisibleElementsInVisuContainer(int) ) );
78 
79  QObject::connect( this->m_Table, SIGNAL(customContextMenuRequested (const QPoint &) ),
80  this, SLOT( CreateContextMenu ( const QPoint &) ) );
81 
82  this->m_ImgSessionID = iImgSessionID;
83 }
84 
85 //-------------------------------------------------------------------------
86 
87 //-------------------------------------------------------------------------
88 std::string QGoDBTraceManager::GetTheNameIDFromName(std::string iName)
89 {
90  std::string oNameID = iName;
91 
92  oNameID += "ID";
93  return oNameID;
94 }
95 
96 //-------------------------------------------------------------------------
97 
98 //-------------------------------------------------------------------------
100 {
101  return this->m_Table;
102 }
103 
104 //-------------------------------------------------------------------------
105 
106 //-------------------------------------------------------------------------
108  vtkMySQLDatabase *iDatabaseConnector)
109 {
110  return MaxValueForOneColumnInTable( iDatabaseConnector,
111  this->m_TraceNameID, this->m_TraceName, "ImagingSessionID",
112  ConvertToString< unsigned int >(this->m_ImgSessionID) );
113 }
114 
115 //-------------------------------------------------------------------------
116 
117 //-------------------------------------------------------------------------
119 {
120  QMenu *ContextMenu = new QMenu;
121 
122  this->AddActionsContextMenu(ContextMenu);
123  ContextMenu->exec( this->m_Table->mapToGlobal(iPos) );
124 }
125 
126 //-------------------------------------------------------------------------
127 
128 //-------------------------------------------------------------------------
130 {
131  this->AddGeneralActionsContextMenu(iMenu);
132 }
133 
134 //-------------------------------------------------------------------------
135 
136 //-------------------------------------------------------------------------
138 {
139  m_CheckedTracesMenu = new QMenu( tr("With the checked %1s").arg( this->m_TraceName.c_str() ) );
140  m_CheckedTracesMenu->addAction( tr("Delete them"),
141  this, SLOT( DeleteTracesFromContextMenu() ) );
142  //m_CheckedTracesMenu->addAction( tr("Add to selected %1 %2").arg(
143  // this->m_CollectionName.c_str() )
144  // .arg(this->m_SelectedCollectionData->first.c_str()),
145  // this, SLOT( AddToSelectedCollection() ) );
146  m_CheckedTracesMenu->addAction( tr("Change their color to the selected one : %1")
147  .arg( this->m_SelectedColorData->first.c_str() ),
148  this, SLOT( ChangeTraceColor() ) );
149  iMenu->addAction( this->m_CheckedTracesMenu->menuAction() );
150 
151  QMenu *SelectedTracesMenu = new QMenu( tr("With the selected %1s").arg( this->m_TraceName.c_str() ) );
152  SelectedTracesMenu->addAction( tr("Check the selected %1s")
153  .arg( this->m_TraceName.c_str() ), this, SLOT( CheckSelectedRows() ) );
154  SelectedTracesMenu->addAction( tr("Uncheck the selected %1s")
155  .arg( this->m_TraceName.c_str() ), this, SLOT( UncheckSelectedRows() ) );
156  SelectedTracesMenu->addAction( tr("Show the selected %1s")
157  .arg( this->m_TraceName.c_str() ), this, SLOT( ShowSelectedRows() ) );
158  SelectedTracesMenu->addAction( tr("Hide the selected %1s")
159  .arg( this->m_TraceName.c_str() ), this, SLOT( HideSelectedRows() ) );
160 
161  iMenu->addAction( SelectedTracesMenu->menuAction() );
162 
163  QMenu *ColorMenu = new QMenu( tr("Change color of your %1s").arg( this->m_TraceName.c_str() ) );
164 
165  ColorMenu->addAction( tr("To the selected color for the checked %1s")
166  .arg( this->m_TraceName.c_str() ),
167  this, SLOT( ChangeTraceColor() ) );
168 
169  QAction *ColorCoding = new QAction(tr("Based on the selected column"), ColorMenu);
170  ColorCoding->setCheckable(true);
171  ColorCoding->setChecked(m_IsColorCodingOn);
172  QObject::connect( ColorCoding, SIGNAL( triggered (bool) ), this, SLOT( SetColorCoding(bool) ) );
173  ColorMenu->addAction(ColorCoding);
174  iMenu->addAction( ColorMenu->menuAction() );
175 
176  iMenu->addAction( tr("Copy Selection"),
177  this->m_Table, SLOT( CopySelection() ) );
178  iMenu->addAction( tr("Copy table"), this->m_Table, SLOT( CopyTable() ) );
179 }
180 
181 //-------------------------------------------------------------------------
182 
183 //-------------------------------------------------------------------------
185 {
187  //for the time being, as we don't use lineages
188  iMenu->addAction( tr("Go to this %1")
189  .arg( this->m_TraceName.c_str() ),
190  this, SLOT( GoToTheTrace() ) );
191  QAction *ShowCurrentTimePoint = new QAction(tr("Show only in the table the %1 for the current timepoint")
192  .arg( this->m_TraceName.c_str() ), iMenu);
193  ShowCurrentTimePoint->setCheckable(true);
194  ShowCurrentTimePoint->setChecked(this->m_IsShowOnlyCurrentTimePointOn);
195  QObject::connect( ShowCurrentTimePoint,
196  SIGNAL( triggered (bool) ),
197  this,
198  SLOT( ShowOnlyRowsForCurrentTimePoint(bool) ) );
199  iMenu->addAction(ShowCurrentTimePoint);
202 }
203 
204 //-------------------------------------------------------------------------
205 
206 //------------------------------------------------------------------------
208 {
209  this->m_CheckedTracesMenu->addAction( tr("Add to selected %1 %2")
210  .arg( this->m_CollectionName.c_str() )
211  .arg( this->m_SelectedCollectionData->first.c_str() ),
212  this, SLOT( AddToSelectedCollection() ) );
213 
214  this->m_CheckedTracesMenu->addAction( tr("Create a new %1 from checked %2s")
215  .arg( this->m_CollectionName.c_str() )
216  .arg( this->m_TraceName.c_str() ),
217  this, SLOT( CreateCorrespondingCollection() ) );
218 }
219 
220 //-------------------------------------------------------------------------
221 
222 //-------------------------------------------------------------------------
224 {
226  this->m_TraceNameID, Qt::Checked);
227 }
228 
229 //-------------------------------------------------------------------------
230 
231 //------------------------------------------------------------------------
233 {
235  this->m_TraceNameID, Qt::Unchecked);
236 }
237 
238 //-------------------------------------------------------------------------
239 
240 //------------------------------------------------------------------------
242 {
244  this->m_TraceNameID, Qt::Checked);
245 }
246 
247 //-------------------------------------------------------------------------
248 
249 //------------------------------------------------------------------------
251 {
253  this->m_TraceNameID, Qt::Unchecked);
254 }
255 
256 //-------------------------------------------------------------------------
257 
258 //------------------------------------------------------------------------
260 {
261  //as it impacts also the collectionof, a signal has to be emitted:
262  //but not for contourManager (no collectionof) where ChangeTraceColor()
263  //is then reimplemented
264  emit TraceColorToChange();
265 }
266 
267 //-------------------------------------------------------------------------
268 
269 //------------------------------------------------------------------------
270 std::list< unsigned int >
272  vtkMySQLDatabase *iDatabaseConnector,
273  const std::list< unsigned int > & iListTraces)
274 {
276  iDatabaseConnector, iListTraces);
277 }
278 
279 //-------------------------------------------------------------------------
280 
281 //------------------------------------------------------------------------
282 std::list< unsigned int >
284  vtkMySQLDatabase *iDatabaseConnector,
285  const std::list< unsigned int > & iListCollectionIDs)
286 {
287  return this->m_CollectionOfTraces->GetTraceIDsBelongingToCollectionID(iDatabaseConnector,
288  iListCollectionIDs);
289 }
290 
291 //-------------------------------------------------------------------------
292 
293 //------------------------------------------------------------------------
294 void
296 DisplayInfoForExistingTraces(vtkMySQLDatabase * iDatabaseConnector,
297  const std::list< unsigned int > & iListTraces)
298 {
299  this->m_Table->setSortingEnabled(false);
300  std::list< unsigned int >::const_iterator iter = iListTraces.begin();
301  while ( iter != iListTraces.end() )
302  {
303  this->DisplayInfoForExistingTrace(iDatabaseConnector, *iter);
304  ++iter;
305  }
306  this->m_Table->setSortingEnabled(true);
307 }
308 
309 //-------------------------------------------------------------------------
310 
311 //------------------------------------------------------------------------
313  const std::list<unsigned int> & iListTracesIDToDelete)
314 {
315 
316  if ( iListTracesIDToDelete.empty() )
317  {
318  QMessageBox msgBox;
319  msgBox.setText(
320  tr("Please check at least one %1 to be deleted")
321  .arg( this->m_TraceName.c_str() ) );
322  msgBox.exec();
323  return false;
324  }
325  else
326  {
327  switch( QMessageBox::warning(this->m_Table, tr(""),
328  tr("Are you sure you want to delete\n"
329  "permanently the selected %1s?").arg( this->m_TraceName.c_str() ),
330  QMessageBox::Yes | QMessageBox::No,
331  QMessageBox::No))
332  {
333  case QMessageBox::Yes:
334  return true;
335  case QMessageBox::No:
336  return false;
337  default:
338  return false;
339  }
340  }
341 }
342 //-------------------------------------------------------------------------
343 
344 //------------------------------------------------------------------------
346 {
347  std::list< unsigned int > ListTracesIDToDelete =
348  this->GetListHighlightedIDs();
349 
350  if (this->CheckThatThereAreTracesToDelete(ListTracesIDToDelete) )
351  {
352  //as it impacts also on the collection and the collectionOf,
353  //a signal has to be emitted for another traceManager:
354  emit CheckedTracesToDelete();
355  }
356 }
357 
358 //-------------------------------------------------------------------------
359 
360 //------------------------------------------------------------------------
361 void
362 QGoDBTraceManager::UpdateCollectionID(vtkMySQLDatabase *iDatabaseConnector,
363  const std::list< unsigned int > & iListTracesIDs,
364  int iCollectionID)
365 {
367  iCollectionID, iDatabaseConnector);
368  this->DisplayInfoForExistingTraces(iDatabaseConnector, iListTracesIDs);
369 }
370 
371 //-------------------------------------------------------------------------
372 
373 //------------------------------------------------------------------------
374 std::list< unsigned int >
376  vtkMySQLDatabase *iDatabaseConnector,
377  const std::list< unsigned int > & iListTracesIDs)
378 {
380  iDatabaseConnector, iListTracesIDs);
381 }
382 
383 //-------------------------------------------------------------------------
384 
385 //------------------------------------------------------------------------
386 void
387 QGoDBTraceManager::UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector,
388  const std::list< unsigned int > & iListTracesIDs,
389  bool UpdateTW)
390 {
391  this->m_CollectionOfTraces->RecalculateDBBoundingBox(iDatabaseConnector, iListTracesIDs);
392 
393  if ( UpdateTW )
394  {
395  this->DisplayInfoForExistingTraces(iDatabaseConnector, iListTracesIDs);
396  }
397 }
398 
399 //-------------------------------------------------------------------------
400 
401 //------------------------------------------------------------------------
403 {
404  qreal r, g, b, a;
405 
406  iColor.getRgbF(&r, &g, &b, &a);
407  double *rgba = new double[4];
408  rgba[0] = static_cast< double >( r );
409  rgba[1] = static_cast< double >( g );
410  rgba[2] = static_cast< double >( b );
411  rgba[3] = static_cast< double >( a );
412  return rgba;
413 }
414 
415 //-------------------------------------------------------------------------
416 
417 //------------------------------------------------------------------------
418 std::list< QGoDBTraceManager::NameWithColorData >
420  vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect)
421 {
422  ioIDToSelect = this->m_LastSelectedTraceAsCollection;
423 
425  iDatabaseConnector);
426 }
427 
428 //-------------------------------------------------------------------------
429 
430 //------------------------------------------------------------------------
431 void QGoDBTraceManager::CheckTheTraceInTW(unsigned int iTraceID,
432  Qt::CheckState iState)
433 {
434  this->m_Table->SetCheckStateForTraceID(iTraceID,
435  this->m_TraceName, iState, false);
436 }
437 
438 //-------------------------------------------------------------------------
439 
440 //------------------------------------------------------------------------
441 void QGoDBTraceManager::ShowTheTraceInTW(unsigned int iTraceID,
442  Qt::CheckState iState)
443 {
444  this->m_Table->SetVisibleStateForTraceID(iTraceID,
445  this->m_TraceName, iState, false);
446 }
447 
448 //-------------------------------------------------------------------------
449 
450 //------------------------------------------------------------------------
452 {
453  std::list< unsigned int > ListCheckedTraces =
454  this->GetListHighlightedIDs();
455  if ( ListCheckedTraces.size() != 1 )
456  {
457  QMessageBox msgBox;
458  msgBox.setText(
459  tr("Please select one and only one %1 to go to")
460  .arg( this->m_TraceName.c_str() ) );
461  msgBox.exec();
462  return;
463  }
464  GoDBCoordinateRow CoordCenter =
465  this->m_Table->GetCoordinateCenterBoundingBox(ListCheckedTraces.front(),
466  this->m_TraceName);
467 
468  emit NeedToGoToTheLocation( CoordCenter.GetMapValue<int>("XCoord"),
469  CoordCenter.GetMapValue<int>("YCoord"),
470  CoordCenter.GetMapValue<int>("ZCoord"),
471  CoordCenter.GetMapValue<int>("TCoord") );
472 }
473 //-------------------------------------------------------------------------
474 
475 //-------------------------------------------------------------------------
477 {
478  std::list< unsigned int > ListCheckedTraces =
479  this->GetListHighlightedIDs();
480  if ( ListCheckedTraces.empty() )
481  {
482  QMessageBox msgBox;
483  msgBox.setText(
484  tr("Please select at least one %1 to create the %2")
485  .arg( this->m_TraceName.c_str() )
486  .arg( this->m_CollectionName.c_str() ) );
487  msgBox.exec();
488  return;
489  }
490  emit NewCollectionFromCheckedTraces(ListCheckedTraces);
491 }
492 
493 //-------------------------------------------------------------------------
494 
495 //-------------------------------------------------------------------------
496 
498  int iYCoord, int iZCoord, int iTCoord)
499 {
500  GoDBCoordinateRow coord;
501 
502  coord.SetField< unsigned int >("XCoord", iXCoord);
503  coord.SetField< unsigned int >("YCoord", iYCoord);
504  coord.SetField< unsigned int >("ZCoord", iZCoord);
505  coord.SetField< unsigned int >("TCoord", iTCoord);
506  return coord;
507 }
508 
509 //-------------------------------------------------------------------------
510 
511 //-------------------------------------------------------------------------
513 {
514  std::list< unsigned int > ListCheckedTraces = this->GetListHighlightedIDs();
515  if ( ListCheckedTraces.empty() )
516  {
517  QMessageBox msgBox;
518  msgBox.setText(
519  tr("Please check at least one %1 to be part of the %2")
520  .arg( this->m_TraceName.c_str() )
521  .arg( this->m_CollectionName.c_str() ) );
522  msgBox.exec();
523  return;
524  }
526  this->GetListHighlightedIDs() );
527 }
528 
529 //-------------------------------------------------------------------------
530 
531 //-------------------------------------------------------------------------
533  vtkMySQLDatabase *iDatabaseConnector, int iNumberOfTraceIDs)
534 {
536  iDatabaseConnector, iNumberOfTraceIDs);
537 }
538 
539 //-------------------------------------------------------------------------
540 
541 //-------------------------------------------------------------------------
543  vtkMySQLDatabase *iDatabaseConnector)
544 {
545  this->m_DatabaseConnector = iDatabaseConnector;
546 }
547 
548 //-------------------------------------------------------------------------
549 
550 //-------------------------------------------------------------------------
552 {
553  this->m_SelectedCollectionData = iCollectionData;
554 }
555 
556 //-------------------------------------------------------------------------
557 
558 //-------------------------------------------------------------------------
560 {
561  this->m_CurrentTimePoint = iTimePoint;
562 }
563 
564 //-------------------------------------------------------------------------
565 
566 //-------------------------------------------------------------------------
568 {
569  this->m_SelectedColorData = iColorData;
570 }
571 
572 //-------------------------------------------------------------------------
573 
574 //-------------------------------------------------------------------------
576 {
577  this->m_IsShowOnlyCurrentTimePointOn = IsChecked;
578 
579  if ( IsChecked )
580  {
582  }
583  else
584  {
585  this->m_Table->ShowAllRows();
586  }
587 }
588 
589 //-------------------------------------------------------------------------
590 
591 //-------------------------------------------------------------------------
593 {
594  if ( this->m_IsShowOnlyCurrentTimePointOn )
595  {
597  }
598 }
599 //-------------------------------------------------------------------------
600 
601 //-------------------------------------------------------------------------
603 {
605  this->m_SelectedCollectionData->first;
606 }
607 //-------------------------------------------------------------------------
std::string m_CollectionNameID
void ShowOnlyRowsForTimePoint(unsigned int iTimePoint)
hide all rows who have a timepoint different than iTimePoint
void UpdateCollectionID(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTracesIDs, int iCollectionID)
update the collectionID of the tracesIDs in the list with the iCollectionID in the database and the T...
void CheckShowRows()
if m_IsShowOnlyCurrentTimePointOn is true, call the method to show only the rows for the current time...
void ChangeCheckStateSelectedRows(std::string iTraceName, std::string iTraceNameID, Qt::CheckState iState)
uncheck/check the boxes in the check/uncheck column for the rows where at least one cell is selected ...
std::string GetTheNameIDFromName(std::string iName)
transform the iName into iNameID
void setChecked(bool)
virtual void UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTracesIDs, bool UpdateTW=true)
update in the database the bounding boxes corresponding to the TracesIDs and update the corresponding...
std::string m_CollectionName
void addAction(QAction *action)
void CheckedTracesToDelete()
signal emitted when the user click on the action "DeleteTraces" from the context menu as it can impac...
void setSortingEnabled(bool enable)
QPoint mapToGlobal(const QPoint &pos) const
virtual void CreateCorrespondingCollection()
slot called when the user click on "create a collection from checked traces" in the context menu...
virtual void SetCollectionsTraceNames()=0
virtual pure method: set the std::string class members
void SetDatabaseConnection(vtkMySQLDatabase *iDatabaseConnector)
set the m_DatabaseConnection to iDatabaseConnector
void AddSpecificActionsForContourMesh(QMenu *iMenu)
NameWithColorData * m_SelectedColorData
void NewCollectionFromCheckedTraces(std::list< unsigned int >)
signal emitted when the user clicks on "create a new collection from checked traces" in the context m...
std::list< NameWithColorData > GetAllTracesIDsWithColor(vtkMySQLDatabase *iDatabaseConnector)
get all the distinct traces IDs with their QColor
virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID)=0
modify to the opposite one the highlighted property of the corresponding trace base on traceID in the...
manages a map with keys matching fields of the gofiguredatabase Coordinate table and values of the ma...
void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const
QString tr(const char *sourceText, const char *disambiguation, int n)
std::string m_CollectionOf
void UpdateLastSelectedOneAsCollection()
virtual std::list< NameWithColorData > GetAllTraceIDsWithColor(vtkMySQLDatabase *iDatabaseConnector, std::string &ioIDToSelect)
return the distinct traces with their color for the imagingsession, for all timepoints if the timepoi...
virtual void AddToSelectedCollection()
virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector, int iTraceID)=0
Virtual pure method: get the data needed from the database for the existing trace with iTraceID and u...
NameWithColorData * m_SelectedCollectionData
std::list< unsigned int > GetLastCreatedTracesIDs(vtkMySQLDatabase *iDatabaseConnector, int iNumberOfTraces)
get the IDs of the last saved traces in the database
std::list< unsigned int > GetListTracesIDsBelongingToCollectionIDs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListCollectionIDs)
get the list of tracesIDs belonging to the collection listed in iListCollectionIDs ...
double * GetVectorFromQColor(QColor iColor)
return a double rgba[4] from a QColor
std::list< unsigned int > GetListTracesIDsFromThisCollectionOf(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraces)
get the list of IDs belonging to the iListTraces as collectionof
inherits from the Qt class QTableWidget, manages all the interactions between the user and the data r...
std::list< unsigned int > GetListCollectionIDs(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTracesIDs, bool ExcludeZero=true, bool Distinct=true)
get the list of IDs that are collection of iListTraces
std::list< unsigned int > GetListTracesIDsFromThisCollectionOf(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTraces)
get the collectionOf IDs for the TracesIDs found in iListTraces
void AddGeneralActionsContextMenu(QMenu *iMenu)
void RecalculateDBBoundingBox(vtkMySQLDatabase *iDatabaseConnector, int iCollectionID)
Calculate the bounding box of the corresponding collection and update it in the database.
void setText(const QString &text)
void SetCurrentTimePoint(int *iTimePoint)
set the pointer to the current timepoint
int MaxValueForOneColumnInTable(vtkMySQLDatabase *DatabaseConnector, const std::string &ColumnName, const std::string &TableName)
SELECT MAX(ColumnName) FROM TableName This is an overloaded member function, provided for convenience...
GoDBCoordinateRow GetCoordinateFromInt(int iXCoord, int iYCoord, int iZCoord, int iTCoord)
create a GoDBCoordinateRow and set its fields X,Y,Z,Tcoord
void SetInfo(unsigned int iImgSessionID, QWidget *iParent)
set the variables class members
QAction * exec()
void CheckTheTraceInTW(unsigned int iTraceID, Qt::CheckState iState)
slot called when a trace has been picked from the visu, to update the TW "checked/unchecked" column c...
GoDBCoordinateRow GetCoordinateCenterBoundingBox(unsigned int iTraceID, const std::string &iTraceName)
calculate the center of the bounding box for the only selected trace and return it as a GoDBCoordinat...
void ShowOnlyRowsForCurrentTimePoint(bool IsChecked)
Show only the rows in the table widget that have a timepoint equal to the current timepoint if IsChec...
void setCheckable(bool)
virtual void SetColorCoding(bool IsChecked)=0
ColorCode the traces in the visualization base on a selected column in the table widget.
virtual void AddActionForAddingCheckedTracesToCollection()
std::list< unsigned int > GetTraceIDsBelongingToCollectionID(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs, unsigned int iCollectionID)
get the tracesIDs contained in iListTraceIDs that have iCollectionID as a collectionID ...
QGoTableWidget * GetTableWidget()
get the m_Table
QGoDBTraceManager(QObject *iParent=NULL)
std::string m_CollectionOfID
bool CheckThatThereAreTracesToDelete(const std::list< unsigned int > &iListTracesIDToDelete)
void SetField(const std::string &key, const T &value)
convert the value into a string and assign it to the key in the map
Definition: GoDBRow.h:73
void CreateContextMenu(const QPoint &iPos)
create the context menu when the user clicks on the table widget
std::list< unsigned int > GetListCollectionIDs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTracesIDs)
return the list of collection IDs distinct and different from zero corresponding to the tracesIDs ...
std::string m_TraceNameID
void ShowTheTraceInTW(unsigned int iTraceID, Qt::CheckState iState)
slot called when a trace has been shown/hidden from the visu, to update the TW "show/hide" column cor...
virtual std::list< unsigned int > GetListHighlightedIDs()=0
void ChangeVisibilityStateSelectedRows(std::string iTraceName, std::string iTraceNameID, Qt::CheckState iState)
check/uncheck the visible boxes for the rows where at least one cell is selected
std::string m_LastSelectedTraceAsCollection
void NeedToGoToTheLocation(int XCoord, int YCoord, int ZCoord, int TCoord)
signal emitted when the user clicks on "go to the trace" in the context menu and return the coordinat...
std::pair< std::string, QColor > NameWithColorData
void SetSelectedColor(NameWithColorData *iColorData)
set the pointer to the current selected color
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void CheckedTracesToAddToSelectedCollection(std::list< unsigned int >)
void SetSelectedCollection(NameWithColorData *iCollectionData)
set the pointer to the selected collection data
void TraceColorToChange()
signal emitted when the user click on the action "change color" from the context menu as it can impac...
QAction * menuAction() const
void SetCheckStateForTraceID(unsigned int iTraceID, const std::string &iTraceName, Qt::CheckState iState, bool EmitSignal=true)
set the state of the checkbox for the check/uncheck column and the TraceID row to iState ...
virtual void ChangeTraceColor()
is called when the user choses the change color action in the context menu, emit the signal TraceColo...
int GetLastCreatedTraceID(vtkMySQLDatabase *iDatabaseConnector)
get the ID for the last created trace in the database
std::list< unsigned int > GetLastCreatedTracesIDs(vtkMySQLDatabase *iDatabaseConnector, int iNumberOfTracesIDs)
get the last saved traces in the database
virtual void UpdateVisibleElementsInVisuContainer(int iTraceID)=0
modify to the opposite one the Visible property of the corresponding trace base on traceID in the con...
QGoTableWidget * m_Table
void SetVisibleStateForTraceID(unsigned int iTraceID, const std::string &iTraceName, Qt::CheckState iState, bool EmitSignal=true)
set the state and icon of the checkbox for the IsVisible column and the TraceID row to iState ...
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void DisplayInfoForExistingTraces(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTraces)
get the data from the database corresponding to the iListTraces and display them in the Table Widget ...
vtkMySQLDatabase * m_DatabaseConnector
this class handles the interaction between the database and the children of QGoDBTraceManager ...
virtual void AddActionsContextMenu(QMenu *iMenu)
std::string GetMapValue(const std::string &key)
return the value for the field map[key] after having removed the " at the beginning and at the end of...
Definition: GoDBRow.cxx:174
void UpdateCollectionIDOfSelectedTraces(std::list< unsigned int > iListSelectedTraces, unsigned int iCollectionID, vtkMySQLDatabase *iDatabaseConnector)
Update the collectionID of the selected traces in the DB traces table with the new collectionID...
GoDBCollectionOfTraces * m_CollectionOfTraces