annotate Framework/Scene2D/ColorSceneLayer.h @ 643:f0008c55e5f7

getting rid of MessageType enumeration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 10 May 2019 17:34:48 +0200
parents 500c3f70b6c2
children 61ba4b504e9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "ISceneLayer.h"
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
25 #include <Core/Enumerations.h>
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <stdint.h>
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class ColorSceneLayer : public ISceneLayer
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 uint8_t red_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 uint8_t green_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 uint8_t blue_;
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
37 uint64_t revision_;
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
38
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
39 protected:
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
40 void BumpRevision()
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
41 {
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
42 // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
43 revision_++;
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
44 }
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
45
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 public:
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ColorSceneLayer() :
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 red_(255),
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 green_(255),
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
50 blue_(255),
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
51 revision_(0)
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
55 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
56 {
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
57 return revision_;
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
58 }
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
59
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 void SetColor(uint8_t red,
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 uint8_t green,
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 uint8_t blue)
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 red_ = red;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 green_ = green;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 blue_ = blue;
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
67 BumpRevision();
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 uint8_t GetRed() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 return red_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 uint8_t GetGreen() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 return green_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 uint8_t GetBlue() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 return blue_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 float GetRedAsFloat() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 return static_cast<float>(red_) / 255.0f;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 float GetGreenAsFloat() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 return static_cast<float>(green_) / 255.0f;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 float GetBlueAsFloat() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 return static_cast<float>(blue_) / 255.0f;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 };
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }