1 #include <vtkSliderRepresentation2D.h> 2 #include <vtkProperty2D.h> 3 #include <vtkAlgorithmOutput.h> 4 #include <vtkTextProperty.h> 5 #include <vtkRectilinearGrid.h> 6 #include <vtkGeometryFilter.h> 7 #include <vtkRectilinearGridGeometryFilter.h> 8 #include <vtkUnstructuredGrid.h> 9 #include <vtkUnstructuredGridGeometryFilter.h> 11 #include <vtkCutter.h> 12 #include <vtkImplicitBoolean.h> 13 #include <vtkOutlineFilter.h> 14 #include <vtkCubeAxesActor2D.h> 15 #include <vtkAppendPolyData.h> 16 #include <vtkAssignAttribute.h> 17 #include <vtkCamera.h> 18 #include <vtkTextActor.h> 19 #include <vtkCoordinate.h> 20 #include <vtkTransformPolyDataFilter.h> 21 #include <vtkTransformFilter.h> 22 #include <vtkClipPolyData.h> 23 #include <vtkWarpScalar.h> 24 #include <vtkExtractCells.h> 25 #include <vtkIdList.h> 46 state.surface_rgbtab_size=tabsize;
47 state.surface_rgbtab_modified=
true;
55 template <
class DATA,
class FILTER>
64 auto values=vtkDoubleArray::SafeDownCast(DATA::SafeDownCast(
data_producer->GetOutputDataObject(0))->GetPointData()->GetAbstractArray(
dataname.c_str()));
66 vtkSmartPointer<vtkExtractCells> subgrid;
69 subgrid=vtkSmartPointer<vtkExtractCells>::New();
75 auto scalar = vtkSmartPointer<vtkAssignAttribute>::New();
76 scalar->Assign(
dataname.c_str(),vtkDataSetAttributes::SCALARS,vtkAssignAttribute::POINT_DATA);
78 scalar->SetInputConnection(subgrid->GetOutputPort());
82 auto geometry=vtkSmartPointer<FILTER>::New();
83 geometry->SetInputConnection(scalar->GetOutputPort());
87 auto transgeometry=vtkSmartPointer<vtkTransformPolyDataFilter>::New();
88 transgeometry->SetInputConnection(geometry->GetOutputPort());
94 vtkSmartPointer<vtkTransformPolyDataFilter> transallgeometry;
97 auto allgeometry=vtkSmartPointer<FILTER>::New();
98 allgeometry->SetInputConnection(
data_producer->GetOutputPort());
100 transallgeometry=vtkSmartPointer<vtkTransformPolyDataFilter>::New();
101 transallgeometry->SetTransform(
transform);
102 transallgeometry->SetInputConnection(allgeometry->GetOutputPort());
105 transallgeometry=transgeometry;
109 auto wtransform = vtkSmartPointer<vtkTransform>::New();
110 wtransform->Translate(0,0,0.5);
111 auto wtransgeometry=vtkSmartPointer<vtkTransformPolyDataFilter>::New();
112 wtransgeometry->SetInputConnection(transgeometry->GetOutputPort());
113 wtransgeometry->SetTransform(wtransform);
115 auto elevation = vtkSmartPointer<vtkWarpScalar>::New();
116 elevation->SetInputConnection(wtransgeometry->GetOutputPort());
117 elevation->SetScaleFactor(0.5/(
state.real_vmax-
state.real_vmin));
118 vtkSmartPointer<vtkPolyDataMapper> wmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
119 wmapper->SetInputConnection(elevation->GetOutputPort());
120 vtkSmartPointer<vtkActor> wplot = vtkSmartPointer<vtkActor>::New();
121 wmapper->UseLookupTableScalarRangeOn();
131 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
132 mapper->SetInputConnection(transgeometry->GetOutputPort());
135 mapper->UseLookupTableScalarRangeOn();
137 #ifdef VTK_HAS_MAPPER_IMMEDIATE_RENDERING_ON 138 mapper->ImmediateModeRenderingOn();
144 if (
state.show_surface_colorbar)
147 cbar->SetLabelFormat(
state.surface_colorbar_label_format);
148 cbar->SetNumberOfLabels(
state.surface_colorbar_num_labels);
157 isoline_filter->SetInputConnection(transgeometry->GetOutputPort());
159 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
163 mapper->ScalarVisibilityOff();
186 template <
class DATA,
class FILTER>
193 vtkSmartPointer<vtkExtractCells> subgrid;
196 subgrid=vtkSmartPointer<vtkExtractCells>::New();
203 auto scalar = vtkSmartPointer<vtkAssignAttribute>::New();
204 scalar->Assign(
dataname.c_str(),vtkDataSetAttributes::SCALARS,vtkAssignAttribute::POINT_DATA);
206 scalar->SetInputConnection(subgrid->GetOutputPort());
213 auto transgeometry=vtkSmartPointer<vtkTransformFilter>::New();
214 transgeometry->SetInputConnection(scalar->GetOutputPort());
217 vtkSmartPointer<vtkTransformFilter> transallgeometry;
220 auto allgeometry=vtkSmartPointer<FILTER>::New();
221 allgeometry->SetInputConnection(
data_producer->GetOutputPort());
223 transallgeometry=vtkSmartPointer<vtkTransformFilter>::New();
224 transallgeometry->SetTransform(
transform);
225 transallgeometry->SetInputConnection(allgeometry->GetOutputPort());
228 transallgeometry=transgeometry;
237 planecutX->SetInputConnection(transgeometry->GetOutputPort());
242 planecutY->SetInputConnection(transgeometry->GetOutputPort());
246 planecutZ->SetInputConnection(transgeometry->GetOutputPort());
252 vtkSmartPointer<vtkClipPolyData> clipgeometry=0;
256 clipgeometry=vtkSmartPointer<vtkClipPolyData>::New();
257 auto sfilter=vtkSmartPointer<FILTER>::New();
258 sfilter->SetInputConnection(transgeometry->GetOutputPort());
259 clipgeometry->SetInputConnection(sfilter->GetOutputPort());
260 clipgeometry->SetClipFunction(
planeZ);
261 clipgeometry->SetInsideOut(1);
263 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
266 mapper->SetInputConnection(clipgeometry->GetOutputPort());
267 mapper->UseLookupTableScalarRangeOn();
269 auto splot=vtkSmartPointer<vtkActor>::New();
270 splot->GetProperty()->SetOpacity(1.0);
271 splot->SetMapper(mapper);
278 auto xyz = vtkSmartPointer<vtkAppendPolyData>::New();
279 xyz->SetUserManagedInputs(1);
281 xyz->SetNumberOfInputs(4);
283 xyz->SetNumberOfInputs(3);
285 xyz->SetInputConnectionByNumber(0,
planecutX->GetOutputPort());
286 xyz->SetInputConnectionByNumber(1,
planecutY->GetOutputPort());
287 xyz->SetInputConnectionByNumber(2,
planecutZ->GetOutputPort());
289 xyz->SetInputConnectionByNumber(3,clipgeometry->GetOutputPort());
292 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
293 mapper->SetInputConnection(xyz->GetOutputPort());
294 mapper->UseLookupTableScalarRangeOn();
297 vtkSmartPointer<vtkActor> plot = vtkSmartPointer<vtkActor>::New();
298 plot->GetProperty()->SetOpacity(1);
299 plot->SetMapper(mapper);
311 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
315 mapper->ScalarVisibilityOff();
331 vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
333 mapper->UseLookupTableScalarRangeOn();
355 if (
state.spacedim==2)
356 this->RTBuildVTKPipeline2D<vtkUnstructuredGrid,vtkGeometryFilter>();
358 this->RTBuildVTKPipeline3D<vtkUnstructuredGrid,vtkGeometryFilter>();
362 if (
state.spacedim==2)
363 this->RTBuildVTKPipeline2D<vtkRectilinearGrid,vtkRectilinearGridGeometryFilter>();
365 this->RTBuildVTKPipeline3D<vtkRectilinearGrid,vtkRectilinearGridGeometryFilter>();
377 if (
state.surface_rgbtab_modified)
380 state.surface_rgbtab_modified=
false;
387 if (
state.surface_rgbtab_modified)
void ServerRTSend(vtkSmartPointer< internals::Communicator > communicator) override final
Client-Server communication.
void RTBuildVTKPipeline2D()
2D Filter
void ClientMTReceive(vtkSmartPointer< internals::Communicator > communicator) override final
Receive data from server.
vtkSmartPointer< vtkLookupTable > BuildLookupTable(RGBTable &xrgb, size_t size)
void SetSurfaceRGBTable(const V &tab, int lutsize)
Set Surface RGB table from vector.
std::vector< RGBPoint > RGBTable
void RTBuildVTKPipeline() override final
Generic access to filter.
vtkSmartPointer< vtkScalarBarActor > BuildColorBar(vtkSmartPointer< vtkPolyDataMapper > mapper, int irank=0)
void RTBuildVTKPipeline3D()
3D Filter