Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 LayoutAnnotationRenderer_H
14 #define LayoutAnnotationRenderer_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 // LayoutAnnotationRenderer_H
The LayoutAnnotationRenderer is used for the layouted placement of mitk::Annotation Objects...
#define MITKANNOTATION_EXPORT
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
Baseclass of Annotation layouters An AbstractAnnotationRenderer can be implemented to control a set o...
std::multimap< int, mitk::Annotation * > AnnotationRankedMap
static const std::string PROP_LAYOUT_ALIGNMENT
Base class for all Annotation This class is to be implemented in order to create Annotation which are...
static const std::string PROP_LAYOUT_PRIORITY
std::map< Alignment, AnnotationRankedMap > AnnotationLayouterContainerMap