#include "VISU_ElnoGeometryFilter.hxx"
#include "VISU_OpenGLElnoMapper.hxx"
+#include <vtkCutter.h>
+#include <vtkPlane.h>
+
+#include <vtkScalarBarActor.h>
+#include <vtkScalarBarWidget.h>
+
+
// VTK includes
#include <vtkMaskPoints.h>
#include <vtkUnstructuredGridReader.h>
anEntity,
theFieldName,
aTimeStamp);
+
+ vtkUnstructuredGrid* anUnstructuredGrid = anUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+ VISU::WriteToFile( anUnstructuredGrid, "/data/apo/elno_from_id_mapper.vtk" );
- VISU_ElnoWarpVector* anElnoWarpVector = VISU_ElnoWarpVector::New();
- anElnoWarpVector->SetInput( anUnstructuredGridIDMapper->GetUnstructuredGridOutput() );
+ vtkCutter *aCutter = vtkCutter::New();
+ aCutter->SetInput( anUnstructuredGrid );
+
+ vtkPlane *aPlane = vtkPlane::New();
+ //aPlane->SetOrigin( 100.0, 100.0, 100.0 );
+ //aPlane->SetNormal( 0.0, -1.0, 0.0 );
+ aPlane->SetOrigin( 15.0, 5.0, 5.0 );
+ aPlane->SetNormal( 0.0, 0.0, -1.0 );
+
+ aCutter->SetCutFunction( aPlane );
+ aPlane->Delete();
+ VISU::WriteToFile( aCutter->GetOutput(), "/data/apo/elno_from_cutter.vtk" );
+
+ //VISU_ElnoWarpVector* anElnoWarpVector = VISU_ElnoWarpVector::New();
+ //anElnoWarpVector->SetInput( anUnstructuredGridIDMapper->GetUnstructuredGridOutput() );
VISU_ElnoGeometryFilter *aGeometryFilter = VISU_ElnoGeometryFilter::New();
aGeometryFilter->SetScalarMode(aComponentNumber);
- aGeometryFilter->SetInput( anElnoWarpVector->GetOutput() );
+ aGeometryFilter->SetInput( anUnstructuredGrid );
+ //aGeometryFilter->SetInput( anElnoWarpVector->GetOutput() );
+ //aGeometryFilter->SetInput( aCutter->GetOutput() );
+ VISU::WriteToFile( aCutter->GetOutput(), "/data/apo/elno_from_geometry.vtk" );
// To calculate and apply default scale factor
- {
- vtkFloatingPointType aScale = VISU_DeformedShapePL::GetScaleFactor( anElnoWarpVector->GetOutput() );
- vtkFloatingPointType* aRange = aGeometryFilter->GetRange();
- aScale /= aRange[1];
- anElnoWarpVector->SetScaleFactor( aScale );
- }
+ //{
+ // vtkFloatingPointType aScale = VISU_DeformedShapePL::GetScaleFactor( anElnoWarpVector->GetOutput() );
+ // vtkFloatingPointType* aRange = aGeometryFilter->GetRange();
+ // aScale /= aRange[1];
+ // anElnoWarpVector->SetScaleFactor( aScale );
+ //}
VISU_OpenGLElnoMapper* aMapper = VISU_OpenGLElnoMapper::New();
aMapper->SetInput( aGeometryFilter->GetOutput() );
aMapper->SetUseLookupTableScalarRange( true );
aMapper->SetColorModeToMapScalars();
aMapper->ScalarVisibilityOn();
-
anActor->SetMapper( aMapper );
- VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
+ vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
+ vtkCellData* aCellData = aPolyData->GetCellData();
+ vtkDataArray* aScalars = aCellData->GetScalars();
+ vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New();
aScalarBar->SetLookupTable( aMapperTable );
+ aScalarBar->SetTitle( aScalars->GetName() );
+
+ vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New();
+ aWidget->SetScalarBarActor( aScalarBar );
+ aWidget->SetInteractor( anInteractor );
+ aWidget->SetEnabled( true );
aRenderer->AddActor(anActor);
aRenderer->AddActor2D(aScalarBar);