comparison Framework/Radiography/RadiographyScene.cpp @ 1204:b519c1c878f1 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2019 21:24:29 +0100
parents 54cbffabdc45 ab958fd99b07
children 21c2b0eee53c
comparison
equal deleted inserted replaced
1203:f3bb9a6dd949 1204:b519c1c878f1
238 assert(found->second != NULL); 238 assert(found->second != NULL);
239 return *found->second; 239 return *found->second;
240 } 240 }
241 } 241 }
242 242
243 RadiographyLayer& RadiographyScene::GetLayer(size_t layerIndex)
244 {
245 Layers::const_iterator found = layers_.find(layerIndex);
246
247 if (found == layers_.end())
248 {
249 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
250 }
251 else
252 {
253 assert(found->second != NULL);
254 return *found->second;
255 }
256 }
257
243 bool RadiographyScene::GetWindowing(float& center, 258 bool RadiographyScene::GetWindowing(float& center,
244 float& width) const 259 float& width) const
245 { 260 {
246 if (hasWindowing_) 261 if (hasWindowing_)
247 { 262 {
273 hasWindowing_ = true; 288 hasWindowing_ = true;
274 windowingCenter_ = center; 289 windowingCenter_ = center;
275 windowingWidth_ = width; 290 windowingWidth_ = width;
276 291
277 BroadcastMessage(RadiographyScene::WindowingChangedMessage(*this)); 292 BroadcastMessage(RadiographyScene::WindowingChangedMessage(*this));
293 }
294
295
296 RadiographyLayer& RadiographyScene::UpdateText(size_t layerIndex,
297 const std::string& utf8,
298 unsigned int fontSize,
299 uint8_t foreground)
300 {
301 RadiographyTextLayer& textLayer = dynamic_cast<RadiographyTextLayer&>(GetLayer(layerIndex));
302 textLayer.SetText(utf8, fontSize, foreground);
303
304 BroadcastMessage(RadiographyScene::ContentChangedMessage(*this, textLayer));
305 BroadcastMessage(RadiographyScene::LayerEditedMessage(*this, textLayer));
306 return textLayer;
278 } 307 }
279 308
280 309
281 RadiographyLayer& RadiographyScene::LoadText(const std::string& utf8, 310 RadiographyLayer& RadiographyScene::LoadText(const std::string& utf8,
282 unsigned int fontSize, 311 unsigned int fontSize,
283 uint8_t foreground, 312 uint8_t foreground,
284 RadiographyLayer::Geometry* geometry) 313 RadiographyLayer::Geometry* geometry)
285 { 314 {
286 std::auto_ptr<RadiographyTextLayer> alpha(new RadiographyTextLayer(*this)); 315 std::auto_ptr<RadiographyTextLayer> alpha(new RadiographyTextLayer(*this));
287 alpha->LoadText(utf8, fontSize, foreground); 316 alpha->SetText(utf8, fontSize, foreground);
288 if (geometry != NULL) 317 if (geometry != NULL)
289 { 318 {
290 alpha->SetGeometry(*geometry); 319 alpha->SetGeometry(*geometry);
291 } 320 }
292 321