| 384 | } |
| 385 | |
| 386 | std::string vtkJSONSceneExporter::ExtractActorRenderingSetup(vtkActor* actor) |
| 387 | { |
| 388 | vtkMapper* mapper = actor->GetMapper(); |
| 389 | // int scalarVisibility = mapper->GetScalarVisibility(); |
| 390 | const char* colorArrayName = mapper->GetArrayName(); |
| 391 | int colorMode = mapper->GetColorMode(); |
| 392 | int scalarMode = mapper->GetScalarMode(); |
| 393 | |
| 394 | vtkProperty* property = actor->GetProperty(); |
| 395 | int representation = property->GetRepresentation(); |
| 396 | double* colorToUse = property->GetDiffuseColor(); |
| 397 | if (representation == 1) |
| 398 | { |
| 399 | colorToUse = property->GetColor(); |
| 400 | } |
| 401 | int pointSize = property->GetPointSize(); |
| 402 | float opacity = property->GetOpacity(); |
| 403 | int edgeVisibility = property->GetEdgeVisibility(); |
| 404 | |
| 405 | double* p3dPosition = actor->GetPosition(); |
| 406 | double* p3dScale = actor->GetScale(); |
| 407 | double* p3dOrigin = actor->GetOrigin(); |
| 408 | double* p3dRotateWXYZ = actor->GetOrientationWXYZ(); |
| 409 | |
| 410 | constexpr const char* INDENT = " "; |
| 411 | std::stringstream renderingConfig; |
| 412 | renderingConfig << ",\n" |
| 413 | << INDENT << "\"actor\": {\n" |
| 414 | << INDENT << " \"origin\": [" << p3dOrigin[0] << ", " << p3dOrigin[1] << ", " |
| 415 | << p3dOrigin[2] << "],\n" |
| 416 | << INDENT << " \"scale\": [" << p3dScale[0] << ", " << p3dScale[1] << ", " |
| 417 | << p3dScale[2] << "],\n" |
| 418 | << INDENT << " \"position\": [" << p3dPosition[0] << ", " << p3dPosition[1] |
| 419 | << ", " << p3dPosition[2] << "]\n" |
| 420 | << INDENT << "},\n" |
| 421 | << INDENT << "\"actorRotation\": [" << p3dRotateWXYZ[0] << ", " |
| 422 | << p3dRotateWXYZ[1] << ", " << p3dRotateWXYZ[2] << ", " << p3dRotateWXYZ[3] |
| 423 | << "],\n" |
| 424 | << INDENT << "\"mapper\": {\n" |
| 425 | << INDENT << " \"colorByArrayName\": \"" << colorArrayName << "\",\n" |
| 426 | << INDENT << " \"colorMode\": " << colorMode << ",\n" |
| 427 | << INDENT << " \"scalarMode\": " << scalarMode << "\n" |
| 428 | << INDENT << "},\n" |
| 429 | << INDENT << "\"property\": {\n" |
| 430 | << INDENT << " \"representation\": " << representation << ",\n" |
| 431 | << INDENT << " \"edgeVisibility\": " << edgeVisibility << ",\n" |
| 432 | << INDENT << " \"diffuseColor\": [" << colorToUse[0] << ", " << colorToUse[1] |
| 433 | << ", " << colorToUse[2] << "],\n" |
| 434 | << INDENT << " \"pointSize\": " << pointSize << ",\n" |
| 435 | << INDENT << " \"opacity\": " << opacity << "\n" |
| 436 | << INDENT << "}"; |
| 437 | |
| 438 | return renderingConfig.str(); |
| 439 | } |
| 440 | |
| 441 | //------------------------------------------------------------------------------ |
| 442 | std::string vtkJSONSceneExporter::GetTemporaryPath() const |
no test coverage detected