Mercurial > hg > orthanc-stone
changeset 58:468c48eaa01c wasm
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 May 2017 17:35:52 +0200 |
parents | d20e25cfcf3a |
children | d2adc6189a95 |
files | Framework/Toolbox/IWebService.h Framework/Toolbox/OrthancWebService.cpp Framework/Toolbox/OrthancWebService.h Framework/Widgets/LayeredSceneWidget.h Framework/Widgets/WorldSceneWidget.h |
diffstat | 5 files changed, 26 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Toolbox/IWebService.h Wed May 03 14:45:21 2017 +0200 +++ b/Framework/Toolbox/IWebService.h Wed May 03 17:35:52 2017 +0200 @@ -30,16 +30,18 @@ class IWebService : public boost::noncopyable { public: - class IRequestObserver : public boost::noncopyable + class ICallback : public boost::noncopyable { public: - virtual ~IRequestObserver() + virtual ~ICallback() { } - virtual void NotifyError(Orthanc::IDynamicObject* payload) = 0; + virtual void NotifyError(const std::string& uri, + Orthanc::IDynamicObject* payload) = 0; - virtual void NotifyAnswer(const std::string& answer, + virtual void NotifyAnswer(const std::string& uri, + const std::string& answer, Orthanc::IDynamicObject* payload) = 0; }; @@ -47,11 +49,11 @@ { } - virtual void ScheduleGetRequest(IRequestObserver& observer, + virtual void ScheduleGetRequest(ICallback& callback, const std::string& uri, Orthanc::IDynamicObject* payload) = 0; - virtual void SchedulePostRequest(IRequestObserver& observer, + virtual void SchedulePostRequest(ICallback& callback, const std::string& uri, const std::string& body, Orthanc::IDynamicObject* payload) = 0;
--- a/Framework/Toolbox/OrthancWebService.cpp Wed May 03 14:45:21 2017 +0200 +++ b/Framework/Toolbox/OrthancWebService.cpp Wed May 03 17:35:52 2017 +0200 @@ -40,7 +40,7 @@ orthanc_.reset(new OrthancPlugins::OrthancHttpConnection(parameters)); } - void OrthancWebService::ScheduleGetRequest(IRequestObserver& observer, + void OrthancWebService::ScheduleGetRequest(ICallback& callback, const std::string& uri, Orthanc::IDynamicObject* payload) { @@ -50,15 +50,15 @@ { std::string answer; orthanc_->RestApiGet(answer, uri); - observer.NotifyAnswer(answer, tmp.release()); + callback.NotifyAnswer(uri, answer, tmp.release()); } catch (Orthanc::OrthancException&) { - observer.NotifyError(tmp.release()); + callback.NotifyError(uri, tmp.release()); } } - void OrthancWebService::SchedulePostRequest(IRequestObserver& observer, + void OrthancWebService::SchedulePostRequest(ICallback& callback, const std::string& uri, const std::string& body, Orthanc::IDynamicObject* payload) @@ -69,11 +69,11 @@ { std::string answer; orthanc_->RestApiPost(answer, uri, body); - observer.NotifyAnswer(answer, tmp.release()); + callback.NotifyAnswer(uri, answer, tmp.release()); } catch (Orthanc::OrthancException&) { - observer.NotifyError(tmp.release()); + callback.NotifyError(uri, tmp.release()); } } }
--- a/Framework/Toolbox/OrthancWebService.h Wed May 03 14:45:21 2017 +0200 +++ b/Framework/Toolbox/OrthancWebService.h Wed May 03 17:35:52 2017 +0200 @@ -44,11 +44,11 @@ return *orthanc_; } - virtual void ScheduleGetRequest(IRequestObserver& observer, + virtual void ScheduleGetRequest(ICallback& callback, const std::string& uri, Orthanc::IDynamicObject* payload); - virtual void SchedulePostRequest(IRequestObserver& observer, + virtual void SchedulePostRequest(ICallback& callback, const std::string& uri, const std::string& body, Orthanc::IDynamicObject* payload);
--- a/Framework/Widgets/LayeredSceneWidget.h Wed May 03 14:45:21 2017 +0200 +++ b/Framework/Widgets/LayeredSceneWidget.h Wed May 03 17:35:52 2017 +0200 @@ -60,6 +60,11 @@ Observers observers_; protected: + virtual void GetSceneExtent(double& x1, + double& y1, + double& x2, + double& y2); + virtual bool RenderScene(CairoContext& context, const ViewportGeometry& view); @@ -70,11 +75,6 @@ virtual SliceGeometry GetSlice(); - virtual void GetSceneExtent(double& x1, - double& y1, - double& x2, - double& y2); - ILayerRendererFactory& AddLayer(size_t& layerIndex, ILayerRendererFactory* factory); // Takes ownership
--- a/Framework/Widgets/WorldSceneWidget.h Wed May 03 14:45:21 2017 +0200 +++ b/Framework/Widgets/WorldSceneWidget.h Wed May 03 17:35:52 2017 +0200 @@ -61,6 +61,11 @@ protected: + virtual void GetSceneExtent(double& x1, + double& y1, + double& x2, + double& y2) = 0; + virtual bool RenderScene(CairoContext& context, const ViewportGeometry& view) = 0; @@ -96,11 +101,6 @@ return SliceGeometry(); } - virtual void GetSceneExtent(double& x1, - double& y1, - double& x2, - double& y2) = 0; - virtual void SetSize(unsigned int width, unsigned int height);