VTK  9.1.0
vtkJSONSceneExporter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkJSONSceneExporter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
25#ifndef vtkJSONSceneExporter_h
26#define vtkJSONSceneExporter_h
27
28#include "vtkExporter.h"
29#include "vtkIOExportModule.h" // For export macro
30#include "vtkSmartPointer.h" // For vtkSmartPointer
31
32#include <map> // For member variables
33#include <string> // For string parameter
34#include <vector> // For member variables
35
36class vtkActor;
38class vtkDataObject;
39class vtkDataSet;
41class vtkPolyData;
44class vtkTexture;
45class vtkVolume;
47
48class VTKIOEXPORT_EXPORT vtkJSONSceneExporter : public vtkExporter
49{
50public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
63
65
70 vtkSetMacro(WriteTextures, bool);
71 vtkGetMacro(WriteTextures, bool);
73
75
84 vtkSetMacro(WriteTextureLODs, bool);
85 vtkGetMacro(WriteTextureLODs, bool);
87
89
94 vtkSetMacro(TextureLODsBaseSize, size_t);
95 vtkGetMacro(TextureLODsBaseSize, size_t);
97
99
103 vtkSetStringMacro(TextureLODsBaseUrl);
104 vtkGetStringMacro(TextureLODsBaseUrl);
106
108
122 vtkSetMacro(WritePolyLODs, bool);
123 vtkGetMacro(WritePolyLODs, bool);
125
127
134 vtkSetMacro(PolyLODsBaseSize, size_t);
135 vtkGetMacro(PolyLODsBaseSize, size_t);
137
139
143 vtkSetStringMacro(PolyLODsBaseUrl);
144 vtkGetStringMacro(PolyLODsBaseUrl);
146
147protected:
150
151 void WritePropCollection(vtkPropCollection* collection, std::ostream& sceneComponents);
152 void WriteVolumeCollection(vtkVolumeCollection* volumeCollection, std::ostream& sceneComponents);
153
154 void WriteDataObject(ostream& os, vtkDataObject* dataObject, vtkActor* actor, vtkVolume* volume);
159 std::string WriteDataSet(vtkDataSet* dataset, const char* addOnMeta);
160 void WriteLookupTable(const char* name, vtkScalarsToColors* lookupTable);
161
162 void WriteData() override;
163
165
168
169 // The returned pointer is the smallest poly LOD, intended to be
170 // written out in the vtkjs file.
172
173 char* FileName;
182 std::map<std::string, std::string> LookupTables;
183 std::map<vtkTexture*, std::string> TextureStrings;
184 std::map<vtkTexture*, std::string> TextureLODStrings;
185
186 // Files that subclasses should zip
187 std::vector<std::string> FilesToZip;
188
189private:
191 void operator=(const vtkJSONSceneExporter&) = delete;
192};
193
194#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
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:166
abstract class to write a scene to a file
Definition: vtkExporter.h:48
a simple class to control print indentation
Definition: vtkIndent.h:113
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 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:195
an ordered list of Props
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:175
an ordered list of volumes
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:134
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496