VTK  9.3.0
vtkJSONSceneExporter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
13#ifndef vtkJSONSceneExporter_h
14#define vtkJSONSceneExporter_h
15
16#include "vtkExporter.h"
17#include "vtkIOExportModule.h" // For export macro
18#include "vtkSmartPointer.h" // For vtkSmartPointer
19
20#include <map> // For member variables
21#include <string> // For string parameter
22#include <vector> // For member variables
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkActor;
27class vtkDataObject;
28class vtkDataSet;
30class vtkPolyData;
33class vtkTexture;
34class vtkVolume;
36
37class VTKIOEXPORT_EXPORT vtkJSONSceneExporter : public vtkExporter
38{
39public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
45
52
54
59 vtkSetMacro(WriteTextures, bool);
60 vtkGetMacro(WriteTextures, bool);
62
64
73 vtkSetMacro(WriteTextureLODs, bool);
74 vtkGetMacro(WriteTextureLODs, bool);
76
78
83 vtkSetMacro(TextureLODsBaseSize, size_t);
84 vtkGetMacro(TextureLODsBaseSize, size_t);
86
88
92 vtkSetStringMacro(TextureLODsBaseUrl);
93 vtkGetStringMacro(TextureLODsBaseUrl);
95
97
111 vtkSetMacro(WritePolyLODs, bool);
112 vtkGetMacro(WritePolyLODs, bool);
114
116
123 vtkSetMacro(PolyLODsBaseSize, size_t);
124 vtkGetMacro(PolyLODsBaseSize, size_t);
126
128
132 vtkSetStringMacro(PolyLODsBaseUrl);
133 vtkGetStringMacro(PolyLODsBaseUrl);
135
136protected:
139
140 void WritePropCollection(vtkPropCollection* collection, std::ostream& sceneComponents);
141 void WriteVolumeCollection(vtkVolumeCollection* volumeCollection, std::ostream& sceneComponents);
142
143 void WriteDataObject(ostream& os, vtkDataObject* dataObject, vtkActor* actor, vtkVolume* volume);
148 std::string WriteDataSet(vtkDataSet* dataset, const char* addOnMeta);
149 void WriteLookupTable(const char* name, vtkScalarsToColors* lookupTable);
150
151 void WriteData() override;
152
154
158 std::string GetTemporaryPath() const;
160 std::string CurrentDataSetPath() const;
161
162 std::string WriteTexture(vtkTexture* texture);
163 std::string WriteTextureLODSeries(vtkTexture* texture);
164
165 // The returned pointer is the smallest poly LOD, intended to be
166 // written out in the vtkjs file.
168
169 char* FileName;
178 std::map<std::string, std::string> LookupTables;
179 std::map<vtkTexture*, std::string> TextureStrings;
180 std::map<vtkTexture*, std::string> TextureLODStrings;
181
182 // Files that subclasses should zip
183 std::vector<std::string> FilesToZip;
184
185private:
187 void operator=(const vtkJSONSceneExporter&) = delete;
188};
189
190VTK_ABI_NAMESPACE_END
191#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:41
Defines a transfer function for mapping a property to an RGB color value.
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
abstract class to write a scene to a file
Definition vtkExporter.h:37
a simple class to control print indentation
Definition vtkIndent.h:29
Export the content of a vtkRenderWindow into a directory with a JSON meta file describing the scene a...
void WriteVolumeCollection(vtkVolumeCollection *volumeCollection, std::ostream &sceneComponents)
std::string CurrentDataSetPath() const
std::string WriteTexture(vtkTexture *texture)
std::string WriteDataSet(vtkDataSet *dataset, const char *addOnMeta)
vtkSmartPointer< vtkPolyData > WritePolyLODSeries(vtkPolyData *polys, std::string &config)
void WriteDataObject(ostream &os, vtkDataObject *dataObject, vtkActor *actor, vtkVolume *volume)
std::string ExtractActorRenderingSetup(vtkActor *actor)
std::string GetTemporaryPath() const
Path to temporary folder where files are written to before being renamed to this->FileName.
std::string ExtractVolumeRenderingSetup(vtkVolume *volume)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetFilePathMacro(FileName)
Specify file name of vtk data file to write.
std::string ExtractPiecewiseFunctionSetup(vtkPiecewiseFunction *pwf)
std::string ExtractColorTransferFunctionSetup(vtkColorTransferFunction *volume)
~vtkJSONSceneExporter() override
void WritePropCollection(vtkPropCollection *collection, std::ostream &sceneComponents)
void WriteLookupTable(const char *name, vtkScalarsToColors *lookupTable)
void WriteData() override
std::vector< std::string > FilesToZip
static vtkJSONSceneExporter * New()
vtkGetFilePathMacro(FileName)
Specify file name of vtk data file to write.
std::string WriteTextureLODSeries(vtkTexture *texture)
std::map< std::string, std::string > LookupTables
std::map< vtkTexture *, std::string > TextureStrings
std::map< vtkTexture *, std::string > TextureLODStrings
Defines a 1D piecewise function.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
an ordered list of Props
Superclass for mapping scalar values to colors.
Hold a reference to a vtkObjectBase instance.
handles properties associated with a texture map
Definition vtkTexture.h:58
an ordered list of volumes
represents a volume (data & properties) in a rendered scene
Definition vtkVolume.h:40