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
50
53 void Copy(vtkMRMLNode* node) override;
54
58
61 const char* GetNodeTagName() override {return "Camera";};
62
67 const char* GetActiveTag();
68 virtual void SetActiveTag(const char *);
69
78 void SetLayoutName(const char* layoutName);
80
83 vtkGetObjectMacro(Camera, vtkCamera);
84
87 void SetParallelProjection(int parallelProjection);
88
92
95 void SetParallelScale(double scale);
96
100
105 void SetViewAngle(double viewAngle);
106
111 double GetViewAngle();
112
118 void SetPosition(double position[3]);
119 inline void SetPosition(double x, double y, double z);
120
124 double* GetPosition() VTK_SIZEHINT(3);
125 void GetPosition(double position[3]);
126
131 void SetFocalPoint(double focalPoint[3]);
132 inline void SetFocalPoint(double x, double y, double z);
133
137 double* GetFocalPoint() VTK_SIZEHINT(3);
138 void GetFocalPoint(double focalPoint[3]);
139
143 void SetViewUp(double viewUp[3]);
144 inline void SetViewUp(double vx, double vy, double vz);
145
149 double* GetViewUp() VTK_SIZEHINT(3);
150 void GetViewUp(double viewUp[3]);
151
154 void ProcessMRMLEvents ( vtkObject * /*caller*/,
155 unsigned long /*event*/,
156 void * /*callData*/ ) override;
157
162 vtkGetObjectMacro(AppliedTransform, vtkMatrix4x4);
163 virtual void SetAppliedTransform(vtkMatrix4x4* appliedTransform);
164
167 enum
168 {
169 LayoutNameModifiedEvent = 30000,
170 ActiveTagModifiedEvent = LayoutNameModifiedEvent, // deprecated, kept for backward compatibility only
171 CameraInteractionEvent = 31000,
172 ResetCameraClippingEvent = 32000,
173 };
174
177
179 Right = 0,
180 Left = 1,
181 Anterior = 2,
182 Posterior = 3,
183 Superior = 4,
184 Inferior = 5
185 };
186
188 R = 0,
189 A = 1,
190 S = 2,
191 };
192
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,
222 bool resetTranslation = true,
223 bool resetDistance = true,
224 vtkRenderer* renderer = nullptr);
225
231 void SetInteracting(int);
232 vtkGetMacro(Interacting, int);
233 vtkBooleanMacro(Interacting, int);
234
249
255 void SetInteractionFlags(unsigned int);
256 vtkGetMacro(InteractionFlags, unsigned int);
257
258protected:
263
264
265 void SetCamera(vtkCamera* camera);
266 void SetAndObserveCamera(vtkCamera* camera);
267 vtkCamera* Camera{nullptr};
268
269 std::string InternalActiveTag; // variable to hold returned value of GetActiveTag
270
271 vtkMatrix4x4* AppliedTransform;
272
274 unsigned int InteractionFlags;
275};
276
277//---------------------------------------------------------------------------
278void vtkMRMLCameraNode::SetPosition(double x, double y, double z)
279{
280 double pos[3] = {x, y, z};
281 this->SetPosition(pos);
282}
283
284//---------------------------------------------------------------------------
285void vtkMRMLCameraNode::SetFocalPoint(double x, double y, double z)
286{
287 double pos[3] = {x, y, z};
288 this->SetFocalPoint(pos);
289}
290
291//---------------------------------------------------------------------------
292void vtkMRMLCameraNode::SetViewUp(double vx, double vy, double vz)
293{
294 double viewUp[3] = {vx, vy, vz};
295 this->SetViewUp(viewUp);
296}
297
298#endif
MRML node to represent camera node.
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
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])
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)
void TranslateAlong(ScreenAxis axis, bool positive)
Abstract Superclass for all specific types of MRML nodes.
virtual void Reset(vtkMRMLNode *defaultNode)
Reset node attributes to the initial state as defined in the constructor or the passed default node.
MRML node for representing a node with a transform.