Salome HOME
PAL7770
authorsan <san@opencascade.com>
Thu, 20 Jan 2005 14:15:21 +0000 (14:15 +0000)
committersan <san@opencascade.com>
Thu, 20 Jan 2005 14:15:21 +0000 (14:15 +0000)
src/BasicGUI/BasicGUI_MarkerDlg.cxx
src/GEOMGUI/GEOM_msg_en.po

index 6f313f6772bbee4b54e1fd568f7e042ddccc3514..3cabd35f8b5bc9d6b763368df489c3021dc8bef5 100644 (file)
@@ -452,6 +452,19 @@ void BasicGUI_MarkerDlg::onSelectionDone()
 
            myEditCurrentArgument->setText( aName );
          }
+         else {
+           myData[ X ]->SetValue( 0 );
+           myData[ Y ]->SetValue( 0 );
+           myData[ Z ]->SetValue( 0 );
+
+           myData[ DX1 ]->SetValue( 0 );
+           myData[ DY1 ]->SetValue( 0 );
+           myData[ DZ1 ]->SetValue( 0 );
+
+           myData[ DX2 ]->SetValue( 0 );
+           myData[ DY2 ]->SetValue( 0 );
+           myData[ DZ2 ]->SetValue( 0 );
+         }
        }
        else if ( getConstructorId() == 2 ) {
          if (myEditCurrentArgument == Group2->LineEdit1) {
@@ -462,6 +475,11 @@ void BasicGUI_MarkerDlg::onSelectionDone()
              myData[ Z ]->SetValue( aPnt.Z() );
              myEditCurrentArgument->setText( aName );
            }
+           else {
+             myData[ X ]->SetValue( 0 );
+             myData[ Y ]->SetValue( 0 );
+             myData[ Z ]->SetValue( 0 );
+           }
          }
          else if (myEditCurrentArgument == Group2->LineEdit2) {
            if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
@@ -474,6 +492,11 @@ void BasicGUI_MarkerDlg::onSelectionDone()
              myData[ DZ1 ]->SetValue( aDir.Z() );
              myEditCurrentArgument->setText( aName );
            }
+           else {
+             myData[ DX1 ]->SetValue( 0 );
+             myData[ DY1 ]->SetValue( 0 );
+             myData[ DZ1 ]->SetValue( 0 );
+           }
          }
          else if (myEditCurrentArgument == Group2->LineEdit3) {
            if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
@@ -486,11 +509,48 @@ void BasicGUI_MarkerDlg::onSelectionDone()
              myData[ DZ2 ]->SetValue( aDir.Z() );
              myEditCurrentArgument->setText( aName );
            }
+           else {
+             myData[ DX2 ]->SetValue( 0 );
+             myData[ DY2 ]->SetValue( 0 );
+             myData[ DZ2 ]->SetValue( 0 );
+           }
          }
        }
       }
     }
   }
+  else {
+    if ( getConstructorId() == 1 ) {
+      myData[ X ]->SetValue( 0 );
+      myData[ Y ]->SetValue( 0 );
+      myData[ Z ]->SetValue( 0 );
+
+      myData[ DX1 ]->SetValue( 0 );
+      myData[ DY1 ]->SetValue( 0 );
+      myData[ DZ1 ]->SetValue( 0 );
+
+      myData[ DX2 ]->SetValue( 0 );
+      myData[ DY2 ]->SetValue( 0 );
+      myData[ DZ2 ]->SetValue( 0 );
+    }
+    else if ( getConstructorId() == 2 ) {
+      if (myEditCurrentArgument == Group2->LineEdit1) {
+       myData[ X ]->SetValue( 0 );
+       myData[ Y ]->SetValue( 0 );
+       myData[ Z ]->SetValue( 0 );
+      }
+      else if (myEditCurrentArgument == Group2->LineEdit2) {
+       myData[ DX1 ]->SetValue( 0 );
+       myData[ DY1 ]->SetValue( 0 );
+       myData[ DZ1 ]->SetValue( 0 );
+      }
+      else if (myEditCurrentArgument == Group2->LineEdit3) {
+       myData[ DX2 ]->SetValue( 0 );
+       myData[ DY2 ]->SetValue( 0 );
+       myData[ DZ2 ]->SetValue( 0 );
+      }
+    }    
+  }
 
   displayPreview();
 }
@@ -586,21 +646,25 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg )
   gp_Vec v1( myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue() ),
          v2( myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
 
-  bool isOrthogonal = false;
+  bool isOk = false;
   // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution()
-  if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() )
-    isOrthogonal = v1.IsNormal( v2, Precision::Confusion() );
+  // Vectors shouldn't be checked for being orthogonal here!
+  if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) {
+    isOk = !v1.IsParallel( v2, Precision::Angular() );
+    if ( !isOk )
+      msg += tr( "VEC_PARALLEL" );
+  }
 
   switch ( id )
   {
     case 0:
-      return isOrthogonal;
+      return isOk;
     case 1:
-      return !Group1->LineEdit1->text().isEmpty() && isOrthogonal;
+      return !Group1->LineEdit1->text().isEmpty() && isOk;
     case 2:
       return !Group2->LineEdit1->text().isEmpty() && 
             !Group2->LineEdit2->text().isEmpty() && 
-            !Group2->LineEdit3->text().isEmpty() && isOrthogonal;
+            !Group2->LineEdit3->text().isEmpty() && isOk;
   }
   return false;
 }
index 45a186b5561afc7647b246362e1215e89beb74b2..8934df8a71f99f67ffb15783923e92c2da4ebf99 100644 (file)
@@ -1865,6 +1865,8 @@ msgstr "Dz"
 msgid "BasicGUI_MarkerDlg::LCS_NAME"
 msgstr "LocalCS"
 
+msgid "BasicGUI_MarkerDlg::VEC_PARALLEL"
+msgstr "Coordinate system axes cannot be parallel"