00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "SMESHGUI_ClippingDlg.h"
00029
00030 #include "SMESHGUI.h"
00031 #include "SMESHGUI_Utils.h"
00032 #include "SMESHGUI_VTKUtils.h"
00033 #include "SMESHGUI_SpinBox.h"
00034
00035 #include <SMESH_Actor.h>
00036 #include <SMESH_ActorUtils.h>
00037
00038
00039 #include <SUIT_Desktop.h>
00040 #include <SUIT_Session.h>
00041 #include <SUIT_OverrideCursor.h>
00042 #include <SUIT_MessageBox.h>
00043 #include <SUIT_ResourceMgr.h>
00044 #include <SUIT_ViewManager.h>
00045
00046 #include <SALOME_ListIO.hxx>
00047
00048 #include <SalomeApp_Study.h>
00049
00050 #include <LightApp_Application.h>
00051
00052 #include <VTKViewer_Algorithm.h>
00053
00054 #include <SVTK_ViewWindow.h>
00055
00056
00057 #include <QLabel>
00058 #include <QPushButton>
00059 #include <QComboBox>
00060 #include <QCheckBox>
00061 #include <QVBoxLayout>
00062 #include <QHBoxLayout>
00063 #include <QGridLayout>
00064 #include <QGroupBox>
00065 #include <QKeyEvent>
00066 #include <QListWidget>
00067
00068
00069 #include <vtkMath.h>
00070 #include <vtkDataSet.h>
00071 #include <vtkDataSetMapper.h>
00072 #include <vtkPlaneSource.h>
00073 #include <vtkProperty.h>
00074 #include <vtkRenderer.h>
00075
00076 #define SPACING 6
00077 #define MARGIN 11
00078
00079
00080
00081
00082
00083 SMESH::OrientedPlane* SMESH::OrientedPlane::New()
00084 {
00085 return new OrientedPlane();
00086 }
00087
00088 SMESH::OrientedPlane* SMESH::OrientedPlane::New(SVTK_ViewWindow* theViewWindow)
00089 {
00090 return new OrientedPlane(theViewWindow);
00091 }
00092
00093 void SMESH::OrientedPlane::ShallowCopy(SMESH::OrientedPlane* theOrientedPlane)
00094 {
00095 SetNormal(theOrientedPlane->GetNormal());
00096 SetOrigin(theOrientedPlane->GetOrigin());
00097
00098 myOrientation = theOrientedPlane->GetOrientation();
00099 myDistance = theOrientedPlane->GetDistance();
00100
00101 myAngle[0] = theOrientedPlane->myAngle[0];
00102 myAngle[1] = theOrientedPlane->myAngle[1];
00103
00104 myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal());
00105 myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin());
00106 myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1());
00107 myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2());
00108 }
00109
00110 SMESH::OrientedPlane::OrientedPlane(SVTK_ViewWindow* theViewWindow):
00111 myViewWindow(theViewWindow),
00112 myOrientation(SMESH::XY),
00113 myDistance(0.5)
00114 {
00115 Init();
00116 myViewWindow->AddActor(myActor, false, false);
00117 }
00118
00119 SMESH::OrientedPlane::OrientedPlane():
00120 myOrientation(SMESH::XY),
00121 myViewWindow(NULL),
00122 myDistance(0.5)
00123 {
00124 Init();
00125 }
00126
00127 void SMESH::OrientedPlane::Init()
00128 {
00129 myPlaneSource = vtkPlaneSource::New();
00130
00131 myAngle[0] = myAngle[1] = 0.0;
00132
00133
00134 myMapper = vtkDataSetMapper::New();
00135 myMapper->SetInput(myPlaneSource->GetOutput());
00136
00137 myActor = SALOME_Actor::New();
00138 myActor->VisibilityOff();
00139 myActor->PickableOff();
00140 myActor->SetInfinitive(true);
00141 myActor->SetMapper(myMapper);
00142
00143 vtkFloatingPointType anRGB[3];
00144 vtkProperty* aProp = vtkProperty::New();
00145 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
00146 aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
00147 aProp->SetOpacity(0.75);
00148 myActor->SetProperty(aProp);
00149 aProp->Delete();
00150
00151 vtkProperty* aBackProp = vtkProperty::New();
00152 SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
00153 aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
00154 aBackProp->SetOpacity(0.75);
00155 myActor->SetBackfaceProperty(aBackProp);
00156 aBackProp->Delete();
00157 }
00158
00159 SMESH::OrientedPlane::~OrientedPlane()
00160 {
00161 if (myViewWindow)
00162 myViewWindow->RemoveActor(myActor);
00163 myActor->Delete();
00164
00165 myMapper->RemoveAllInputs();
00166 myMapper->Delete();
00167
00168
00169
00170 myPlaneSource->Delete();
00171 }
00172
00173
00174
00175
00176
00177 class ActorItem : public QListWidgetItem
00178 {
00179 public:
00180 ActorItem( SMESH_Actor* theActor, const QString& theName, QListWidget* theListWidget ) :
00181 QListWidgetItem( theName, theListWidget ),
00182 myActor( theActor ) {}
00183
00184 SMESH_Actor* getActor() const { return myActor; }
00185
00186 private:
00187 SMESH_Actor* myActor;
00188 };
00189
00190
00191
00192
00193
00194 struct TSetVisibility {
00195 TSetVisibility(int theIsVisible): myIsVisible(theIsVisible){}
00196 void operator()(SMESH::TPlaneData& thePlaneData){
00197 bool anIsEmpty = thePlaneData.ActorList.empty();
00198 thePlaneData.Plane.GetPointer()->myActor->SetVisibility(myIsVisible && !anIsEmpty);
00199 }
00200 int myIsVisible;
00201 };
00202
00203
00204
00205
00206
00207 SMESH::OrientedPlane* SMESHGUI_ClippingDlg::AddPlane (SMESH::TActorList theActorList,
00208 SVTK_ViewWindow* theViewWindow,
00209 SMESH::Orientation theOrientation,
00210 double theDistance,
00211 const vtkFloatingPointType theAngle[2])
00212 {
00213 SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(theViewWindow);
00214
00215 aPlane->myAngle[0] = theAngle[0];
00216 aPlane->myAngle[1] = theAngle[1];
00217
00218 aPlane->SetOrientation(theOrientation);
00219 aPlane->SetDistance(theDistance);
00220
00221 vtkFloatingPointType aNormal[3];
00222 vtkFloatingPointType aDir[2][3] = {{0, 0, 0}, {0, 0, 0}};
00223 {
00224 static double aCoeff = vtkMath::Pi()/180.0;
00225
00226 vtkFloatingPointType anU[2] = {cos(aCoeff * theAngle[0]), cos(aCoeff * theAngle[1])};
00227 vtkFloatingPointType aV[2] = {sqrt(1.0 - anU[0]*anU[0]), sqrt(1.0 - anU[1]*anU[1])};
00228 aV[0] = theAngle[0] > 0? aV[0]: -aV[0];
00229 aV[1] = theAngle[1] > 0? aV[1]: -aV[1];
00230
00231 switch (theOrientation) {
00232 case SMESH::XY:
00233 aDir[0][1] = anU[0];
00234 aDir[0][2] = aV[0];
00235
00236 aDir[1][0] = anU[1];
00237 aDir[1][2] = aV[1];
00238
00239 break;
00240 case SMESH::YZ:
00241 aDir[0][2] = anU[0];
00242 aDir[0][0] = aV[0];
00243
00244 aDir[1][1] = anU[1];
00245 aDir[1][0] = aV[1];
00246
00247 break;
00248 case SMESH::ZX:
00249 aDir[0][0] = anU[0];
00250 aDir[0][1] = aV[0];
00251
00252 aDir[1][2] = anU[1];
00253 aDir[1][1] = aV[1];
00254
00255 break;
00256 }
00257
00258 vtkMath::Cross(aDir[1],aDir[0],aNormal);
00259 vtkMath::Normalize(aNormal);
00260 vtkMath::Cross(aNormal,aDir[1],aDir[0]);
00261 }
00262
00263 vtkFloatingPointType aBounds[6];
00264 vtkFloatingPointType anOrigin[3];
00265
00266 bool anIsOk = false;
00267 if( theActorList.empty() ) {
00268
00269
00270 anOrigin[0] = anOrigin[1] = anOrigin[2] = 0;
00271 aBounds[0] = aBounds[2] = aBounds[4] = 0;
00272 aBounds[1] = aBounds[3] = aBounds[5] = 0;
00273 anIsOk = true;
00274 }
00275 else
00276 anIsOk = SMESH::ComputeClippingPlaneParameters( theActorList,
00277 aNormal,
00278 theDistance,
00279 aBounds,
00280 anOrigin );
00281 if( !anIsOk )
00282 return NULL;
00283
00284 aPlane->SetNormal( aNormal );
00285 aPlane->SetOrigin( anOrigin );
00286
00287 vtkFloatingPointType aPnt[3] = { ( aBounds[0] + aBounds[1] ) / 2.,
00288 ( aBounds[2] + aBounds[3] ) / 2.,
00289 ( aBounds[4] + aBounds[5] ) / 2. };
00290
00291 vtkFloatingPointType aDel = pow( pow( aBounds[1] - aBounds[0], 2 ) +
00292 pow( aBounds[3] - aBounds[2], 2 ) +
00293 pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
00294
00295 vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
00296 {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
00297 vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3];
00298
00299 vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
00300 aPnt[1] - aDelta[0][1] - aDelta[1][1],
00301 aPnt[2] - aDelta[0][2] - aDelta[1][2]};
00302 vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
00303 aPnt01[1] + aNormal[1],
00304 aPnt01[2] + aNormal[2]};
00305 vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
00306
00307 vtkFloatingPointType aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
00308 aPnt[1] - aDelta[0][1] + aDelta[1][1],
00309 aPnt[2] - aDelta[0][2] + aDelta[1][2]};
00310 vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
00311 aPnt11[1] + aNormal[1],
00312 aPnt11[2] + aNormal[2]};
00313 vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
00314
00315 vtkFloatingPointType aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
00316 aPnt[1] + aDelta[0][1] - aDelta[1][1],
00317 aPnt[2] + aDelta[0][2] - aDelta[1][2]};
00318 vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
00319 aPnt21[1] + aNormal[1],
00320 aPnt21[2] + aNormal[2]};
00321 vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
00322
00323 vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
00324 aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
00325 aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
00326 aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
00327 aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
00328
00329 SMESH::TActorList::iterator anIter = theActorList.begin();
00330 for ( ; anIter != theActorList.end(); anIter++ )
00331 if( vtkActor* aVTKActor = *anIter )
00332 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
00333 anActor->AddClippingPlane( aPlane );
00334
00335 return aPlane;
00336 }
00337
00338
00339
00340
00341
00342
00343 SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow* theViewWindow ):
00344 QDialog( SMESH::GetDesktop(theModule) ),
00345 mySMESHGUI(theModule),
00346 myViewWindow(theViewWindow)
00347 {
00348 setModal( false );
00349 setAttribute( Qt::WA_DeleteOnClose, true );
00350 setWindowTitle(tr("SMESH_CLIPPING_TITLE"));
00351 setSizeGripEnabled(true);
00352
00353 QVBoxLayout* SMESHGUI_ClippingDlgLayout = new QVBoxLayout(this);
00354 SMESHGUI_ClippingDlgLayout->setSpacing(SPACING);
00355 SMESHGUI_ClippingDlgLayout->setMargin(MARGIN);
00356
00357
00358 QGroupBox* GroupPlanes = new QGroupBox(tr("CLIP_PLANES"), this);
00359 QGridLayout* GroupPlanesLayout = new QGridLayout(GroupPlanes);
00360 GroupPlanesLayout->setSpacing(SPACING);
00361 GroupPlanesLayout->setMargin(MARGIN);
00362
00363 ComboBoxPlanes = new QComboBox(GroupPlanes);
00364
00365 buttonNew = new QPushButton(tr("SMESH_BUT_NEW"), GroupPlanes);
00366
00367 buttonDelete = new QPushButton(tr("SMESH_BUT_DELETE"), GroupPlanes);
00368
00369 QLabel* aLabel = new QLabel(tr("MESHES_SUBMESHES_GROUPS"), GroupPlanes);
00370
00371 ActorList = new QListWidget(GroupPlanes);
00372 ActorList->setSelectionMode(QAbstractItemView::SingleSelection);
00373
00374 SelectAllCheckBox = new QCheckBox(tr("SELECT_ALL"), GroupPlanes);
00375
00376 GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0);
00377 GroupPlanesLayout->addWidget(new QWidget(), 0, 1);
00378 GroupPlanesLayout->addWidget(buttonNew, 0, 2);
00379 GroupPlanesLayout->addWidget(buttonDelete, 0, 3);
00380 GroupPlanesLayout->addWidget(aLabel, 1, 0, 1, 4);
00381 GroupPlanesLayout->addWidget(ActorList, 2, 0, 1, 4);
00382 GroupPlanesLayout->addWidget(SelectAllCheckBox, 3, 0, 1, 4);
00383 GroupPlanesLayout->setColumnStretch( 1, 1 );
00384
00385
00386 QGroupBox* GroupParameters = new QGroupBox(tr("SMESH_PARAMETERS"), this);
00387 QGridLayout* GroupParametersLayout = new QGridLayout(GroupParameters);
00388 GroupParametersLayout->setSpacing(SPACING);
00389 GroupParametersLayout->setMargin(MARGIN);
00390
00391 TextLabelOrientation = new QLabel(tr("SMESH_ORIENTATION"), GroupParameters);
00392
00393 ComboBoxOrientation = new QComboBox(GroupParameters);
00394
00395 TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupParameters);
00396
00397 SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters);
00398
00399 TextLabelRot1 = new QLabel(tr("ROTATION_AROUND_X_Y2Z"), GroupParameters);
00400
00401 SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters);
00402
00403 TextLabelRot2 = new QLabel(tr("ROTATION_AROUND_Y_X2Z"), GroupParameters);
00404
00405 SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters);
00406
00407 PreviewCheckBox = new QCheckBox(tr("SHOW_PREVIEW"), GroupParameters);
00408 PreviewCheckBox->setChecked(true);
00409
00410 AutoApplyCheckBox = new QCheckBox(tr("AUTO_APPLY"), GroupParameters);
00411 AutoApplyCheckBox->setChecked(false);
00412
00413 GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0);
00414 GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1);
00415 GroupParametersLayout->addWidget(TextLabelDistance, 1, 0);
00416 GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1);
00417 GroupParametersLayout->addWidget(TextLabelRot1, 2, 0);
00418 GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1);
00419 GroupParametersLayout->addWidget(TextLabelRot2, 3, 0);
00420 GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1);
00421 GroupParametersLayout->addWidget(PreviewCheckBox, 4, 0);
00422 GroupParametersLayout->addWidget(AutoApplyCheckBox, 4, 1);
00423
00424
00425 QGroupBox* GroupButtons = new QGroupBox(this);
00426 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
00427 GroupButtonsLayout->setSpacing(SPACING);
00428 GroupButtonsLayout->setMargin(MARGIN);
00429
00430 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
00431 buttonOk->setAutoDefault(true);
00432 buttonOk->setDefault(true);
00433 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
00434 buttonApply->setAutoDefault(true);
00435 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
00436 buttonCancel->setAutoDefault(true);
00437 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
00438 buttonHelp->setAutoDefault(true);
00439 GroupButtonsLayout->addWidget(buttonOk);
00440 GroupButtonsLayout->addSpacing(10);
00441 GroupButtonsLayout->addWidget(buttonApply);
00442 GroupButtonsLayout->addSpacing(10);
00443 GroupButtonsLayout->addStretch();
00444 GroupButtonsLayout->addWidget(buttonCancel);
00445 GroupButtonsLayout->addWidget(buttonHelp);
00446
00447 SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes);
00448 SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters);
00449 SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons);
00450
00451
00452 SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, "length_precision" );
00453 SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );
00454 SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, "angle_precision" );
00455
00456 ComboBoxOrientation->addItem(tr("ALONG_XY"));
00457 ComboBoxOrientation->addItem(tr("ALONG_YZ"));
00458 ComboBoxOrientation->addItem(tr("ALONG_ZX"));
00459
00460 SpinBoxDistance->SetValue(0.5);
00461
00462 myIsSelectPlane = false;
00463
00464 initializePlaneData();
00465 synchronize();
00466
00467 myHelpFileName = "clipping_page.html";
00468
00469
00470 connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
00471 connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
00472 connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
00473 connect(ActorList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(onActorItemChanged(QListWidgetItem*)));
00474 connect(SelectAllCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onSelectAll(int)));
00475 connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
00476 connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
00477 connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
00478 connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
00479 connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
00480 connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
00481 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
00482 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
00483 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
00484 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
00485 connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
00486
00487 connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));
00488
00489 this->show();
00490 }
00491
00492
00493
00494
00495
00496 SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
00497 {
00498
00499 std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisibility(false));
00500 if (myViewWindow)
00501 SMESH::RenderViewWindow(myViewWindow);
00502 }
00503
00504 double SMESHGUI_ClippingDlg::getDistance() const
00505 {
00506 return SpinBoxDistance->GetValue();
00507 }
00508
00509 void SMESHGUI_ClippingDlg::setDistance( const double theDistance )
00510 {
00511 SpinBoxDistance->SetValue( theDistance );
00512 }
00513
00514 double SMESHGUI_ClippingDlg::getRotation1() const
00515 {
00516 return SpinBoxRot1->GetValue();
00517 }
00518
00519 double SMESHGUI_ClippingDlg::getRotation2() const
00520 {
00521 return SpinBoxRot2->GetValue();
00522 }
00523
00524
00525
00526
00527
00528 void SMESHGUI_ClippingDlg::ClickOnApply()
00529 {
00530 if (myViewWindow) {
00531 SUIT_OverrideCursor wc;
00532
00533 QWidget *aCurrWid = this->focusWidget();
00534 aCurrWid->clearFocus();
00535 aCurrWid->setFocus();
00536
00537 SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = mySMESHGUI->getClippingPlaneInfoMap();
00538 SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = aClippingPlaneInfoMap[ myViewWindow->getViewManager() ];
00539
00540
00541 SMESHGUI_ClippingPlaneInfoList::iterator anIter1 = aClippingPlaneInfoList.begin();
00542 for( ; anIter1 != aClippingPlaneInfoList.end(); anIter1++ )
00543 if( SMESH::OrientedPlane* aPlane = (*anIter1).Plane )
00544 aPlane->Delete();
00545
00546 aClippingPlaneInfoList.clear();
00547
00548 VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
00549 vtkActorCollection* anAllActors = aCopy.GetActors();
00550 anAllActors->InitTraversal();
00551 while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
00552 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
00553 anActor->RemoveAllClippingPlanes();
00554
00555 SMESH::TPlaneDataVector::iterator anIter2 = myPlanes.begin();
00556 for( ; anIter2 != myPlanes.end(); anIter2++ ) {
00557 SMESH::TPlaneData aPlaneData = *anIter2;
00558 SMESH::TPlane aPlane = aPlaneData.Plane;
00559 SMESH::TActorList anActorList = aPlaneData.ActorList;
00560
00561
00562
00563
00564
00565 SMESH::OrientedPlane* anOrientedPlane = SMESH::OrientedPlane::New(myViewWindow);
00566 anOrientedPlane->ShallowCopy(aPlane.GetPointer());
00567
00568 SMESH::TActorList::iterator anIter3 = anActorList.begin();
00569 for( ; anIter3 != anActorList.end(); anIter3++ )
00570 if( vtkActor* aVTKActor = *anIter3 )
00571 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
00572 anActor->AddClippingPlane(anOrientedPlane);
00573
00574 SMESH::ClippingPlaneInfo aClippingPlaneInfo;
00575 aClippingPlaneInfo.Plane = anOrientedPlane;
00576 aClippingPlaneInfo.ActorList = anActorList;
00577
00578 aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
00579 }
00580
00581 SMESH::RenderViewWindow( myViewWindow );
00582 }
00583 }
00584
00585
00586
00587
00588
00589 void SMESHGUI_ClippingDlg::ClickOnOk()
00590 {
00591 ClickOnApply();
00592 ClickOnCancel();
00593 }
00594
00595
00596
00597
00598
00599 void SMESHGUI_ClippingDlg::ClickOnCancel()
00600 {
00601 close();
00602 }
00603
00604
00605
00606
00607
00608 void SMESHGUI_ClippingDlg::ClickOnHelp()
00609 {
00610 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
00611 if (app)
00612 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
00613 else {
00614 QString platform;
00615 #ifdef WIN32
00616 platform = "winapplication";
00617 #else
00618 platform = "application";
00619 #endif
00620 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
00621 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
00622 arg(app->resourceMgr()->stringValue("ExternalBrowser",
00623 platform)).
00624 arg(myHelpFileName));
00625 }
00626 }
00627
00628
00629
00630
00631
00632 void SMESHGUI_ClippingDlg::onSelectPlane (int theIndex)
00633 {
00634 if (myPlanes.empty())
00635 return;
00636
00637 SMESH::TPlaneData aPlaneData = myPlanes[theIndex];
00638 SMESH::OrientedPlane* aPlane = aPlaneData.Plane.GetPointer();
00639
00640
00641 SMESH::Orientation anOrientation = aPlane->GetOrientation();
00642
00643
00644 double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
00645
00646
00647 myIsSelectPlane = true;
00648 setDistance(aPlane->GetDistance());
00649 setRotation(aRot[0], aRot[1]);
00650 switch (anOrientation) {
00651 case SMESH::XY:
00652 ComboBoxOrientation->setCurrentIndex(0);
00653 onSelectOrientation(0);
00654 break;
00655 case SMESH::YZ:
00656 ComboBoxOrientation->setCurrentIndex(1);
00657 onSelectOrientation(1);
00658 break;
00659 case SMESH::ZX:
00660 ComboBoxOrientation->setCurrentIndex(2);
00661 onSelectOrientation(2);
00662 break;
00663 }
00664 myIsSelectPlane = false;
00665
00666
00667 bool anIsBlocked = ActorList->blockSignals( true );
00668 updateActorList();
00669 ActorList->blockSignals( anIsBlocked );
00670 }
00671
00672
00673
00674
00675
00676 void SMESHGUI_ClippingDlg::ClickOnNew()
00677 {
00678 if(myViewWindow){
00679 SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(myViewWindow);
00680 SMESH::TPlane aTPlane(aPlane);
00681
00682 SMESH::TActorList anActorList;
00683 VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
00684 vtkActorCollection* anAllActors = aCopy.GetActors();
00685 anAllActors->InitTraversal();
00686 while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
00687 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
00688 anActorList.push_back( anActor );
00689
00690 SMESH::TPlaneData aPlaneData(aTPlane, anActorList);
00691
00692 myPlanes.push_back(aPlaneData);
00693
00694 if (PreviewCheckBox->isChecked())
00695 aTPlane->myActor->VisibilityOn();
00696
00697 bool anIsBlocked = ActorList->blockSignals( true );
00698
00699 synchronize();
00700 SetCurrentPlaneParam();
00701
00702 ActorList->blockSignals( anIsBlocked );
00703 }
00704 }
00705
00706
00707
00708
00709
00710 void SMESHGUI_ClippingDlg::ClickOnDelete()
00711 {
00712 if (myPlanes.empty())
00713 return;
00714
00715 int aPlaneIndex = ComboBoxPlanes->currentIndex();
00716
00717 SMESH::TPlaneDataVector::iterator anIter = myPlanes.begin() + aPlaneIndex;
00718 SMESH::TPlaneData aPlaneData = *anIter;
00719 aPlaneData.Plane.GetPointer()->myActor->SetVisibility(false);
00720 myPlanes.erase(anIter);
00721
00722 if(AutoApplyCheckBox->isChecked())
00723 ClickOnApply();
00724
00725 synchronize();
00726 SMESH::RenderViewWindow( myViewWindow );
00727 }
00728
00729
00730
00731
00732
00733 void SMESHGUI_ClippingDlg::updateActorItem( QListWidgetItem* theItem,
00734 bool theUpdateSelectAll,
00735 bool theUpdateClippingPlaneMap )
00736 {
00737
00738 if( theUpdateSelectAll ) {
00739 int aNbItems = ActorList->count(), aNbChecked = 0;
00740 for( int i = 0; i < aNbItems; i++ )
00741 if( QListWidgetItem* anItem = ActorList->item( i ) )
00742 if( anItem->checkState() == Qt::Checked )
00743 aNbChecked++;
00744
00745 Qt::CheckState aCheckState = Qt::Unchecked;
00746 if( aNbChecked == aNbItems )
00747 aCheckState = Qt::Checked;
00748 else if( aNbChecked > 0 )
00749 aCheckState = Qt::PartiallyChecked;
00750
00751 bool anIsBlocked = SelectAllCheckBox->blockSignals( true );
00752 SelectAllCheckBox->setCheckState( aCheckState );
00753 SelectAllCheckBox->blockSignals( anIsBlocked );
00754 }
00755
00756
00757 if( theUpdateClippingPlaneMap ) {
00758 int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
00759 if( ActorItem* anItem = dynamic_cast<ActorItem*>( theItem ) ) {
00760 if( SMESH_Actor* anActor = anItem->getActor() ) {
00761 SMESH::TPlaneData& aPlaneData = myPlanes[ aCurPlaneIndex ];
00762 SMESH::TActorList& anActorList = aPlaneData.ActorList;
00763 bool anIsPushed = false;
00764 SMESH::TActorList::iterator anIter = anActorList.begin();
00765 for ( ; anIter != anActorList.end(); anIter++ ) {
00766 if( anActor == *anIter ) {
00767 anIsPushed = true;
00768 break;
00769 }
00770 }
00771 if( theItem->checkState() == Qt::Checked && !anIsPushed )
00772 anActorList.push_back( anActor );
00773 else if( theItem->checkState() == Qt::Unchecked && anIsPushed )
00774 anActorList.remove( anActor );
00775 }
00776 }
00777 }
00778 }
00779
00780
00781
00782
00783
00784 void SMESHGUI_ClippingDlg::onActorItemChanged( QListWidgetItem* theItem )
00785 {
00786 updateActorItem( theItem, true, true );
00787 SetCurrentPlaneParam();
00788 }
00789
00790
00791
00792
00793
00794 void SMESHGUI_ClippingDlg::onSelectAll( int theState )
00795 {
00796 if( theState == Qt::PartiallyChecked ) {
00797 SelectAllCheckBox->setCheckState( Qt::Checked );
00798 return;
00799 }
00800
00801 bool anIsBlocked = ActorList->blockSignals( true );
00802 for( int i = 0, n = ActorList->count(); i < n; i++ ) {
00803 if( QListWidgetItem* anItem = ActorList->item( i ) ) {
00804 anItem->setCheckState( theState == Qt::Checked ? Qt::Checked : Qt::Unchecked );
00805 updateActorItem( anItem, false, true );
00806 }
00807 }
00808 SelectAllCheckBox->setTristate( false );
00809 ActorList->blockSignals( anIsBlocked );
00810 SetCurrentPlaneParam();
00811 }
00812
00813
00814
00815
00816
00817 void SMESHGUI_ClippingDlg::onSelectOrientation (int theItem)
00818 {
00819 if (myPlanes.empty())
00820 return;
00821
00822 if (theItem == 0) {
00823 TextLabelRot1->setText(tr("ROTATION_AROUND_X_Y2Z"));
00824 TextLabelRot2->setText(tr("ROTATION_AROUND_Y_X2Z"));
00825 }
00826 else if (theItem == 1) {
00827 TextLabelRot1->setText(tr("ROTATION_AROUND_Y_Z2X"));
00828 TextLabelRot2->setText(tr("ROTATION_AROUND_Z_Y2X"));
00829 }
00830 else if (theItem == 2) {
00831 TextLabelRot1->setText(tr("ROTATION_AROUND_Z_X2Y"));
00832 TextLabelRot2->setText(tr("ROTATION_AROUND_X_Z2Y"));
00833 }
00834
00835 if((QComboBox*)sender() == ComboBoxOrientation)
00836 SetCurrentPlaneParam();
00837 }
00838
00839
00840
00841
00842
00843 void SMESHGUI_ClippingDlg::synchronize()
00844 {
00845 int aNbPlanes = myPlanes.size();
00846 ComboBoxPlanes->clear();
00847
00848 QString aName;
00849 for(int i = 1; i<=aNbPlanes; i++) {
00850 aName = QString(tr("PLANE_NUM")).arg(i);
00851 ComboBoxPlanes->addItem(aName);
00852 }
00853
00854 int aPos = ComboBoxPlanes->count() - 1;
00855 ComboBoxPlanes->setCurrentIndex(aPos);
00856
00857 bool anIsControlsEnable = (aPos >= 0);
00858 if (anIsControlsEnable) {
00859 onSelectPlane(aPos);
00860 updateActorList();
00861 } else {
00862 ComboBoxPlanes->addItem(tr("NO_PLANES"));
00863 ActorList->clear();
00864 SpinBoxRot1->SetValue(0.0);
00865 SpinBoxRot2->SetValue(0.0);
00866 SpinBoxDistance->SetValue(0.5);
00867 }
00868
00869 ActorList->setEnabled(anIsControlsEnable);
00870 SelectAllCheckBox->setEnabled(anIsControlsEnable);
00871 buttonDelete->setEnabled(anIsControlsEnable);
00872
00873
00874
00875
00876 ComboBoxOrientation->setEnabled(anIsControlsEnable);
00877 SpinBoxDistance->setEnabled(anIsControlsEnable);
00878 SpinBoxRot1->setEnabled(anIsControlsEnable);
00879 SpinBoxRot2->setEnabled(anIsControlsEnable);
00880 }
00881
00882
00883
00884
00885
00886 void SMESHGUI_ClippingDlg::setRotation (const double theRot1, const double theRot2)
00887 {
00888 SpinBoxRot1->SetValue(theRot1);
00889 SpinBoxRot2->SetValue(theRot2);
00890 }
00891
00892
00893
00894
00895
00896 void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
00897 {
00898 if (myPlanes.empty() || myIsSelectPlane)
00899 return;
00900
00901 int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
00902
00903 SMESH::TPlaneData aPlaneData = myPlanes[aCurPlaneIndex];
00904 SMESH::OrientedPlane* aPlane = aPlaneData.Plane.GetPointer();
00905
00906 vtkFloatingPointType aNormal[3];
00907 SMESH::Orientation anOrientation;
00908 vtkFloatingPointType aDir[3][3] = {{0, 0, 0}, {0, 0, 0}};
00909 {
00910 static double aCoeff = vtkMath::Pi()/180.0;
00911
00912 vtkFloatingPointType aRot[2] = {getRotation1(), getRotation2()};
00913 aPlane->myAngle[0] = aRot[0];
00914 aPlane->myAngle[1] = aRot[1];
00915
00916 vtkFloatingPointType anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])};
00917 vtkFloatingPointType aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])};
00918 aV[0] = aRot[0] > 0? aV[0]: -aV[0];
00919 aV[1] = aRot[1] > 0? aV[1]: -aV[1];
00920
00921 switch (ComboBoxOrientation->currentIndex()) {
00922 case 0:
00923 anOrientation = SMESH::XY;
00924
00925 aDir[0][1] = anU[0];
00926 aDir[0][2] = aV[0];
00927
00928 aDir[1][0] = anU[1];
00929 aDir[1][2] = aV[1];
00930
00931 break;
00932 case 1:
00933 anOrientation = SMESH::YZ;
00934
00935 aDir[0][2] = anU[0];
00936 aDir[0][0] = aV[0];
00937
00938 aDir[1][1] = anU[1];
00939 aDir[1][0] = aV[1];
00940
00941 break;
00942 case 2:
00943 anOrientation = SMESH::ZX;
00944
00945 aDir[0][0] = anU[0];
00946 aDir[0][1] = aV[0];
00947
00948 aDir[1][2] = anU[1];
00949 aDir[1][1] = aV[1];
00950
00951 break;
00952 }
00953
00954 vtkMath::Cross(aDir[1],aDir[0],aNormal);
00955 vtkMath::Normalize(aNormal);
00956 vtkMath::Cross(aNormal,aDir[1],aDir[0]);
00957 }
00958
00959 aPlane->SetOrientation(anOrientation);
00960 aPlane->SetDistance(getDistance());
00961
00962 SMESH::TActorList anActorList = aPlaneData.ActorList;
00963
00964 vtkFloatingPointType aBounds[6];
00965 vtkFloatingPointType anOrigin[3];
00966 bool anIsOk = SMESH::ComputeClippingPlaneParameters( anActorList,
00967 aNormal,
00968 getDistance(),
00969 aBounds,
00970 anOrigin );
00971
00972 aPlane->myActor->SetVisibility( anIsOk && PreviewCheckBox->isChecked() );
00973
00974 if( anIsOk ) {
00975 aPlane->SetNormal( aNormal );
00976 aPlane->SetOrigin( anOrigin );
00977
00978 vtkFloatingPointType aPnt[3] = { ( aBounds[0] + aBounds[1] ) / 2.,
00979 ( aBounds[2] + aBounds[3] ) / 2.,
00980 ( aBounds[4] + aBounds[5] ) / 2. };
00981
00982 vtkFloatingPointType aDel = pow( pow( aBounds[1] - aBounds[0], 2 ) +
00983 pow( aBounds[3] - aBounds[2], 2 ) +
00984 pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
00985
00986 vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel},
00987 {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}};
00988 vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3];
00989
00990 vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0],
00991 aPnt[1] - aDelta[0][1] - aDelta[1][1],
00992 aPnt[2] - aDelta[0][2] - aDelta[1][2]};
00993 vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0],
00994 aPnt01[1] + aNormal[1],
00995 aPnt01[2] + aNormal[2]};
00996 vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0);
00997
00998 vtkFloatingPointType aPnt11[3] = {aPnt[0] - aDelta[0][0] + aDelta[1][0],
00999 aPnt[1] - aDelta[0][1] + aDelta[1][1],
01000 aPnt[2] - aDelta[0][2] + aDelta[1][2]};
01001 vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0],
01002 aPnt11[1] + aNormal[1],
01003 aPnt11[2] + aNormal[2]};
01004 vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1);
01005
01006 vtkFloatingPointType aPnt21[3] = {aPnt[0] + aDelta[0][0] - aDelta[1][0],
01007 aPnt[1] + aDelta[0][1] - aDelta[1][1],
01008 aPnt[2] + aDelta[0][2] - aDelta[1][2]};
01009 vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0],
01010 aPnt21[1] + aNormal[1],
01011 aPnt21[2] + aNormal[2]};
01012 vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2);
01013
01014 vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource;
01015 aPlaneSource->SetNormal(aNormal[0],aNormal[1],aNormal[2]);
01016 aPlaneSource->SetOrigin(aPnt0[0],aPnt0[1],aPnt0[2]);
01017 aPlaneSource->SetPoint1(aPnt1[0],aPnt1[1],aPnt1[2]);
01018 aPlaneSource->SetPoint2(aPnt2[0],aPnt2[1],aPnt2[2]);
01019 }
01020
01021 if(AutoApplyCheckBox->isChecked())
01022 ClickOnApply();
01023
01024 SMESH::RenderViewWindow( myViewWindow );
01025 }
01026
01027
01028
01029
01030
01031 void SMESHGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
01032 {
01033 std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisibility(theIsToggled));
01034 SMESH::RenderViewWindow( myViewWindow );
01035 }
01036
01037
01038
01039
01040
01041 void SMESHGUI_ClippingDlg::keyPressEvent( QKeyEvent* e )
01042 {
01043 QDialog::keyPressEvent( e );
01044 if ( e->isAccepted() )
01045 return;
01046
01047 if ( e->key() == Qt::Key_F1 ) {
01048 e->accept();
01049 ClickOnHelp();
01050 }
01051 }
01052
01053
01054
01055
01056
01057 void SMESHGUI_ClippingDlg::initializePlaneData()
01058 {
01059 const SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = mySMESHGUI->getClippingPlaneInfoMap();
01060 SMESHGUI_ClippingPlaneInfoMap::const_iterator anIter1 = aClippingPlaneInfoMap.find( myViewWindow->getViewManager() );
01061 if( anIter1 != aClippingPlaneInfoMap.end() ) {
01062 const SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = anIter1->second;
01063 SMESHGUI_ClippingPlaneInfoList::const_iterator anIter2 = aClippingPlaneInfoList.begin();
01064 for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) {
01065 const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2;
01066 SMESH::TPlane aTPlane( aClippingPlaneInfo.Plane );
01067 SMESH::TPlaneData aPlaneData( aTPlane, aClippingPlaneInfo.ActorList );
01068 myPlanes.push_back( aPlaneData );
01069 }
01070 }
01071 std::for_each( myPlanes.begin(),myPlanes.end(), TSetVisibility( PreviewCheckBox->isChecked() ) );
01072 }
01073
01074
01075
01076
01077
01078 void SMESHGUI_ClippingDlg::updateActorList()
01079 {
01080 ActorList->clear();
01081
01082 SalomeApp_Study* anAppStudy = SMESHGUI::activeStudy();
01083 if( !anAppStudy )
01084 return;
01085
01086 _PTR(Study) aStudy = anAppStudy->studyDS();
01087 if( !aStudy )
01088 return;
01089
01090 if( !myViewWindow )
01091 return;
01092
01093 int aCurPlaneIndex = ComboBoxPlanes->currentIndex();
01094 const SMESH::TPlaneData& aPlaneData = myPlanes[ aCurPlaneIndex ];
01095 const SMESH::TActorList& anActorList = aPlaneData.ActorList;
01096
01097 VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
01098 vtkActorCollection* anAllActors = aCopy.GetActors();
01099 anAllActors->InitTraversal();
01100 while( vtkActor* aVTKActor = anAllActors->GetNextActor() ) {
01101 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) {
01102 if( anActor->hasIO() ) {
01103 Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
01104 if( _PTR(SObject) aSObj = aStudy->FindObjectID( anIO->getEntry() ) ) {
01105 bool anIsChecked = false;
01106 SMESH::TActorList::const_iterator anIter = anActorList.begin();
01107 for ( ; anIter != anActorList.end(); anIter++ ) {
01108 if( vtkActor* aVTKActorRef = *anIter ) {
01109 if( SMESH_Actor* anActorRef = SMESH_Actor::SafeDownCast( aVTKActorRef ) ) {
01110 if( anActorRef == anActor ) {
01111 anIsChecked = true;
01112 break;
01113 }
01114 }
01115 }
01116 }
01117 QString aName = QString( aSObj->GetName().c_str() );
01118 QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
01119 anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
01120 updateActorItem( anItem, true, false );
01121 }
01122 }
01123 }
01124 }
01125 }
01126
01127
01128
01129
01130
01131 SMESH::TActorList SMESHGUI_ClippingDlg::getCurrentActors()
01132 {
01133 SMESH::TActorList anActorList;
01134 for( int i = 0, n = ActorList->count(); i < n; i++ )
01135 if( ActorItem* anItem = dynamic_cast<ActorItem*>( ActorList->item( i ) ) )
01136 if( anItem->checkState() == Qt::Checked )
01137 if( SMESH_Actor* anActor = anItem->getActor() )
01138 anActorList.push_back( anActor );
01139 return anActorList;
01140 }
01141
01142
01143
01144
01145
01146 void SMESHGUI_ClippingDlg::dumpPlaneData() const
01147 {
01148 printf( "----------- Plane Data -----------\n" );
01149 int anId = 1;
01150 SMESH::TPlaneDataVector::const_iterator anIter1 = myPlanes.begin();
01151 for ( ; anIter1 != myPlanes.end(); anIter1++, anId++ ) {
01152 SMESH::TPlaneData aPlaneData = *anIter1;
01153 SMESH::TPlane aPlane = aPlaneData.Plane;
01154 vtkFloatingPointType* aNormal = aPlane->GetNormal();
01155 vtkFloatingPointType* anOrigin = aPlane->GetOrigin();
01156 printf( "Plane N%d:\n", anId );
01157 printf( " Normal = ( %f, %f, %f )\n", aNormal[0], aNormal[1], aNormal[2] );
01158 printf( " Origin = ( %f, %f, %f )\n", anOrigin[0], anOrigin[1], anOrigin[2] );
01159
01160 SMESH::TActorList anActorList = aPlaneData.ActorList;
01161 SMESH::TActorList::const_iterator anIter2 = anActorList.begin();
01162 for ( ; anIter2 != anActorList.end(); anIter2++ ) {
01163 if( vtkActor* aVTKActor = *anIter2 ) {
01164 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
01165 printf( " - Actor: '%s'\n", anActor->getName() );
01166 }
01167 else
01168 printf( " - Actor: NULL\n");
01169 }
01170 }
01171 printf( "----------------------------------\n" );
01172 }