Back to index

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

List of all members.

Public Member Functions

 TIdPreview (SVTK_ViewWindow *theViewWindow)
void SetPointsData (SMDS_Mesh *theMesh, TColStd_MapOfInteger &theNodesIdMap)
void SetElemsData (TColStd_MapOfInteger &theElemsIdMap, std::list< gp_XYZ > &aGrCentersXYZ)
void AddToRender (vtkRenderer *theRenderer)
void RemoveFromRender (vtkRenderer *theRenderer)
void SetPointsLabeled (bool theIsPointsLabeled, bool theIsActorVisible=true)
 ~TIdPreview ()

Private Attributes

SVTK_ViewWindow * myViewWindow
vtkUnstructuredGrid * myIdGrid
SALOME_Actor * myIdActor
vtkUnstructuredGrid * myPointsNumDataSet
vtkMaskPoints * myPtsMaskPoints
vtkSelectVisiblePoints * myPtsSelectVisiblePoints
vtkLabeledDataMapper * myPtsLabeledDataMapper
vtkTextProperty * aPtsTextProp
bool myIsPointsLabeled
vtkActor2D * myPointLabels
std::vector< int > myIDs

Detailed Description

Definition at line 102 of file SMESHGUI_MergeDlg.cxx.


Constructor & Destructor Documentation

SMESH::TIdPreview::TIdPreview ( SVTK_ViewWindow *  theViewWindow) [inline]

Definition at line 120 of file SMESHGUI_MergeDlg.cxx.

                                              :
      myViewWindow(theViewWindow)
    {
      myIdGrid = vtkUnstructuredGrid::New();

      // Create and display actor
      vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
      aMapper->SetInput( myIdGrid );

      myIdActor = SALOME_Actor::New();
      myIdActor->SetInfinitive(true);
      myIdActor->VisibilityOff();
      myIdActor->PickableOff();

      myIdActor->SetMapper( aMapper );
      aMapper->Delete();

      myViewWindow->AddActor(myIdActor);

      //Definition of points numbering pipeline
      myPointsNumDataSet = vtkUnstructuredGrid::New();

      myPtsMaskPoints = vtkMaskPoints::New();
      myPtsMaskPoints->SetInput(myPointsNumDataSet);
      myPtsMaskPoints->SetOnRatio(1);

      myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
      myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
      myPtsSelectVisiblePoints->SelectInvisibleOff();
      myPtsSelectVisiblePoints->SetTolerance(0.1);
    
      myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
      myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
#if (VTK_XVERSION < 0x050200)
      myPtsLabeledDataMapper->SetLabelFormat("%g");
#endif
      myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
    
      vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
      aPtsTextProp->SetFontFamilyToTimes();
      static int aPointsFontSize = 12;
      aPtsTextProp->SetFontSize(aPointsFontSize);
      aPtsTextProp->SetBold(1);
      aPtsTextProp->SetItalic(0);
      aPtsTextProp->SetShadow(0);
      myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
      aPtsTextProp->Delete();
  
      myIsPointsLabeled = false;

      myPointLabels = vtkActor2D::New();
      myPointLabels->SetMapper(myPtsLabeledDataMapper);
      myPointLabels->GetProperty()->SetColor(1,1,1);
      myPointLabels->SetVisibility(myIsPointsLabeled);

      AddToRender(myViewWindow->getRenderer());
    }

Here is the call graph for this function:

Definition at line 261 of file SMESHGUI_MergeDlg.cxx.

    {
      RemoveFromRender(myViewWindow->getRenderer());

      myIdGrid->Delete();

      myViewWindow->RemoveActor(myIdActor);
      myIdActor->Delete();

      //Deleting of points numbering pipeline
      //---------------------------------------
      myPointsNumDataSet->Delete();
      
      //myPtsLabeledDataMapper->RemoveAllInputs();        //vtk 5.0 porting
      myPtsLabeledDataMapper->Delete();

      //myPtsSelectVisiblePoints->UnRegisterAllOutputs(); //vtk 5.0 porting
      myPtsSelectVisiblePoints->Delete();

      //myPtsMaskPoints->UnRegisterAllOutputs();          //vtk 5.0 porting
      myPtsMaskPoints->Delete();

      myPointLabels->Delete();

//       myTimeStamp->Delete();
    }

Here is the call graph for this function:


Member Function Documentation

void SMESH::TIdPreview::AddToRender ( vtkRenderer *  theRenderer) [inline]

Definition at line 223 of file SMESHGUI_MergeDlg.cxx.

    {
      myIdActor->AddToRender(theRenderer);

      myPtsSelectVisiblePoints->SetRenderer(theRenderer);
      theRenderer->AddActor2D(myPointLabels);
    }

Here is the caller graph for this function:

void SMESH::TIdPreview::RemoveFromRender ( vtkRenderer *  theRenderer) [inline]

Definition at line 231 of file SMESHGUI_MergeDlg.cxx.

    {
      myIdActor->RemoveFromRender(theRenderer);

      myPtsSelectVisiblePoints->SetRenderer(theRenderer);
      theRenderer->RemoveActor(myPointLabels);
    }

Here is the caller graph for this function:

void SMESH::TIdPreview::SetElemsData ( TColStd_MapOfInteger &  theElemsIdMap,
std::list< gp_XYZ > &  aGrCentersXYZ 
) [inline]

Definition at line 199 of file SMESHGUI_MergeDlg.cxx.

    {
      vtkPoints* aPoints = vtkPoints::New();
      aPoints->SetNumberOfPoints(theElemsIdMap.Extent());
      myIDs.clear();
      
      TColStd_MapIteratorOfMapOfInteger idIter( theElemsIdMap );
      for( ; idIter.More(); idIter.Next() ) {
        myIDs.push_back(idIter.Key());
      }

      gp_XYZ aXYZ;
      std::list<gp_XYZ>::iterator coordIt = aGrCentersXYZ.begin();
      for( int i = 0; coordIt != aGrCentersXYZ.end(); coordIt++, i++ ) {
        aXYZ = *coordIt;
        aPoints->SetPoint( i, aXYZ.X(), aXYZ.Y(), aXYZ.Z() );
      }
      myIdGrid->SetPoints(aPoints);
      aPoints->Delete();
      
      myIdActor->GetMapper()->Update();
    }
void SMESH::TIdPreview::SetPointsData ( SMDS_Mesh *  theMesh,
TColStd_MapOfInteger &  theNodesIdMap 
) [inline]

Definition at line 178 of file SMESHGUI_MergeDlg.cxx.

    {
      vtkPoints* aPoints = vtkPoints::New();
      aPoints->SetNumberOfPoints(theNodesIdMap.Extent());
      myIDs.clear();
      
      TColStd_MapIteratorOfMapOfInteger idIter( theNodesIdMap );
      for( int i = 0; idIter.More(); idIter.Next(), i++ ) {
        const SMDS_MeshNode* aNode = theMesh->FindNode(idIter.Key());
        aPoints->SetPoint( i, aNode->X(), aNode->Y(), aNode->Z() );
        myIDs.push_back(idIter.Key());
      }

      myIdGrid->SetPoints(aPoints);

      aPoints->Delete();

      myIdActor->GetMapper()->Update();
    }
void SMESH::TIdPreview::SetPointsLabeled ( bool  theIsPointsLabeled,
bool  theIsActorVisible = true 
) [inline]

Definition at line 239 of file SMESHGUI_MergeDlg.cxx.

    {
      myIsPointsLabeled = theIsPointsLabeled && myIdGrid->GetNumberOfPoints();
      
      if ( myIsPointsLabeled ) {
        myPointsNumDataSet->ShallowCopy(myIdGrid);
        vtkDataSet *aDataSet = myPointsNumDataSet;
        int aNbElem = myIDs.size();
        vtkIntArray *anArray = vtkIntArray::New();
        anArray->SetNumberOfValues( aNbElem );
        for ( int i = 0; i < aNbElem; i++ )
          anArray->SetValue( i, myIDs[i] );
        aDataSet->GetPointData()->SetScalars( anArray );
        anArray->Delete();
        myPtsMaskPoints->SetInput( aDataSet );
        myPointLabels->SetVisibility( theIsActorVisible );
      }
      else {
        myPointLabels->SetVisibility( false );
      }
    }

Member Data Documentation

vtkTextProperty* SMESH::TIdPreview::aPtsTextProp [private]

Definition at line 113 of file SMESHGUI_MergeDlg.cxx.

SALOME_Actor* SMESH::TIdPreview::myIdActor [private]

Definition at line 107 of file SMESHGUI_MergeDlg.cxx.

vtkUnstructuredGrid* SMESH::TIdPreview::myIdGrid [private]

Definition at line 106 of file SMESHGUI_MergeDlg.cxx.

std::vector<int> SMESH::TIdPreview::myIDs [private]

Definition at line 117 of file SMESHGUI_MergeDlg.cxx.

Definition at line 114 of file SMESHGUI_MergeDlg.cxx.

vtkActor2D* SMESH::TIdPreview::myPointLabels [private]

Definition at line 115 of file SMESHGUI_MergeDlg.cxx.

vtkUnstructuredGrid* SMESH::TIdPreview::myPointsNumDataSet [private]

Definition at line 109 of file SMESHGUI_MergeDlg.cxx.

vtkLabeledDataMapper* SMESH::TIdPreview::myPtsLabeledDataMapper [private]

Definition at line 112 of file SMESHGUI_MergeDlg.cxx.

vtkMaskPoints* SMESH::TIdPreview::myPtsMaskPoints [private]

Definition at line 110 of file SMESHGUI_MergeDlg.cxx.

vtkSelectVisiblePoints* SMESH::TIdPreview::myPtsSelectVisiblePoints [private]

Definition at line 111 of file SMESHGUI_MergeDlg.cxx.

SVTK_ViewWindow* SMESH::TIdPreview::myViewWindow [private]

Definition at line 104 of file SMESHGUI_MergeDlg.cxx.


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