39 #include <QMessageBox>
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)
90 std::string oNameID = iName;
108 vtkMySQLDatabase *iDatabaseConnector)
152 SelectedTracesMenu->
addAction(
tr(
"Check the selected %1s")
154 SelectedTracesMenu->
addAction(
tr(
"Uncheck the selected %1s")
156 SelectedTracesMenu->
addAction(
tr(
"Show the selected %1s")
158 SelectedTracesMenu->
addAction(
tr(
"Hide the selected %1s")
165 ColorMenu->
addAction(
tr(
"To the selected color for the checked %1s")
169 QAction *ColorCoding =
new QAction(
tr(
"Based on the selected column"), ColorMenu);
177 this->
m_Table, SLOT( CopySelection() ) );
191 QAction *ShowCurrentTimePoint =
new QAction(
tr(
"Show only in the table the %1 for the current timepoint")
196 SIGNAL( triggered (
bool) ),
270 std::list< unsigned int >
272 vtkMySQLDatabase *iDatabaseConnector,
273 const std::list< unsigned int > & iListTraces)
276 iDatabaseConnector, iListTraces);
282 std::list< unsigned int >
284 vtkMySQLDatabase *iDatabaseConnector,
285 const std::list< unsigned int > & iListCollectionIDs)
297 const std::list< unsigned int > & iListTraces)
300 std::list< unsigned int >::const_iterator iter = iListTraces.begin();
301 while ( iter != iListTraces.end() )
313 const std::list<unsigned int> & iListTracesIDToDelete)
316 if ( iListTracesIDToDelete.empty() )
320 tr(
"Please check at least one %1 to be deleted")
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,
333 case QMessageBox::Yes:
335 case QMessageBox::No:
347 std::list< unsigned int > ListTracesIDToDelete =
363 const std::list< unsigned int > & iListTracesIDs,
367 iCollectionID, iDatabaseConnector);
374 std::list< unsigned int >
376 vtkMySQLDatabase *iDatabaseConnector,
377 const std::list< unsigned int > & iListTracesIDs)
380 iDatabaseConnector, iListTracesIDs);
388 const std::list< unsigned int > & iListTracesIDs,
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 );
418 std::list< QGoDBTraceManager::NameWithColorData >
420 vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect)
432 Qt::CheckState iState)
442 Qt::CheckState iState)
453 std::list< unsigned int > ListCheckedTraces =
455 if ( ListCheckedTraces.size() != 1 )
459 tr(
"Please select one and only one %1 to go to")
478 std::list< unsigned int > ListCheckedTraces =
480 if ( ListCheckedTraces.empty() )
484 tr(
"Please select at least one %1 to create the %2")
498 int iYCoord,
int iZCoord,
int iTCoord)
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);
515 if ( ListCheckedTraces.empty() )
519 tr(
"Please check at least one %1 to be part of the %2")
533 vtkMySQLDatabase *iDatabaseConnector,
int iNumberOfTraceIDs)
536 iDatabaseConnector, iNumberOfTraceIDs);
543 vtkMySQLDatabase *iDatabaseConnector)
std::string m_CollectionNameID
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 UncheckSelectedRows()
std::string GetTheNameIDFromName(std::string iName)
transform the iName into iNameID
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 CheckedTracesToDelete()
signal emitted when the user click on the action "DeleteTraces" from the context menu as it can impac...
void setSortingEnabled(bool enable)
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
void DeleteTracesFromContextMenu()
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
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...
virtual ~QGoDBTraceManager()
void ShowOnlyRowsForCurrentTimePoint(bool IsChecked)
Show only the rows in the table widget that have a timepoint equal to the current timepoint if IsChec...
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
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
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...
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...
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 ...
QMenu * m_CheckedTracesMenu
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...
bool m_IsShowOnlyCurrentTimePointOn
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