Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkLayoutAnnotationRenderer.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLayoutAnnotationRenderer_h
14 #define mitkLayoutAnnotationRenderer_h
15 
16 #include "MitkAnnotationExports.h"
18 
19 namespace mitk
20 {
21  class BaseRenderer;
22 
33  {
34  public:
35  static const std::string PROP_LAYOUT;
36  static const std::string PROP_LAYOUT_PRIORITY;
37  static const std::string PROP_LAYOUT_ALIGNMENT;
38  static const std::string PROP_LAYOUT_MARGIN;
39  enum Alignment
40  {
42  Top,
48  Right
49  };
50  typedef std::multimap<int, mitk::Annotation *> AnnotationRankedMap;
51  typedef std::map<Alignment, AnnotationRankedMap> AnnotationLayouterContainerMap;
52 
54  ~LayoutAnnotationRenderer() override;
55 
56  const std::string GetID() const;
57 
58  static LayoutAnnotationRenderer *GetAnnotationRenderer(const std::string &rendererID);
59 
60  void OnRenderWindowModified() override;
61 
62  static void AddAnnotation(Annotation *annotation,
63  const std::string &rendererID,
64  Alignment alignment = TopLeft,
65  double marginX = 5,
66  double marginY = 5,
67  int priority = -1);
68 
69  static void AddAnnotation(Annotation *annotation,
70  BaseRenderer *renderer,
71  Alignment alignment = TopLeft,
72  double marginX = 5,
73  double marginY = 5,
74  int priority = -1);
75 
76  void PrepareLayout();
77 
78  private:
79  LayoutAnnotationRenderer(const std::string &rendererId);
80 
81  static void AddAlignmentProperty(Annotation *annotation, Alignment activeAlignment, Point2D margin, int priority);
82 
83  void PrepareTopLeftLayout(int *displaySize);
84  void PrepareTopLayout(int *displaySize);
85  void PrepareTopRightLayout(int *displaySize);
86  void PrepareBottomLeftLayout(int *displaySize);
87  void PrepareBottomLayout(int *displaySize);
88  void PrepareBottomRightLayout(int *displaySize);
89  void PrepareLeftLayout(int *displaySize);
90  void PrepareRightLayout(int *displaySize);
91 
92  static double GetHeight(AnnotationRankedMap &annotations, BaseRenderer *renderer);
93 
94  void OnAnnotationRenderersChanged() override;
95  static const std::string ANNOTATIONRENDERER_ID;
96  AnnotationLayouterContainerMap m_AnnotationContainerMap;
97  static void SetMargin2D(Annotation *annotation, const Point2D &OffsetVector);
98  static Point2D GetMargin2D(Annotation *annotation);
99  };
100 
101 } // namespace mitk
102 
103 #endif
mitk::Annotation
Base class for all Annotation This class is to be implemented in order to create Annotation which are...
Definition: mitkAnnotation.h:27
mitk::LayoutAnnotationRenderer::PROP_LAYOUT_MARGIN
static const std::string PROP_LAYOUT_MARGIN
Definition: mitkLayoutAnnotationRenderer.h:38
mitk::LayoutAnnotationRenderer::Top
@ Top
Definition: mitkLayoutAnnotationRenderer.h:42
mitk::LayoutAnnotationRenderer::Alignment
Alignment
Definition: mitkLayoutAnnotationRenderer.h:39
mitk::LayoutAnnotationRenderer::AnnotationLayouterContainerMap
std::map< Alignment, AnnotationRankedMap > AnnotationLayouterContainerMap
Definition: mitkLayoutAnnotationRenderer.h:51
mitk::LayoutAnnotationRenderer::PROP_LAYOUT_PRIORITY
static const std::string PROP_LAYOUT_PRIORITY
Definition: mitkLayoutAnnotationRenderer.h:36
mitk::LayoutAnnotationRenderer::BottomRight
@ BottomRight
Definition: mitkLayoutAnnotationRenderer.h:46
mitk::LayoutAnnotationRenderer::PROP_LAYOUT_ALIGNMENT
static const std::string PROP_LAYOUT_ALIGNMENT
Definition: mitkLayoutAnnotationRenderer.h:37
mitk::LayoutAnnotationRenderer::PROP_LAYOUT
static const std::string PROP_LAYOUT
Definition: mitkLayoutAnnotationRenderer.h:35
mitk::LayoutAnnotationRenderer::Left
@ Left
Definition: mitkLayoutAnnotationRenderer.h:47
mitk::LayoutAnnotationRenderer::Bottom
@ Bottom
Definition: mitkLayoutAnnotationRenderer.h:45
mitk::LayoutAnnotationRenderer::TopRight
@ TopRight
Definition: mitkLayoutAnnotationRenderer.h:43
MitkAnnotationExports.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
MITKANNOTATION_EXPORT
#define MITKANNOTATION_EXPORT
Definition: MitkAnnotationExports.h:15
mitk::LayoutAnnotationRenderer
The LayoutAnnotationRenderer is used for the layouted placement of mitk::Annotation Objects.
Definition: mitkLayoutAnnotationRenderer.h:32
mitk::Point< ScalarType, 2 >
mitk::AbstractAnnotationRenderer
Baseclass of Annotation layouters An AbstractAnnotationRenderer can be implemented to control a set o...
Definition: mitkAbstractAnnotationRenderer.h:31
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::LayoutAnnotationRenderer::TopLeft
@ TopLeft
Definition: mitkLayoutAnnotationRenderer.h:41
mitkAbstractAnnotationRenderer.h
mitk::LayoutAnnotationRenderer::AnnotationRankedMap
std::multimap< int, mitk::Annotation * > AnnotationRankedMap
Definition: mitkLayoutAnnotationRenderer.h:50
mitk::LayoutAnnotationRenderer::BottomLeft
@ BottomLeft
Definition: mitkLayoutAnnotationRenderer.h:44