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

Function SetColorAndOpacity

Rendering/VtkJS/vtkVtkJSSceneGraphSerializer.cxx:307–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305namespace
306{
307void SetColorAndOpacity(
308 Json::Value& property, vtkCompositePolyDataMapper* mapper, vtkDataObject* block)
309{
310 static const std::array<std::string, 4> colorProperties = { "ambientColor", "color",
311 "diffuseColor", "specularColor" };
312
313 // Set the color and opacity according to the dataset's corresponding block
314 // information.
315 vtkCompositeDataDisplayAttributes* atts = mapper->GetCompositeDataDisplayAttributes();
316 if (atts->HasBlockColor(block))
317 {
318 for (int i = 0; i < 3; i++)
319 {
320 for (auto& colorProperty : colorProperties)
321 {
322 property["properties"][colorProperty.c_str()][i] = atts->GetBlockColor(block)[i];
323 }
324 }
325 }
326 if (atts->HasBlockOpacity(block))
327 {
328 property["properties"]["opacity"] = atts->GetBlockOpacity(block);
329 }
330 if (atts->HasBlockVisibility(block))
331 {
332 property["properties"]["visibility"] = atts->GetBlockVisibility(block);
333 }
334}
335}
336
337//------------------------------------------------------------------------------

Callers 1

AddMethod · 0.85

Calls 8

HasBlockColorMethod · 0.45
c_strMethod · 0.45
GetBlockColorMethod · 0.45
HasBlockOpacityMethod · 0.45
GetBlockOpacityMethod · 0.45
HasBlockVisibilityMethod · 0.45
GetBlockVisibilityMethod · 0.45

Tested by

no test coverage detected