]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Fri, 6 Jun 2008 11:43:24 +0000 (11:43 +0000)
committervsv <vsv@opencascade.com>
Fri, 6 Jun 2008 11:43:24 +0000 (11:43 +0000)
src/OBJECT/VISU_DataSetActor.cxx
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h
src/OBJECT/VISU_GaussPtsDeviceActor.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.h
src/VISUGUI/VisuGUI_BasePanel.cxx
src/VISUGUI/VisuGUI_SegmentationMgr.cxx
src/VISUGUI/VisuGUI_SelectionPanel.cxx

index ca3891ac570052a762a9502df311e1ef3d2fbc40..dbdb25ec1ce8fb4e627013ffcdbb5b091286a7d4 100644 (file)
@@ -62,7 +62,8 @@ VISU_DataSetActor
 
   myExtractor->SetImplicitFunction(myFunction);
   myPolyDataExtractor->SetImplicitFunction(myFunction);
-  myExtractor->ExtractBoundaryCellsOn();
+  //myExtractor->ExtractBoundaryCellsOn();
+  //myPolyDataExtractor->ExtractBoundaryCellsOn();
 
   myFunction->SetOperationTypeToIntersection();
 
index d8e30ca3a38257a716b7fe6e84a5949ab292d774..810907627eb44d0d73cc0cafa95df8b860f6fc62 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "VISU_Event.h" 
 #include "SVTK_Actor.h"
+#include <SALOME_ExtractPolyDataGeometry.h>
 
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
@@ -46,6 +47,9 @@
 #include <vtkScalarBarWidget.h>
 #include <vtkTextMapper.h>
 #include <vtkTextProperty.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkPlane.h>
 
 #include <vtkPointData.h>
 #include <vtkDataArray.h>
@@ -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 = "<<this);
 
@@ -170,6 +176,13 @@ VISU_GaussPtsAct
 
   myMapper->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 = "<<this);
 
+  myDeviceActor->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<vtkPlane*>(aFun);
+  }
+  return aPlane;
+}
+
+vtkImplicitFunctionCollection* VISU_GaussPtsAct::GetClippingPlanes()
+{
+  return myFunction->GetFunction();
+}
+
+
+
 //==============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct1);
 
index b4105a2b8d88d5024fa544e60fdcfb09c9e3192b..c2192b2eee5f04eecbf2165e7e120b4fc1846389 100644 (file)
@@ -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<VISU_GaussPointsPL> myGaussPointsPL;
 
   vtkSmartPointer<vtkPolyDataMapper> myMapper;
+  vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
+  vtkSmartPointer<vtkImplicitBoolean> myFunction;
 
   vtkIdType myLastPreHighlightObjID;
 
index 925865164d03b8e32b069ae9408c7f4e786ba849..654243d65e98f7ce008c8e9d47b285ce8544e116 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "VTKViewer_Transform.h"
 #include "VTKViewer_TransformFilter.h"
+#include <SALOME_ExtractPolyDataGeometry.h>
 
 #include <vtkObjectFactory.h>
 #include <vtkPolyData.h>
@@ -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 - "<<this);
 
@@ -214,9 +216,14 @@ VISU_GaussDeviceActorBase
   myMapper = theMapper;
 
   int anId = 0;
-  myPassFilter[ anId ]->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() );
   
index 7ff5c369ea9e729b6e941d242b519ef9436161d4..5b25e78e15b8a3b4f12a5541834fad73ed389e9f 100644 (file)
@@ -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<vtkPassThroughFilter> PPassThroughFilter;
   std::vector<PPassThroughFilter> myPassFilter;
 
+  SALOME_ExtractPolyDataGeometry* myPolyDataExtractor;
+
   VISU_GaussDeviceActorBase();
   ~VISU_GaussDeviceActorBase();
 
index 4d131cf202fa937f5f9f33e19ffe55af92aef748..ed0dc30d1fb34abda35c6030d4d3ee0af79c3056 100755 (executable)
@@ -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 );
 }
 
index e90d25b6d4561db9ee4a3afc0583a4704ff7225e..a09262eb688c10f5196d2866342d30e788afbf1f 100644 (file)
@@ -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();
 }
 
 
index 0d5a6e2ff83c0b57d88ba6bcf4809b020a994cda..1983764eeb04679cc853d0669c9d7bdfb6119438 100644 (file)
 
 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 );