Version: 6.3.1
Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

SMESHGUI_ClippingDlg Class Reference

#include <SMESHGUI_ClippingDlg.h>

Inheritance diagram for SMESHGUI_ClippingDlg:
Inheritance graph
[legend]

Public Slots

void onSelectPlane (int)
void ClickOnNew ()
void ClickOnDelete ()
void onActorItemChanged (QListWidgetItem *)
void onSelectAll (int)
void onSelectOrientation (int)
void SetCurrentPlaneParam ()
void OnPreviewToggle (bool)
void ClickOnOk ()
void ClickOnCancel ()
void ClickOnApply ()
void ClickOnHelp ()

Public Member Functions

 SMESHGUI_ClippingDlg (SMESHGUI *, SVTK_ViewWindow *)
 ~SMESHGUI_ClippingDlg ()
double getDistance () const
void setDistance (const double)
double getRotation1 () const
double getRotation2 () const
void setRotation (const double, const double)

Static Public Member Functions

static SMESH::OrientedPlaneAddPlane (SMESH::TActorList theActorList, SVTK_ViewWindow *theViewWindow, SMESH::Orientation theOrientation, double theDistance, const vtkFloatingPointType theAngle[2])

Protected Member Functions

void keyPressEvent (QKeyEvent *)

Private Member Functions

void initializePlaneData ()
void synchronize ()
void updateActorList ()
SMESH::TActorList getCurrentActors ()
void updateActorItem (QListWidgetItem *theItem, bool theUpdateSelectAll, bool theUpdateClippingPlaneMap)
void dumpPlaneData () const

Private Attributes

SMESHGUImySMESHGUI
SVTK_ViewWindow * myViewWindow
SMESH::TPlaneDataVector myPlanes
QComboBox * ComboBoxPlanes
QPushButton * buttonNew
QPushButton * buttonDelete
QListWidget * ActorList
QCheckBox * SelectAllCheckBox
QLabel * TextLabelOrientation
QComboBox * ComboBoxOrientation
QLabel * TextLabelDistance
SMESHGUI_SpinBoxSpinBoxDistance
QLabel * TextLabelRot1
SMESHGUI_SpinBoxSpinBoxRot1
QLabel * TextLabelRot2
SMESHGUI_SpinBoxSpinBoxRot2
QCheckBox * PreviewCheckBox
QCheckBox * AutoApplyCheckBox
QPushButton * buttonOk
QPushButton * buttonCancel
QPushButton * buttonApply
QPushButton * buttonHelp
bool myIsSelectPlane
QString myHelpFileName

Detailed Description

Definition at line 128 of file SMESHGUI_ClippingDlg.h.


Constructor & Destructor Documentation

SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg ( SMESHGUI theModule,
SVTK_ViewWindow *  theViewWindow 
)

Definition at line 343 of file SMESHGUI_ClippingDlg.cxx.

References ActorList, AutoApplyCheckBox, buttonApply, buttonCancel, buttonDelete, buttonHelp, buttonNew, buttonOk, ClickOnApply(), ClickOnCancel(), ClickOnDelete(), ClickOnHelp(), ClickOnNew(), ClickOnOk(), ComboBoxOrientation, ComboBoxPlanes, initializePlaneData(), MARGIN, myHelpFileName, myIsSelectPlane, mySMESHGUI, onActorItemChanged(), OnPreviewToggle(), onSelectAll(), onSelectOrientation(), onSelectPlane(), PreviewCheckBox, SMESHGUI_SpinBox.RangeStepAndValidator(), SelectAllCheckBox, SetCurrentPlaneParam(), SMESHGUI_SpinBox.SetValue(), SPACING, SpinBoxDistance, SpinBoxRot1, SpinBoxRot2, synchronize(), TextLabelDistance, TextLabelOrientation, TextLabelRot1, and TextLabelRot2.

                                                                                               :
  QDialog( SMESH::GetDesktop(theModule) ),
  mySMESHGUI(theModule),
  myViewWindow(theViewWindow)
{
  setModal( false );
  setAttribute( Qt::WA_DeleteOnClose, true );
  setWindowTitle(tr("SMESH_CLIPPING_TITLE"));
  setSizeGripEnabled(true);

  QVBoxLayout* SMESHGUI_ClippingDlgLayout = new QVBoxLayout(this);
  SMESHGUI_ClippingDlgLayout->setSpacing(SPACING);
  SMESHGUI_ClippingDlgLayout->setMargin(MARGIN);

  // Controls for selecting, creating, deleting planes
  QGroupBox* GroupPlanes = new QGroupBox(tr("CLIP_PLANES"), this);
  QGridLayout* GroupPlanesLayout = new QGridLayout(GroupPlanes);
  GroupPlanesLayout->setSpacing(SPACING);
  GroupPlanesLayout->setMargin(MARGIN);

  ComboBoxPlanes = new QComboBox(GroupPlanes);

  buttonNew = new QPushButton(tr("SMESH_BUT_NEW"), GroupPlanes);

  buttonDelete = new QPushButton(tr("SMESH_BUT_DELETE"), GroupPlanes);

  QLabel* aLabel = new QLabel(tr("MESHES_SUBMESHES_GROUPS"), GroupPlanes);

  ActorList = new QListWidget(GroupPlanes);
  ActorList->setSelectionMode(QAbstractItemView::SingleSelection);

  SelectAllCheckBox = new QCheckBox(tr("SELECT_ALL"), GroupPlanes);

  GroupPlanesLayout->addWidget(ComboBoxPlanes,    0, 0);
  GroupPlanesLayout->addWidget(new QWidget(),     0, 1);
  GroupPlanesLayout->addWidget(buttonNew,         0, 2);
  GroupPlanesLayout->addWidget(buttonDelete,      0, 3);
  GroupPlanesLayout->addWidget(aLabel,            1, 0, 1, 4);
  GroupPlanesLayout->addWidget(ActorList,         2, 0, 1, 4);
  GroupPlanesLayout->addWidget(SelectAllCheckBox, 3, 0, 1, 4);
  GroupPlanesLayout->setColumnStretch( 1, 1 );

  // Controls for defining plane parameters
  QGroupBox* GroupParameters = new QGroupBox(tr("SMESH_PARAMETERS"), this);
  QGridLayout* GroupParametersLayout = new QGridLayout(GroupParameters);
  GroupParametersLayout->setSpacing(SPACING);
  GroupParametersLayout->setMargin(MARGIN);

  TextLabelOrientation = new QLabel(tr("SMESH_ORIENTATION"), GroupParameters);

  ComboBoxOrientation = new QComboBox(GroupParameters);

  TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupParameters);

  SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters);

  TextLabelRot1 = new QLabel(tr("ROTATION_AROUND_X_Y2Z"), GroupParameters);

  SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters);

  TextLabelRot2 = new QLabel(tr("ROTATION_AROUND_Y_X2Z"), GroupParameters);

  SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters);

  PreviewCheckBox = new QCheckBox(tr("SHOW_PREVIEW"), GroupParameters);
  PreviewCheckBox->setChecked(true);

  AutoApplyCheckBox = new QCheckBox(tr("AUTO_APPLY"), GroupParameters);
  AutoApplyCheckBox->setChecked(false);

  GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
  GroupParametersLayout->addWidget(ComboBoxOrientation,  0, 1);
  GroupParametersLayout->addWidget(TextLabelDistance,    1, 0);
  GroupParametersLayout->addWidget(SpinBoxDistance,      1, 1);
  GroupParametersLayout->addWidget(TextLabelRot1,        2, 0);
  GroupParametersLayout->addWidget(SpinBoxRot1,          2, 1);
  GroupParametersLayout->addWidget(TextLabelRot2,        3, 0);
  GroupParametersLayout->addWidget(SpinBoxRot2,          3, 1);
  GroupParametersLayout->addWidget(PreviewCheckBox,      4, 0);
  GroupParametersLayout->addWidget(AutoApplyCheckBox,    4, 1);

  // Controls for "Ok", "Apply" and "Close" button
  QGroupBox* GroupButtons = new QGroupBox(this);
  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
  GroupButtonsLayout->setSpacing(SPACING);
  GroupButtonsLayout->setMargin(MARGIN);
  
  buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
  buttonOk->setAutoDefault(true);
  buttonOk->setDefault(true);
  buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
  buttonApply->setAutoDefault(true);
  buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
  buttonCancel->setAutoDefault(true);
  buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
  buttonHelp->setAutoDefault(true);
  GroupButtonsLayout->addWidget(buttonOk);
  GroupButtonsLayout->addSpacing(10);
  GroupButtonsLayout->addWidget(buttonApply);
  GroupButtonsLayout->addSpacing(10);
  GroupButtonsLayout->addStretch();
  GroupButtonsLayout->addWidget(buttonCancel);
  GroupButtonsLayout->addWidget(buttonHelp);

  SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes);
  SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters);
  SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons);

  // Initial state
  SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, "length_precision" );
  SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );
  SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );

  ComboBoxOrientation->addItem(tr("ALONG_XY"));
  ComboBoxOrientation->addItem(tr("ALONG_YZ"));
  ComboBoxOrientation->addItem(tr("ALONG_ZX"));

  SpinBoxDistance->SetValue(0.5);

  myIsSelectPlane = false;

  initializePlaneData();
  synchronize();

  myHelpFileName = "clipping_page.html";

  // signals and slots connections :
  connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
  connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
  connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
  connect(ActorList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(onActorItemChanged(QListWidgetItem*)));
  connect(SelectAllCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onSelectAll(int)));
  connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
  connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
  connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
  connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
  connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
  connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
  connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
  connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
  connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
  /* to close dialog if study frame change */
  connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));

  this->show();
}
SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg ( )

Definition at line 496 of file SMESHGUI_ClippingDlg.cxx.

References myPlanes, myViewWindow, and SMESH.RenderViewWindow().

{
  // no need to delete child widgets, Qt does it all for us
  std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisibility(false));
  if (myViewWindow)
    SMESH::RenderViewWindow(myViewWindow);
}

Member Function Documentation

SMESH::OrientedPlane * SMESHGUI_ClippingDlg::AddPlane ( SMESH::TActorList  theActorList,
SVTK_ViewWindow *  theViewWindow,
SMESH::Orientation  theOrientation,
double  theDistance,
const vtkFloatingPointType  theAngle[2] 
) [static]

Definition at line 207 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.ComputeClippingPlaneParameters(), SMESH.OrientedPlane.myAngle, SMESH.OrientedPlane.myPlaneSource, SMESH.OrientedPlane.New(), SMESH.OrientedPlane.SetDistance(), SMESH.OrientedPlane.SetOrientation(), SMESH.XY, SMESH.YZ, and SMESH.ZX.

Referenced by SMESHGUI.restoreVisualParameters().

{
  SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(theViewWindow);

  aPlane->myAngle[0] = theAngle[0];
  aPlane->myAngle[1] = theAngle[1];

  aPlane->SetOrientation(theOrientation);
  aPlane->SetDistance(theDistance);

  vtkFloatingPointType aNormal[3];
  vtkFloatingPointType aDir[2][3] = {{0, 0, 0}, {0, 0, 0}};
  {
    static double aCoeff = vtkMath::Pi()/180.0;

    vtkFloatingPointType anU[2] = {cos(aCoeff * theAngle[0]), cos(aCoeff * theAngle[1])};
    vtkFloatingPointType aV[2] = {sqrt(1.0 - anU[0]*anU[0]), sqrt(1.0 - anU[1]*anU[1])};
    aV[0] = theAngle[0] > 0? aV[0]: -aV[0];
    aV[1] = theAngle[1] > 0? aV[1]: -aV[1];

    switch (theOrientation) {
    case SMESH::XY:
      aDir[0][1] = anU[0];
      aDir[0][2] = aV[0];

      aDir[1][0] = anU[1];
      aDir[1][2] = aV[1];

      break;
    case SMESH::YZ:
      aDir[0][2] = anU[0];
      aDir[0][0] = aV[0];

      aDir[1][1] = anU[1];
      aDir[1][0] = aV[1];

      break;
    case SMESH::ZX:
      aDir[0][0] = anU[0];
      aDir[0][1] = aV[0];

      aDir[1][2] = anU[1];
      aDir[1][1] = aV[1];

      break;
    }

    vtkMath::Cross(aDir[1],aDir[0],aNormal);
    vtkMath::Normalize(aNormal);
    vtkMath::Cross(aNormal,aDir[1],aDir[0]);
  }

  vtkFloatingPointType aBounds[6];
  vtkFloatingPointType anOrigin[3];

  bool anIsOk = false;
  if( theActorList.empty() ) {
    // to support planes with empty actor list we should create
    // a nullified plane that will be initialized later 
    anOrigin[0] = anOrigin[1] = anOrigin[2] = 0;
    aBounds[0] = aBounds[2] = aBounds[4] = 0;
    aBounds[1] = aBounds[3] = aBounds[5] = 0;
    anIsOk = true;
  }
  else
    anIsOk = SMESH::ComputeClippingPlaneParameters( theActorList,
                                                    aNormal,
                                                    theDistance,
                                                    aBounds,
                                                    anOrigin );
  if( !anIsOk )
    return NULL;

  aPlane->SetNormal( aNormal );
  aPlane->SetOrigin( anOrigin );

  vtkFloatingPointType aPnt[3] = { ( aBounds[0] + aBounds[1] ) / 2.,
                                   ( aBounds[2] + aBounds[3] ) / 2.,
                                   ( aBounds[4] + aBounds[5] ) / 2. };

  vtkFloatingPointType aDel = pow( pow( aBounds[1] - aBounds[0], 2 ) +
                                   pow( aBounds[3] - aBounds[2], 2 ) +
                                   pow( aBounds[5] - aBounds[4], 2 ), 0.5 );

  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]};
  vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
                                    aPnt01[1] + aNormal[1],
                                    aPnt01[2] + aNormal[2]};
  vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);

  vtkFloatingPointType aPnt11[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]};
  vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
                                    aPnt11[1] + aNormal[1],
                                    aPnt11[2] + aNormal[2]};
  vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);

  vtkFloatingPointType aPnt21[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]};
  vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
                                    aPnt21[1] + aNormal[1],
                                    aPnt21[2] + aNormal[2]};
  vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);

  vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
  aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
  aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
  aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
  aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);

  SMESH::TActorList::iterator anIter = theActorList.begin();
  for ( ; anIter != theActorList.end(); anIter++ )
    if( vtkActor* aVTKActor = *anIter )
      if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
        anActor->AddClippingPlane( aPlane );

  return aPlane;
}
void SMESHGUI_ClippingDlg::ClickOnApply ( ) [slot]

Definition at line 528 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.ClippingPlaneInfo.ActorList, SMESH.TPlaneData.ActorList, SMESHGUI.getClippingPlaneInfoMap(), myPlanes, mySMESHGUI, myViewWindow, SMESH.OrientedPlane.New(), SMESH.ClippingPlaneInfo.Plane, SMESH.TPlaneData.Plane, SMESH.RenderViewWindow(), and SMESH.OrientedPlane.ShallowCopy().

Referenced by ClickOnDelete(), ClickOnOk(), SetCurrentPlaneParam(), and SMESHGUI_ClippingDlg().

{
  if (myViewWindow) {
    SUIT_OverrideCursor wc;
    
    QWidget *aCurrWid = this->focusWidget();
    aCurrWid->clearFocus();
    aCurrWid->setFocus();

    SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = mySMESHGUI->getClippingPlaneInfoMap();
    SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = aClippingPlaneInfoMap[ myViewWindow->getViewManager() ];

    // clean memory allocated for planes
    SMESHGUI_ClippingPlaneInfoList::iterator anIter1 = aClippingPlaneInfoList.begin();
    for( ; anIter1 != aClippingPlaneInfoList.end(); anIter1++ )
      if( SMESH::OrientedPlane* aPlane = (*anIter1).Plane )
        aPlane->Delete();

    aClippingPlaneInfoList.clear();

    VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
    vtkActorCollection* anAllActors = aCopy.GetActors();
    anAllActors->InitTraversal();
    while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
      if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
        anActor->RemoveAllClippingPlanes();

    SMESH::TPlaneDataVector::iterator anIter2 = myPlanes.begin();
    for( ; anIter2 != myPlanes.end(); anIter2++ ) {
      SMESH::TPlaneData aPlaneData = *anIter2;
      SMESH::TPlane aPlane = aPlaneData.Plane;
      SMESH::TActorList anActorList = aPlaneData.ActorList;

      // the check is disabled to support planes with empty actor list
      //if( anActorList.empty() )
      //  continue;

      SMESH::OrientedPlane* anOrientedPlane = SMESH::OrientedPlane::New(myViewWindow);
      anOrientedPlane->ShallowCopy(aPlane.GetPointer());

      SMESH::TActorList::iterator anIter3 = anActorList.begin();
      for( ; anIter3 != anActorList.end(); anIter3++ )
        if( vtkActor* aVTKActor = *anIter3 )
          if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
            anActor->AddClippingPlane(anOrientedPlane);

      SMESH::ClippingPlaneInfo aClippingPlaneInfo;
      aClippingPlaneInfo.Plane = anOrientedPlane;
      aClippingPlaneInfo.ActorList = anActorList;

      aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
    }

    SMESH::RenderViewWindow( myViewWindow );
  }
}
void SMESHGUI_ClippingDlg::ClickOnCancel ( ) [slot]

Definition at line 599 of file SMESHGUI_ClippingDlg.cxx.

Referenced by ClickOnOk(), and SMESHGUI_ClippingDlg().

{
  close();
}
void SMESHGUI_ClippingDlg::ClickOnDelete ( ) [slot]

Definition at line 710 of file SMESHGUI_ClippingDlg.cxx.

References AutoApplyCheckBox, ClickOnApply(), ComboBoxPlanes, myPlanes, myViewWindow, SMESH.TPlaneData.Plane, SMESH.RenderViewWindow(), and synchronize().

Referenced by SMESHGUI_ClippingDlg().

{
  if (myPlanes.empty())
    return;

  int aPlaneIndex = ComboBoxPlanes->currentIndex();

  SMESH::TPlaneDataVector::iterator anIter = myPlanes.begin() + aPlaneIndex;
  SMESH::TPlaneData aPlaneData = *anIter;
  aPlaneData.Plane.GetPointer()->myActor->SetVisibility(false);
  myPlanes.erase(anIter);

  if(AutoApplyCheckBox->isChecked())
    ClickOnApply();

  synchronize();
  SMESH::RenderViewWindow( myViewWindow );
}
void SMESHGUI_ClippingDlg::ClickOnHelp ( ) [slot]

Definition at line 608 of file SMESHGUI_ClippingDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by keyPressEvent(), and SMESHGUI_ClippingDlg().

{
  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
  if (app) 
    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
  else {
                QString platform;
#ifdef WIN32
                platform = "winapplication";
#else
                platform = "application";
#endif
    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
                                                                 platform)).
                             arg(myHelpFileName));
  }
}
void SMESHGUI_ClippingDlg::ClickOnNew ( ) [slot]

Definition at line 676 of file SMESHGUI_ClippingDlg.cxx.

References ActorList, myPlanes, myViewWindow, SMESH.OrientedPlane.New(), PreviewCheckBox, SetCurrentPlaneParam(), and synchronize().

Referenced by SMESHGUI_ClippingDlg().

{
  if(myViewWindow){
    SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(myViewWindow);
    SMESH::TPlane aTPlane(aPlane);

    SMESH::TActorList anActorList;
    VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
    vtkActorCollection* anAllActors = aCopy.GetActors();
    anAllActors->InitTraversal();
    while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
      if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
        anActorList.push_back( anActor );

    SMESH::TPlaneData aPlaneData(aTPlane, anActorList);

    myPlanes.push_back(aPlaneData);

    if (PreviewCheckBox->isChecked())
      aTPlane->myActor->VisibilityOn();

    bool anIsBlocked = ActorList->blockSignals( true );

    synchronize();
    SetCurrentPlaneParam();

    ActorList->blockSignals( anIsBlocked );
  }
}
void SMESHGUI_ClippingDlg::ClickOnOk ( ) [slot]

Definition at line 589 of file SMESHGUI_ClippingDlg.cxx.

References ClickOnApply(), and ClickOnCancel().

Referenced by SMESHGUI_ClippingDlg().

void SMESHGUI_ClippingDlg::dumpPlaneData ( ) const [private]

Definition at line 1146 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.TPlaneData.ActorList, myPlanes, and SMESH.TPlaneData.Plane.

{
  printf( "----------- Plane Data -----------\n" );
  int anId = 1;
  SMESH::TPlaneDataVector::const_iterator anIter1 = myPlanes.begin();
  for ( ; anIter1 != myPlanes.end(); anIter1++, anId++ ) {
    SMESH::TPlaneData aPlaneData = *anIter1;
    SMESH::TPlane aPlane = aPlaneData.Plane;
    vtkFloatingPointType* aNormal = aPlane->GetNormal();
    vtkFloatingPointType* anOrigin = aPlane->GetOrigin();
    printf( "Plane N%d:\n", anId );
    printf( "  Normal = ( %f, %f, %f )\n", aNormal[0], aNormal[1], aNormal[2] );
    printf( "  Origin = ( %f, %f, %f )\n", anOrigin[0], anOrigin[1], anOrigin[2] );

    SMESH::TActorList anActorList = aPlaneData.ActorList;
    SMESH::TActorList::const_iterator anIter2 = anActorList.begin();
    for ( ; anIter2 != anActorList.end(); anIter2++ ) {
      if( vtkActor* aVTKActor = *anIter2 ) {
        if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
          printf( "  - Actor: '%s'\n", anActor->getName() );
      }
      else
        printf( "  - Actor: NULL\n");
    }
  }
  printf( "----------------------------------\n" );
}
SMESH::TActorList SMESHGUI_ClippingDlg::getCurrentActors ( ) [private]

Definition at line 1131 of file SMESHGUI_ClippingDlg.cxx.

References ActorList.

{
  SMESH::TActorList anActorList;
  for( int i = 0, n = ActorList->count(); i < n; i++ )
    if( ActorItem* anItem = dynamic_cast<ActorItem*>( ActorList->item( i ) ) )
      if( anItem->checkState() == Qt::Checked )
        if( SMESH_Actor* anActor = anItem->getActor() )
          anActorList.push_back( anActor );
  return anActorList;
}
double SMESHGUI_ClippingDlg::getDistance ( ) const

Definition at line 504 of file SMESHGUI_ClippingDlg.cxx.

References SMESHGUI_SpinBox.GetValue(), and SpinBoxDistance.

Referenced by SetCurrentPlaneParam().

{
  return SpinBoxDistance->GetValue();
}
double SMESHGUI_ClippingDlg::getRotation1 ( ) const

Definition at line 514 of file SMESHGUI_ClippingDlg.cxx.

References SMESHGUI_SpinBox.GetValue(), and SpinBoxRot1.

Referenced by SetCurrentPlaneParam().

{
  return SpinBoxRot1->GetValue();
}
double SMESHGUI_ClippingDlg::getRotation2 ( ) const

Definition at line 519 of file SMESHGUI_ClippingDlg.cxx.

References SMESHGUI_SpinBox.GetValue(), and SpinBoxRot2.

Referenced by SetCurrentPlaneParam().

{
  return SpinBoxRot2->GetValue();
}
void SMESHGUI_ClippingDlg::initializePlaneData ( ) [private]

Definition at line 1057 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.ClippingPlaneInfo.ActorList, SMESHGUI.getClippingPlaneInfoMap(), myPlanes, mySMESHGUI, myViewWindow, SMESH.ClippingPlaneInfo.Plane, and PreviewCheckBox.

Referenced by SMESHGUI_ClippingDlg().

{
  const SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = mySMESHGUI->getClippingPlaneInfoMap();
  SMESHGUI_ClippingPlaneInfoMap::const_iterator anIter1 = aClippingPlaneInfoMap.find( myViewWindow->getViewManager() );
  if( anIter1 != aClippingPlaneInfoMap.end() ) {
    const SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = anIter1->second;
    SMESHGUI_ClippingPlaneInfoList::const_iterator anIter2 = aClippingPlaneInfoList.begin();
    for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) {
      const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2;
      SMESH::TPlane aTPlane( aClippingPlaneInfo.Plane );
      SMESH::TPlaneData aPlaneData( aTPlane, aClippingPlaneInfo.ActorList );
      myPlanes.push_back( aPlaneData );
    }
  }
  std::for_each( myPlanes.begin(),myPlanes.end(), TSetVisibility( PreviewCheckBox->isChecked() ) );
}
void SMESHGUI_ClippingDlg::keyPressEvent ( QKeyEvent *  e) [protected]

Definition at line 1041 of file SMESHGUI_ClippingDlg.cxx.

References ClickOnHelp().

{
  QDialog::keyPressEvent( e );
  if ( e->isAccepted() )
    return;

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    ClickOnHelp();
  }
}
void SMESHGUI_ClippingDlg::onActorItemChanged ( QListWidgetItem theItem) [slot]

Definition at line 784 of file SMESHGUI_ClippingDlg.cxx.

References SetCurrentPlaneParam(), and updateActorItem().

Referenced by SMESHGUI_ClippingDlg().

{
  updateActorItem( theItem, true, true );
  SetCurrentPlaneParam();
}
void SMESHGUI_ClippingDlg::OnPreviewToggle ( bool  theIsToggled) [slot]

Definition at line 1031 of file SMESHGUI_ClippingDlg.cxx.

References myPlanes, myViewWindow, and SMESH.RenderViewWindow().

Referenced by SMESHGUI_ClippingDlg().

{
  std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisibility(theIsToggled));
  SMESH::RenderViewWindow( myViewWindow );
}
void SMESHGUI_ClippingDlg::onSelectAll ( int  theState) [slot]

Definition at line 794 of file SMESHGUI_ClippingDlg.cxx.

References ActorList, SelectAllCheckBox, SetCurrentPlaneParam(), and updateActorItem().

Referenced by SMESHGUI_ClippingDlg().

{
  if( theState == Qt::PartiallyChecked ) {
    SelectAllCheckBox->setCheckState( Qt::Checked );
    return;
  }

  bool anIsBlocked = ActorList->blockSignals( true );
  for( int i = 0, n = ActorList->count(); i < n; i++ ) {
    if( QListWidgetItem* anItem = ActorList->item( i ) ) {
      anItem->setCheckState( theState == Qt::Checked ? Qt::Checked : Qt::Unchecked );
      updateActorItem( anItem, false, true );
    }
  }
  SelectAllCheckBox->setTristate( false );
  ActorList->blockSignals( anIsBlocked );
  SetCurrentPlaneParam();
}
void SMESHGUI_ClippingDlg::onSelectOrientation ( int  theItem) [slot]

Definition at line 817 of file SMESHGUI_ClippingDlg.cxx.

References ComboBoxOrientation, myPlanes, SetCurrentPlaneParam(), TextLabelRot1, and TextLabelRot2.

Referenced by onSelectPlane(), and SMESHGUI_ClippingDlg().

{
  if (myPlanes.empty())
    return;

  if      (theItem == 0) {
    TextLabelRot1->setText(tr("ROTATION_AROUND_X_Y2Z"));
    TextLabelRot2->setText(tr("ROTATION_AROUND_Y_X2Z"));
  }
  else if (theItem == 1) {
    TextLabelRot1->setText(tr("ROTATION_AROUND_Y_Z2X"));
    TextLabelRot2->setText(tr("ROTATION_AROUND_Z_Y2X"));
  }
  else if (theItem == 2) {
    TextLabelRot1->setText(tr("ROTATION_AROUND_Z_X2Y"));
    TextLabelRot2->setText(tr("ROTATION_AROUND_X_Z2Y"));
  }

  if((QComboBox*)sender() == ComboBoxOrientation)
    SetCurrentPlaneParam();
}
void SMESHGUI_ClippingDlg::onSelectPlane ( int  theIndex) [slot]

Definition at line 632 of file SMESHGUI_ClippingDlg.cxx.

References ActorList, ComboBoxOrientation, SMESH.OrientedPlane.GetDistance(), SMESH.OrientedPlane.GetOrientation(), SMESH.OrientedPlane.myAngle, myIsSelectPlane, myPlanes, onSelectOrientation(), SMESH.TPlaneData.Plane, setDistance(), setRotation(), updateActorList(), SMESH.XY, SMESH.YZ, and SMESH.ZX.

Referenced by SMESHGUI_ClippingDlg(), and synchronize().

{
  if (myPlanes.empty())
    return;

  SMESH::TPlaneData aPlaneData = myPlanes[theIndex];
  SMESH::OrientedPlane* aPlane = aPlaneData.Plane.GetPointer();

  // Orientation
  SMESH::Orientation anOrientation = aPlane->GetOrientation();

  // Rotations
  double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};

  // Set plane parameters in the dialog
  myIsSelectPlane = true;
  setDistance(aPlane->GetDistance());
  setRotation(aRot[0], aRot[1]);
  switch (anOrientation) {
  case SMESH::XY:
    ComboBoxOrientation->setCurrentIndex(0);
    onSelectOrientation(0);
    break;
  case SMESH::YZ:
    ComboBoxOrientation->setCurrentIndex(1);
    onSelectOrientation(1);
    break;
  case SMESH::ZX:
    ComboBoxOrientation->setCurrentIndex(2);
    onSelectOrientation(2);
    break;
  }
  myIsSelectPlane = false;

  // Actors
  bool anIsBlocked = ActorList->blockSignals( true );
  updateActorList();
  ActorList->blockSignals( anIsBlocked );
}
void SMESHGUI_ClippingDlg::SetCurrentPlaneParam ( ) [slot]

Definition at line 896 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.TPlaneData.ActorList, AutoApplyCheckBox, ClickOnApply(), ComboBoxOrientation, ComboBoxPlanes, SMESH.ComputeClippingPlaneParameters(), getDistance(), getRotation1(), getRotation2(), SMESH.OrientedPlane.myActor, SMESH.OrientedPlane.myAngle, myIsSelectPlane, myPlanes, SMESH.OrientedPlane.myPlaneSource, myViewWindow, SMESH.TPlaneData.Plane, PreviewCheckBox, SMESH.RenderViewWindow(), SMESH.OrientedPlane.SetDistance(), SMESH.OrientedPlane.SetOrientation(), XY(), SMESH.YZ, and SMESH.ZX.

Referenced by ClickOnNew(), onActorItemChanged(), onSelectAll(), onSelectOrientation(), and SMESHGUI_ClippingDlg().

{
  if (myPlanes.empty() || myIsSelectPlane)
    return;

  int aCurPlaneIndex = ComboBoxPlanes->currentIndex();

  SMESH::TPlaneData aPlaneData = myPlanes[aCurPlaneIndex];
  SMESH::OrientedPlane* aPlane = aPlaneData.Plane.GetPointer();

  vtkFloatingPointType aNormal[3];
  SMESH::Orientation anOrientation;
  vtkFloatingPointType aDir[3][3] = {{0, 0, 0}, {0, 0, 0}};
  {
    static double aCoeff = vtkMath::Pi()/180.0;

    vtkFloatingPointType aRot[2] = {getRotation1(), getRotation2()};
    aPlane->myAngle[0] = aRot[0];
    aPlane->myAngle[1] = aRot[1];

    vtkFloatingPointType anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])};
    vtkFloatingPointType aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])};
    aV[0] = aRot[0] > 0? aV[0]: -aV[0];
    aV[1] = aRot[1] > 0? aV[1]: -aV[1];

    switch (ComboBoxOrientation->currentIndex()) {
    case 0:
      anOrientation = SMESH::XY;

      aDir[0][1] = anU[0];
      aDir[0][2] = aV[0];

      aDir[1][0] = anU[1];
      aDir[1][2] = aV[1];

      break;
    case 1:
      anOrientation = SMESH::YZ;

      aDir[0][2] = anU[0];
      aDir[0][0] = aV[0];

      aDir[1][1] = anU[1];
      aDir[1][0] = aV[1];

      break;
    case 2:
      anOrientation = SMESH::ZX;

      aDir[0][0] = anU[0];
      aDir[0][1] = aV[0];

      aDir[1][2] = anU[1];
      aDir[1][1] = aV[1];

      break;
    }

    vtkMath::Cross(aDir[1],aDir[0],aNormal);
    vtkMath::Normalize(aNormal);
    vtkMath::Cross(aNormal,aDir[1],aDir[0]);
  }

  aPlane->SetOrientation(anOrientation);
  aPlane->SetDistance(getDistance());

  SMESH::TActorList anActorList = aPlaneData.ActorList;

  vtkFloatingPointType aBounds[6];
  vtkFloatingPointType anOrigin[3];
  bool anIsOk = SMESH::ComputeClippingPlaneParameters( anActorList,
                                                       aNormal,
                                                       getDistance(),
                                                       aBounds,
                                                       anOrigin );

  aPlane->myActor->SetVisibility( anIsOk && PreviewCheckBox->isChecked() );

  if( anIsOk ) {
    aPlane->SetNormal( aNormal );
    aPlane->SetOrigin( anOrigin );

    vtkFloatingPointType aPnt[3] = { ( aBounds[0] + aBounds[1] ) / 2.,
                                     ( aBounds[2] + aBounds[3] ) / 2.,
                                     ( aBounds[4] + aBounds[5] ) / 2. };

    vtkFloatingPointType aDel = pow( pow( aBounds[1] - aBounds[0], 2 ) +
                                     pow( aBounds[3] - aBounds[2], 2 ) +
                                     pow( aBounds[5] - aBounds[4], 2 ), 0.5 );

    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]};
    vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
                                      aPnt01[1] + aNormal[1],
                                      aPnt01[2] + aNormal[2]};
    vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);

    vtkFloatingPointType aPnt11[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]};
    vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
                                      aPnt11[1] + aNormal[1],
                                      aPnt11[2] + aNormal[2]};
    vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);

    vtkFloatingPointType aPnt21[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]};
    vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
                                      aPnt21[1] + aNormal[1],
                                      aPnt21[2] + aNormal[2]};
    vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);

    vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
    aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
    aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
    aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
    aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
  }

  if(AutoApplyCheckBox->isChecked())
    ClickOnApply();

  SMESH::RenderViewWindow( myViewWindow );
}
void SMESHGUI_ClippingDlg::setDistance ( const double  theDistance)

Definition at line 509 of file SMESHGUI_ClippingDlg.cxx.

References SMESHGUI_SpinBox.SetValue(), and SpinBoxDistance.

Referenced by onSelectPlane().

{
  SpinBoxDistance->SetValue( theDistance );
}
void SMESHGUI_ClippingDlg::setRotation ( const double  theRot1,
const double  theRot2 
)

Definition at line 886 of file SMESHGUI_ClippingDlg.cxx.

References SMESHGUI_SpinBox.SetValue(), SpinBoxRot1, and SpinBoxRot2.

Referenced by onSelectPlane().

{
  SpinBoxRot1->SetValue(theRot1);
  SpinBoxRot2->SetValue(theRot2);
}
void SMESHGUI_ClippingDlg::synchronize ( ) [private]

Definition at line 843 of file SMESHGUI_ClippingDlg.cxx.

References ActorList, buttonDelete, ComboBoxOrientation, ComboBoxPlanes, myPlanes, onSelectPlane(), SelectAllCheckBox, SMESHGUI_SpinBox.SetValue(), SpinBoxDistance, SpinBoxRot1, SpinBoxRot2, and updateActorList().

Referenced by ClickOnDelete(), ClickOnNew(), and SMESHGUI_ClippingDlg().

{
  int aNbPlanes = myPlanes.size();
  ComboBoxPlanes->clear();

  QString aName;
  for(int i = 1; i<=aNbPlanes; i++) {
    aName = QString(tr("PLANE_NUM")).arg(i);
    ComboBoxPlanes->addItem(aName);
  }

  int aPos = ComboBoxPlanes->count() - 1;
  ComboBoxPlanes->setCurrentIndex(aPos);

  bool anIsControlsEnable = (aPos >= 0);
  if (anIsControlsEnable) {
    onSelectPlane(aPos);
    updateActorList();
  } else {
    ComboBoxPlanes->addItem(tr("NO_PLANES"));
    ActorList->clear();
    SpinBoxRot1->SetValue(0.0);
    SpinBoxRot2->SetValue(0.0);
    SpinBoxDistance->SetValue(0.5);
  }

  ActorList->setEnabled(anIsControlsEnable);
  SelectAllCheckBox->setEnabled(anIsControlsEnable);
  buttonDelete->setEnabled(anIsControlsEnable);
  // the following 3 controls should be enabled
  //buttonApply->setEnabled(anIsControlsEnable);
  //PreviewCheckBox->setEnabled(anIsControlsEnable);
  //AutoApplyCheckBox->setEnabled(anIsControlsEnable);
  ComboBoxOrientation->setEnabled(anIsControlsEnable);
  SpinBoxDistance->setEnabled(anIsControlsEnable);
  SpinBoxRot1->setEnabled(anIsControlsEnable);
  SpinBoxRot2->setEnabled(anIsControlsEnable);
}
void SMESHGUI_ClippingDlg::updateActorItem ( QListWidgetItem theItem,
bool  theUpdateSelectAll,
bool  theUpdateClippingPlaneMap 
) [private]

Definition at line 733 of file SMESHGUI_ClippingDlg.cxx.

References SMESH.TPlaneData.ActorList, ActorList, ComboBoxPlanes, myPlanes, and SelectAllCheckBox.

Referenced by onActorItemChanged(), onSelectAll(), and updateActorList().

{
  // update Select All check box
  if( theUpdateSelectAll ) {
    int aNbItems = ActorList->count(), aNbChecked = 0;
    for( int i = 0; i < aNbItems; i++ )
      if( QListWidgetItem* anItem = ActorList->item( i ) )
        if( anItem->checkState() == Qt::Checked )
          aNbChecked++;

    Qt::CheckState aCheckState = Qt::Unchecked;
    if( aNbChecked == aNbItems )
      aCheckState = Qt::Checked;
    else if( aNbChecked > 0 )
      aCheckState = Qt::PartiallyChecked;

    bool anIsBlocked = SelectAllCheckBox->blockSignals( true );
    SelectAllCheckBox->setCheckState( aCheckState );
    SelectAllCheckBox->blockSignals( anIsBlocked );
  }

  // update clipping plane map
  if( theUpdateClippingPlaneMap ) {
    int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
    if( ActorItem* anItem = dynamic_cast<ActorItem*>( theItem ) ) {
      if( SMESH_Actor* anActor = anItem->getActor() ) {
        SMESH::TPlaneData& aPlaneData = myPlanes[ aCurPlaneIndex ];
        SMESH::TActorList& anActorList = aPlaneData.ActorList;
        bool anIsPushed = false;
        SMESH::TActorList::iterator anIter = anActorList.begin();
        for ( ; anIter != anActorList.end(); anIter++ ) {
          if( anActor == *anIter ) {
            anIsPushed = true;
            break;
          }
        }
        if( theItem->checkState() == Qt::Checked && !anIsPushed )
          anActorList.push_back( anActor );
        else if( theItem->checkState() == Qt::Unchecked && anIsPushed )
          anActorList.remove( anActor );
      }
    }
  }
}
void SMESHGUI_ClippingDlg::updateActorList ( ) [private]

Definition at line 1078 of file SMESHGUI_ClippingDlg.cxx.

References _PTR(), SMESHGUI.activeStudy(), SMESH.TPlaneData.ActorList, ActorList, ComboBoxPlanes, Handle(), myPlanes, myViewWindow, and updateActorItem().

Referenced by onSelectPlane(), and synchronize().

{
  ActorList->clear();

  SalomeApp_Study* anAppStudy = SMESHGUI::activeStudy();
  if( !anAppStudy )
    return;

  _PTR(Study) aStudy = anAppStudy->studyDS();
  if( !aStudy )
    return;

  if( !myViewWindow )
    return;

  int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
  const SMESH::TPlaneData& aPlaneData = myPlanes[ aCurPlaneIndex ];
  const SMESH::TActorList& anActorList = aPlaneData.ActorList;

  VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
  vtkActorCollection* anAllActors = aCopy.GetActors();
  anAllActors->InitTraversal();
  while( vtkActor* aVTKActor = anAllActors->GetNextActor() ) {
    if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) {
      if( anActor->hasIO() ) {
        Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
        if( _PTR(SObject) aSObj = aStudy->FindObjectID( anIO->getEntry() ) ) {
          bool anIsChecked = false;
          SMESH::TActorList::const_iterator anIter = anActorList.begin();
          for ( ; anIter != anActorList.end(); anIter++ ) {
            if( vtkActor* aVTKActorRef = *anIter ) {
              if( SMESH_Actor* anActorRef = SMESH_Actor::SafeDownCast( aVTKActorRef ) ) {
                if( anActorRef == anActor ) {
                  anIsChecked = true;
                  break;
                }
              }
            }
          }
          QString aName = QString( aSObj->GetName().c_str() );
          QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
          anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
          updateActorItem( anItem, true, false );
        }
      }
    }
  }
}

Field Documentation

QListWidget* SMESHGUI_ClippingDlg.ActorList [private]
QPushButton* SMESHGUI_ClippingDlg.buttonApply [private]

Definition at line 189 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

QPushButton* SMESHGUI_ClippingDlg.buttonCancel [private]

Definition at line 188 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

QPushButton* SMESHGUI_ClippingDlg.buttonDelete [private]

Definition at line 174 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg(), and synchronize().

QPushButton* SMESHGUI_ClippingDlg.buttonHelp [private]

Definition at line 190 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

QPushButton* SMESHGUI_ClippingDlg.buttonNew [private]

Definition at line 173 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

QPushButton* SMESHGUI_ClippingDlg.buttonOk [private]

Definition at line 187 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

Definition at line 193 of file SMESHGUI_ClippingDlg.h.

Referenced by ClickOnHelp(), and SMESHGUI_ClippingDlg().

SVTK_ViewWindow* SMESHGUI_ClippingDlg.myViewWindow [private]

Definition at line 179 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

Definition at line 177 of file SMESHGUI_ClippingDlg.h.

Referenced by SMESHGUI_ClippingDlg().

Definition at line 181 of file SMESHGUI_ClippingDlg.h.

Referenced by onSelectOrientation(), and SMESHGUI_ClippingDlg().

Definition at line 183 of file SMESHGUI_ClippingDlg.h.

Referenced by onSelectOrientation(), and SMESHGUI_ClippingDlg().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS