#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
+#include <SMESH_FaceOrientationFilter.h>
#include <SMDS_Mesh.hxx>
// SALOME GUI includes
#include <vtkIdList.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkCellType.h>
vtkUnstructuredGrid* myGrid;
//vtkProperty* myBackProp, *myProp;
- vtkFloatingPointType myRGB[3], myBackRGB[3];
+ //vtkFloatingPointType myRGB[3], myBackRGB[3];
+
+ SALOME_Actor* myFaceOrientation;
+ vtkPolyDataMapper* myFaceOrientationDataMapper;
+ SMESH_FaceOrientationFilter* myFaceOrientationFilter;
public:
TElementSimulation (SalomeApp_Application* theApplication)
myPreviewActor->SetMapper(myMapper);
vtkProperty* myProp = vtkProperty::New();
- GetColor( "SMESH", "fill_color", myRGB[0], myRGB[1], myRGB[2], QColor( 0, 170, 255 ) );
- myProp->SetColor( myRGB[0], myRGB[1], myRGB[2] );
+ 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", myBackRGB[0], myBackRGB[1], myBackRGB[2], QColor( 0, 0, 255 ) );
- myBackProp->SetColor( myBackRGB[0], myBackRGB[1], myBackRGB[2] );
+ 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);
}
typedef std::vector<vtkIdType> TVTKIds;
aType = VTK_CONVEX_POINT_SET;
break;
case QUAD_PENTAHEDRON:
- //aType = VTK_QUADRATIC_WEDGE; // NOT SUPPORTED IN VTK4.2
- aType = VTK_CONVEX_POINT_SET;
+ aType = VTK_QUADRATIC_WEDGE;
+ //aType = VTK_CONVEX_POINT_SET;
break;
case QUAD_HEXAHEDRON:
aType = VTK_QUADRATIC_HEXAHEDRON;
}
else {
// VTK cell connectivity opposites the MED one for volumic elements
- if ( theIds.size() > 8 ? !theReverse : theReverse ) {
- ReverseConnectivity( theIds, theType );
+ if( aType != VTK_QUADRATIC_WEDGE) {
+ if ( theIds.size() > 8 ? !theReverse : theReverse ) {
+ ReverseConnectivity( theIds, theType );
+ }
}
+ else if(theReverse)
+ ReverseConnectivity( theIds, theType );
}
myGrid->Reset();
myPreviewActor->GetMapper()->Update();
myPreviewActor->SetRepresentation( theMode );
- SetVisibility(true);
+ SetVisibility(true, theActor->GetFacesOriented());
// restore normal orientation
if ( aType == VTK_CONVEX_POINT_SET ) {
}
- void SetVisibility (bool theVisibility)
+ void SetVisibility (bool theVisibility, bool theShowOrientation = false)
{
myPreviewActor->SetVisibility(theVisibility);
+ myFaceOrientation->SetVisibility(theShowOrientation);
RepaintCurrentView();
}
{
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();