Back to index

salome-smesh  6.5.0
Public Types | Public Member Functions | Private Attributes
SMESH::TElementSimulation Class Reference
Collaboration diagram for SMESH::TElementSimulation:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< vtkIdType > TVTKIds
typedef std::vector< vtkIdType > TVTKIds

Public Member Functions

 TElementSimulation (SalomeApp_Application *theApplication)
void SetPosition (SMESH_Actor *theActor, vtkIdType theType, TVTKIds &theIds)
void SetVisibility (bool theVisibility, bool theShowOrientation=false)
 ~TElementSimulation ()
 TElementSimulation (SalomeApp_Application *theApplication)
void SetPosition (SMESH_Actor *theActor, SMDSAbs_EntityType theType, TVTKIds &theIds, const int theMode, const bool theReverse)
void SetVisibility (bool theVisibility, bool theShowOrientation=false)
 ~TElementSimulation ()

Private Attributes

SalomeApp_Application * myApplication
SUIT_ViewWindow * myViewWindow
SVTK_ViewWindow * myVTKViewWindow
SALOME_Actor * myPreviewActor
vtkDataSetMapper * myMapper
vtkUnstructuredGrid * myGrid
SALOME_Actor * myFaceOrientation
vtkPolyDataMapper * myFaceOrientationDataMapper
SMESH_FaceOrientationFiltermyFaceOrientationFilter

Detailed Description

Definition at line 88 of file SMESHGUI_AddMeshElementDlg.cxx.


Member Typedef Documentation

typedef std::vector<vtkIdType> SMESH::TElementSimulation::TVTKIds

Definition at line 158 of file SMESHGUI_AddMeshElementDlg.cxx.

typedef std::vector<vtkIdType> SMESH::TElementSimulation::TVTKIds

Definition at line 186 of file SMESHGUI_AddQuadraticElementDlg.cxx.


Constructor & Destructor Documentation

SMESH::TElementSimulation::TElementSimulation ( SalomeApp_Application *  theApplication) [inline]

Definition at line 103 of file SMESHGUI_AddMeshElementDlg.cxx.

    {
      myApplication = theApplication;
      SUIT_ViewManager* mgr = theApplication->activeViewManager();
      if (!mgr) return;
      myViewWindow = mgr->getActiveView();
      myVTKViewWindow = GetVtkViewWindow(myViewWindow);

      myGrid = vtkUnstructuredGrid::New();

      // Create and display actor
      myMapper = vtkDataSetMapper::New();
      myMapper->SetInput(myGrid);

      myPreviewActor = SALOME_Actor::New();
      myPreviewActor->PickableOff();
      myPreviewActor->VisibilityOff();
      myPreviewActor->SetMapper(myMapper);

      vtkFloatingPointType anRGB[3];
      vtkProperty* aProp = vtkProperty::New();
      GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
      aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
      myPreviewActor->SetProperty( aProp );
      aProp->Delete();

      vtkProperty* aBackProp = vtkProperty::New();
      GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
      aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
      myPreviewActor->SetBackfaceProperty( aBackProp );
      aBackProp->Delete();

      myVTKViewWindow->AddActor(myPreviewActor);

      // Orientation of faces
      myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
      myFaceOrientationFilter->SetInput(myGrid);

      myFaceOrientationDataMapper = vtkPolyDataMapper::New();
      myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());

      myFaceOrientation = SALOME_Actor::New();
      myFaceOrientation->PickableOff();
      myFaceOrientation->VisibilityOff();
      myFaceOrientation->SetMapper(myFaceOrientationDataMapper);

      vtkProperty* anOrientationProp = vtkProperty::New();
      GetColor( "SMESH", "orientation_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
      anOrientationProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
      myFaceOrientation->SetProperty( anOrientationProp );
      anOrientationProp->Delete();

      myVTKViewWindow->AddActor(myFaceOrientation);
    }

Here is the call graph for this function:

Definition at line 191 of file SMESHGUI_AddMeshElementDlg.cxx.

    {
      if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
        myVTKViewWindow->RemoveActor(myPreviewActor);
        myVTKViewWindow->RemoveActor(myFaceOrientation);
      }
      myPreviewActor->Delete();
      myFaceOrientation->Delete();

      myMapper->RemoveAllInputs();
      myMapper->Delete();

      myFaceOrientationFilter->Delete();

      myFaceOrientationDataMapper->RemoveAllInputs();
      myFaceOrientationDataMapper->Delete();

      myGrid->Delete();
    }

Here is the call graph for this function:

SMESH::TElementSimulation::TElementSimulation ( SalomeApp_Application *  theApplication) [inline]

Definition at line 131 of file SMESHGUI_AddQuadraticElementDlg.cxx.

    {
      myApplication = theApplication;
      SUIT_ViewManager* mgr = theApplication->activeViewManager();
      if (!mgr) return;
      myViewWindow = mgr->getActiveView();
      myVTKViewWindow = GetVtkViewWindow(myViewWindow);

      myGrid = vtkUnstructuredGrid::New();

      // Create and display actor
      myMapper = vtkDataSetMapper::New();
      myMapper->SetInput(myGrid);

      myPreviewActor = SALOME_Actor::New();
      myPreviewActor->PickableOff();
      myPreviewActor->VisibilityOff();
      myPreviewActor->SetMapper(myMapper);

      vtkProperty* myProp = vtkProperty::New();
      vtkFloatingPointType aRGB[3], aBackRGB[3];
      GetColor( "SMESH", "fill_color", aRGB[0], aRGB[1], aRGB[2], QColor( 0, 170, 255 ) );
      myProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
      myPreviewActor->SetProperty( myProp );
      myProp->Delete();

      vtkProperty* myBackProp = vtkProperty::New();
      GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) );
      myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] );
      myPreviewActor->SetBackfaceProperty( myBackProp );
      myBackProp->Delete();

      myVTKViewWindow->AddActor(myPreviewActor);

      // Orientation of faces
      myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
      myFaceOrientationFilter->SetInput(myGrid);

      myFaceOrientationDataMapper = vtkPolyDataMapper::New();
      myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());

      myFaceOrientation = SALOME_Actor::New();
      myFaceOrientation->PickableOff();
      myFaceOrientation->VisibilityOff();
      myFaceOrientation->SetMapper(myFaceOrientationDataMapper);

      vtkProperty* anOrientationProp = vtkProperty::New();
      GetColor( "SMESH", "orientation_color", aRGB[0], aRGB[1], aRGB[2], QColor( 255, 255, 255 ) );
      anOrientationProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
      myFaceOrientation->SetProperty( anOrientationProp );
      anOrientationProp->Delete();

      myVTKViewWindow->AddActor(myFaceOrientation);
    }

Here is the call graph for this function:

Definition at line 228 of file SMESHGUI_AddQuadraticElementDlg.cxx.

    {
      if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
        myVTKViewWindow->RemoveActor(myPreviewActor);
        myVTKViewWindow->RemoveActor(myFaceOrientation);
      }
      myPreviewActor->Delete();
      myFaceOrientation->Delete();

      myMapper->RemoveAllInputs();
      myMapper->Delete();

      myFaceOrientationFilter->Delete();

      myFaceOrientationDataMapper->RemoveAllInputs();
      myFaceOrientationDataMapper->Delete();

      myGrid->Delete();

//       myProp->Delete();
//       myBackProp->Delete();
    }

Here is the call graph for this function:


Member Function Documentation

void SMESH::TElementSimulation::SetPosition ( SMESH_Actor *  theActor,
vtkIdType  theType,
TVTKIds theIds 
) [inline]

Definition at line 159 of file SMESHGUI_AddMeshElementDlg.cxx.

    {
      vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
      myGrid->SetPoints(aGrid->GetPoints());
      myGrid->Reset();

      const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( theType ));
      SMDS_MeshCell::applyInterlace( interlace, theIds );

      vtkIdList *anIds = vtkIdList::New();
      for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
        anIds->InsertId(i,theIds[i]);

      myGrid->InsertNextCell(theType,anIds);
      anIds->Delete();

      myGrid->Modified();

      SetVisibility(true, theActor->GetFacesOriented());
    }

Here is the call graph for this function:

void SMESH::TElementSimulation::SetPosition ( SMESH_Actor *  theActor,
SMDSAbs_EntityType  theType,
TVTKIds theIds,
const int  theMode,
const bool  theReverse 
) [inline]

Definition at line 187 of file SMESHGUI_AddQuadraticElementDlg.cxx.

    {
      vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
      myGrid->SetPoints(aGrid->GetPoints());

      //add points

      ReverseConnectivity( theIds, theType, theReverse, /*toVtkOrder=*/true);

      myGrid->Reset();
      vtkIdList *anIds = vtkIdList::New();

      for (int i = 0, iEnd = theIds.size(); i < iEnd; i++) {
        anIds->InsertId(i,theIds[i]);
        //std::cout << i<< ": " << theIds[i] << std::endl;
      }

      vtkIdType aType = SMDS_MeshCell::toVtkType(theType);
      myGrid->InsertNextCell(aType,anIds);
      anIds->Delete();

      myGrid->Modified();

      myPreviewActor->GetMapper()->Update();
      myPreviewActor->SetRepresentation( theMode );
      SetVisibility(true, theActor->GetFacesOriented());
    }

Here is the call graph for this function:

void SMESH::TElementSimulation::SetVisibility ( bool  theVisibility,
bool  theShowOrientation = false 
) [inline]

Definition at line 183 of file SMESHGUI_AddMeshElementDlg.cxx.

    {
      myPreviewActor->SetVisibility(theVisibility);
      myFaceOrientation->SetVisibility(theShowOrientation);
      RepaintCurrentView();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void SMESH::TElementSimulation::SetVisibility ( bool  theVisibility,
bool  theShowOrientation = false 
) [inline]

Definition at line 220 of file SMESHGUI_AddQuadraticElementDlg.cxx.

    {
      myPreviewActor->SetVisibility(theVisibility);
      myFaceOrientation->SetVisibility(theShowOrientation);
      RepaintCurrentView();
    }

Here is the call graph for this function:


Member Data Documentation

SalomeApp_Application * SMESH::TElementSimulation::myApplication [private]

Definition at line 90 of file SMESHGUI_AddMeshElementDlg.cxx.

Definition at line 98 of file SMESHGUI_AddMeshElementDlg.cxx.

Definition at line 99 of file SMESHGUI_AddMeshElementDlg.cxx.

Definition at line 100 of file SMESHGUI_AddMeshElementDlg.cxx.

vtkUnstructuredGrid * SMESH::TElementSimulation::myGrid [private]

Definition at line 96 of file SMESHGUI_AddMeshElementDlg.cxx.

vtkDataSetMapper * SMESH::TElementSimulation::myMapper [private]

Definition at line 95 of file SMESHGUI_AddMeshElementDlg.cxx.

Definition at line 94 of file SMESHGUI_AddMeshElementDlg.cxx.

SUIT_ViewWindow * SMESH::TElementSimulation::myViewWindow [private]

Definition at line 91 of file SMESHGUI_AddMeshElementDlg.cxx.

SVTK_ViewWindow * SMESH::TElementSimulation::myVTKViewWindow [private]

Definition at line 92 of file SMESHGUI_AddMeshElementDlg.cxx.


The documentation for this class was generated from the following files: