]> Creatis software - clitk.git/commitdiff
add "Remove All" landmarks
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 13 Dec 2012 15:31:43 +0000 (16:31 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 13 Dec 2012 15:31:43 +0000 (16:31 +0100)
vv/qt_ui/vvLandmarksPanel.ui
vv/vvLandmarks.cxx
vv/vvLandmarks.h
vv/vvLandmarksPanel.cxx
vv/vvLandmarksPanel.h

index 7a64ea6b9940e946ddb99be2cb72c1d7dd3b726c..8cbe197d9134697bf47c17da6acb55d0c6ad4fd5 100644 (file)
@@ -7,20 +7,14 @@
     <x>0</x>
     <y>0</y>
     <width>325</width>
-    <height>131</height>
+    <height>214</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout">
-   <property name="margin">
-    <number>2</number>
-   </property>
-   <property name="spacing">
-    <number>2</number>
-   </property>
-   <item row="0" column="0" colspan="4">
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="2">
     <widget class="QLabel" name="nameLabel">
      <property name="text">
       <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@@ -30,7 +24,14 @@ p, li { white-space: pre-wrap; }
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="4">
+   <item row="1" column="0" colspan="2">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Coordinates are in mm</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="5">
     <widget class="QTableWidget" name="tableWidget">
      <property name="columnCount">
       <number>7</number>
@@ -84,7 +85,7 @@ p, li { white-space: pre-wrap; }
       <string>remove last landmark.</string>
      </property>
      <property name="text">
-      <string/>
+      <string>1</string>
      </property>
      <property name="icon">
       <iconset resource="../vvIcons.qrc">
@@ -93,19 +94,30 @@ p, li { white-space: pre-wrap; }
     </widget>
    </item>
    <item row="3" column="1">
-    <spacer>
+    <widget class="QPushButton" name="removeAllButton">
+     <property name="text">
+      <string>All</string>
+     </property>
+     <property name="icon">
+      <iconset resource="../vvIcons.qrc">
+       <normaloff>:/common/icons/standardbutton-cancel-16.png</normaloff>:/common/icons/standardbutton-cancel-16.png</iconset>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="2">
+    <spacer name="spacer">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>40</width>
+       <width>39</width>
        <height>20</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="3" column="2">
+   <item row="3" column="3">
     <widget class="QPushButton" name="loadButton">
      <property name="text">
       <string>Load</string>
@@ -116,7 +128,7 @@ p, li { white-space: pre-wrap; }
      </property>
     </widget>
    </item>
-   <item row="3" column="3">
+   <item row="3" column="4">
     <widget class="QPushButton" name="saveButton">
      <property name="text">
       <string>Save</string>
@@ -127,13 +139,6 @@ p, li { white-space: pre-wrap; }
      </property>
     </widget>
    </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Coordinates are in mm</string>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <resources>
index 0b5f98a264886c6b11bad1e6a0a488d1557511cd..fed697ebc2a218943ac125b4676e15ac1f3afd70 100644 (file)
@@ -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)
index cd564dc1c8aced4cab057d5f148931b75612451b..7920d6f9357787b3ccea6ff27b2e80214a4932d1 100644 (file)
@@ -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);
index a90ea5bb22901651c004e75de0bd3a1ba0ad6810..3781cd6938cf59d7a384bace294c207770b5de0e 100644 (file)
@@ -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);
index 41307d4af4129bc43da31d89244b0f29bd462684..87682d3d4871cf2669ead4ddb2419e8806168bbf 100644 (file)
@@ -44,6 +44,7 @@ public slots:
     bool LoadFromFile(std::vector<std::string> file);
     void Save();
     void RemoveSelectedPoints();
+    void RemoveAllPoints();
     void AddPoint();
     void CommentsChanged(int row, int column);
 signals: