]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Implementation Notebook in the GEOM.
authorrnv <rnv@opencascade.com>
Fri, 21 Nov 2008 17:02:17 +0000 (17:02 +0000)
committerrnv <rnv@opencascade.com>
Fri, 21 Nov 2008 17:02:17 +0000 (17:02 +0000)
src/GEOM_SWIG/geompyDC.py
src/TransformationGUI/TransformationGUI_MultiRotationDlg.h
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h
src/TransformationGUI/TransformationGUI_OffsetDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.h
src/TransformationGUI/TransformationGUI_ScaleDlg.cxx
src/TransformationGUI/TransformationGUI_ScaleDlg.h
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx

index 1996716ace3cb0500082a0c6523438978297ee8c..b12b0ab17180f63e174f9e123448e0fab37753c4 100644 (file)
@@ -104,8 +104,8 @@ def ParseParameters(*parameters):
         if isinstance(parameter,str):
             if notebook.isVariable(parameter):
                 Result.append(notebook.get(parameter))
-                pass
-            pass
+            else:
+                raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
         else:
             Result.append(parameter)
             pass
index dac7699afb2147e82399bd48891e97fbcdd470b9..c21a373a04a5b3dbcee1d553557f6b487f427e80 100644 (file)
@@ -77,6 +77,7 @@ private slots:
   void                               SetEditCurrentArgument();
   void                               ReverseAngle();
   void                               ValueChangedInSpinBox( double );
+  void                               TextValueChangedInSpinBox( const QString& );
   void                               ConstructorsClicked( int );
   void                               SetDoubleSpinBoxStep( double );
 };
index c3d4b216e8764943d9fde867a27483b203e2ec42..498c1d16bd28e740aea5380477827918f78fe43c 100644 (file)
@@ -184,6 +184,13 @@ void TransformationGUI_MultiTranslationDlg::Init()
   connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
   connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
 
+  connect(GroupPoints->SpinBox_DX,      SIGNAL(textChanged(const QString& )), 
+          this, SLOT(TextValueChangedInSpinBox(const QString& )));
+  connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), 
+          this, SLOT(TextValueChangedInSpinBox(const QString& )));
+  connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), 
+          this, SLOT(TextValueChangedInSpinBox(const QString& )));
+  
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
 
   connect(GroupPoints->CheckButton1,     SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
@@ -505,6 +512,40 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
     ActivateThisDialog();
 }
 
+//=================================================================================
+// function : TextValueChangedInSpinBox
+// purpose  :
+//=================================================================================
+void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s)
+{
+  QObject* send = (QObject*)sender();
+  bool isDigit = true;
+  
+  switch (getConstructorId()) {
+  case 0: 
+    GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
+    if(!isDigit){
+      GroupPoints->CheckButton1->setChecked(false);
+    }
+    GroupPoints->CheckButton1->setEnabled(isDigit);
+    break;
+  case 1: 
+    if (send == GroupDimensions->SpinBox_DX1) {
+      GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
+      if(!isDigit) 
+        GroupDimensions->CheckButton1->setChecked(false);
+      GroupDimensions->CheckButton1->setEnabled(isDigit);
+    }
+    else if(send == GroupDimensions->SpinBox_DX2){
+      GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
+      if(!isDigit) 
+        GroupDimensions->CheckButton2->setChecked(false);
+      GroupDimensions->CheckButton2->setEnabled(isDigit);
+    }
+    break;
+  }
+}
+
 //=================================================================================
 // function : ValueChangedInSpinBox()
 // purpose  :
@@ -512,7 +553,6 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
 void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
 {
   QObject* send = (QObject*)sender();
-
   switch (getConstructorId()) {
   case 0:
     if (send == GroupPoints->SpinBox_DX)
@@ -579,14 +619,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
 // function : isValid
 // purpose  :
 //=================================================================================
-bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
 {
   int aConstructorId = getConstructorId();
-
-  if (aConstructorId == 0)
-    return !(myBase->_is_nil() || myVectorU->_is_nil());
-  else if (aConstructorId == 1)
-    return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
+  
+  if (aConstructorId == 0) {
+    bool ok = true;
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok;
+  }
+  else if (aConstructorId == 1) {
+    bool ok = true;
+    ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
+    return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok;
+  }
   return 0;
 }
 
@@ -600,11 +650,17 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  QStringList aParameters;
+
   switch (getConstructorId()) {
   case 0:
     if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
       anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
         MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
+      if(!IsPreview()) {
+        aParameters<<GroupPoints->SpinBox_DX->text();
+        aParameters<<GroupPoints->SpinBox_DY->text();
+      }
       res = true;
     }
     break;
@@ -614,13 +670,22 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
       anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
         MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
                           myVectorV, myStepV, myNbTimesV);
+      if(!IsPreview()) {
+        aParameters<<GroupDimensions->SpinBox_DX1->text();
+        aParameters<<GroupDimensions->SpinBox_DY1->text();
+        aParameters<<GroupDimensions->SpinBox_DX2->text();
+        aParameters<<GroupDimensions->SpinBox_DY2->text();
+      }
       res = true;
     }
     break;
   }
 
-  if (!anObj->_is_nil())
+  if (!anObj->_is_nil()) {
+    if(!IsPreview())
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
     objects.push_back(anObj._retn());
+  }
 
   return res;
 }
index 145fb48ec17a44a6f81f3087590773c8ab1f1b03..ab91a46717617dd01fb9a443e271cf2d6a266b61 100644 (file)
@@ -78,6 +78,7 @@ private slots:
   void                               ReverseStepU();
   void                               ReverseStepV();
   void                               ValueChangedInSpinBox( double );
+  void                               TextValueChangedInSpinBox( const QString& );
   void                               ConstructorsClicked( int );
   void                               SetDoubleSpinBoxStep( double );
 };
index a0f4d448dbd93479ca6e3d24febc5c969003b822..dd9636d6a58cdf6d1904d7a1b513e44fa06ef9da 100644 (file)
@@ -278,7 +278,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
       return false;
     }
   }
-  return true;
+  return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
 }
 
 //=================================================================================
@@ -295,8 +295,12 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
     for ( int i = 0; i < myObjects.length(); i++ ) {
       
       anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
-      if ( !anObj->_is_nil() )
+      if ( !anObj->_is_nil() ) {
+        if(!IsPreview()) {
+          anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
+        }
        objects.push_back( anObj._retn() );
+      }
     }
   }
   else {
index eb4d0703c0b2b52aee8ab3e1670935bd03f7d246..de530cc54f3d5eddf68ee26c72aef8e0e8c390c4 100644 (file)
@@ -151,6 +151,9 @@ void TransformationGUI_RotationDlg::Init()
 
   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
 
+  connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )),
+          this, SLOT(TextValueChangedInSpinBox( const QString&)));
+
   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
   connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
 
@@ -464,6 +467,16 @@ void TransformationGUI_RotationDlg::enterEvent (QEvent*)
     ActivateThisDialog();
 }
 
+void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
+{
+  bool isDigit = true;
+  s.toDouble(&isDigit);
+  if(!isDigit) {
+    GroupPoints->CheckButton2->setChecked(false);
+  }
+  GroupPoints->CheckButton2->setEnabled(isDigit); 
+}
+
 //=================================================================================
 // function : ValueChangedInSpinBox()
 // purpose  :
@@ -486,13 +499,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_RotationDlg::isValid (QString& msg)
 {
   if (myObjects.length() < 1) return false;
 
   switch (getConstructorId()) {
   case 0:
-    return !(myAxis->_is_nil());
+    return !(myAxis->_is_nil()) && GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
     break;
   case 1:
     return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
@@ -522,8 +535,12 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
           myCurrObject = myObjects[i];
           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
             RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
-          if (!anObj->_is_nil())
+          if (!anObj->_is_nil()) {
+            if(!IsPreview()) {
+              anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
+            }
             objects.push_back(anObj._retn());
+          }
         }
       }
       else {
index b741346f0ff4c2344b8edf5bd1aa8a363d7972b8..5cc6ff2d7ba437cb198db93b6ab0c65be3940ae1 100644 (file)
@@ -74,6 +74,7 @@ private slots:
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox();
+  void                               TextValueChangedInSpinBox( const QString& );
   void                               CreateCopyModeChanged( bool );
   void                               ConstructorsClicked( int );
   void                               onReverse();
index f9c28818be1be9a868f290cd467e3bb8d50582fc..e77150d3a4dcb90cc69b1239cee3ce63b60d7f03 100644 (file)
@@ -28,7 +28,7 @@
 #include <GeometryGUI.h>
 #include <GEOMBase.h>
 
-#include <QtxDoubleSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
 #include <SalomeApp_Application.h>
@@ -92,13 +92,13 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry
   LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
 
   TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1);
-  SpinBox_FX = new QtxDoubleSpinBox(GroupBox1);
+  SpinBox_FX = new SalomeApp_DoubleSpinBox(GroupBox1);
 
   TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1);
-  SpinBox_FY = new QtxDoubleSpinBox(GroupBox1);
+  SpinBox_FY = new SalomeApp_DoubleSpinBox(GroupBox1);
 
   TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1);
-  SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1);
+  SpinBox_FZ = new SalomeApp_DoubleSpinBox(GroupBox1);
 
   CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1);
   CheckBoxCopy->setChecked(true);
@@ -458,15 +458,19 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_ScaleDlg::isValid (QString& msg)
 {
   if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001)
   {
     // && !myPoint->_is_nil()
-    if (getConstructorId() == 0)
-      return true;
+    if (getConstructorId() == 0) {
+      return SpinBox_FX->isValid( msg, !IsPreview() );
+    }
     if (fabs(SpinBox_FY->value()) > 0.00001 &&
-        fabs(SpinBox_FZ->value()) > 0.00001)
+        fabs(SpinBox_FZ->value()) > 0.00001 &&
+        SpinBox_FX->isValid( msg, !IsPreview()) &&
+        SpinBox_FY->isValid( msg, !IsPreview()) &&
+        SpinBox_FZ->isValid( msg, !IsPreview()))
       return true;
   }
   return false;
@@ -492,8 +496,11 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
         {
           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
             ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
-          if (!anObj->_is_nil())
+          if (!anObj->_is_nil()) {
+            if(!IsPreview()) 
+              anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
             objects.push_back(anObj._retn());
+          }
         }
       }
       else
@@ -518,6 +525,13 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
             ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
                                      SpinBox_FY->value(), SpinBox_FZ->value());
           if (!anObj->_is_nil())
+            if(!IsPreview()) {
+              QStringList aParameters;
+              aParameters<<SpinBox_FX->text();
+              aParameters<<SpinBox_FY->text();
+              aParameters<<SpinBox_FZ->text();
+              anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+            }
             objects.push_back(anObj._retn());
         }
       }
index a2533298e75b9d899b0758abf029ea163a689f6a..c4830e5246df0d93424afc78816612037869579d 100644 (file)
@@ -35,7 +35,7 @@ class QGroupBox;
 class QLabel;
 class QLineEdit;
 class QPushButton;
-class QtxDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
 
 //=================================================================================
 // class    : TransformationGUI_ScaleDlg
@@ -79,9 +79,9 @@ private:
   QLabel*                            TextLabel3;
   QLabel*                            TextLabel4;
   QLabel*                            TextLabel5;
-  QtxDoubleSpinBox*                  SpinBox_FX;
-  QtxDoubleSpinBox*                  SpinBox_FY;
-  QtxDoubleSpinBox*                  SpinBox_FZ;
+  SalomeApp_DoubleSpinBox*           SpinBox_FX;
+  SalomeApp_DoubleSpinBox*           SpinBox_FY;
+  SalomeApp_DoubleSpinBox*           SpinBox_FZ;
   QCheckBox*                         CheckBoxCopy;
 
 private slots:
index f47bb590da460e87078b1fab7b5080cdb01791b6..6a55d49a61521aabc7364e12ac5a350def2be890 100644 (file)
@@ -516,19 +516,25 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_TranslationDlg::isValid (QString& msg)
 {
   int aConstructorId = getConstructorId();
 
   if (myObjects.length() < 1) return false;
 
   switch (aConstructorId) {
-  case 0:
-    return true;
+  case 0: 
+    {
+      bool ok = true;
+      ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
+      ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
+      ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
+      return ok;
+    }
   case 1:
     return !(myPoint1->_is_nil() || myPoint2->_is_nil());
   case 2:
-    return !(myVector->_is_nil());
+    return !(myVector->_is_nil()) && GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
   default:
     break;
   }
@@ -553,13 +559,21 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
       double dy = GroupPoints->SpinBox2->value();
       double dz = GroupPoints->SpinBox3->value();
 
+      QStringList aParameters;
+      aParameters<<GroupPoints->SpinBox1->text();
+      aParameters<<GroupPoints->SpinBox2->text();
+      aParameters<<GroupPoints->SpinBox3->text();
+
       if (toCreateCopy) {
         for (int i = 0; i < myObjects.length(); i++) {
           myCurrObject = myObjects[i];
           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
             TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
-          if (!anObj->_is_nil())
+          if (!anObj->_is_nil()) {
+            if(!IsPreview())
+              anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
             objects.push_back(anObj._retn());
+          }
         }
       }
       else {
@@ -599,6 +613,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
     }
   case 2:
     {
+      QStringList aParameters;
       bool byDistance = GroupPoints->CheckBox1->isChecked();
       if (byDistance) {
         double aDistance = GroupPoints->SpinBox3->value();
@@ -606,8 +621,12 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
           myCurrObject = myObjects[i];
           anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
             TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
-          if (!anObj->_is_nil())
+          if (!anObj->_is_nil()) {
+            if(toCreateCopy)
+              if(!IsPreview())
+                anObj->SetParameters(GroupPoints->SpinBox3->text().toLatin1().constData());
             objects.push_back(anObj._retn());
+          }
         }
       }
       else {