From: san Date: Thu, 20 Jan 2005 14:15:21 +0000 (+0000) Subject: PAL7770 X-Git-Tag: V2_2_0b2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=01283434b5c078546f185533e11d7718fbfa8724;p=modules%2Fgeom.git PAL7770 --- diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 6f313f677..3cabd35f8 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -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; } diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 45a186b55..8934df8a7 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -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"