#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_PipeLine.hxx"
+#include "VISU_PipeLineUtils.hxx"
#include "VISU_DataSetActor.h"
#include <SalomeApp_IntSpinBox.h>
myPrs3d->SetPlaneParam(aNormal, 1. - getDistance(), aPlane);
- vtkDataSet* aDataSet = myPrs3d->GetInput();
- vtkFloatingPointType *aPnt = aDataSet->GetCenter();
+ //Get bounds of the visible part of the dataset
+ vtkFloatingPointType aBounds[6];
+ myPrs3d->GetPipeLine()->GetVisibleBounds(aBounds);
- vtkFloatingPointType* anOrigin = aPlane->GetOrigin();
- vtkFloatingPointType aDel = aDataSet->GetLength()/2.0;
+ //Get center
+ vtkFloatingPointType aPnt[3];
+ VISU::ComputeBoxCenter(aBounds,aPnt);
+ vtkFloatingPointType* anOrigin = aPlane->GetOrigin();
+
+ //Get Length of the diagonal
+ vtkFloatingPointType aDel = VISU::ComputeBoxDiagonal(aBounds)/2.0;
+
vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
{aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3];
-
+
vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
aPnt[1] - aDelta[0][1] - aDelta[1][1],
aPnt[2] - aDelta[0][2] - aDelta[1][2]};
// purpose : set non structured parameters by IJK parameters
//=================================================================================
void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam()
-{
+{
if (myPlanes.empty() || myIsSelectPlane || !WidgetIJKTab->isEnabled())
return;
// find index value
double v = SpinBoxDistance->value();
// reverse value?
-// bool reverse = (normal * axDir < 0); // normal and axis are opposite
-// if (gridDir * axDir < 0) // grid dir and axis are opposite
-// reverse = !reverse;
-// if (reverse)
-// v = 1. - v;
+ bool reverse = (normal * axDir < 0); // normal and axis are opposite
+ if (gridDir * axDir < 0) // grid dir and axis are opposite
+ reverse = !reverse;
+ if (reverse)
+ v = 1. - v;
for (i = 0; i < values->size(); ++i)
if ((*values)[ i ] > v)
break;
--i;
// set control values
+ onIJKAxisChanged(gridAxId); // first of all update label and range of index
myIsSelectPlane = true;
CheckBoxIJKPlaneReverse->setChecked(normal * axDir < 0);
SpinBoxIJKIndex->setValue(i);
ButtonGroupIJKAxis->button(gridAxId)->setChecked( true );
- onIJKAxisChanged(gridAxId); // update label and range of index
myIsSelectPlane = false;
SetCurrentPlaneIJKParam();