This commit is contained in:
san 2005-01-20 14:15:21 +00:00
parent 9bb681b800
commit 01283434b5
2 changed files with 72 additions and 6 deletions

View 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;
}

View 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"