# HG changeset patch # User Sebastien Jodogne # Date 1493825752 -7200 # Node ID 468c48eaa01c9280bc06c234dc6ab5c648c70974 # Parent d20e25cfcf3acb30b2b82c95695cb7af34b2a67f refactoring diff -r d20e25cfcf3a -r 468c48eaa01c Framework/Toolbox/IWebService.h --- 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; diff -r d20e25cfcf3a -r 468c48eaa01c Framework/Toolbox/OrthancWebService.cpp --- 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()); } } } diff -r d20e25cfcf3a -r 468c48eaa01c Framework/Toolbox/OrthancWebService.h --- 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); diff -r d20e25cfcf3a -r 468c48eaa01c Framework/Widgets/LayeredSceneWidget.h --- 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 diff -r d20e25cfcf3a -r 468c48eaa01c Framework/Widgets/WorldSceneWidget.h --- 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);