Mercurial > hg > orthanc-stone
comparison Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp @ 377:8eb4fe74000f
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 05 Nov 2018 16:18:27 +0100 |
parents | 7a364e44fbb4 |
children | 20f149669c1f |
comparison
equal
deleted
inserted
replaced
376:70256a53ff21 | 377:8eb4fe74000f |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "SimpleViewerApplication.h" | 22 #include "SimpleViewerApplication.h" |
23 | 23 |
24 #if ORTHANC_ENABLE_QT==1 | 24 #if ORTHANC_ENABLE_QT == 1 |
25 #include "Qt/SimpleViewerMainWindow.h" | 25 # include "Qt/SimpleViewerMainWindow.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #if ORTHANC_ENABLE_WASM==1 | 28 #if ORTHANC_ENABLE_WASM == 1 |
29 #include <Platforms/Wasm/WasmViewport.h> | 29 # include <Platforms/Wasm/WasmViewport.h> |
30 #endif | 30 #endif |
31 | 31 |
32 namespace SimpleViewer { | 32 namespace SimpleViewer |
33 { | |
33 | 34 |
34 void SimpleViewerApplication::Initialize(StoneApplicationContext* context, | 35 void SimpleViewerApplication::Initialize(StoneApplicationContext* context, |
35 IStatusBar& statusBar, | 36 IStatusBar& statusBar, |
36 const boost::program_options::variables_map& parameters) | 37 const boost::program_options::variables_map& parameters) |
37 { | 38 { |
99 options.add(generic); | 100 options.add(generic); |
100 } | 101 } |
101 | 102 |
102 void SimpleViewerApplication::OnStudyListReceived(const OrthancApiClient::JsonResponseReadyMessage& message) | 103 void SimpleViewerApplication::OnStudyListReceived(const OrthancApiClient::JsonResponseReadyMessage& message) |
103 { | 104 { |
104 const Json::Value& response = message.Response; | 105 const Json::Value& response = message.GetJson(); |
105 | 106 |
106 if (response.isArray() && response.size() > 1) | 107 if (response.isArray() && response.size() > 1) |
107 { | 108 { |
108 SelectStudy(response[0].asString()); | 109 SelectStudy(response[0].asString()); |
109 } | 110 } |
110 } | 111 } |
111 void SimpleViewerApplication::OnStudyReceived(const OrthancApiClient::JsonResponseReadyMessage& message) | 112 void SimpleViewerApplication::OnStudyReceived(const OrthancApiClient::JsonResponseReadyMessage& message) |
112 { | 113 { |
113 const Json::Value& response = message.Response; | 114 const Json::Value& response = message.GetJson(); |
114 | 115 |
115 if (response.isObject() && response["Series"].isArray()) | 116 if (response.isObject() && response["Series"].isArray()) |
116 { | 117 { |
117 for (size_t i=0; i < response["Series"].size(); i++) | 118 for (size_t i=0; i < response["Series"].size(); i++) |
118 { | 119 { |
121 } | 122 } |
122 } | 123 } |
123 | 124 |
124 void SimpleViewerApplication::OnSeriesReceived(const OrthancApiClient::JsonResponseReadyMessage& message) | 125 void SimpleViewerApplication::OnSeriesReceived(const OrthancApiClient::JsonResponseReadyMessage& message) |
125 { | 126 { |
126 const Json::Value& response = message.Response; | 127 const Json::Value& response = message.GetJson(); |
127 | 128 |
128 if (response.isObject() && response["Instances"].isArray() && response["Instances"].size() > 0) | 129 if (response.isObject() && response["Instances"].isArray() && response["Instances"].size() > 0) |
129 { | 130 { |
130 // keep track of all instances IDs | 131 // keep track of all instances IDs |
131 const std::string& seriesId = response["ID"].asString(); | 132 const std::string& seriesId = response["ID"].asString(); |
164 orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived)); | 165 orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived)); |
165 } | 166 } |
166 | 167 |
167 void SimpleViewerApplication::OnWidgetGeometryChanged(const LayerWidget::GeometryChangedMessage& message) | 168 void SimpleViewerApplication::OnWidgetGeometryChanged(const LayerWidget::GeometryChangedMessage& message) |
168 { | 169 { |
169 message.origin_.FitContent(); | 170 message.GetOrigin().FitContent(); |
170 } | 171 } |
171 | 172 |
172 void SimpleViewerApplication::SelectSeriesInMainViewport(const std::string& seriesId) | 173 void SimpleViewerApplication::SelectSeriesInMainViewport(const std::string& seriesId) |
173 { | 174 { |
174 smartLoader_->SetFrameInWidget(*mainWidget_, 0, instancesIdsPerSeriesId_[seriesId][0], 0); | 175 smartLoader_->SetFrameInWidget(*mainWidget_, 0, instancesIdsPerSeriesId_[seriesId][0], 0); |