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

Method WriteData

IO/Export/vtkJSONRenderWindowExporter.cxx:108–187  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

106
107//------------------------------------------------------------------------------
108void vtkJSONRenderWindowExporter::WriteData()
109{
110 if (this->GetSerializer() == nullptr)
111 {
112 vtkErrorMacro(<< "No scene!");
113 return;
114 }
115 this->GetSerializer()->Reset();
116
117 if (this->GetArchiver() == nullptr)
118 {
119 vtkErrorMacro(<< "No archiver!");
120 return;
121 }
122
123 if (this->GetArchiver()->GetArchiveName() == nullptr)
124 {
125 vtkErrorMacro(<< "Please specify Archive Name to use");
126 return;
127 }
128
129 // Populate the scene instance
130 {
131 // Construct a top-level node for the render window
132 vtkViewNode* vn = this->Factory->CreateNode(this->RenderWindow);
133
134 // Build the scene graph
135 vn->Traverse(vtkViewNode::build);
136
137 // Construct the vtk-js representation of the scene graph
138 vn->Traverse(vtkViewNode::synchronize);
139
140 // Update the datasets associated with the scene graph
141 vn->Traverse(vtkViewNode::render);
142
143 // Delete the top level node
144 vn->Delete();
145 }
146
147 // Open the archive for writing
148 this->GetArchiver()->OpenArchive();
149
150 // Write the top-level index file describing the scene elements and their
151 // topology.
152 {
153 std::stringstream stream;
154 Json::StreamWriterBuilder builder;
155 builder["commentStyle"] = "None";
156 builder["indentation"] = this->CompactOutput ? "" : " ";
157 std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
158 writer->write(this->GetSerializer()->GetRoot(), &stream);
159
160 std::string index = stream.str();
161 this->GetArchiver()->InsertIntoArchive("index.json", index.c_str(), index.size());
162 }
163
164 // Write the associated data arrays into the archive
165 {

Callers

nothing calls this directly

Calls 15

CreateNodeMethod · 0.80
newStreamWriterMethod · 0.80
GetDataArrayIdMethod · 0.80
WriteArrayContentsMethod · 0.80
DeleteMethod · 0.65
ResetMethod · 0.45
TraverseMethod · 0.45
OpenArchiveMethod · 0.45
writeMethod · 0.45
GetRootMethod · 0.45
strMethod · 0.45
InsertIntoArchiveMethod · 0.45

Tested by

no test coverage detected