VTK  9.2.6
TreeInformation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: TreeInformation.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=========================================================================*/
23#ifndef TreeInformation_h
24#define TreeInformation_h
25
26#include <vtkSmartPointer.h>
27
28#include <vtk_nlohmannjson.h>
29#include VTK_NLOHMANN_JSON(json.hpp)
30
31#include <array>
32#include <vector>
33
34class vtkActor;
36class vtkIdList;
37class vtkImageData;
38class vtkIntArray;
39class vtkPolyData;
40class vtkPointSet;
41class vtkRenderWindow;
44
46{
47public:
49
52 TreeInformation(vtkIncrementalOctreeNode* root, int numberOfNodes,
53 const std::vector<vtkSmartPointer<vtkCompositeDataSet>>* buildings,
54 const std::string& textureBaseDirectory, bool saveTextures, bool contentGLTF, const char* crs,
55 const std::string& outputDir);
56 TreeInformation(vtkIncrementalOctreeNode* root, int numberOfNodes, vtkPointSet* points,
57 bool contentGLTF, const char* crs, const std::string& output);
58 TreeInformation(vtkIncrementalOctreeNode* root, int numberOfNodes, vtkPolyData* mesh,
59 const std::string& textureBaseDirectory, bool saveTextures, bool contentGLTF, const char* crs,
60 const std::string& output);
62
64
66
71 std::array<double, 6> GetNodeTightBounds(int i) { return NodeTightBounds[i]; }
72 bool GetNodeTightBounds(int i, double* bounds);
73 static bool GetNodeTightBounds(void* data, vtkIncrementalOctreeNode* node, double* bounds);
75
82 void AddGeometricError(vtkPolyData* representation);
88 void Compute();
89 void SaveTilesBuildings(bool mergeTilePolyData);
92 void SaveTileset(const std::string& output);
93 static void PrintBounds(const char* name, const double* bounds);
94 static void PrintBounds(const std::string& name, const double* bounds)
95 {
96 PrintBounds(name.c_str(), bounds);
97 }
98 static std::array<double, 6> ExpandBounds(double* first, double* second);
99
100protected:
101 void PostOrderTraversal(void (TreeInformation::*Visit)(vtkIncrementalOctreeNode* node, void* aux),
102 vtkIncrementalOctreeNode* node, void* aux);
103 void PreOrderTraversal(void (TreeInformation::*Visit)(vtkIncrementalOctreeNode* node, void* aux),
104 vtkIncrementalOctreeNode* node, void* aux);
105 void SaveTileset(vtkIncrementalOctreeNode* root, const std::string& output);
109
111
119 void SaveTileBuildings(vtkIncrementalOctreeNode* node, void* auxData);
120 void SaveTileMesh(vtkIncrementalOctreeNode* node, void* auxData);
125 vtkPolyData* tileMesh, vtkImageData* textureImage);
126 void SaveTilePoints(vtkIncrementalOctreeNode* node, void* auxData);
127
129
141 std::array<double, 6> ComputeTightBB(vtkIdList* tileBuildings);
142 std::string ContentTypeExtension() const;
145
146private:
150 int InputType;
153
156 const std::vector<vtkSmartPointer<vtkCompositeDataSet>>* Buildings;
157 vtkPointSet* Points;
158 vtkPolyData* Mesh;
160
161 std::string OutputDir;
162 std::string TextureBaseDirectory;
163 bool SaveTextures;
164 bool ContentGLTF;
165
166 const char* CRS;
170 std::vector<std::array<double, 6>> NodeTightBounds;
175 std::vector<bool> EmptyNode;
180 std::vector<double> GeometricError;
181 nlohmann::json RootJson;
182};
183
184#endif
185// VTK-HeaderTest-Exclude: TreeInformation.h
Additional information and routins for 3D Tiles octree nodes.
bool ConvertTileCartesianBuildings(vtkIncrementalOctreeNode *node)
void VisitComputeGeometricError(vtkIncrementalOctreeNode *node, void *aux)
Computes the additional information for 'node'.
bool GetNodeTightBounds(int i, double *bounds)
void SaveTilesPoints()
TreeInformation(vtkIncrementalOctreeNode *root, int numberOfNodes, vtkPointSet *points, bool contentGLTF, const char *crs, const std::string &output)
void SaveTilePoints(vtkIncrementalOctreeNode *node, void *auxData)
double ComputeGeometricErrorTilesetBuildings()
Compute geometric error for the tileset and for a node.
double ComputeGeometricErrorNodeMesh(vtkIncrementalOctreeNode *node, void *aux)
Compute geometric error for the tileset and for a node.
static bool GetNodeTightBounds(void *data, vtkIncrementalOctreeNode *node, double *bounds)
void SaveTileset(const std::string &output)
TreeInformation(vtkIncrementalOctreeNode *root, int numberOfNodes, vtkPolyData *mesh, const std::string &textureBaseDirectory, bool saveTextures, bool contentGLTF, const char *crs, const std::string &output)
double ComputeGeometricErrorNode(vtkIncrementalOctreeNode *node, void *aux)
Compute geometric error for the tileset and for a node.
void PreOrderTraversal(void(TreeInformation::*Visit)(vtkIncrementalOctreeNode *node, void *aux), vtkIncrementalOctreeNode *node, void *aux)
static void PrintBounds(const char *name, const double *bounds)
void PrintNode(vtkIncrementalOctreeNode *node)
void SaveTileset(vtkIncrementalOctreeNode *root, const std::string &output)
std::array< double, 6 > ComputeTightBB(vtkIdList *tileBuildings)
double ComputeGeometricErrorNodeBuildings(vtkIncrementalOctreeNode *node, void *aux)
Compute geometric error for the tileset and for a node.
void VisitCompute(vtkIncrementalOctreeNode *node, void *aux)
Computes the additional information for 'node'.
void SaveTileBuildings(vtkIncrementalOctreeNode *node, void *auxData)
void Compute()
Computes the additional information for all nodes.
nlohmann::json GenerateTileJson(vtkIncrementalOctreeNode *node)
static void PrintBounds(const std::string &name, const double *bounds)
void PostOrderTraversal(void(TreeInformation::*Visit)(vtkIncrementalOctreeNode *node, void *aux), vtkIncrementalOctreeNode *node, void *aux)
void SaveTileMesh(vtkIncrementalOctreeNode *node, void *auxData)
double ComputeGeometricErrorNodePoints(vtkIncrementalOctreeNode *node, void *aux)
Compute geometric error for the tileset and for a node.
void SaveTilesMesh()
std::string ContentTypeExtension() const
TreeInformation(vtkIncrementalOctreeNode *root, int numberOfNodes, const std::vector< vtkSmartPointer< vtkCompositeDataSet > > *buildings, const std::string &textureBaseDirectory, bool saveTextures, bool contentGLTF, const char *crs, const std::string &outputDir)
Constructors for buildings, points and meshes.
vtkSmartPointer< vtkImageData > ComputeTileMeshTexture(vtkPolyData *tileMesh, vtkImageData *textureImage)
Compute the texture image for the tile and recompute texture coordinates.
static std::array< double, 6 > ExpandBounds(double *first, double *second)
double ComputeGeometricErrorTileset()
Compute geometric error for the tileset and for a node.
void SaveTilesBuildings(bool mergeTilePolyData)
double GetRootLength2()
std::array< double, 6 > GetNodeTightBounds(int i)
Returns the bounds for node with index 'i' The versions that returns a bool returns true if the node ...
double ComputeGeometricErrorTilesetPoints()
Compute geometric error for the tileset and for a node.
double ComputeGeometricErrorTilesetMesh()
Compute geometric error for the tileset and for a node.
bool ConvertDataSetCartesian(vtkPointSet *points)
void AddGeometricError(vtkPolyData *representation)
Adds a node geometric error cell attribute for the bounding box representation for nodes on a level.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
abstract superclass for composite (multi-block or AMR) datasets
list of point or cell ids
Definition: vtkIdList.h:34
topologically and geometrically regular array of data
Definition: vtkImageData.h:54
Octree node constituting incremental octree (in support of both point location and point insertion)
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
concrete class for storing a set of points
Definition: vtkPointSet.h:70
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:91
platform-independent render window interaction including picking and frame rate control.
create a window for renderers to draw into
Hold a reference to a vtkObjectBase instance.