Mercurial > hg > orthanc-stone
annotate Framework/Viewport/ViewportBase.h @ 942:685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 05 Aug 2019 12:27:27 +0200 |
parents | 88bf49aebc13 |
children | 1091b2adeb5a |
rev | line source |
---|---|
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 #pragma once |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "IViewport.h" |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include <boost/shared_ptr.hpp> |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace OrthancStone |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 class ViewportBase : public IViewport |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 private: |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 std::string identifier_; |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 boost::shared_ptr<Scene2D> scene_; |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 public: |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 ViewportBase(const std::string& identifier); |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 ViewportBase(const std::string& identifier, |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 boost::shared_ptr<Scene2D>& scene); |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
41 virtual Scene2D& GetScene() ORTHANC_OVERRIDE |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 { |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 return *scene_; |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 } |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
46 virtual const std::string& GetCanvasIdentifier() const ORTHANC_OVERRIDE |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 { |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 return identifier_; |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 } |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
51 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const ORTHANC_OVERRIDE; |
905
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
52 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
53 virtual void Refresh() ORTHANC_OVERRIDE |
905
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
54 { |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
55 GetCompositor().Refresh(); |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
56 } |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
57 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
58 virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE |
905
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
59 { |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
60 return GetCompositor().GetCanvasWidth(); |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
61 } |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
62 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
63 virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE |
905
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
64 { |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
65 return GetCompositor().GetCanvasHeight(); |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
66 } |
88bf49aebc13
introduced ICompositor and allow SdlViewport to work with a CairoCompositor (to run on machines without OpenGL drivers)
Alain Mazy <alain@mazy.be>
parents:
891
diff
changeset
|
67 |
942
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
68 #if ORTHANC_ENABLE_LOCALE == 1 |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
69 virtual void SetFont(size_t index, |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
70 Orthanc::EmbeddedResources::FileResourceId resource, |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
71 unsigned int fontSize, |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
72 Orthanc::Encoding codepage) ORTHANC_OVERRIDE |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
73 { |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
74 return GetCompositor().SetFont(index, resource, fontSize, codepage); |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
75 } |
685c9a2d115f
Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
Benjamin Golinvaux <bgo@osimis.io>
parents:
905
diff
changeset
|
76 #endif |
891
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 }; |
0aff28f15ea2
new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |