comparison Framework/SmartLoader.cpp @ 270:2d64f4d39610 am-2

backup (work in progress)
author am@osimis.io
date Thu, 23 Aug 2018 14:45:04 +0200
parents 5bd4161bf11b
children 3c190e2bb3af
comparison
equal deleted inserted replaced
269:0dfa83535cd7 270:2d64f4d39610
27 { 27 {
28 SmartLoader::SmartLoader(MessageBroker& broker, IWebService& webService) : 28 SmartLoader::SmartLoader(MessageBroker& broker, IWebService& webService) :
29 IObservable(broker), 29 IObservable(broker),
30 IObserver(broker), 30 IObserver(broker),
31 imageQuality_(SliceImageQuality_FullPam), 31 imageQuality_(SliceImageQuality_FullPam),
32 webService_(webService) 32 webService_(webService),
33 orthancApiClient_(broker, webService)
33 { 34 {
34 DeclareHandledMessage(MessageType_LayerSource_GeometryReady); 35 DeclareHandledMessage(MessageType_LayerSource_GeometryReady);
35 DeclareHandledMessage(MessageType_LayerSource_LayerReady); 36 DeclareHandledMessage(MessageType_LayerSource_LayerReady);
36 DeclareIgnoredMessage(MessageType_LayerSource_GeometryError); 37 DeclareIgnoredMessage(MessageType_LayerSource_GeometryError);
37 DeclareIgnoredMessage(MessageType_LayerSource_ContentChanged); 38 DeclareIgnoredMessage(MessageType_LayerSource_ContentChanged);
38 DeclareIgnoredMessage(MessageType_LayerSource_SliceChanged); 39 DeclareIgnoredMessage(MessageType_LayerSource_SliceChanged);
40
41 // DeclareHandledMessage(MessageType_OrthancApi_InternalGetJsonResponseReady);
42 // DeclareIgnoredMessage(MessageType_OrthancApi_InternalGetJsonResponseError);
39 } 43 }
40 44
41 void SmartLoader::HandleMessage(IObservable& from, const IMessage& message) 45 void SmartLoader::HandleMessage(IObservable& from, const IMessage& message)
42 { 46 {
43 switch (message.GetType()) { 47 switch (message.GetType()) {
49 case MessageType_LayerSource_LayerReady: 53 case MessageType_LayerSource_LayerReady:
50 { 54 {
51 const OrthancFrameLayerSource* layerSource=dynamic_cast<const OrthancFrameLayerSource*>(&from); 55 const OrthancFrameLayerSource* layerSource=dynamic_cast<const OrthancFrameLayerSource*>(&from);
52 // TODO keep track of objects that have been loaded already 56 // TODO keep track of objects that have been loaded already
53 }; break; 57 }; break;
58 // case MessageType_OrthancApi_GetStudyIds_Ready:
59 // {
60
61 // const OrthancApiClient::GetJsonResponseReadyMessage& msg = dynamic_cast<OrthancApiClient::GetJsonResponseReadyMessage&>(message);
62
63 // }; break;
54 default: 64 default:
55 VLOG("unhandled message type" << message.GetType()); 65 VLOG("unhandled message type" << message.GetType());
56 } 66 }
57 67
58 // forward messages to its own observers 68 // forward messages to its own observers
73 layerSource->LoadFrame(instanceId, frame); 83 layerSource->LoadFrame(instanceId, frame);
74 84
75 return layerSource.release(); 85 return layerSource.release();
76 } 86 }
77 87
88 void SmartLoader::LoadStudyList()
89 {
90 // orthancApiClient_.ScheduleGetJsonRequest("/studies");
91 }
78 92
79 void PreloadStudy(const std::string studyId) 93 void PreloadStudy(const std::string studyId)
80 { 94 {
81 /* TODO */ 95 /* TODO */
82 } 96 }