Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/TextSceneLayer.cpp @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Framework/Scene2D/TextSceneLayer.cpp@30deba7bc8e2 |
children | 4fb8fdf03314 |
comparison
equal
deleted
inserted
replaced
1511:9dfeee74c1e6 | 1512:244ad1e4e76a |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "TextSceneLayer.h" | |
23 | |
24 #include <Compatibility.h> | |
25 | |
26 namespace OrthancStone | |
27 { | |
28 TextSceneLayer::TextSceneLayer() : | |
29 x_(0), | |
30 y_(0), | |
31 fontIndex_(0), | |
32 anchor_(BitmapAnchor_Center), | |
33 border_(0), | |
34 revision_(0) | |
35 { | |
36 } | |
37 | |
38 | |
39 ISceneLayer* TextSceneLayer::Clone() const | |
40 { | |
41 std::unique_ptr<TextSceneLayer> cloned(new TextSceneLayer); | |
42 cloned->SetColor(GetColor()); | |
43 cloned->x_ = x_; | |
44 cloned->y_ = y_; | |
45 cloned->utf8_ = utf8_; | |
46 cloned->fontIndex_ = fontIndex_; | |
47 cloned->anchor_ = anchor_; | |
48 cloned->border_ = border_; | |
49 return cloned.release(); | |
50 } | |
51 | |
52 void TextSceneLayer::SetPosition(double x, | |
53 double y) | |
54 { | |
55 if (x != x_ || y != y_) | |
56 { | |
57 x_ = x; | |
58 y_ = y; | |
59 revision_++; | |
60 } | |
61 } | |
62 | |
63 void TextSceneLayer::SetText(const std::string& utf8) | |
64 { | |
65 if (utf8 != utf8_) | |
66 { | |
67 utf8_ = utf8; | |
68 revision_++; | |
69 } | |
70 } | |
71 | |
72 void TextSceneLayer::SetFontIndex(size_t fontIndex) | |
73 { | |
74 if (fontIndex != fontIndex_) | |
75 { | |
76 fontIndex_ = fontIndex; | |
77 revision_++; | |
78 } | |
79 } | |
80 | |
81 void TextSceneLayer::SetAnchor(BitmapAnchor anchor) | |
82 { | |
83 if (anchor != anchor_) | |
84 { | |
85 anchor_ = anchor; | |
86 revision_++; | |
87 } | |
88 } | |
89 | |
90 void TextSceneLayer::SetBorder(unsigned int border) | |
91 { | |
92 if (border != border_) | |
93 { | |
94 border_ = border; | |
95 revision_++; | |
96 } | |
97 } | |
98 } |