Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLCameraNode.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8 Program: 3D Slicer
9 Module: $RCSfile: vtkMRMLCameraNode.h,v $
10 Date: $Date: 2006/03/19 17:12:28 $
11 Version: $Revision: 1.6 $
12
13=========================================================================auto=*/
14
15#ifndef __vtkMRMLCameraNode_h
16#define __vtkMRMLCameraNode_h
17
18// MRML includes
20
21// VTK includes
22class vtkCamera;
23class vtkMatrix4x4;
24class vtkRenderer;
25
29class VTK_MRML_EXPORT vtkMRMLCameraNode : public vtkMRMLTransformableNode
30{
31public:
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
36 //--------------------------------------------------------------------------
38 //--------------------------------------------------------------------------
39
41
44 void ReadXMLAttributes(const char** atts) override;
45
48 void WriteXML(ostream& of, int indent) override;
49
52 void Copy(vtkMRMLNode* node) override;
53
57
60 const char* GetNodeTagName() override { return "Camera"; };
61
66 const char* GetActiveTag();
67 virtual void SetActiveTag(const char*);
68
77 void SetLayoutName(const char* layoutName);
79
82 vtkGetObjectMacro(Camera, vtkCamera);
83
86 void SetParallelProjection(int parallelProjection);
87
91
94 void SetParallelScale(double scale);
95
99
104 void SetViewAngle(double viewAngle);
105
110 double GetViewAngle();
111
117 void SetPosition(double position[3]);
118 inline void SetPosition(double x, double y, double z);
119
123 double* GetPosition() VTK_SIZEHINT(3);
124 void GetPosition(double position[3]);
125
130 void SetFocalPoint(double focalPoint[3]);
131 inline void SetFocalPoint(double x, double y, double z);
132
136 double* GetFocalPoint() VTK_SIZEHINT(3);
137 void GetFocalPoint(double focalPoint[3]);
138
142 void SetViewUp(double viewUp[3]);
143 inline void SetViewUp(double vx, double vy, double vz);
144
148 double* GetViewUp() VTK_SIZEHINT(3);
149 void GetViewUp(double viewUp[3]);
150
153 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
154
159 vtkGetObjectMacro(AppliedTransform, vtkMatrix4x4);
160 virtual void SetAppliedTransform(vtkMatrix4x4* appliedTransform);
161
164 enum
165 {
167 ActiveTagModifiedEvent = LayoutNameModifiedEvent, // deprecated, kept for backward compatibility only
170 };
171
174
176 {
177 Right = 0,
178 Left = 1,
183 };
184
186 {
187 R = 0,
188 A = 1,
189 S = 2,
190 };
191
193 {
194 X = 0, // left
195 Y = 1, // up
196 Z = 2 // forward
197 };
198
201 void RotateTo(Direction position);
202
205 void RotateAround(RASAxis axis, bool clockWise);
206
208 void RotateAround(RASAxis axis, double angle = 15.);
209
212 void TranslateAlong(ScreenAxis axis, bool positive);
213
220 using vtkMRMLNode::Reset;
221 void Reset(bool resetRotation, bool resetTranslation = true, bool resetDistance = true, vtkRenderer* renderer = nullptr);
222
228 void SetInteracting(int);
229 vtkGetMacro(Interacting, int);
230 vtkBooleanMacro(Interacting, int);
231
246
252 void SetInteractionFlags(unsigned int);
253 vtkGetMacro(InteractionFlags, unsigned int);
254
255protected:
260
261 void SetCamera(vtkCamera* camera);
262 void SetAndObserveCamera(vtkCamera* camera);
263 vtkCamera* Camera{ nullptr };
264
265 std::string InternalActiveTag; // variable to hold returned value of GetActiveTag
266
267 vtkMatrix4x4* AppliedTransform;
268
270 unsigned int InteractionFlags;
271};
272
273//---------------------------------------------------------------------------
274void vtkMRMLCameraNode::SetPosition(double x, double y, double z)
275{
276 double pos[3] = { x, y, z };
277 this->SetPosition(pos);
278}
279
280//---------------------------------------------------------------------------
281void vtkMRMLCameraNode::SetFocalPoint(double x, double y, double z)
282{
283 double pos[3] = { x, y, z };
284 this->SetFocalPoint(pos);
285}
286
287//---------------------------------------------------------------------------
288void vtkMRMLCameraNode::SetViewUp(double vx, double vy, double vz)
289{
290 double viewUp[3] = { vx, vy, vz };
291 this->SetViewUp(viewUp);
292}
293
294#endif
static vtkMRMLCameraNode * New()
int GetParallelProjection()
Set camera ParallelProjection flag.
void SetParallelProjection(int parallelProjection)
Set camera ParallelProjection flag.
void SetCamera(vtkCamera *camera)
char * GetLayoutName()
void RotateAround(RASAxis axis, bool clockWise)
void SetViewUp(double viewUp[3])
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
void operator=(const vtkMRMLCameraNode &)
vtkMRMLCopyContentMacro(vtkMRMLCameraNode)
void SetLayoutName(const char *layoutName)
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object.
double * GetPosition() VTK_SIZEHINT(3)
void Reset(bool resetRotation, bool resetTranslation=true, bool resetDistance=true, vtkRenderer *renderer=nullptr)
void SetPosition(double position[3])
vtkMatrix4x4 * AppliedTransform
void ResetClippingRange()
Reset the clipping range just based on its position and focal point.
void RotateAround(RASAxis axis, double angle=15.)
15 degrees by default
const char * GetActiveTag()
void SetParallelScale(double scale)
Set camera Parallel Scale.
void SetAndObserveCamera(vtkCamera *camera)
void SetViewAngle(double viewAngle)
double GetViewAngle()
void PrintSelf(ostream &os, vtkIndent indent) override
double * GetViewUp() VTK_SIZEHINT(3)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
~vtkMRMLCameraNode() override
vtkMRMLCameraNode(const vtkMRMLCameraNode &)
void SetFocalPoint(double focalPoint[3])
double * GetFocalPoint() VTK_SIZEHINT(3)
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Camera nodes
std::string InternalActiveTag
void SetInteracting(int)
void RotateTo(Direction position)
double GetParallelScale()
Set camera Parallel Scale.
virtual void SetActiveTag(const char *)
unsigned int InteractionFlags
void SetInteractionFlags(unsigned int)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual void SetAppliedTransform(vtkMatrix4x4 *appliedTransform)
void TranslateAlong(ScreenAxis axis, bool positive)
virtual void Reset(vtkMRMLNode *defaultNode)
Reset node attributes to the initial state as defined in the constructor or the passed default node.