MCPcopy Create free account
hub / github.com/Kitware/VTK / ExtractPiecewiseFunctionSetup

Method ExtractPiecewiseFunctionSetup

IO/Export/vtkJSONSceneExporter.cxx:274–300  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

272
273//------------------------------------------------------------------------------
274std::string vtkJSONSceneExporter::ExtractPiecewiseFunctionSetup(vtkPiecewiseFunction* function)
275{
276 bool clamping = function->GetClamping();
277 vtkIdType numberOfPoints = function->GetSize();
278 constexpr const char* INDENT = " ";
279 std::stringstream configuration;
280 configuration << INDENT << " \"clamping\": " << (clamping ? "true" : "false") << ",\n";
281 configuration << INDENT << " \"points\": [\n";
282 for (vtkIdType pointId = 0; pointId < numberOfPoints; ++pointId)
283 {
284 double point[4];
285 function->GetNodeValue(pointId, point);
286 configuration << INDENT << " [";
287 for (int i = 0; i < 4; ++i)
288 {
289 configuration << point[i] << (i < 3 ? ", " : "");
290 }
291 configuration << "]";
292 if (pointId < numberOfPoints - 1)
293 {
294 configuration << ",";
295 }
296 configuration << "\n";
297 }
298 configuration << INDENT << " ]\n";
299 return configuration.str();
300}
301
302//------------------------------------------------------------------------------
303std::string vtkJSONSceneExporter::ExtractVolumeRenderingSetup(vtkVolume* volume)

Callers 1

Calls 4

GetClampingMethod · 0.80
GetSizeMethod · 0.45
GetNodeValueMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected