mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
Orientation of faces is added for new elements' preview (remark for issue 0017291: EDF 591 SMESH : Visualization of the orientation of the normal vector of the mesh faces)
This commit is contained in:
parent
6bf039b662
commit
7b09f5b72c
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_ActorUtils.h>
|
#include <SMESH_ActorUtils.h>
|
||||||
|
#include <SMESH_FaceOrientationFilter.h>
|
||||||
#include <SMDS_Mesh.hxx>
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
// SALOME GUI inclues
|
// SALOME GUI inclues
|
||||||
@ -59,6 +60,7 @@
|
|||||||
#include <vtkIdList.h>
|
#include <vtkIdList.h>
|
||||||
#include <vtkUnstructuredGrid.h>
|
#include <vtkUnstructuredGrid.h>
|
||||||
#include <vtkDataSetMapper.h>
|
#include <vtkDataSetMapper.h>
|
||||||
|
#include <vtkPolyDataMapper.h>
|
||||||
#include <vtkProperty.h>
|
#include <vtkProperty.h>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
@ -90,6 +92,10 @@ namespace SMESH
|
|||||||
vtkDataSetMapper* myMapper;
|
vtkDataSetMapper* myMapper;
|
||||||
vtkUnstructuredGrid* myGrid;
|
vtkUnstructuredGrid* myGrid;
|
||||||
|
|
||||||
|
SALOME_Actor* myFaceOrientation;
|
||||||
|
vtkPolyDataMapper* myFaceOrientationDataMapper;
|
||||||
|
SMESH_FaceOrientationFilter* myFaceOrientationFilter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TElementSimulation (SalomeApp_Application* theApplication)
|
TElementSimulation (SalomeApp_Application* theApplication)
|
||||||
{
|
{
|
||||||
@ -124,6 +130,26 @@ namespace SMESH
|
|||||||
aBackProp->Delete();
|
aBackProp->Delete();
|
||||||
|
|
||||||
myVTKViewWindow->AddActor(myPreviewActor);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::vector<vtkIdType> TVTKIds;
|
typedef std::vector<vtkIdType> TVTKIds;
|
||||||
@ -171,13 +197,14 @@ namespace SMESH
|
|||||||
|
|
||||||
myGrid->Modified();
|
myGrid->Modified();
|
||||||
|
|
||||||
SetVisibility(true);
|
SetVisibility(true, theActor->GetFacesOriented());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetVisibility (bool theVisibility)
|
void SetVisibility (bool theVisibility, bool theShowOrientation = false)
|
||||||
{
|
{
|
||||||
myPreviewActor->SetVisibility(theVisibility);
|
myPreviewActor->SetVisibility(theVisibility);
|
||||||
|
myFaceOrientation->SetVisibility(theShowOrientation);
|
||||||
RepaintCurrentView();
|
RepaintCurrentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,12 +213,19 @@ namespace SMESH
|
|||||||
{
|
{
|
||||||
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
||||||
myVTKViewWindow->RemoveActor(myPreviewActor);
|
myVTKViewWindow->RemoveActor(myPreviewActor);
|
||||||
|
myVTKViewWindow->RemoveActor(myFaceOrientation);
|
||||||
}
|
}
|
||||||
myPreviewActor->Delete();
|
myPreviewActor->Delete();
|
||||||
|
myFaceOrientation->Delete();
|
||||||
|
|
||||||
myMapper->RemoveAllInputs();
|
myMapper->RemoveAllInputs();
|
||||||
myMapper->Delete();
|
myMapper->Delete();
|
||||||
|
|
||||||
|
myFaceOrientationFilter->Delete();
|
||||||
|
|
||||||
|
myFaceOrientationDataMapper->RemoveAllInputs();
|
||||||
|
myFaceOrientationDataMapper->Delete();
|
||||||
|
|
||||||
myGrid->Delete();
|
myGrid->Delete();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <SMESH_Actor.h>
|
#include <SMESH_Actor.h>
|
||||||
#include <SMESH_ActorUtils.h>
|
#include <SMESH_ActorUtils.h>
|
||||||
|
#include <SMESH_FaceOrientationFilter.h>
|
||||||
#include <SMDS_Mesh.hxx>
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
@ -63,6 +64,7 @@
|
|||||||
#include <vtkIdList.h>
|
#include <vtkIdList.h>
|
||||||
#include <vtkUnstructuredGrid.h>
|
#include <vtkUnstructuredGrid.h>
|
||||||
#include <vtkDataSetMapper.h>
|
#include <vtkDataSetMapper.h>
|
||||||
|
#include <vtkPolyDataMapper.h>
|
||||||
#include <vtkProperty.h>
|
#include <vtkProperty.h>
|
||||||
#include <vtkCellType.h>
|
#include <vtkCellType.h>
|
||||||
|
|
||||||
@ -155,6 +157,10 @@ namespace SMESH
|
|||||||
|
|
||||||
vtkFloatingPointType myRGB[3], myBackRGB[3];
|
vtkFloatingPointType myRGB[3], myBackRGB[3];
|
||||||
|
|
||||||
|
SALOME_Actor* myFaceOrientation;
|
||||||
|
vtkPolyDataMapper* myFaceOrientationDataMapper;
|
||||||
|
SMESH_FaceOrientationFilter* myFaceOrientationFilter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TElementSimulation (SalomeApp_Application* theApplication)
|
TElementSimulation (SalomeApp_Application* theApplication)
|
||||||
{
|
{
|
||||||
@ -188,6 +194,26 @@ namespace SMESH
|
|||||||
myBackProp->Delete();
|
myBackProp->Delete();
|
||||||
|
|
||||||
myVTKViewWindow->AddActor(myPreviewActor);
|
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", myRGB[0], myRGB[1], myRGB[2], QColor( 255, 255, 255 ) );
|
||||||
|
anOrientationProp->SetColor( myRGB[0], myRGB[1], myRGB[2] );
|
||||||
|
myFaceOrientation->SetProperty( anOrientationProp );
|
||||||
|
anOrientationProp->Delete();
|
||||||
|
|
||||||
|
myVTKViewWindow->AddActor(myFaceOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::vector<vtkIdType> TVTKIds;
|
typedef std::vector<vtkIdType> TVTKIds;
|
||||||
@ -262,7 +288,7 @@ namespace SMESH
|
|||||||
|
|
||||||
myPreviewActor->GetMapper()->Update();
|
myPreviewActor->GetMapper()->Update();
|
||||||
myPreviewActor->SetRepresentation( theMode );
|
myPreviewActor->SetRepresentation( theMode );
|
||||||
SetVisibility(true);
|
SetVisibility(true, theActor->GetFacesOriented());
|
||||||
|
|
||||||
// restore normal orientation
|
// restore normal orientation
|
||||||
if ( aType == VTK_CONVEX_POINT_SET ) {
|
if ( aType == VTK_CONVEX_POINT_SET ) {
|
||||||
@ -273,9 +299,10 @@ namespace SMESH
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetVisibility (bool theVisibility)
|
void SetVisibility (bool theVisibility, bool theShowOrientation = false)
|
||||||
{
|
{
|
||||||
myPreviewActor->SetVisibility(theVisibility);
|
myPreviewActor->SetVisibility(theVisibility);
|
||||||
|
myFaceOrientation->SetVisibility(theShowOrientation);
|
||||||
RepaintCurrentView();
|
RepaintCurrentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,12 +311,19 @@ namespace SMESH
|
|||||||
{
|
{
|
||||||
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
|
||||||
myVTKViewWindow->RemoveActor(myPreviewActor);
|
myVTKViewWindow->RemoveActor(myPreviewActor);
|
||||||
|
myVTKViewWindow->RemoveActor(myFaceOrientation);
|
||||||
}
|
}
|
||||||
myPreviewActor->Delete();
|
myPreviewActor->Delete();
|
||||||
|
myFaceOrientation->Delete();
|
||||||
|
|
||||||
myMapper->RemoveAllInputs();
|
myMapper->RemoveAllInputs();
|
||||||
myMapper->Delete();
|
myMapper->Delete();
|
||||||
|
|
||||||
|
myFaceOrientationFilter->Delete();
|
||||||
|
|
||||||
|
myFaceOrientationDataMapper->RemoveAllInputs();
|
||||||
|
myFaceOrientationDataMapper->Delete();
|
||||||
|
|
||||||
myGrid->Delete();
|
myGrid->Delete();
|
||||||
|
|
||||||
// myProp->Delete();
|
// myProp->Delete();
|
||||||
|
Loading…
Reference in New Issue
Block a user