------------------------------------------------------------------------------
| 84 | |
| 85 | //------------------------------------------------------------------------------ |
| 86 | void vtkJSONSceneExporter::WriteDataObject( |
| 87 | ostream& os, vtkDataObject* dataObject, vtkActor* actor, vtkVolume* volume, const char* name) |
| 88 | { |
| 89 | // Skip if nothing to process |
| 90 | if (dataObject == nullptr) |
| 91 | { |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | // Handle Dataset |
| 96 | if (dataObject->IsA("vtkDataSet")) |
| 97 | { |
| 98 | std::string texturesString; |
| 99 | std::string renderingSetup; |
| 100 | |
| 101 | if (actor) |
| 102 | { |
| 103 | if (this->WriteTextures && actor->GetTexture()) |
| 104 | { |
| 105 | // Write out the textures, add it to the textures string |
| 106 | texturesString += this->WriteTexture(actor->GetTexture()); |
| 107 | } |
| 108 | |
| 109 | if (this->WriteTextureLODs && actor->GetTexture()) |
| 110 | { |
| 111 | // Write out the texture LODs, add it to the textures string |
| 112 | texturesString += this->WriteTextureLODSeries(actor->GetTexture()); |
| 113 | } |
| 114 | renderingSetup = this->ExtractActorRenderingSetup(actor); |
| 115 | } |
| 116 | else if (volume) |
| 117 | { |
| 118 | renderingSetup = this->ExtractVolumeRenderingSetup(volume); |
| 119 | } |
| 120 | std::string addOnMeta = renderingSetup + texturesString + "\n"; |
| 121 | std::string dsMeta = |
| 122 | this->WriteDataSet(vtkDataSet::SafeDownCast(dataObject), addOnMeta.c_str(), name); |
| 123 | if (!dsMeta.empty()) |
| 124 | { |
| 125 | os << dsMeta; |
| 126 | } |
| 127 | return; |
| 128 | } |
| 129 | |
| 130 | // Handle composite |
| 131 | if (dataObject->IsA("vtkCompositeDataSet")) |
| 132 | { |
| 133 | vtkCompositeDataSet* composite = vtkCompositeDataSet::SafeDownCast(dataObject); |
| 134 | vtkSmartPointer<vtkCompositeDataIterator> iter; |
| 135 | iter.TakeReference(composite->NewIterator()); |
| 136 | iter->SkipEmptyNodesOn(); |
| 137 | iter->InitTraversal(); |
| 138 | while (!iter->IsDoneWithTraversal()) |
| 139 | { |
| 140 | this->WriteDataObject(os, iter->GetCurrentDataObject(), actor, volume, name); |
| 141 | iter->GoToNextItem(); |
| 142 | } |
| 143 |
no test coverage detected