VTK  9.1.0
vtkContext3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContext3D.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 =========================================================================*/
15 
46 #ifndef vtkContext3D_h
47 #define vtkContext3D_h
48 
49 #include "vtkObject.h"
50 #include "vtkRenderingContext2DModule.h" // For export macro
51 #include "vtkSmartPointer.h" // For SP ivars.
52 #include "vtkVector.h" // For the vector coordinates.
53 
54 class vtkContextDevice3D;
55 class vtkPen;
56 class vtkBrush;
57 class vtkTransform;
58 
59 class VTKRENDERINGCONTEXT2D_EXPORT vtkContext3D : public vtkObject
60 {
61 public:
62  vtkTypeMacro(vtkContext3D, vtkObject);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
68  static vtkContext3D* New();
69 
75  bool Begin(vtkContextDevice3D* device);
76 
81 
87  bool End();
88 
92  void DrawLine(const vtkVector3f& start, const vtkVector3f& end);
93 
97  void DrawPoly(const float* points, int n);
98 
103 
107  void DrawPoints(const float* points, int n);
108 
114  void DrawPoints(const float* points, int n, unsigned char* colors, int nc_comps);
115 
119  void DrawTriangleMesh(const float* mesh, int n, const unsigned char* colors, int nc);
120 
126  void ApplyPen(vtkPen* pen);
127 
133  void ApplyBrush(vtkBrush* brush);
134 
140  void SetTransform(vtkTransform* transform);
141 
146 
153  void AppendTransform(vtkTransform* transform);
154 
156 
160  void PushMatrix();
161  void PopMatrix();
163 
165 
172  void EnableClippingPlane(int i, double* planeEquation);
173  void DisableClippingPlane(int i);
175 
176 protected:
178  ~vtkContext3D() override;
179 
180  vtkSmartPointer<vtkContextDevice3D> Device; // The underlying device
182 
183 private:
184  vtkContext3D(const vtkContext3D&) = delete;
185  void operator=(const vtkContext3D&) = delete;
186 };
187 
188 #endif // VTKCONTEXT3D_H
vtkBrush
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:97
vtkContext3D::DrawLine
void DrawLine(const vtkVector3f &start, const vtkVector3f &end)
Draw a line between the specified points.
vtkContext3D::PushMatrix
void PushMatrix()
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when av...
vtkContext3D::GetDevice
vtkContextDevice3D * GetDevice()
Get access to the underlying 3D context.
vtkContext3D::New
static vtkContext3D * New()
Creates a 3D context object.
vtkContext3D::DrawPoints
void DrawPoints(const float *points, int n)
Draw a sequence of points at the specified locations.
vtkContext3D::vtkContext3D
vtkContext3D()
vtkContextDevice3D
Abstract class for drawing 3D primitives.
Definition: vtkContextDevice3D.h:42
vtkSmartPointer< vtkContextDevice3D >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkVector.h
vtkContext3D::AppendTransform
void AppendTransform(vtkTransform *transform)
Append the transform for the context, the underlying device will use the matrix of the transform.
vtkContext3D::Device
vtkSmartPointer< vtkContextDevice3D > Device
Definition: vtkContext3D.h:180
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkContext3D::DrawTriangleMesh
void DrawTriangleMesh(const float *mesh, int n, const unsigned char *colors, int nc)
Draw triangles to generate the specified mesh.
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkContext3D::~vtkContext3D
~vtkContext3D() override
vtkContext3D::DisableClippingPlane
void DisableClippingPlane(int i)
Enable/Disable the specified clipping plane.
vtkVector3f
Definition: vtkVector.h:534
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkContext3D::DrawPoint
void DrawPoint(const vtkVector3f &point)
Draw a point at the point in 3D space.
vtkContext3D::End
bool End()
Ends painting on the device, you would not usually need to call this as it should be called by the de...
vtkSmartPointer.h
vtkContext3D::GetTransform
vtkTransform * GetTransform()
Compute the current transform applied to the context.
vtkObject.h
vtkContext3D::DrawPoints
void DrawPoints(const float *points, int n, unsigned char *colors, int nc_comps)
Draw a sequence of points at the specified locations.
vtkContext3D::SetTransform
void SetTransform(vtkTransform *transform)
Set the transform for the context, the underlying device will use the matrix of the transform.
vtkContext3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkContext3D::DrawPoly
void DrawPoly(const float *points, int n)
Draw a poly line between the specified points.
vtkContext3D::ApplyPen
void ApplyPen(vtkPen *pen)
Apply the supplied pen which controls the outlines of shapes, as well as lines, points and related pr...
vtkContext3D
Class for drawing 3D primitives to a graphical context.
Definition: vtkContext3D.h:60
vtkContext3D::ApplyBrush
void ApplyBrush(vtkBrush *brush)
Apply the supplied brush which controls the outlines of shapes, as well as lines, points and related ...
vtkContext3D::Begin
bool Begin(vtkContextDevice3D *device)
Begin painting on a vtkContextDevice3D, no painting can occur before this call has been made.
vtkContext3D::PopMatrix
void PopMatrix()
Push/pop the transformation matrix for the painter (sets the underlying matrix for the device when av...
vtkPen
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:136
vtkContext3D::Transform
vtkSmartPointer< vtkTransform > Transform
Definition: vtkContext3D.h:181
vtkContext3D::EnableClippingPlane
void EnableClippingPlane(int i, double *planeEquation)
Enable/Disable the specified clipping plane.