Salome HOME
Fix for the "0051899: curves are not shown in opened study" issue.
[modules/visu.git] / src / VISUGUI / VisuGUI_OffsetDlg.cxx
index ec2f95eec616c8c2c2bc11163c258c28a1a404ec..81456a3406d9e0b0dde23a4dcf0489b1a6c96f6f 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "VisuGUI_OffsetDlg.h"
 
 #include "VisuGUI.h"
@@ -31,6 +32,7 @@
 #include "LightApp_SelectionMgr.h"
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SalomeApp_Application.h"
+#include <SalomeApp_DoubleSpinBox.h>
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
 #include "SUIT_ViewManager.h"
@@ -39,8 +41,6 @@
 #include "SUIT_MessageBox.h"
 #include "SUIT_ResourceMgr.h"
 
-#include "QtxDoubleSpinBox.h"
-
 // VTK Includes
 #include "vtkRenderer.h"
 
@@ -76,16 +76,16 @@ VisuGUI_OffsetDlg::VisuGUI_OffsetDlg (VisuGUI* theModule)
   aHBLay->setSpacing(6);
 
   aHBLay->addWidget( new QLabel ("dX:", anOffsetsPane) );
-  aHBLay->addWidget( myDxEdt = new QtxDoubleSpinBox (anOffsetsPane) );
-  myDxEdt->setRange(-MAXVAL, MAXVAL);
+  aHBLay->addWidget( myDxEdt = new SalomeApp_DoubleSpinBox (anOffsetsPane) );
+  VISU::initSpinBox( myDxEdt, -MAXVAL, MAXVAL, 1., "length_precision" );
 
   aHBLay->addWidget( new QLabel("dY:", anOffsetsPane) );;
-  aHBLay->addWidget( myDyEdt = new QtxDoubleSpinBox (anOffsetsPane) );
-  myDyEdt->setRange(-MAXVAL, MAXVAL);
+  aHBLay->addWidget( myDyEdt = new SalomeApp_DoubleSpinBox (anOffsetsPane) );
+  VISU::initSpinBox( myDyEdt, -MAXVAL, MAXVAL, 1., "length_precision" );
 
   aHBLay->addWidget( new QLabel("dZ:", anOffsetsPane) );
-  aHBLay->addWidget( myDzEdt = new QtxDoubleSpinBox (anOffsetsPane) );
-  myDzEdt->setRange(-MAXVAL, MAXVAL);
+  aHBLay->addWidget( myDzEdt = new SalomeApp_DoubleSpinBox (anOffsetsPane) );
+  VISU::initSpinBox( myDzEdt, -MAXVAL, MAXVAL, 1., "length_precision" );
 
   QPushButton* aResetBtn = new QPushButton(tr("BTN_RESET"), anOffsetsPane);
   aHBLay->addWidget( aResetBtn );
@@ -168,9 +168,9 @@ void VisuGUI_OffsetDlg::onSelectionChanged(){
       QString anEntry(anIO->getEntry());
       VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry.toLatin1().constData());
       if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
-       addPresentation(aPrsObject);
+        addPresentation(aPrsObject);
       else if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anObjectInfo.myBase)) {
-       addPointMapPresentation(aPrs);
+        addPointMapPresentation(aPrs);
       }
     }
   }
@@ -214,14 +214,14 @@ void VisuGUI_OffsetDlg::addPointMapPresentation (VISU::PointMap3d_i* thePrs)
   }
 }
 
-void VisuGUI_OffsetDlg::setOffset (const vtkFloatingPointType* theOffset)
+void VisuGUI_OffsetDlg::setOffset (const double* theOffset)
 {
   myDxEdt->setValue(theOffset[0]);
   myDyEdt->setValue(theOffset[1]);
   myDzEdt->setValue(theOffset[2]);
 }
 
-void VisuGUI_OffsetDlg::getOffset (vtkFloatingPointType* theOffset) const
+void VisuGUI_OffsetDlg::getOffset (double* theOffset) const
 {
   theOffset[0] = myDxEdt->value();
   theOffset[1] = myDyEdt->value();
@@ -243,7 +243,7 @@ bool VisuGUI_OffsetDlg::isToSave() const
     return false;
 }
 
-void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset)
+void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, double* theOffset)
 {
   if (myPrsList.count() == 0) 
     return;
@@ -264,7 +264,7 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp
       if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
         if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
           if (VISU_Actor* anActor = VISU::FindActor(vw, thePrs)) {
-               anActor->SetPosition(theOffset);
+                anActor->SetPosition(theOffset);
             vw->onAdjustTrihedron();
             vw->getRenderer()->ResetCameraClippingRange();
             vw->Repaint();
@@ -275,7 +275,7 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp
   }
 }
 
-void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset)
+void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, double* theOffset)
 {
   if (myPointMapList.count() == 0) 
     return;
@@ -292,11 +292,11 @@ void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFlo
     for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
       if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
         if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
-         vw->onAdjustTrihedron();
+          vw->onAdjustTrihedron();
 
           if (VISU_ActorBase* anActor = VISU::FindActorBase(vw, thePrs)) {
             anActor->SetPosition(theOffset);
-           vw->highlight(thePrs->GetIO(), 1);
+            vw->highlight(thePrs->GetIO(), 1);
             vw->getRenderer()->ResetCameraClippingRange();
             vw->Repaint();
           }
@@ -308,7 +308,7 @@ void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFlo
 
 void VisuGUI_OffsetDlg::accept()
 {
-  vtkFloatingPointType anOffset[3];
+  double anOffset[3];
   getOffset(anOffset);
   for (int i = 0; i < myPrsList.count(); i++) {
     updateOffset(myPrsList.at(i), anOffset);
@@ -325,14 +325,14 @@ void VisuGUI_OffsetDlg::reject()
     updateOffset(myPrsList.at(i), myOldOffsets[i].myOffset);
   }
   for (int i = 0; i < myPointMapList.count(); i++) {
-    updatePointMapOffset(myPointMapList.at(i), myOldOffsets[i].myOffset);
+    updatePointMapOffset(myPointMapList.at(i), myOldPointMapOffsets[i].myOffset);
   }
   QDialog::reject();
 }
 
 void VisuGUI_OffsetDlg::onApply()
 {
-  vtkFloatingPointType anOffset[3];
+  double anOffset[3];
   getOffset(anOffset);
 
   for (int i = 0; i < myPrsList.count(); i++) {