#include "vtkProperty.h"
#include "vtkLinearTransform.h"
#include "vtkCleanPolyData.h"
+#include "vtkFieldData.h"
#include "bbvtkPolyDataToActor.h"
#include "bbvtkPackage.h"
bbSetInputScalarVisibility(false);
polydatamapper = NULL;
vtkactor = NULL;
+
+ bbSetInputScalarVisibilityOn_LookupTable(NULL);
+ bbSetInputScalarVisibilityOn_NameColorArray("");
}
{
polydatamapper = vtkPolyDataMapper::New();
vtkactor = vtkActor::New();
-
// polydatamapper->SetInput(marchingcubes->GetOutput());
vtkactor->SetMapper(polydatamapper);
+//EED 2020-04-21 vtk8 deprecated
// polydatamapper->ImmediateModeRenderingOn();
}
}
-//---------------------------------------------------------------------
-
- void PolyDataToActor::DoProcess()
- {
-
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n");
-//https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk
-//https://itk.org/Wiki/VTK/Depth_Peeling
-bbGetInputRenderer()->SetUseDepthPeeling(1);
-bbGetInputRenderer()->SetOcclusionRatio(0.1);
-bbGetInputRenderer()->SetMaximumNumberOfPeels(100);
-bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0);
-bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1);
+
+
+/*
+-----------------------------------------------
+
+https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ScalarBarActor
+https://vtk.org/Wiki/VTK/Examples/Cxx/VisualizationAlgorithms/TubesFromSplines
+https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ElevationBandsWithGlyphs
+
+vtkSmartPointer<vtkFloatArray> scalars = vtkSmartPointer<vtkFloatArray>::New();
+ scalars set value ....
+poly->GetPointData()->SetScalars(scalars); or poly->GetPointData()->SetActiveScalars("<NameArray>");
+
+vtkSmartPointer<vtkLookupTable> hueLut = vtkSmartPoint | ^~
+er<vtkLookupTable>::New();
+ hueLut Build ....
+
+ mapper->SetInputData(poly);
+ mapper->ScalarVisibilityOn();
+ mapper->SetScalarModeToUsePointData(); Point of Cell ...
+
+ default: mapper->SetColorModeToDirectScalars() Busca scalars 3 componentes [R,G,B] float 0..1 or integer 0..255
+ else:
+ mapper->SetColorModeToMapScalars() El vector scalar solo tiene un componente
+ mapper->SetLookupTable( hueLut );
+
+ To change Array
+ mapper->SelectColorArray("<NameVector>");
+
+ mapper->SetUseLookupTableScalarRange( true/false ) true:Para compartir lookuptable con otros mappers
+ si false then
+ mapper->SetScalarRange( min, max); Range especifico este mapper
+ mapper->SetScalarRange( tubePolyData->GetScalarRange() );
+
+------------------------------------------
+
+ mapper->ScalarVisibilityOff(); -> SetScalarModeToDefault()
+ Utiliza el color del actor
+
+----------------------------------------
+
+*/
+
+
+//---------------------------------------------------------------------
+void PolyDataToActor::DoProcess()
+{
if (bbGetInputRenderer()==NULL)
{
printf("EED Warnning! PolyDataToActor::DoProcess missing Renderer.\n");
if (bbGetInputScalarVisibility()==true )
{
- polydatamapper->ScalarVisibilityOn();
+ polydatamapper->ScalarVisibilityOn();
+ if (bbGetInputScalarVisibilityOn_LookupTable()!=NULL)
+ {
+// polydatamapper->SetScalarModeToDefault();
+// polydatamapper->SetScalarModeToUseCellData();
+// polydatamapper->SetScalarModeToUseCellFieldData();
+// polydatamapper->SetScalarModeToUseFieldData(); // 1/2 hausdorff->SetTargetDistanceMethodToPointToCell();
+// polydatamapper->SetScalarModeToUsePointData(); // *
+ polydatamapper->SetScalarModeToUsePointFieldData();
+
+ polydatamapper->SetColorModeToMapScalars();
+ polydatamapper->SetLookupTable( bbGetInputScalarVisibilityOn_LookupTable() );
+ if (bbGetInputScalarVisibilityOn_NameColorArray()!="")
+ {
+ polydatamapper->SelectColorArray( bbGetInputScalarVisibilityOn_NameColorArray().c_str() );
+ }
+ if (bbGetInputScalarVisibilityOn_ScalarRange().size()==2)
+ {
+ polydatamapper->SetScalarRange( bbGetInputScalarVisibilityOn_ScalarRange()[0] , bbGetInputScalarVisibilityOn_ScalarRange()[1] );
+ }
+
+ } // if ScalarVisibilityOn_LookupTable
} else {
polydatamapper->ScalarVisibilityOff();
} // ScalarVisibility
bbGetInputRenderer()->RemoveActor( vtkactor );
} // actorAdded
} // Active
- }
+}