]> Creatis software - clitk.git/blobdiff - vv/vvLandmarksPanel.cxx
Add tool_install for clitkMergeRootFiles & clitkMergeAsciiDoseActor
[clitk.git] / vv / vvLandmarksPanel.cxx
index a90ea5bb22901651c004e75de0bd3a1ba0ad6810..2d3e1a5503ca4f0702e13947935035afd690d16f 100644 (file)
@@ -41,7 +41,9 @@ vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
   connect(loadButton, SIGNAL(clicked()),this,SLOT(Load()));
   connect(saveButton, SIGNAL(clicked()),this,SLOT(Save()));
   connect(removeButton, SIGNAL(clicked()),this,SLOT(RemoveSelectedPoints()));
+  connect(removeAllButton, SIGNAL(clicked()),this,SLOT(RemoveAllPoints()));
   connect(tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(CommentsChanged(int,int)));
+  connect(tableWidget,SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(SelectPoint()));
 }
 
 void vvLandmarksPanel::Load()
@@ -77,6 +79,25 @@ void vvLandmarksPanel::Save()
   }
 }
 
+void vvLandmarksPanel::SelectPoint()
+{
+  if (tableWidget->rowCount() > 0) {
+    QList<QTableWidgetItem *> items = tableWidget->selectedItems();
+    if (!items.empty()) {
+      // we're using single-selection mode
+      int row = items[0]->row();
+      mSelectedPoint[0] = mCurrentLandmarks->GetCoordinates(row)[0];
+      mSelectedPoint[1] = mCurrentLandmarks->GetCoordinates(row)[1];
+      mSelectedPoint[2] = mCurrentLandmarks->GetCoordinates(row)[2];
+      mSelectedPoint[3] = mCurrentLandmarks->GetCoordinates(row)[3];
+        
+      emit SelectedPointChanged();
+    }
+  }
+
+}
+
+
 void vvLandmarksPanel::RemoveSelectedPoints()
 {
   if (tableWidget->rowCount() > 0) {
@@ -101,6 +122,14 @@ void vvLandmarksPanel::RemoveSelectedPoints()
   }
 }
 
+void vvLandmarksPanel::RemoveAllPoints()
+{
+  mCurrentLandmarks->RemoveAll();
+  tableWidget->clearContents();
+  tableWidget->setRowCount(0);
+  emit UpdateRenderWindows();
+}
+
 void vvLandmarksPanel::AddPoint()
 {
   AddPoint(mCurrentLandmarks->GetNumberOfPoints()-1);