From c0a74043737f60242bd6205f2370e863cfefa72a Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 6 Jun 2008 11:43:24 +0000 Subject: [PATCH] *** empty log message *** --- src/OBJECT/VISU_DataSetActor.cxx | 3 +- src/OBJECT/VISU_GaussPtsAct.cxx | 63 ++++++++++++++++++++++++- src/OBJECT/VISU_GaussPtsAct.h | 15 ++++++ src/OBJECT/VISU_GaussPtsDeviceActor.cxx | 13 +++-- src/OBJECT/VISU_GaussPtsDeviceActor.h | 10 ++++ src/VISUGUI/VisuGUI_BasePanel.cxx | 18 +++---- src/VISUGUI/VisuGUI_SegmentationMgr.cxx | 9 ++-- src/VISUGUI/VisuGUI_SelectionPanel.cxx | 34 ++++++------- 8 files changed, 130 insertions(+), 35 deletions(-) diff --git a/src/OBJECT/VISU_DataSetActor.cxx b/src/OBJECT/VISU_DataSetActor.cxx index ca3891ac..dbdb25ec 100644 --- a/src/OBJECT/VISU_DataSetActor.cxx +++ b/src/OBJECT/VISU_DataSetActor.cxx @@ -62,7 +62,8 @@ VISU_DataSetActor myExtractor->SetImplicitFunction(myFunction); myPolyDataExtractor->SetImplicitFunction(myFunction); - myExtractor->ExtractBoundaryCellsOn(); + //myExtractor->ExtractBoundaryCellsOn(); + //myPolyDataExtractor->ExtractBoundaryCellsOn(); myFunction->SetOperationTypeToIntersection(); diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index d8e30ca3..81090762 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -39,6 +39,7 @@ #include "VISU_Event.h" #include "SVTK_Actor.h" +#include #include #include @@ -46,6 +47,9 @@ #include #include #include +#include +#include +#include #include #include @@ -131,7 +135,9 @@ VISU_GaussPtsAct myBarVisibility(true), myInsideCursorSettings(NULL), myCurrentPL(NULL), - myMapper(vtkPolyDataMapper::New()) + myMapper(vtkPolyDataMapper::New()), + myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()), + myFunction(vtkImplicitBoolean::New()) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<Delete(); + myPolyDataExtractor->SetImplicitFunction(myFunction); + //myPolyDataExtractor->ExtractBoundaryCellsOn(); + + myFunction->SetOperationTypeToIntersection(); + myPolyDataExtractor->Delete(); + myFunction->Delete(); + if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() ) aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, myEventCallbackCommand.GetPointer(), @@ -412,11 +425,14 @@ VISU_GaussPtsAct { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<SetExtractor(myPolyDataExtractor); myDeviceActor->SetPipeLine(GetGaussPointsPL()); myCurrentPL = myDeviceActor->GetPipeLine(); //SetMapper(myCurrentPL->GetPointSpriteMapper()); + // myPolyDataExtractor->SetInput(myCurrentPL->GetPickableDataSet()); + //myMapper->SetInput(myPolyDataExtractor->GetOutput()); myMapper->SetInput(myCurrentPL->GetPickableDataSet()); SetMapper(myMapper.GetPointer()); } @@ -1175,6 +1191,51 @@ VISU_GaussPtsAct return aTime; } +void VISU_GaussPtsAct::RemoveAllClippingPlanes() +{ + myFunction->GetFunction()->RemoveAllItems(); + myFunction->Modified(); +} + +vtkIdType VISU_GaussPtsAct::GetNumberOfClippingPlanes() +{ + return myFunction->GetFunction()->GetNumberOfItems(); +} + +bool VISU_GaussPtsAct::AddClippingPlane(vtkPlane* thePlane) +{ + vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes(); + aFunctions->InitTraversal(); + vtkImplicitFunction* aItem; + while ((aItem = aFunctions->GetNextItem())) { + if (thePlane == aItem) + return false; + } + myFunction->AddFunction(thePlane); + return true; +} + +vtkPlane* VISU_GaussPtsAct::GetClippingPlane(vtkIdType theID) +{ + vtkPlane* aPlane = NULL; + if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) { + vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction(); + vtkImplicitFunction* aFun = NULL; + aFunction->InitTraversal(); + for (vtkIdType i = 0; i <= theID; i++) + aFun = aFunction->GetNextItem(); + aPlane = dynamic_cast(aFun); + } + return aPlane; +} + +vtkImplicitFunctionCollection* VISU_GaussPtsAct::GetClippingPlanes() +{ + return myFunction->GetFunction(); +} + + + //============================================================================== vtkStandardNewMacro(VISU_GaussPtsAct1); diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index b4105a2b..c2192b2e 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -63,6 +63,8 @@ class VISU_ScalarBarCtrl; class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; +class SALOME_ExtractPolyDataGeometry; +class vtkImplicitBoolean; //============================================================================ //! Base class for Gauss Points Actors. @@ -248,6 +250,17 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor unsigned long int GetMTime(); + //---------------------------------------------------------------------------- + virtual void RemoveAllClippingPlanes(); + + virtual vtkIdType GetNumberOfClippingPlanes(); + + virtual bool AddClippingPlane(vtkPlane* thePlane); + + virtual vtkPlane* GetClippingPlane(vtkIdType theID); + + virtual vtkImplicitFunctionCollection* GetClippingPlanes(); + protected: //---------------------------------------------------------------------------- VISU_GaussPtsAct(); @@ -311,6 +324,8 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor vtkSmartPointer myGaussPointsPL; vtkSmartPointer myMapper; + vtkSmartPointer myPolyDataExtractor; + vtkSmartPointer myFunction; vtkIdType myLastPreHighlightObjID; diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index 92586516..654243d6 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -34,6 +34,7 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" +#include #include #include @@ -136,7 +137,8 @@ vtkStandardNewMacro(VISU_GaussDeviceActorBase); VISU_GaussDeviceActorBase ::VISU_GaussDeviceActorBase(): - myTransformFilter(VTKViewer_TransformFilter::New()) + myTransformFilter(VTKViewer_TransformFilter::New()), + myPolyDataExtractor(0) { if(MYDEBUG) MESSAGE("VISU_GaussDeviceActorBase - "<SetInput( aDataSet ); + if (myPolyDataExtractor) { + myPolyDataExtractor->SetInput(aDataSet); + myPassFilter[ anId ]->SetInput( myPolyDataExtractor->GetOutput() ); + } else { + myPassFilter[ anId ]->SetInput( aDataSet ); + } myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); - + anId++; myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h index 7ff5c369..5b25e78e 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.h +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.h @@ -43,6 +43,7 @@ class VISU_GaussPointsPL; class vtkPassThroughFilter; class vtkImageData; +class SALOME_ExtractPolyDataGeometry; //============================================================================ @@ -92,6 +93,13 @@ class VISU_GaussDeviceActorBase: public vtkLODActor virtual unsigned long int GetMemorySize(); + + //---------------------------------------------------------------------------- + void SetExtractor(SALOME_ExtractPolyDataGeometry* theExtractor) + { myPolyDataExtractor = theExtractor; } + + SALOME_ExtractPolyDataGeometry* GetExtractor() const + { return myPolyDataExtractor; } protected: //---------------------------------------------------------------------------- @@ -101,6 +109,8 @@ class VISU_GaussDeviceActorBase: public vtkLODActor typedef vtkSmartPointer PPassThroughFilter; std::vector myPassFilter; + SALOME_ExtractPolyDataGeometry* myPolyDataExtractor; + VISU_GaussDeviceActorBase(); ~VISU_GaussDeviceActorBase(); diff --git a/src/VISUGUI/VisuGUI_BasePanel.cxx b/src/VISUGUI/VisuGUI_BasePanel.cxx index 4d131cf2..ed0dc30d 100755 --- a/src/VISUGUI/VisuGUI_BasePanel.cxx +++ b/src/VISUGUI/VisuGUI_BasePanel.cxx @@ -89,21 +89,21 @@ VisuGUI_BasePanel::VisuGUI_BasePanel( const QString& theName, myHelp( 0 ) { // Create scroll view - //myView = new QScrollArea( this ); + myView = new QScrollArea( this ); // Create main frame - myMainFrame = new MainFrame( this/*myView*/ ); - //myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame ); - /* + myMainFrame = new MainFrame( myView ); + myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame ); + myView->setWidget( myMainFrame ); myView->setAlignment( Qt::AlignCenter ); myView->setWidgetResizable( true ); - myView->setMinimumWidth( myMainFrame->sizeHint().width() + MARGIN_SIZE * 2 ); - */ + myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 ); + // Create buttons QWidget* aBtnWg = new QWidget( this ); QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg ); - aBtnWgLayout->setSpacing( 5 ); + //aBtnWgLayout->setSpacing( 5 ); aBtnWgLayout->addStretch(); @@ -145,8 +145,8 @@ VisuGUI_BasePanel::VisuGUI_BasePanel( const QString& theName, // fill layout QVBoxLayout* aLay = new QVBoxLayout( this ); aLay->setContentsMargins( 0, 0, 0, 0 ); - aLay->setSpacing( 5 ); - aLay->addWidget( myMainFrame/*myView*/, 1 ); + //aLay->setSpacing( 5 ); + aLay->addWidget( myView, 1 ); aLay->addWidget( aBtnWg ); } diff --git a/src/VISUGUI/VisuGUI_SegmentationMgr.cxx b/src/VISUGUI/VisuGUI_SegmentationMgr.cxx index e90d25b6..a09262eb 100644 --- a/src/VISUGUI/VisuGUI_SegmentationMgr.cxx +++ b/src/VISUGUI/VisuGUI_SegmentationMgr.cxx @@ -283,14 +283,16 @@ void VisuGUI_SegmentationMgr::setPlanes(const QListOfPlanes& theNewPlanes) vtkActorCollection* anActors = myWindow->getRenderer()->GetActors(); anActors->InitTraversal(); - vtkActor* aActor = 0; + vtkActor* aActor = anActors->GetNextActor(); VISU_Actor* aVisuActor = 0; - while ( (aActor = anActors->GetNextActor()) ) { + while (aActor) { aVisuActor = VISU_Actor::SafeDownCast(aActor); if (aVisuActor) { applyPlanes(aVisuActor); } + aActor = anActors->GetNextActor(); } + myWindow->Repaint(); } //**************************************************************** @@ -306,11 +308,10 @@ void VisuGUI_SegmentationMgr::applyPlanes(VISU_Actor* theActor) { for (int i = 0; i < myListOfPlanes.size(); i++) { PlaneDef aPlane = myListOfPlanes.at(i); - if (aPlane.isAuto && (!isContainsPlane(theActor, aPlane.plane))) { + if (aPlane.isAuto && (!isContainsPlane(theActor, aPlane.plane))) { theActor->AddClippingPlane(aPlane.plane); } } - myWindow->Repaint(); } diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx index 0d5a6e2f..1983764e 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.cxx +++ b/src/VISUGUI/VisuGUI_SelectionPanel.cxx @@ -106,7 +106,7 @@ using namespace std; -#define MARGIN_SIZE 11 +#define MARGIN_SIZE 3 VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent ) : VisuGUI_BasePanel( tr("WINDOW_TITLE" ), theParent, /*ApplyBtn | */CloseBtn | HelpBtn ), @@ -114,8 +114,8 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul mySelectionMgr( 0 ) { QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() ); - TopLayout->setSpacing(6); - TopLayout->setMargin(MARGIN_SIZE); + //TopLayout->setSpacing(6); + //TopLayout->setMargin(MARGIN_SIZE); QWidget* aNamePane = new QWidget (mainFrame()); QGridLayout* aNameLay = new QGridLayout (aNamePane); @@ -142,7 +142,7 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane); QGridLayout* aGridLay = new QGridLayout (aDataGrp); - aGridLay->setSpacing(6); + //aGridLay->setSpacing(6); aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 ); aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aDataGrp), 1, 0 ); @@ -171,7 +171,7 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul QGroupBox* aCoordGrp = new QGroupBox ( tr("POINT_COORD_TITLE"), myPointsPane); aGridLay = new QGridLayout (aCoordGrp); - aGridLay->setSpacing(6); + //aGridLay->setSpacing(6); aGridLay->addWidget( new QLabel ("X:", aCoordGrp), 0, 0 ); myXValLbl = new QLabel ("", aCoordGrp); @@ -204,7 +204,7 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul // Create Cells pane myCellsPane = new QWidget (mainFrame()); QGridLayout* aCellLayout = new QGridLayout (myCellsPane); - aCellLayout->setSpacing(6); + //aCellLayout->setSpacing(6); aCellLayout->setRowStretch(0, 0); aCellLayout->setRowStretch(1, 1); @@ -261,11 +261,11 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul // Actor Pane myActorsPane = new QWidget (mainFrame()); aVBoxLayout = new QVBoxLayout(myActorsPane); - aVBoxLayout->setSpacing(6); + //aVBoxLayout->setSpacing(6); QGroupBox* aPosGrp = new QGroupBox (tr("ACTOR_DATA_POSITION_TITLE"), myActorsPane); aGridLay = new QGridLayout (aPosGrp); - aGridLay->setSpacing(6); + //aGridLay->setSpacing(6); aGridLay->addWidget( new QLabel ("X:", aPosGrp), 0, 0); myXPosLbl = new QLabel ("0", aPosGrp); aGridLay->addWidget( myXPosLbl, 0, 1); @@ -280,7 +280,7 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul QGroupBox* aSizeGrp = new QGroupBox ( tr("ACTOR_DATA_SIZE_TITLE"), myActorsPane); aGridLay = new QGridLayout (aSizeGrp); - aGridLay->setSpacing(6); + //aGridLay->setSpacing(6); aGridLay->addWidget( new QLabel ("dX:", aSizeGrp ), 0, 0); myDXLbl = new QLabel ("0", aSizeGrp); aGridLay->addWidget( myDXLbl, 0, 1); @@ -319,19 +319,19 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul QGridLayout* InfoWindowGroupLayout = new QGridLayout (myInfoWindowGroup); InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - InfoWindowGroupLayout->setSpacing(6); - InfoWindowGroupLayout->setMargin(11); + //InfoWindowGroupLayout->setSpacing(6); + //InfoWindowGroupLayout->setMargin(11); QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), myInfoWindowGroup ); myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, myInfoWindowGroup ); - myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + //myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 ); InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 ); QLabel* PositionLabel = new QLabel( tr( "POSITION" ), myInfoWindowGroup ); myPositionComboBox = new QComboBox( myInfoWindowGroup ); - myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + //myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myPositionComboBox->addItem( tr( "BELOW_POINT" ) ); myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) ); @@ -353,17 +353,17 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul QGridLayout* CameraGroupLayout = new QGridLayout (myCameraGroup); CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - CameraGroupLayout->setSpacing(6); - CameraGroupLayout->setMargin(11); + //CameraGroupLayout->setSpacing(6); + //CameraGroupLayout->setMargin(11); QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup ); myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup ); - myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + //myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup ); StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) ); myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup ); - myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + //myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 ); CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 ); -- 2.39.2