+
+ isActivePlane->setChecked( true );
+}
+
+/*!
+ Set plane parameters from widgets.
+*/
+void OCCViewer_ClippingDlg::setPlaneParam( OCCViewer_ClipPlane& thePlane )
+{
+ OCCViewer_ClipPlane::PlaneMode aMode = currentPlaneMode();
+
+ thePlane.Mode = aMode;
+
+ if ( aMode == OCCViewer_ClipPlane::Absolute )
+ {
+ if( qFuzzyIsNull( SpinBox_Dx->value() ) &&
+ qFuzzyIsNull( SpinBox_Dy->value() ) &&
+ qFuzzyIsNull( SpinBox_Dz->value() ) ) {
+ return;
+ }
+ }
+
+ thePlane.OrientationType = (aMode == OCCViewer_ClipPlane::Absolute)
+ ? CBAbsoluteOrientation->currentIndex()
+ : CBRelativeOrientation->currentIndex();
+
+ // Get XYZ, DXYZ
+ if ( aMode == OCCViewer_ClipPlane::Absolute )
+ {
+ if ( thePlane.OrientationType == OCCViewer_ClipPlane::AbsoluteCustom )
+ {
+ thePlane.AbsoluteOrientation.Dx = SpinBox_Dx->value();
+ thePlane.AbsoluteOrientation.Dy = SpinBox_Dy->value();
+ thePlane.AbsoluteOrientation.Dz = SpinBox_Dz->value();
+ thePlane.AbsoluteOrientation.IsInvert = false;
+ }
+ else
+ {
+ thePlane.AbsoluteOrientation.IsInvert = SpinBox_Dx->value() < 0.0
+ || SpinBox_Dy->value() < 0.0
+ || SpinBox_Dz->value() < 0.0;
+ }
+
+ thePlane.X = SpinBox_X->value();
+ thePlane.Y = SpinBox_Y->value();
+ thePlane.Z = SpinBox_Z->value();
+ }
+ else
+ {
+ thePlane.RelativeOrientation.Rotation1 = SpinSliderRotation1->value();
+ thePlane.RelativeOrientation.Rotation2 = SpinSliderRotation2->value();
+
+ double aPlaneDx = 0.0;
+ double aPlaneDy = 0.0;
+ double aPlaneDz = 0.0;
+ double aX = 0.0;
+ double aY = 0.0;
+ double aZ = 0.0;
+
+ OCCViewer_ClipPlane::RelativeToDXYZ( thePlane.OrientationType,
+ thePlane.RelativeOrientation.Rotation1,
+ thePlane.RelativeOrientation.Rotation2,
+ aPlaneDx, aPlaneDy, aPlaneDz );
+
+ DistanceToXYZ( myModel->getAISContext(),
+ myModel->trihedronSize(),
+ SpinSliderDistance->value(),
+ aPlaneDx, aPlaneDy, aPlaneDz,
+ aX, aY, aZ );
+
+ thePlane.X = aX;
+ thePlane.Y = aY;
+ thePlane.Z = aZ;
+ }
+
+ thePlane.IsOn = isActivePlane->isChecked();