Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLAnnotationRulerDisplayableManager.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 
10  Module: $RCSfile: vtkMRMLAnnotationRulerDisplayableManager.h,v $
11  Date: $Date: 2010/07/26 04:48:05 $
12  Version: $Revision: 1.5 $
13 
14  =========================================================================auto=*/
15 
16 #ifndef __vtkMRMLAnnotationRulerDisplayableManager_h
17 #define __vtkMRMLAnnotationRulerDisplayableManager_h
18 
19 // Annotation includes
21 #include "vtkSlicerAnnotationsModuleMRMLDisplayableManagerExport.h"
22 
24 class vtkSlicerViewerWidget;
25 class vtkMRMLAnnotationRulerDisplayNode;
29 class vtkTextWidget;
30 
32 class VTK_SLICER_ANNOTATIONS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT
35 {
36 public:
37 
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42 protected:
43 
44  vtkMRMLAnnotationRulerDisplayableManager(){this->m_Focus="vtkMRMLAnnotationRulerNode";}
45  ~vtkMRMLAnnotationRulerDisplayableManager() override = default;
46 
48  void OnClickInRenderWindow(double x, double y, const char *associatedNodeID) override;
50  vtkAbstractWidget * CreateWidget(vtkMRMLAnnotationNode* node) override;
51 
53  void OnWidgetCreated(vtkAbstractWidget * widget, vtkMRMLAnnotationNode * node) override;
54 
56  void PropagateMRMLToWidget(vtkMRMLAnnotationNode* node, vtkAbstractWidget * widget) override;
58  void PropagateWidgetToMRML(vtkAbstractWidget * widget, vtkMRMLAnnotationNode* node) override;
59 
60  // update the ruler end point positions from the MRML node
61  void UpdatePosition(vtkAbstractWidget *widget, vtkMRMLNode *node) override;
62 
63  // Get the label from the node and unit node
64  std::string GetLabelFormat(vtkMRMLAnnotationRulerNode* rulerNode);
65 
68  double GetDistance(const double* wc1, const double* wc2);
71  double ApplyUnit(double lengthInMM);
72 
75  void OnMRMLSelectionNodeUnitModifiedEvent(vtkMRMLSelectionNode* selectionNode) override;
76 
77 private:
78 
80  void operator=(const vtkMRMLAnnotationRulerDisplayableManager&) = delete;
81 
82 };
83 
84 #endif
virtual void OnClickInRenderWindow(double x, double y, const char *associatedNodeID=nullptr)
Callback for click in RenderWindow.
virtual void OnWidgetCreated(vtkAbstractWidget *widget, vtkMRMLAnnotationNode *node)
Gets called when widget was created.
virtual void PropagateWidgetToMRML(vtkAbstractWidget *widget, vtkMRMLAnnotationNode *node)
Propagate properties of widget to MRML node.
virtual void OnMRMLSelectionNodeUnitModifiedEvent(vtkMRMLSelectionNode *)
virtual vtkAbstractWidget * CreateWidget(vtkMRMLAnnotationNode *node)
Create a widget.
virtual void PropagateMRMLToWidget(vtkMRMLAnnotationNode *node, vtkAbstractWidget *widget)
Propagate properties of MRML node to widget.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void PrintSelf(ostream &os, vtkIndent indent) override
MRML node for storing information about the active nodes in the scene.
virtual void UpdatePosition(vtkAbstractWidget *vtkNotUsed(widget), vtkMRMLNode *vtkNotUsed(node))
Update just the position for the widget, implemented by subclasses.
static vtkMRMLAnnotationDisplayableManager * New()