From 14db82d8e865a2ea41a34e45c33ccda2f8dcd131 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Thu, 13 Dec 2012 16:31:43 +0100 Subject: [PATCH] add "Remove All" landmarks --- vv/qt_ui/vvLandmarksPanel.ui | 49 ++++++++++++++++++++---------------- vv/vvLandmarks.cxx | 11 ++++++++ vv/vvLandmarks.h | 2 ++ vv/vvLandmarksPanel.cxx | 9 +++++++ vv/vvLandmarksPanel.h | 1 + 5 files changed, 50 insertions(+), 22 deletions(-) diff --git a/vv/qt_ui/vvLandmarksPanel.ui b/vv/qt_ui/vvLandmarksPanel.ui index 7a64ea6..8cbe197 100644 --- a/vv/qt_ui/vvLandmarksPanel.ui +++ b/vv/qt_ui/vvLandmarksPanel.ui @@ -7,20 +7,14 @@ 0 0 325 - 131 + 214 Form - - - 2 - - - 2 - - + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -30,7 +24,14 @@ p, li { white-space: pre-wrap; } - + + + + Coordinates are in mm + + + + 7 @@ -84,7 +85,7 @@ p, li { white-space: pre-wrap; } remove last landmark. - + 1 @@ -93,19 +94,30 @@ p, li { white-space: pre-wrap; } - + + + All + + + + :/common/icons/standardbutton-cancel-16.png:/common/icons/standardbutton-cancel-16.png + + + + + Qt::Horizontal - 40 + 39 20 - + Load @@ -116,7 +128,7 @@ p, li { white-space: pre-wrap; } - + Save @@ -127,13 +139,6 @@ p, li { white-space: pre-wrap; } - - - - Coordinates are in mm - - - diff --git a/vv/vvLandmarks.cxx b/vv/vvLandmarks.cxx index 0b5f98a..fed697e 100644 --- a/vv/vvLandmarks.cxx +++ b/vv/vvLandmarks.cxx @@ -143,6 +143,17 @@ void vvLandmarks::RemoveLandmark(int index) } //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void vvLandmarks::RemoveAll() +{ + for (unsigned int i = 0; i < mLandmarks.size(); i++) { + mLandmarks[i].clear(); + mPoints[i]->SetNumberOfPoints(0); + mLabels[i]->SetNumberOfValues(0); + mIds[i]->SetNumberOfValues(0); + } +} +//-------------------------------------------------------------------- //-------------------------------------------------------------------- void vvLandmarks::ChangeComments(int index, std::string comments) diff --git a/vv/vvLandmarks.h b/vv/vvLandmarks.h index cd564dc..7920d6f 100644 --- a/vv/vvLandmarks.h +++ b/vv/vvLandmarks.h @@ -45,6 +45,8 @@ public : void AddLandmark(float x,float y,float z,float t,double value); void RemoveLastLandmark(); void RemoveLandmark(int index); + void RemoveAll(); + void ChangeComments(int index, std::string comments); float* GetCoordinates(int index); double GetPixelValue(int index); diff --git a/vv/vvLandmarksPanel.cxx b/vv/vvLandmarksPanel.cxx index a90ea5b..3781cd6 100644 --- a/vv/vvLandmarksPanel.cxx +++ b/vv/vvLandmarksPanel.cxx @@ -41,6 +41,7 @@ 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))); } @@ -101,6 +102,14 @@ void vvLandmarksPanel::RemoveSelectedPoints() } } +void vvLandmarksPanel::RemoveAllPoints() +{ + mCurrentLandmarks->RemoveAll(); + tableWidget->clearContents(); + tableWidget->setRowCount(0); + emit UpdateRenderWindows(); +} + void vvLandmarksPanel::AddPoint() { AddPoint(mCurrentLandmarks->GetNumberOfPoints()-1); diff --git a/vv/vvLandmarksPanel.h b/vv/vvLandmarksPanel.h index 41307d4..87682d3 100644 --- a/vv/vvLandmarksPanel.h +++ b/vv/vvLandmarksPanel.h @@ -44,6 +44,7 @@ public slots: bool LoadFromFile(std::vector file); void Save(); void RemoveSelectedPoints(); + void RemoveAllPoints(); void AddPoint(); void CommentsChanged(int row, int column); signals: -- 2.47.1