typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
vtkIdType aNbComp = theField->myNbComp;
- switch(aNbComp) {
- case 1:
- aSelectedDataArray->SetNumberOfComponents(1);
- aDataSetAttributes->SetScalars(aSelectedDataArray);
- break;
- default:
- aSelectedDataArray->SetNumberOfComponents(3);
- aDataSetAttributes->SetVectors(aSelectedDataArray);
- }
- aSelectedDataArray->SetNumberOfTuples(aNbTuples);
- aSelectedDataArray->SetName(aFieldName.c_str());
+ aSelectedDataArray->SetNumberOfComponents( 3 );
+ aSelectedDataArray->SetNumberOfTuples( aNbTuples );
+ aSelectedDataArray->SetName( aFieldName.c_str() );
+ aDataSetAttributes->SetVectors( aSelectedDataArray );
TVTKDataArray *aFullDataArray = TVTKDataArray::New();
aFullDataArray->SetNumberOfComponents( aNbComp );
#include "VISU_ElnoAssembleFilter.hxx"
#include "VISU_ElnoExtractScalars.hxx"
+typedef VISU_ScalarMapPL TPresent;
+
#include <vtkShrinkFilter.h>
#include <vtkPointLocator.h>
#include <vtkScalarBarActor.h>
#include <vtkScalarBarWidget.h>
-
// VTK includes
#include <vtkMaskPoints.h>
#include <vtkUnstructuredGridReader.h>
}
//VISU_OpenGLElnoMapper* aMapper = VISU_OpenGLElnoMapper::New();
- vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
- aMapper->SetScalarModeToUsePointData();
+ //vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+ //aMapper->SetScalarModeToUsePointData();
//aMapper->SetInput( aGeometryFilter->GetOutput() );
//aMapper->SetInput( aCutter->GetOutput() );
//aMapper->SetInput( anAssembleFilter->GetOutput() );
- aMapper->SetInput( anElnoWarpVector->GetOutput() );
+ //aMapper->SetInput( anElnoWarpVector->GetOutput() );
- VISU_LookupTable* aMapperTable( VISU_LookupTable::New() );
- aMapperTable->SetHueRange( 0.667, 0.0 );
- aMapperTable->SetRange( aScalarRange );
- aMapperTable->Build();
+ //VISU_LookupTable* aMapperTable( VISU_LookupTable::New() );
+ //aMapperTable->SetHueRange( 0.667, 0.0 );
+ //aMapperTable->SetRange( aScalarRange );
+ //aMapperTable->Build();
- aMapper->SetLookupTable( aMapperTable );
- aMapper->SetUseLookupTableScalarRange( true );
- aMapper->SetColorModeToMapScalars();
- aMapper->ScalarVisibilityOn();
+ //aMapper->SetLookupTable( aPresent->GetBarTable() );
+ //aMapper->SetUseLookupTableScalarRange( true );
+ //aMapper->SetColorModeToMapScalars();
+ //aMapper->ScalarVisibilityOn();
- anActor->SetMapper( aMapper );
+ //anActor->SetMapper( aMapper );
+ TPresent* aPresent = TPresent::New();
+ aPresent->SetUnstructuredGridIDMapper( anUnstructuredGridIDMapper );
+ aPresent->Update();
+
+ anActor->SetMapper( aPresent->GetMapper() );
+
vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New();
- aScalarBar->SetLookupTable( aMapperTable );
+ //aScalarBar->SetLookupTable( aMapperTable );
+ aScalarBar->SetLookupTable( aPresent->GetBarTable() );
vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
vtkCellData* aCellData = aPolyData->GetCellData();
#include "VISU_DataSetMapperHolder.hxx"
#include "SALOME_ExtractGeometry.h"
+#include "VISU_ElnoDisassembleFilter.hxx"
#include "VISU_LookupTable.hxx"
#include "VISU_PipeLineUtils.hxx"
//----------------------------------------------------------------------------
VISU_DataSetMapperHolder
::VISU_DataSetMapperHolder():
- myExtractGeometry(SALOME_ExtractGeometry::New())
+ myElnoDisassembleFilter( VISU_ElnoDisassembleFilter::New() ),
+ myExtractGeometry( SALOME_ExtractGeometry::New() )
{
if(MYDEBUG) MESSAGE("VISU_DataSetMapperHolder::VISU_DataSetMapperHolder - "<<this);
+ myElnoDisassembleFilter->Delete();
+
// Clipping functionality
myExtractGeometry->Delete();
myExtractGeometry->SetStoreMapping(true);
VISU_DataSetMapperHolder
::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
{
- myExtractGeometry->SetInput(theIDMapper->GetUnstructuredGridOutput());
+ myElnoDisassembleFilter->SetInput( theIDMapper->GetUnstructuredGridOutput() );
+ myExtractGeometry->SetInput( myElnoDisassembleFilter->GetOutput() );
myUnstructuredGridIDMapper = theIDMapper;
- SetIDMapper(theIDMapper);
+ SetIDMapper( theIDMapper );
}
class vtkDataSetMapper;
class vtkUnstructuredGrid;
class SALOME_ExtractGeometry;
+class VISU_ElnoDisassembleFilter;
//----------------------------------------------------------------------------
private:
//----------------------------------------------------------------------------
VISU::PUnstructuredGridIDMapper myUnstructuredGridIDMapper;
- vtkSmartPointer<vtkDataSetMapper> myDataSetMapper;
- vtkSmartPointer<SALOME_ExtractGeometry> myExtractGeometry; //!< Clipping
+ vtkSmartPointer< VISU_ElnoDisassembleFilter > myElnoDisassembleFilter; //!< Handling ELNO data
+ vtkSmartPointer< SALOME_ExtractGeometry > myExtractGeometry; //!< Clipping
+ vtkSmartPointer< vtkDataSetMapper > myDataSetMapper;
};
#endif
vtkDataArray *anElnoPointCoords = this->GetInputArrayToProcess( 0, inputVector );
+ if ( !anElnoPointCoords ) {
+ anOutput->ShallowCopy( anInput );
+ return 1;
+ }
+
vtkPoints *aPoints = anInput->GetPoints();
switch( aPoints->GetDataType() ){
case VTK_DOUBLE:
vtkPointData *anOutputPointData = theOutput->GetPointData();
anOutputPointData->Allocate( aNbPoints );
+ vtkCellData *anInputCellData = theInput->GetCellData();
+ vtkDataArray* aVectors = anInputCellData->GetVectors();
+
typedef typename VISU::TL::TEnum2VTKArrayType< elno_type >::TResult TElnoDataArray;
TElnoDataArray* anElnoPointDataArray = TElnoDataArray::New();
anElnoPointDataArray->SetNumberOfComponents( aGetElnoNodeData.getNbComp() );
anElnoPointDataArray->SetNumberOfTuples( aNbPoints );
- anElnoPointDataArray->SetName( "ELNO_POINT_DATA" );
+ anElnoPointDataArray->SetName( "VISU_FIELD" );
TElnoDataArray* anElnoPointVectors = TElnoDataArray::New();
anElnoPointVectors->SetNumberOfComponents( 3 );
anElnoPointVectors->SetNumberOfTuples( aNbPoints );
- anElnoPointVectors->SetName( "ELNO_POINT_VECTORS" );
+ anElnoPointVectors->SetName( aVectors->GetName() );
TPointsDataArray* anElnoPointCoords = TPointsDataArray::New();
anElnoPointCoords->SetNumberOfComponents( 3 );
theInput->GetCellLocationsArray(),
aConnectivity );
- vtkCellData *aCellData = theOutput->GetCellData();
- aCellData->PassData( theInput->GetCellData() );
+ vtkCellData *anOutputCellData = theOutput->GetCellData();
+ anOutputCellData->PassData( anInputCellData );
+
+ anOutputCellData->RemoveArray( "ELNO_COMPONENT_MAPPER" );
+ anOutputCellData->RemoveArray( "ELNO_FIELD" );
+ anOutputCellData->RemoveArray( "VISU_FIELD" );
+ anOutputCellData->SetVectors( NULL );
- aCellData->RemoveArray( "ELNO_COMPONENT_MAPPER" );
- aCellData->RemoveArray( "ELNO_FIELD" );
+ anOutputPointData->PassData( anInputPointData );
anOutputPointData->AddArray( anElnoPointDataArray );
anElnoPointDataArray->Delete();
vtkDataArray *anElnoDataArray = this->GetInputArrayToProcess( 0, inputVector );
vtkDataArray *anElnoDataMapper = this->GetInputArrayToProcess( 1, inputVector );
+ if ( !anElnoDataArray ) {
+ anOutput->ShallowCopy( anInput );
+ return 1;
+ }
+
vtkPoints *aPoints = anInput->GetPoints();
switch( aPoints->GetDataType() ){
case VTK_DOUBLE:
0, // port
0, // connection
vtkDataObject::FIELD_ASSOCIATION_POINTS, // field association
- "ELNO_POINT_DATA" ); // name
+ "VISU_FIELD" ); // name
myScalarMode = 1;
}
#include "VISU_ScalarMapPL.hxx"
#include "VISU_DataSetMapperHolder.hxx"
+#include "VISU_ElnoAssembleFilter.hxx"
#include "VISU_FieldTransform.hxx"
#include "VISU_AppendFilter.hxx"
VISU_ScalarMapPL
::VISU_ScalarMapPL():
VISU_UnstructuredGridPL(this),
+ myElnoAssembleFilter( VISU_ElnoAssembleFilter::New() ),
myAppendFilter(VISU_AppendFilter::New()),
myMergeFilter(VISU_MergeFilter::New())
{
SetIsShrinkable(true);
+ myElnoAssembleFilter->Delete();
+
myAppendFilter->SetMergingInputs(true);
myAppendFilter->Delete();
myMergeFilter->AddField("VISU_FIELD", aDataSet);
myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
+ myMergeFilter->AddField("ELNO_POINT_COORDS", aDataSet);
+
+ myElnoAssembleFilter->SetInput( InsertCustomPL() );
- GetDataSetMapper()->SetInput(InsertCustomPL());
+ GetDataSetMapper()->SetInput( myElnoAssembleFilter->GetOutput() );
}
::Update()
{
Superclass::Update();
- //{
- // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aScalarsOutput.vtk";
- // VISU::WriteToFile(GetFieldTransformFilter()->GetUnstructuredGridOutput(), aFileName);
- //}
- //{
- // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aGeomDataSet.vtk";
- // VISU::WriteToFile(myAppendFilter->GetOutput(), aFileName);
- //}
- //{
- // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter.vtk";
- // VISU::WriteToFile(myMergeFilter->GetUnstructuredGridOutput(), aFileName);
- //}
+ {
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aScalarsOutput.vtk";
+ VISU::WriteToFile(GetFieldTransformFilter()->GetUnstructuredGridOutput(), aFileName);
+ }
+ {
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aGeomDataSet.vtk";
+ VISU::WriteToFile(myAppendFilter->GetOutput(), aFileName);
+ }
+ {
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter.vtk";
+ VISU::WriteToFile(myMergeFilter->GetUnstructuredGridOutput(), aFileName);
+ }
}
#include "VISU_UnstructuredGridPL.hxx"
class VISU_DataSetMapperHolder;
+class VISU_ElnoAssembleFilter;
class VISU_AppendFilter;
class VISU_MergeFilter;
VISU_ScalarMapPL(const VISU_ScalarMapPL&); // Not implemented.
void operator=(const VISU_ScalarMapPL&); // Not implemented.
- vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
- vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
+ vtkSmartPointer< VISU_ElnoAssembleFilter > myElnoAssembleFilter;
+ vtkSmartPointer< VISU_AppendFilter > myAppendFilter;
+ vtkSmartPointer< VISU_MergeFilter > myMergeFilter;
};
#endif