VTK  9.7.20260805
vtkSTLReader.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
25
26#ifndef vtkSTLReader_h
27#define vtkSTLReader_h
28
30#include "vtkIOGeometryModule.h" // For export macro
31
32VTK_ABI_NAMESPACE_BEGIN
33class vtkCellArray;
34class vtkFloatArray;
36class vtkPoints;
39
40class VTKIOGEOMETRY_EXPORT vtkSTLReader : public vtkAbstractPolyDataReader
41{
42public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
49 static vtkSTLReader* New();
50
52
60 static bool CanReadFile(VTK_FILEPATH const char* filename);
61 static bool CanReadFile(vtkResourceStream* stream);
63
69
71
75 vtkSetMacro(RelaxedConformance, bool);
76 vtkGetMacro(RelaxedConformance, bool);
77 vtkBooleanMacro(RelaxedConformance, bool);
79
81
85 vtkSetMacro(Merging, vtkTypeBool);
86 vtkGetMacro(Merging, vtkTypeBool);
87 vtkBooleanMacro(Merging, vtkTypeBool);
89
91
95 vtkSetMacro(ScalarTags, vtkTypeBool);
96 vtkGetMacro(ScalarTags, vtkTypeBool);
97 vtkBooleanMacro(ScalarTags, vtkTypeBool);
99
101
108
118 vtkGetStringMacro(Header);
119
127
128protected:
130 ~vtkSTLReader() override;
131
136
140 vtkSetStringMacro(Header);
141 virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
142
146 char* Header = nullptr;
148
150
151private:
152 bool RelaxedConformance = true;
153
154 vtkSTLReader(const vtkSTLReader&) = delete;
155 void operator=(const vtkSTLReader&) = delete;
156
157 bool ReadBinarySTL(vtkResourceStream* stream, vtkPoints*, vtkCellArray*);
158 bool ReadASCIISTL(
159 vtkResourceParser* parser, vtkPoints*, vtkCellArray*, vtkFloatArray* scalars = nullptr);
160
161 static bool ReadBinaryHeader(vtkResourceStream* stream, vtkUnsignedCharArray* header);
162 static bool ReadBinaryTrisField(vtkResourceStream* stream, uint32_t& numTrisField);
163 static bool ReadBinaryTrisFile(vtkResourceStream* stream, vtkTypeInt64& numTrisFile);
164};
165
166VTK_ABI_NAMESPACE_END
167#endif
object to represent cell connectivity
dynamic, self-adjusting array of float
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:31
Helper class to perform formatted input from vtkResourceStream.
Abstract class used for custom streams.
void SetLocator(vtkIncrementalPointLocator *locator)
Specify a spatial locator for merging points.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static bool CanReadFile(vtkResourceStream *stream)
Return true if, after a quick check of file header, it looks like the provided file or stream can be ...
vtkIncrementalPointLocator * Locator
vtkIncrementalPointLocator * NewDefaultLocator()
Create default locator.
vtkTypeBool ScalarTags
vtkMTimeType GetMTime() override
Overload standard modified time function.
vtkUnsignedCharArray * BinaryHeader
static bool CanReadFile(const char *filename)
Return true if, after a quick check of file header, it looks like the provided file or stream can be ...
static vtkSTLReader * New()
Construct object with default options.
vtkTypeBool Merging
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual void SetBinaryHeader(vtkUnsignedCharArray *binaryHeader)
~vtkSTLReader() override
dynamic, self-adjusting array of unsigned char
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_FILEPATH