Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
22 class vtkCamera;
23 class vtkMatrix4x4;
24 class vtkRenderer;
25 
29 class VTK_MRML_EXPORT vtkMRMLCameraNode : public vtkMRMLTransformableNode
30 {
31 public:
32  static vtkMRMLCameraNode *New();
34  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
35 
36  //--------------------------------------------------------------------------
38  //--------------------------------------------------------------------------
39 
40  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
41 
44  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
45 
48  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
49 
50 
53  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
54 
57  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "Camera";};
58 
62  const char* GetActiveTag();
63  virtual void SetActiveTag(const char *);
64 
67  vtkGetObjectMacro(Camera, vtkCamera);
68 
71  void SetParallelProjection(int parallelProjection);
72 
75  int GetParallelProjection();
76 
79  void SetParallelScale(double scale);
80 
83  double GetParallelScale();
84 
89  void SetViewAngle(double viewAngle);
90 
95  double GetViewAngle();
96 
100  void SetPosition(double position[3]);
101  inline void SetPosition(double x, double y, double z);
102 
106  double *GetPosition();
107  void GetPosition(double position[3]);
108 
113  void SetFocalPoint(double focalPoint[3]);
114  inline void SetFocalPoint(double x, double y, double z);
115 
119  double *GetFocalPoint();
120  void GetFocalPoint(double focalPoint[3]);
121 
125  void SetViewUp(double viewUp[3]);
126  inline void SetViewUp(double vx, double vy, double vz);
127 
131  double *GetViewUp();
132  void GetViewUp(double viewUp[3]);
133 
136  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
137  unsigned long /*event*/,
138  void * /*callData*/ ) VTK_OVERRIDE;
139 
144  vtkGetObjectMacro(AppliedTransform, vtkMatrix4x4);
145  virtual void SetAppliedTransform(vtkMatrix4x4* appliedTransform);
146 
149  enum
150  {
151  ActiveTagModifiedEvent = 30000
152  };
153 
155  virtual void SetSceneReferences() VTK_OVERRIDE;
156 
160  virtual void UpdateReferences() VTK_OVERRIDE;
161 
164  virtual void UpdateReferenceID(const char *oldID, const char *newID) VTK_OVERRIDE;
165 
167  void ResetClippingRange();
168 
169  enum Direction{
170  Right = 0,
171  Left = 1,
172  Anterior = 2,
173  Posterior = 3,
174  Superior = 4,
175  Inferior = 5
176  };
177 
178  enum RASAxis{
179  R = 0,
180  A = 1,
181  S = 2,
182  };
183 
185  X = 0,
186  Y = 1,
187  Z = 2
188  };
189 
192  void RotateTo(Direction position);
193 
196  void RotateAround(RASAxis axis, bool clockWise);
197 
199  void RotateAround(RASAxis axis, double angle = 15.);
200 
203  void TranslateAlong(ScreenAxis axis, bool positive);
204 
211  using vtkMRMLNode::Reset;
212  void Reset(bool resetRotation,
213  bool resetTranslation = true,
214  bool resetDistance = true,
215  vtkRenderer* renderer = 0);
216 protected:
220  void operator=(const vtkMRMLCameraNode&);
221 
222 
223  void SetCamera(vtkCamera* camera);
224  void SetAndObserveCamera(vtkCamera *camera);
225  vtkCamera *Camera;
226 
227  vtkMRMLCameraNode* FindActiveTagInScene(const char *tag);
228 
229  void SetInternalActiveTag(const char* id);
231 
232  vtkMatrix4x4 *AppliedTransform;
233 };
234 
235 //---------------------------------------------------------------------------
236 void vtkMRMLCameraNode::SetPosition(double x, double y, double z)
237 {
238  double pos[3] = {x, y, z};
239  this->SetPosition(pos);
240 }
241 
242 //---------------------------------------------------------------------------
243 void vtkMRMLCameraNode::SetFocalPoint(double x, double y, double z)
244 {
245  double pos[3] = {x, y, z};
246  this->SetFocalPoint(pos);
247 }
248 
249 //---------------------------------------------------------------------------
250 void vtkMRMLCameraNode::SetViewUp(double vx, double vy, double vz)
251 {
252  double viewUp[3] = {vx, vy, vz};
253  this->SetViewUp(viewUp);
254 }
255 
256 #endif
virtual void Reset(vtkMRMLNode *defaultNode)
Reset node attributes to the initial state as defined in the constructor or the passed default node...
vtkMatrix4x4 * AppliedTransform
void SetFocalPoint(double focalPoint[3])
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Transform nodes
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void SetSceneReferences()
Update the references of the node to the scene.
void operator=(const vtkMRMLTransformableNode &)
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE=0
MRMLNode methods.
MRML node to represent camera node.
void SetPosition(double position[3])
void SetViewUp(double viewUp[3])
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
MRML node for representing a node with a tranform.