VTK  9.0.1
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 
36 class vtkActor;
37 class vtkDataObject;
38 class vtkDataSet;
39 class vtkPolyData;
40 class vtkScalarsToColors;
41 class vtkTexture;
42 
43 class VTKIOEXPORT_EXPORT vtkJSONSceneExporter : public vtkExporter
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
55  vtkSetStringMacro(FileName);
56  vtkGetStringMacro(FileName);
58 
60 
65  vtkSetMacro(WriteTextures, bool);
66  vtkGetMacro(WriteTextures, bool);
68 
70 
79  vtkSetMacro(WriteTextureLODs, bool);
80  vtkGetMacro(WriteTextureLODs, bool);
82 
84 
89  vtkSetMacro(TextureLODsBaseSize, size_t);
90  vtkGetMacro(TextureLODsBaseSize, size_t);
92 
94 
98  vtkSetStringMacro(TextureLODsBaseUrl);
99  vtkGetStringMacro(TextureLODsBaseUrl);
101 
103 
117  vtkSetMacro(WritePolyLODs, bool);
118  vtkGetMacro(WritePolyLODs, bool);
120 
122 
129  vtkSetMacro(PolyLODsBaseSize, size_t);
130  vtkGetMacro(PolyLODsBaseSize, size_t);
132 
134 
138  vtkSetStringMacro(PolyLODsBaseUrl);
139  vtkGetStringMacro(PolyLODsBaseUrl);
141 
142 protected:
145 
146  void WriteDataObject(ostream& os, vtkDataObject* dataObject, vtkActor* actor);
148  std::string WriteDataSet(vtkDataSet* dataset, const char* addOnMeta);
149  void WriteLookupTable(const char* name, vtkScalarsToColors* lookupTable);
150 
151  void WriteData() override;
152 
154 
157 
158  // The returned pointer is the smallest poly LOD, intended to be
159  // written out in the vtkjs file.
161 
162  char* FileName;
171  std::map<std::string, std::string> LookupTables;
172  std::map<vtkTexture*, std::string> TextureStrings;
173  std::map<vtkTexture*, std::string> TextureLODStrings;
174 
175  // Files that subclasses should zip
176  std::vector<std::string> FilesToZip;
177 
178 private:
180  void operator=(const vtkJSONSceneExporter&) = delete;
181 };
182 
183 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
general representation of visualization data
Definition: vtkDataObject.h:60
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
abstract class to write a scene to a file
Definition: vtkExporter.h:48
a simple class to control print indentation
Definition: vtkIndent.h:34
Export the content of a vtkRenderWindow into a directory with a JSON meta file describing the scene a...
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)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkJSONSceneExporter() override
std::string ExtractRenderingSetup(vtkActor *actor)
void WriteLookupTable(const char *name, vtkScalarsToColors *lookupTable)
void WriteData() override
std::vector< std::string > FilesToZip
static vtkJSONSceneExporter * New()
std::string WriteTextureLODSeries(vtkTexture *texture)
std::map< std::string, std::string > LookupTables
std::map< vtkTexture *, std::string > TextureStrings
std::map< vtkTexture *, std::string > TextureLODStrings
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
Superclass for mapping scalar values to colors.
handles properties associated with a texture map
Definition: vtkTexture.h:66
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496