Salome HOME
Issue #2998: Add help description for automatic creation of constraints
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetPointInput.cpp
index 7d8596556b0eaf6a7c47c734fd3e4057ad04db4d..ca7c3c055209afb2a4ecff874246bb7de8230777 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "ModuleBase_WidgetPointInput.h"
@@ -61,7 +60,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent,
 
   myXSpin = new ModuleBase_ParamSpinBox(this);
   myXSpin->setAcceptVariables(aAcceptVariables);
-  myXSpin->setToolTip("X coordinate");
+  myXSpin->setToolTip(tr("X coordinate"));
   myXSpin->setValue(myDefaultValue[0]);
   QLabel* aXLbl = new QLabel(this);
   aXLbl->setPixmap(QPixmap(":pictures/x_size.png"));
@@ -69,7 +68,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent,
 
   myYSpin = new ModuleBase_ParamSpinBox(this);
   myYSpin->setAcceptVariables(aAcceptVariables);
-  myYSpin->setToolTip("Y coordinate");
+  myYSpin->setToolTip(tr("Y coordinate"));
   myYSpin->setValue(myDefaultValue[1]);
   QLabel* aYLbl = new QLabel(this);
   aYLbl->setPixmap(QPixmap(":pictures/y_size.png"));
@@ -77,7 +76,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent,
 
   myZSpin = new ModuleBase_ParamSpinBox(this);
   myZSpin->setAcceptVariables(aAcceptVariables);
-  myZSpin->setToolTip("Z coordinate");
+  myZSpin->setToolTip(tr("Z coordinate"));
   myZSpin->setValue(myDefaultValue[2]);
   QLabel* aZLbl = new QLabel(this);
   aZLbl->setPixmap(QPixmap(":pictures/z_size.png"));
@@ -219,16 +218,19 @@ QIntList ModuleBase_WidgetPointInput::shapeTypes() const
 
 //********************************************************************
 bool ModuleBase_WidgetPointInput
-::setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+::setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+  const bool theToValidate)
 {
-  GeomShapePtr aShape = thePrs->shape();
-  if (aShape->isVertex()) {
-    GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
-    GeomPointPtr aPnt = aVertex->point();
-    myXSpin->setValue(aPnt->x());
-    myYSpin->setValue(aPnt->y());
-    myZSpin->setValue(aPnt->z());
-    return true;
+  if (theValues.size() == 1) {
+    GeomShapePtr aShape = theValues.first()->shape();
+    if (aShape.get() && aShape->isVertex()) {
+      GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
+      GeomPointPtr aPnt = aVertex->point();
+      myXSpin->setValue(aPnt->x());
+      myYSpin->setValue(aPnt->y());
+      myZSpin->setValue(aPnt->z());
+      return true;
+    }
   }
   return false;
 }