VTK  9.6.20260202
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
134
135#ifndef vtkSTLReader_h
136#define vtkSTLReader_h
137
139#include "vtkIOGeometryModule.h" // For export macro
140
141VTK_ABI_NAMESPACE_BEGIN
142class vtkCellArray;
143class vtkFloatArray;
145class vtkPoints;
148
149class VTKIOGEOMETRY_EXPORT vtkSTLReader : public vtkAbstractPolyDataReader
150{
151public:
153 void PrintSelf(ostream& os, vtkIndent indent) override;
154
158 static vtkSTLReader* New();
159
161
169 static bool CanReadFile(VTK_FILEPATH const char* filename);
170 static bool CanReadFile(vtkResourceStream* stream);
172
178
180
184 vtkSetMacro(RelaxedConformance, bool);
185 vtkGetMacro(RelaxedConformance, bool);
186 vtkBooleanMacro(RelaxedConformance, bool);
188
190
194 vtkSetMacro(Merging, vtkTypeBool);
195 vtkGetMacro(Merging, vtkTypeBool);
196 vtkBooleanMacro(Merging, vtkTypeBool);
198
200
204 vtkSetMacro(ScalarTags, vtkTypeBool);
205 vtkGetMacro(ScalarTags, vtkTypeBool);
206 vtkBooleanMacro(ScalarTags, vtkTypeBool);
208
210
217
227 vtkGetStringMacro(Header);
228
236
237protected:
239 ~vtkSTLReader() override;
240
245
249 vtkSetStringMacro(Header);
250 virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
251
255 char* Header = nullptr;
257
259
260private:
261 bool RelaxedConformance = true;
262
263 vtkSTLReader(const vtkSTLReader&) = delete;
264 void operator=(const vtkSTLReader&) = delete;
265
266 bool ReadBinarySTL(vtkResourceStream* stream, vtkPoints*, vtkCellArray*);
267 bool ReadASCIISTL(
268 vtkResourceParser* parser, vtkPoints*, vtkCellArray*, vtkFloatArray* scalars = nullptr);
269
270 static bool ReadBinaryHeader(vtkResourceStream* stream, vtkUnsignedCharArray* header);
271 static bool ReadBinaryTrisField(vtkResourceStream* stream, uint32_t& numTrisField);
272 static bool ReadBinaryTrisFile(vtkResourceStream* stream, vtkTypeInt64& numTrisFile);
273};
274
275VTK_ABI_NAMESPACE_END
276#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:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:139
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:309
#define VTK_FILEPATH