Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLRulerDisplayableManager.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Andras Lasso, PerkLab, Queen's University.
17 
18 ==============================================================================*/
19 
20 #ifndef __vtkMRMLRulerDisplayableManager_h
21 #define __vtkMRMLRulerDisplayableManager_h
22 
23 // MRMLDisplayableManager includes
25 #include "vtkMRMLDisplayableManagerExport.h"
26 
27 // STL includes
28 #include <vector>
29 
31 class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkMRMLRulerDisplayableManager
33 {
34  friend class vtkRulerRendererUpdateObserver;
35 
36 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
52  void AddRulerScalePreset(double length, int numberOfMajorDivisons, int numberOfMinorDivisions, const std::string& displayedUnitName, double displayedScale);
54  void RemoveAllRulerScalePresets();
55 
56 protected:
57 
60 
62  void Create() override;
63 
67  void OnMRMLDisplayableNodeModifiedEvent(vtkObject* caller) override;
68 
70  void UpdateFromViewNode();
71 
73  void UpdateFromRenderer();
74 
76  {
77  double Length; // actual length of the ruler (in world coordinates)
78  int NumberOfMajorDivisions; // number of major divisions of the ruler
79  int NumberOfMinorDivisions; // number of divisions of each major division
80  std::string DisplayedUnitName; // label that will be shown after the scaled length
81  double DisplayedScale; // displayed length is Length*Scale
82  };
83 
84  // List of ruler presets, ordered based on length.
85  std::vector<RulerScalePreset> RulerScalePresets;
86 
87 private:
88 
90  void operator=(const vtkMRMLRulerDisplayableManager&) = delete;
91 
92  class vtkInternal;
93  vtkInternal * Internal;
94 };
95 
96 #endif
Superclass for displayable manager classes.
void PrintSelf(ostream &os, vtkIndent indent) override
static vtkMRMLAbstractDisplayableManager * New()
virtual void OnMRMLDisplayableNodeModifiedEvent(vtkObject *caller)
Displayable manager that displays orientation marker in a slice or 3D view.
std::vector< RulerScalePreset > RulerScalePresets