# HG changeset patch # User Benjamin Golinvaux # Date 1571142619 -7200 # Node ID 6dd90b8d15892c47fc44b491e93395ce9c4678a8 # Parent 2d6237221ff107b9fc179c45826768cdd5470216 Fixes related to refactorings in viewports. diff -r 2d6237221ff1 -r 6dd90b8d1589 Framework/Messages/LockingEmitter.h --- a/Framework/Messages/LockingEmitter.h Tue Oct 15 10:54:53 2019 +0200 +++ b/Framework/Messages/LockingEmitter.h Tue Oct 15 14:30:19 2019 +0200 @@ -20,6 +20,9 @@ #pragma once +#include +#include + #include "IMessageEmitter.h" #include "IObservable.h" @@ -39,7 +42,7 @@ class LockingEmitter : public IMessageEmitter { private: - boost::shared_mutex mutex_; + boost::shared_mutex mutex_; MessageBroker broker_; IObservable oracleObservable_; diff -r 2d6237221ff1 -r 6dd90b8d1589 Framework/StoneException.h --- a/Framework/StoneException.h Tue Oct 15 10:54:53 2019 +0200 +++ b/Framework/StoneException.h Tue Oct 15 14:30:19 2019 +0200 @@ -43,6 +43,7 @@ }; + class StoneException { protected: @@ -63,7 +64,35 @@ virtual const char* What() const { - return "TODO: EnumerationToString for StoneException"; + switch (errorCode_) + { + case ErrorCode_Success: + return "Success"; + break; + case ErrorCode_OrthancError: + return "OrthancError"; + break; + case ErrorCode_ApplicationException: + return "ApplicationException"; + break; + case ErrorCode_NotImplemented: + return "NotImplemented"; + break; + case ErrorCode_CanOnlyAddOneLayerAtATime: + return "CanOnlyAddOneLayerAtATime"; + break; + case ErrorCode_CommandJsonInvalidFormat: + return "CommandJsonInvalidFormat"; + break; + case ErrorCode_WebGLContextLost: + return "WebGLContextLost"; + break; + case ErrorCode_Last: + return "Last"; + break; + default: + return "Unknown exception code!"; + } } }; } diff -r 2d6237221ff1 -r 6dd90b8d1589 Framework/Viewport/IViewport.h --- a/Framework/Viewport/IViewport.h Tue Oct 15 10:54:53 2019 +0200 +++ b/Framework/Viewport/IViewport.h Tue Oct 15 14:30:19 2019 +0200 @@ -42,10 +42,13 @@ virtual void Refresh() = 0; - virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) = 0; + virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const = 0; virtual bool HasCompositor() const = 0; virtual ICompositor& GetCompositor() = 0; + + virtual const ICompositor& GetCompositor() const = 0; }; } + diff -r 2d6237221ff1 -r 6dd90b8d1589 Framework/Viewport/ViewportBase.cpp --- a/Framework/Viewport/ViewportBase.cpp Tue Oct 15 10:54:53 2019 +0200 +++ b/Framework/Viewport/ViewportBase.cpp Tue Oct 15 14:30:19 2019 +0200 @@ -42,7 +42,7 @@ } - ScenePoint2D ViewportBase::GetPixelCenterCoordinates(int x, int y) + ScenePoint2D ViewportBase::GetPixelCenterCoordinates(int x, int y) const { if (HasCompositor()) { diff -r 2d6237221ff1 -r 6dd90b8d1589 Framework/Viewport/ViewportBase.h --- a/Framework/Viewport/ViewportBase.h Tue Oct 15 10:54:53 2019 +0200 +++ b/Framework/Viewport/ViewportBase.h Tue Oct 15 14:30:19 2019 +0200 @@ -41,6 +41,14 @@ return *scene_; } - virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) ORTHANC_OVERRIDE; + virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const ORTHANC_OVERRIDE; + + virtual const ICompositor& GetCompositor() const ORTHANC_OVERRIDE + { + IViewport* mutableThis = + const_cast(static_cast(this)); + return mutableThis->GetCompositor(); + } + }; } diff -r 2d6237221ff1 -r 6dd90b8d1589 Resources/CMake/OrthancStoneConfiguration.cmake --- a/Resources/CMake/OrthancStoneConfiguration.cmake Tue Oct 15 10:54:53 2019 +0200 +++ b/Resources/CMake/OrthancStoneConfiguration.cmake Tue Oct 15 14:30:19 2019 +0200 @@ -572,6 +572,8 @@ ${ORTHANC_STONE_ROOT}/Framework/Toolbox/UndoRedoStack.cpp ${ORTHANC_STONE_ROOT}/Framework/Toolbox/UndoRedoStack.h + ${ORTHANC_STONE_ROOT}/Framework/Viewport/IViewport.h + ${ORTHANC_STONE_ROOT}/Framework/Viewport/ViewportBase.h ${ORTHANC_STONE_ROOT}/Framework/Viewport/ViewportBase.cpp ${ORTHANC_STONE_ROOT}/Framework/Volumes/IVolumeSlicer.cpp @@ -658,14 +660,15 @@ if (ENABLE_WASM) list(APPEND ORTHANC_STONE_SOURCES + ${ORTHANC_STONE_ROOT}/Framework/OpenGL/WebAssemblyOpenGLContext.h ${ORTHANC_STONE_ROOT}/Framework/OpenGL/WebAssemblyOpenGLContext.cpp + ${ORTHANC_STONE_ROOT}/Framework/Viewport/WebAssemblyViewport.h ${ORTHANC_STONE_ROOT}/Framework/Viewport/WebAssemblyViewport.cpp ) endif() endif() - ## ## TEST - Automatically add all ".h" headers to the list of sources ##