| 305 | namespace |
| 306 | { |
| 307 | void 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 | //------------------------------------------------------------------------------ |
no test coverage detected