Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographySceneReader.cpp @ 1190:f417a0ae282b
wip: TextLayer with new fonts
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 26 Nov 2019 15:27:48 +0100 |
parents | 9889c819db01 |
children | bdc6837d5917 9ee6b28f53e8 |
comparison
equal
deleted
inserted
replaced
1184:848dcba80d81 | 1190:f417a0ae282b |
---|---|
95 | 95 |
96 scene_.LoadMask(corners, *dicomLayer, foreground, &geometry); | 96 scene_.LoadMask(corners, *dicomLayer, foreground, &geometry); |
97 } | 97 } |
98 else if (jsonLayer["type"].asString() == "text") | 98 else if (jsonLayer["type"].asString() == "text") |
99 { | 99 { |
100 if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0) | 100 ReadLayerGeometry(geometry, jsonLayer); |
101 { | 101 scene_.LoadText(jsonLayer["text"].asString(), jsonLayer["fontSize"].asUInt(), static_cast<uint8_t>(jsonLayer["foreground"].asUInt()), &geometry); |
102 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you must provide a FontRegistry if you need to re-create text layers. | |
103 } | |
104 | |
105 ReadLayerGeometry(geometry, jsonLayer); | |
106 const Orthanc::Font* font = fontRegistry_->FindFont(jsonLayer["fontName"].asString()); | |
107 if (font == NULL) // if not found, take the first font in the registry | |
108 { | |
109 font = &(fontRegistry_->GetFont(0)); | |
110 } | |
111 scene_.LoadText(*font, jsonLayer["text"].asString(), &geometry); | |
112 } | 102 } |
113 else if (jsonLayer["type"].asString() == "alpha") | 103 else if (jsonLayer["type"].asString() == "alpha") |
114 { | 104 { |
115 ReadLayerGeometry(geometry, jsonLayer); | 105 ReadLayerGeometry(geometry, jsonLayer); |
116 | 106 |
182 | 172 |
183 scene_.LoadMask(corners, *dicomLayer, foreground, &geometry); | 173 scene_.LoadMask(corners, *dicomLayer, foreground, &geometry); |
184 } | 174 } |
185 else if (jsonLayer["type"].asString() == "text") | 175 else if (jsonLayer["type"].asString() == "text") |
186 { | 176 { |
187 if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0) | 177 ReadLayerGeometry(geometry, jsonLayer); |
188 { | 178 scene_.LoadText(jsonLayer["text"].asString(), jsonLayer["fontSize"].asUInt(), static_cast<uint8_t>(jsonLayer["foreground"].asUInt()), &geometry); |
189 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you must provide a FontRegistry if you need to re-create text layers. | |
190 } | |
191 | |
192 ReadLayerGeometry(geometry, jsonLayer); | |
193 const Orthanc::Font* font = fontRegistry_->FindFont(jsonLayer["fontName"].asString()); | |
194 if (font == NULL) // if not found, take the first font in the registry | |
195 { | |
196 font = &(fontRegistry_->GetFont(0)); | |
197 } | |
198 scene_.LoadText(*font, jsonLayer["text"].asString(), &geometry); | |
199 } | 179 } |
200 else if (jsonLayer["type"].asString() == "alpha") | 180 else if (jsonLayer["type"].asString() == "alpha") |
201 { | 181 { |
202 ReadLayerGeometry(geometry, jsonLayer); | 182 ReadLayerGeometry(geometry, jsonLayer); |
203 | 183 |