comparison Framework/Viewport/ViewportBase.h @ 1053:32b403a47b19

simplifying IViewport
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Oct 2019 15:24:48 +0200
parents 6a9300ecfa13
children af456106576c
comparison
equal deleted inserted replaced
1052:0cc62db7e61b 1053:32b403a47b19
26 26
27 namespace OrthancStone 27 namespace OrthancStone
28 { 28 {
29 class ViewportBase : public IViewport 29 class ViewportBase : public IViewport
30 { 30 {
31 private:
32 std::string identifier_;
33 boost::shared_ptr<Scene2D> scene_;
34
31 public: 35 public:
32 ViewportBase(const std::string& identifier); 36 ViewportBase(const std::string& identifier);
33 37
34 ViewportBase(const std::string& identifier, 38 ViewportBase(const std::string& identifier,
35 boost::shared_ptr<Scene2D>& scene); 39 boost::shared_ptr<Scene2D>& scene);
42 virtual const std::string& GetCanvasIdentifier() const ORTHANC_OVERRIDE 46 virtual const std::string& GetCanvasIdentifier() const ORTHANC_OVERRIDE
43 { 47 {
44 return identifier_; 48 return identifier_;
45 } 49 }
46 50
47 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const ORTHANC_OVERRIDE; 51 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) ORTHANC_OVERRIDE;
48
49 virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE
50 {
51 if (GetCompositor())
52 return GetCompositor()->GetCanvasWidth();
53 else
54 return 0;
55 }
56
57 virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE
58 {
59 if (GetCompositor())
60 return GetCompositor()->GetCanvasHeight();
61 else
62 return 0;
63 }
64
65 #if ORTHANC_ENABLE_LOCALE == 1
66 virtual void SetFont(size_t index,
67 Orthanc::EmbeddedResources::FileResourceId resource,
68 unsigned int fontSize,
69 Orthanc::Encoding codepage) ORTHANC_OVERRIDE
70 {
71 return GetCompositor()->SetFont(index, resource, fontSize, codepage);
72 }
73 #endif
74
75 private:
76 std::string identifier_;
77 boost::shared_ptr<Scene2D> scene_;
78 }; 52 };
79 } 53 }