Mercurial > hg > orthanc-stone
changeset 1571:85e117739eca
cppcheck
line wrap: on
line diff
--- a/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Mon Sep 21 17:46:39 2020 +0200 @@ -242,6 +242,7 @@ if (ENABLE_DCMTK) list(APPEND ORTHANC_STONE_SOURCES ${ORTHANC_STONE_ROOT}/Sources/Oracle/ParseDicomSuccessMessage.cpp + ${ORTHANC_STONE_ROOT}/Sources/Toolbox/OrthancDatasets/SimplifiedOrthancDataset.cpp ${ORTHANC_STONE_ROOT}/Sources/Toolbox/ParsedDicomCache.cpp ${ORTHANC_STONE_ROOT}/Sources/Toolbox/ParsedDicomDataset.cpp )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancStone/Resources/RunCppCheck.sh Mon Sep 21 17:46:39 2020 +0200 @@ -0,0 +1,54 @@ +#!/bin/bash + +set -ex + +CPPCHECK=cppcheck + +if [ $# -ge 1 ]; then + CPPCHECK=$1 +fi + +cat <<EOF > /tmp/cppcheck-suppressions.txt +unpreciseMathCall:../../OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.cpp +unpreciseMathCall:../../OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.cpp +unusedFunction +useInitializationList:../../OrthancStone/Sources/OpenGL/OpenGLProgram.cpp:36 +unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:135 +unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:193 +EOF + +${CPPCHECK} --enable=all --quiet --std=c++11 \ + --suppressions-list=/tmp/cppcheck-suppressions.txt \ + -DORTHANC_BUILDING_FRAMEWORK_LIBRARY=1 \ + -DORTHANC_ENABLE_BASE64=1 \ + -DORTHANC_ENABLE_CIVETWEB=0 \ + -DORTHANC_ENABLE_CURL=1 \ + -DORTHANC_ENABLE_DCMTK=1 \ + -DORTHANC_ENABLE_DCMTK_JPEG=1 \ + -DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=1 \ + -DORTHANC_ENABLE_GLEW=1 \ + -DORTHANC_ENABLE_JPEG=1 \ + -DORTHANC_ENABLE_LOCALE=1 \ + -DORTHANC_ENABLE_LOGGING=1 \ + -DORTHANC_ENABLE_LOGGING_STDIO=1 \ + -DORTHANC_ENABLE_MD5=1 \ + -DORTHANC_ENABLE_MONGOOSE=0 \ + -DORTHANC_ENABLE_OPENGL=1 \ + -DORTHANC_ENABLE_PKCS11=0 \ + -DORTHANC_ENABLE_PNG=1 \ + -DORTHANC_ENABLE_PUGIXML=0 \ + -DORTHANC_ENABLE_SDL=1 \ + -DORTHANC_ENABLE_SSL=1 \ + -DORTHANC_ENABLE_THREADS=1 \ + -DORTHANC_ENABLE_WASM=1 \ + -DORTHANC_ENABLE_ZLIB=1 \ + -DORTHANC_SANDBOXED=0 \ + -D__GNUC__ \ + -D__cplusplus=201103 \ + -D__linux__ \ + -UNDEBUG \ + -I/home/jodogne/Subversion/orthanc/OrthancFramework/Sources \ + \ + ../../OrthancStone/Sources \ + \ + 2>&1
--- a/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -54,7 +54,7 @@ int y, unsigned int width, unsigned int height, - const Orthanc::IDynamicObject* payload) + const Orthanc::IDynamicObject* payload) ORTHANC_OVERRIDE { int left = x + offsetX_; int top = y + offsetY_;
--- a/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -56,7 +56,7 @@ } virtual void Visit(uint32_t unicode, - const Glyph& glyph) + const Glyph& glyph) ORTHANC_OVERRIDE { maxWidth_ = std::max(maxWidth_, glyph.GetWidth()); maxHeight_ = std::max(maxHeight_, glyph.GetHeight()); @@ -125,7 +125,7 @@ virtual void Visit(uint32_t unicode, - const Glyph& glyph) + const Glyph& glyph) ORTHANC_OVERRIDE { if (!glyph.HasPayload()) { @@ -138,9 +138,6 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - unsigned int x = column_ * glyphMaxWidth_; - unsigned int y = row_ * glyphMaxHeight_; - const Orthanc::ImageAccessor& source = dynamic_cast<const DynamicBitmap&>(glyph.GetPayload()).GetBitmap(); if (source.GetFormat() != Orthanc::PixelFormat_Grayscale8) @@ -148,10 +145,14 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - targetAlphabet_.Register(unicode, glyph, new TextureLocation(x, y)); + Orthanc::ImageAccessor target; - Orthanc::ImageAccessor target; - texture_->GetRegion(target, x, y, source.GetWidth(), source.GetHeight()); + { + unsigned int x = column_ * glyphMaxWidth_; + unsigned int y = row_ * glyphMaxHeight_; + targetAlphabet_.Register(unicode, glyph, new TextureLocation(x, y)); + texture_->GetRegion(target, x, y, source.GetWidth(), source.GetHeight()); + } //Orthanc::ImageProcessing::Copy(target, bitmap->GetBitmap()); @@ -214,7 +215,7 @@ int y, unsigned int width, unsigned int height, - const Orthanc::IDynamicObject* payload) + const Orthanc::IDynamicObject* payload) ORTHANC_OVERRIDE { int left = x + offsetX_; int top = y + offsetY_;
--- a/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphTextureAlphabet.h Mon Sep 21 17:46:39 2020 +0200 @@ -66,7 +66,7 @@ unsigned int textureHeight_; public: - GlyphTextureAlphabet(const GlyphBitmapAlphabet& sourceAlphabet); + explicit GlyphTextureAlphabet(const GlyphBitmapAlphabet& sourceAlphabet); const Orthanc::ImageAccessor& GetTexture() const;
--- a/OrthancStone/Sources/Fonts/OpenGLTextCoordinates.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Fonts/OpenGLTextCoordinates.h Mon Sep 21 17:46:39 2020 +0200 @@ -47,7 +47,7 @@ int y, unsigned int width, unsigned int height, - const Orthanc::IDynamicObject* payload); + const Orthanc::IDynamicObject* payload) ORTHANC_OVERRIDE; public: OpenGLTextCoordinates(const GlyphTextureAlphabet& alphabet,
--- a/OrthancStone/Sources/Fonts/TextBoundingBox.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Fonts/TextBoundingBox.h Mon Sep 21 17:46:39 2020 +0200 @@ -45,7 +45,7 @@ int y, unsigned int width, unsigned int height, - const Orthanc::IDynamicObject* payload /* ignored */); + const Orthanc::IDynamicObject* payload /* ignored */) ORTHANC_OVERRIDE; public: TextBoundingBox(const GlyphAlphabet& alphabet,
--- a/OrthancStone/Sources/Loaders/BasicFetchingItemsSorter.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/BasicFetchingItemsSorter.h Mon Sep 21 17:46:39 2020 +0200 @@ -23,6 +23,8 @@ #include "IFetchingItemsSorter.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE + namespace OrthancStone { class BasicFetchingItemsSorter : public IFetchingItemsSorter @@ -34,20 +36,20 @@ class Factory : public IFactory { public: - virtual IFetchingItemsSorter* CreateSorter(unsigned int itemsCount) const + virtual IFetchingItemsSorter* CreateSorter(unsigned int itemsCount) const ORTHANC_OVERRIDE { return new BasicFetchingItemsSorter(itemsCount); } }; - BasicFetchingItemsSorter(unsigned int itemsCount); + explicit BasicFetchingItemsSorter(unsigned int itemsCount); - virtual unsigned int GetItemsCount() const + virtual unsigned int GetItemsCount() const ORTHANC_OVERRIDE { return itemsCount_; } virtual void Sort(std::vector<unsigned int>& target, - unsigned int current); + unsigned int current) ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Loaders/BasicFetchingStrategy.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/BasicFetchingStrategy.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -58,7 +58,7 @@ void BasicFetchingStrategy::SetBlockSize(unsigned int size) { - if (size <= 0) + if (size == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); }
--- a/OrthancStone/Sources/Loaders/BasicFetchingStrategy.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/BasicFetchingStrategy.h Mon Sep 21 17:46:39 2020 +0200 @@ -72,12 +72,12 @@ BasicFetchingStrategy(IFetchingItemsSorter* sorter, // Takes ownership unsigned int maxQuality); - virtual unsigned int GetItemsCount() const + virtual unsigned int GetItemsCount() const ORTHANC_OVERRIDE { return sorter_->GetItemsCount(); } - virtual unsigned int GetMaxQuality() const + virtual unsigned int GetMaxQuality() const ORTHANC_OVERRIDE { return maxQuality_; } @@ -87,10 +87,10 @@ void SetBlockSize(unsigned int size); virtual bool GetNext(unsigned int& item, - unsigned int& quality); + unsigned int& quality) ORTHANC_OVERRIDE; - virtual void SetCurrent(unsigned int item); + virtual void SetCurrent(unsigned int item) ORTHANC_OVERRIDE; - virtual void RecycleFurthest(unsigned int& item); + virtual void RecycleFurthest(unsigned int& item) ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Loaders/DicomResourcesLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/DicomResourcesLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -166,7 +166,7 @@ { } - virtual void HandleJson(const Json::Value& body) + virtual void HandleJson(const Json::Value& body) ORTHANC_OVERRIDE { GetTarget()->AddFromDicomWeb(body); BroadcastSuccess(); @@ -236,7 +236,7 @@ { } - virtual void HandleJson(const Json::Value& body) + virtual void HandleJson(const Json::Value& body) ORTHANC_OVERRIDE { GetTarget()->AddFromOrthanc(body); CloseCommand(); @@ -257,7 +257,7 @@ { } - virtual void HandleJson(const Json::Value& body) + virtual void HandleJson(const Json::Value& body) ORTHANC_OVERRIDE { static const char* const ID = "ID"; @@ -305,7 +305,7 @@ { } - virtual void HandleJson(const Json::Value& body) + virtual void HandleJson(const Json::Value& body) ORTHANC_OVERRIDE { static const char* const ID = "ID"; static const char* const INSTANCES = "Instances"; @@ -481,12 +481,12 @@ { } - virtual void HandleJson(const Json::Value& body) + virtual void HandleJson(const Json::Value& body) ORTHANC_OVERRIDE { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - virtual void HandleString(const std::string& body) + virtual void HandleString(const std::string& body) ORTHANC_OVERRIDE { Orthanc::ParsedDicomDir dicomDir(body); GetDicomDirInstances(*GetTarget(), dicomDir); @@ -609,7 +609,7 @@ } - boost::shared_ptr<DicomResourcesLoader> DicomResourcesLoader::Create(ILoadersContext::ILock& stone) + boost::shared_ptr<DicomResourcesLoader> DicomResourcesLoader::Create(const ILoadersContext::ILock& stone) { boost::shared_ptr<DicomResourcesLoader> result(new DicomResourcesLoader(stone.GetContext())); result->Register<HttpCommand::SuccessMessage>(stone.GetOracleObservable(), &DicomResourcesLoader::Handle);
--- a/OrthancStone/Sources/Loaders/DicomResourcesLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/DicomResourcesLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -93,7 +93,7 @@ boost::shared_ptr<unsigned int> remainingCommands, boost::shared_ptr<Orthanc::IDynamicObject> userPayload); - DicomResourcesLoader(ILoadersContext& context) : + explicit DicomResourcesLoader(ILoadersContext& context) : context_(context) { } @@ -153,14 +153,14 @@ class Factory : public ILoaderFactory { public: - virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& stone) + virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& stone) ORTHANC_OVERRIDE { return DicomResourcesLoader::Create(stone); } }; - static boost::shared_ptr<DicomResourcesLoader> Create(ILoadersContext::ILock& stone); + static boost::shared_ptr<DicomResourcesLoader> Create(const ILoadersContext::ILock& stone); void ScheduleGetDicomWeb(boost::shared_ptr<LoadedDicomResources> target, int priority,
--- a/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -62,9 +62,9 @@ } protected: - RestInstanceLookupHandler(DicomStructureSetLoader& loader) - : LoaderStateMachine(loader.loadersContext_) - , loader_(loader) + explicit RestInstanceLookupHandler(DicomStructureSetLoader& loader) : + LoaderStateMachine(loader.loadersContext_), + loader_(loader) { } @@ -91,7 +91,7 @@ { } - virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) + virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) ORTHANC_OVERRIDE { Json::Value tags; message.ParseJsonBody(tags); @@ -120,7 +120,7 @@ { } - virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) + virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) ORTHANC_OVERRIDE { DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); @@ -179,12 +179,12 @@ class DicomStructureSetLoader::LoadStructure : public LoaderStateMachine::State { public: - LoadStructure(DicomStructureSetLoader& that) : - State(that) + explicit LoadStructure(DicomStructureSetLoader& that) : + State(that) { } - virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) + virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) ORTHANC_OVERRIDE { DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); @@ -291,10 +291,10 @@ Slice(const OrthancStone::DicomStructureSet& content, uint64_t revision, const OrthancStone::CoordinateSystem3D& cuttingPlane, - std::vector<bool> visibility = std::vector<bool>()) - : content_(content) - , revision_(revision) - , visibility_(visibility) + const std::vector<bool>& visibility) : + content_(content), + revision_(revision), + visibility_(visibility) { ORTHANC_ASSERT((visibility_.size() == content_.GetStructuresCount()) || (visibility_.size() == 0u)); @@ -308,19 +308,19 @@ OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisY())); } - virtual bool IsValid() + virtual bool IsValid() ORTHANC_OVERRIDE { return isValid_; } - virtual uint64_t GetRevision() + virtual uint64_t GetRevision() ORTHANC_OVERRIDE { return revision_; } virtual OrthancStone::ISceneLayer* CreateSceneLayer( const OrthancStone::ILayerStyleConfigurator* configurator, - const OrthancStone::CoordinateSystem3D& cuttingPlane) + const OrthancStone::CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE { assert(isValid_);
--- a/OrthancStone/Sources/Loaders/DicomStructureSetLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/DicomStructureSetLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -141,6 +141,6 @@ void RetrieveReferencedSlices(const std::set<std::string>& nonEmptyInstances); protected: - DicomStructureSetLoader(OrthancStone::ILoadersContext& loadersContext); + explicit DicomStructureSetLoader(OrthancStone::ILoadersContext& loadersContext); }; }
--- a/OrthancStone/Sources/Loaders/DicomVolumeLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/DicomVolumeLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -49,7 +49,7 @@ ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); public: - VolumeReadyMessage(const DicomVolumeLoader& loader) : + explicit VolumeReadyMessage(const DicomVolumeLoader& loader) : OriginMessage(loader) { } @@ -97,9 +97,9 @@ bool computeRange_; public: - Factory(LoadedDicomResources& instances); + explicit Factory(LoadedDicomResources& instances); - Factory(const SeriesMetadataLoader::SuccessMessage& metadata); + explicit Factory(const SeriesMetadataLoader::SuccessMessage& metadata); void SetComputeRange(bool computeRange) {
--- a/OrthancStone/Sources/Loaders/GenericLoadersContext.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/GenericLoadersContext.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -30,7 +30,7 @@ boost::recursive_mutex::scoped_lock lock_; public: - Locker(GenericLoadersContext& that) : + explicit Locker(GenericLoadersContext& that) : that_(that), lock_(that.mutex_) {
--- a/OrthancStone/Sources/Loaders/LoadedDicomResources.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/LoadedDicomResources.h Mon Sep 21 17:46:39 2020 +0200 @@ -44,7 +44,7 @@ void AddFromDicomWebInternal(const Json::Value& dicomweb); public: - LoadedDicomResources(const Orthanc::DicomTag& indexedTag) : + explicit LoadedDicomResources(const Orthanc::DicomTag& indexedTag) : indexedTag_(indexedTag) { }
--- a/OrthancStone/Sources/Loaders/LoaderCache.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/LoaderCache.h Mon Sep 21 17:46:39 2020 +0200 @@ -49,7 +49,8 @@ If you pass true for useCtProgressiveQuality, jpeg (50/100 quality), then jpeg (90/100 quality) then eventually uncompressed 16-bit images will be loaded. */ - LoaderCache(OrthancStone::ILoadersContext& loadersContext, bool useCtProgressiveQuality = false); + LoaderCache(OrthancStone::ILoadersContext& loadersContext, + bool useCtProgressiveQuality); boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> GetSeriesVolumeProgressiveLoader (std::string seriesUuid);
--- a/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -142,7 +142,7 @@ template <typename T> void LoaderStateMachine::HandleSuccessMessage(const T& message) { - if (activeCommands_ <= 0) { + if (activeCommands_ == 0) { LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage : activeCommands_ should be > 0 but is: " << activeCommands_; } else {
--- a/OrthancStone/Sources/Loaders/LoaderStateMachine.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/LoaderStateMachine.h Mon Sep 21 17:46:39 2020 +0200 @@ -58,13 +58,13 @@ LoaderStateMachine& that_; public: - State(LoaderStateMachine& that) : - that_(that) + explicit State(LoaderStateMachine& that) : + that_(that) { } - State(const State& currentState) : - that_(currentState.that_) + explicit State(const State& currentState) : + that_(currentState.that_) { } @@ -110,7 +110,7 @@ public: - LoaderStateMachine(OrthancStone::ILoadersContext& loadersContext); + explicit LoaderStateMachine(OrthancStone::ILoadersContext& loadersContext); void PostConstructor();
--- a/OrthancStone/Sources/Loaders/OracleScheduler.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/OracleScheduler.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -464,7 +464,7 @@ assert(PRIORITY_HIGH < 0 && PRIORITY_LOW > 0); - if (maxLowPriority <= 0) + if (maxLowPriority == 0) { // There must be at least 1 lane available to deal with low-priority commands throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
--- a/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -44,7 +44,7 @@ } - virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) + virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) ORTHANC_OVERRIDE { // Complete the DICOM tags with just-received "Grid Frame Offset Vector" std::string s = Orthanc::Toolbox::StripSpaces(message.GetAnswer()); @@ -73,8 +73,8 @@ class OrthancMultiframeVolumeLoader::LoadGeometry : public State { public: - LoadGeometry(OrthancMultiframeVolumeLoader& that) : - State(that) + explicit LoadGeometry(OrthancMultiframeVolumeLoader& that) : + State(that) { } @@ -115,8 +115,8 @@ class OrthancMultiframeVolumeLoader::LoadTransferSyntax : public State { public: - LoadTransferSyntax(OrthancMultiframeVolumeLoader& that) : - State(that) + explicit LoadTransferSyntax(OrthancMultiframeVolumeLoader& that) : + State(that) { } @@ -129,8 +129,8 @@ class OrthancMultiframeVolumeLoader::LoadUncompressedPixelData : public State { public: - LoadUncompressedPixelData(OrthancMultiframeVolumeLoader& that) : - State(that) + explicit LoadUncompressedPixelData(OrthancMultiframeVolumeLoader& that) : + State(that) { } @@ -385,7 +385,7 @@ T pixelValue = it->first; uint64_t count = it->second; totalCount += count; - it++; + ++it; if (it == distribution.end()) distributionRawMax_ = static_cast<float>(pixelValue); } @@ -443,7 +443,7 @@ currentCount += count; } // and continue walking along the distribution - it++; + ++it; } } @@ -473,7 +473,7 @@ currentCount += count; } // and continue walking along the distribution - it++; + ++it; } } if (resultMin > resultMax)
--- a/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -104,8 +104,9 @@ virtual ~OrthancMultiframeVolumeLoader(); - bool HasGeometry() const; - const OrthancStone::VolumeImageGeometry& GetImageGeometry() const; + bool HasGeometry() const ORTHANC_OVERRIDE; + + virtual const OrthancStone::VolumeImageGeometry& GetImageGeometry() const ORTHANC_OVERRIDE; bool IsPixelDataLoaded() const {
--- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -60,6 +60,8 @@ sopInstanceUid_(sopInstanceUid), quality_(quality), hasWindowing_(false), + windowingCenter_(0), + windowingWidth_(0), userPayload_(userPayload) { } @@ -165,7 +167,7 @@ #if ORTHANC_ENABLE_DCMTK == 1 void SeriesFramesLoader::HandleDicom(const Payload& payload, - Orthanc::ParsedDicomFile& dicom) + const Orthanc::ParsedDicomFile& dicom) { size_t frameIndex = frames_.GetFrameIndex(payload.GetSeriesIndex());
--- a/OrthancStone/Sources/Loaders/SeriesFramesLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesFramesLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -56,7 +56,7 @@ #if ORTHANC_ENABLE_DCMTK == 1 void HandleDicom(const Payload& payload, - Orthanc::ParsedDicomFile& dicom); + const Orthanc::ParsedDicomFile& dicom); #endif void HandleDicomWebRendered(const Payload& payload, @@ -153,15 +153,15 @@ public: // No "const" because "LoadedDicomResources::GetResource()" will call "Flatten()" - Factory(LoadedDicomResources& instances) : - instances_(instances) + explicit Factory(LoadedDicomResources& instances) : + instances_(instances) { } void SetDicomDir(const std::string& dicomDirPath, boost::shared_ptr<LoadedDicomResources> dicomDir); - virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& context); + virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& context) ORTHANC_OVERRIDE; }; const SeriesOrderedFrames& GetOrderedFrames() const
--- a/OrthancStone/Sources/Loaders/SeriesMetadataLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesMetadataLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -187,7 +187,7 @@ } - boost::shared_ptr<SeriesMetadataLoader> SeriesMetadataLoader::Create(ILoadersContext::ILock& context) + boost::shared_ptr<SeriesMetadataLoader> SeriesMetadataLoader::Create(const ILoadersContext::ILock& context) { boost::shared_ptr<DicomResourcesLoader> loader(DicomResourcesLoader::Create(context));
--- a/OrthancStone/Sources/Loaders/SeriesMetadataLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesMetadataLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -48,7 +48,7 @@ std::string dicomDirPath_; std::map<std::string, unsigned int> seriesSize_; - SeriesMetadataLoader(boost::shared_ptr<DicomResourcesLoader>& loader); + explicit SeriesMetadataLoader(boost::shared_ptr<DicomResourcesLoader>& loader); bool IsScheduledWithHigherPriority(const std::string& seriesInstanceUid, int priority) const; @@ -128,14 +128,14 @@ class Factory : public ILoaderFactory { public: - virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& context) + virtual boost::shared_ptr<IObserver> Create(ILoadersContext::ILock& context) ORTHANC_OVERRIDE { return SeriesMetadataLoader::Create(context); } }; - static boost::shared_ptr<SeriesMetadataLoader> Create(ILoadersContext::ILock& context); + static boost::shared_ptr<SeriesMetadataLoader> Create(const ILoadersContext::ILock& context); class Accessor : public boost::noncopyable
--- a/OrthancStone/Sources/Loaders/SeriesOrderedFrames.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesOrderedFrames.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -33,7 +33,7 @@ DicomInstanceParameters parameters_; public: - Instance(const Orthanc::DicomMap& dicom) : + explicit Instance(const Orthanc::DicomMap& dicom) : dicom_(dicom.Clone()), parameters_(dicom) { @@ -134,8 +134,8 @@ int index_; public: - InstanceWithIndexInSeries(const Instance& instance) : - instance_(&instance) + explicit InstanceWithIndexInSeries(const Instance& instance) : + instance_(&instance) { if (!instance_->LookupIndexInSeries(index_)) {
--- a/OrthancStone/Sources/Loaders/SeriesOrderedFrames.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesOrderedFrames.h Mon Sep 21 17:46:39 2020 +0200 @@ -49,7 +49,7 @@ const Frame& GetFrame(size_t seriesIndex) const; public: - SeriesOrderedFrames(LoadedDicomResources& instances); + explicit SeriesOrderedFrames(LoadedDicomResources& instances); ~SeriesOrderedFrames() {
--- a/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -226,7 +226,7 @@ } virtual void HandleSuccess(const std::string& body, - const std::map<std::string, std::string>& headers) + const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE { Json::Reader reader; Json::Value value; @@ -281,7 +281,7 @@ } virtual void HandleSuccess(const std::string& body, - const std::map<std::string, std::string>& headers) + const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE { std::string mime = Orthanc::MIME_JPEG; for (std::map<std::string, std::string>::const_iterator @@ -297,7 +297,7 @@ GetSeriesInstanceUid(), new Thumbnail(body, mime)); } - virtual void HandleError() + virtual void HandleError() ORTHANC_OVERRIDE { // The DICOMweb wasn't able to generate a thumbnail, try to // retrieve the SopClassUID tag using QIDO-RS @@ -367,7 +367,7 @@ } virtual void HandleSuccess(const std::string& body, - const std::map<std::string, std::string>& headers) + const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE { SeriesThumbnailType type = ExtractSopClassUid(body); @@ -402,7 +402,7 @@ } virtual void HandleSuccess(const std::string& body, - const std::map<std::string, std::string>& headers) + const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE { static const char* const INSTANCES = "Instances"; @@ -422,10 +422,6 @@ Json::Value::ArrayIndex index = json[INSTANCES].size() / 2; if (json[INSTANCES][index].type() == Json::stringValue) { - std::map<std::string, std::string> arguments, headers; - arguments["quality"] = boost::lexical_cast<std::string>(JPEG_QUALITY); - headers["Accept"] = Orthanc::MIME_JPEG; - const std::string instance = json[INSTANCES][index].asString(); std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); @@ -453,7 +449,7 @@ } virtual void HandleSuccess(const std::string& body, - const std::map<std::string, std::string>& headers) + const std::map<std::string, std::string>& headers) ORTHANC_OVERRIDE { Json::Value json; Json::Reader reader; @@ -630,8 +626,9 @@ } - boost::shared_ptr<SeriesThumbnailsLoader> SeriesThumbnailsLoader::Create(ILoadersContext::ILock& stone, - int priority) + boost::shared_ptr<SeriesThumbnailsLoader> SeriesThumbnailsLoader::Create( + const ILoadersContext::ILock& stone, + int priority) { boost::shared_ptr<SeriesThumbnailsLoader> result(new SeriesThumbnailsLoader(stone.GetContext(), priority)); result->Register<GetOrthancImageCommand::SuccessMessage>(stone.GetOracleObservable(), &SeriesThumbnailsLoader::Handle); @@ -650,8 +647,8 @@ void SeriesThumbnailsLoader::SetThumbnailSize(unsigned int width, unsigned int height) { - if (width <= 0 || - height <= 0) + if (width == 0 || + height == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); }
--- a/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h Mon Sep 21 17:46:39 2020 +0200 @@ -65,7 +65,7 @@ Thumbnail(const std::string& image, const std::string& mime); - Thumbnail(SeriesThumbnailType type); + explicit Thumbnail(SeriesThumbnailType type); SeriesThumbnailType GetType() const { @@ -215,7 +215,7 @@ } - static boost::shared_ptr<SeriesThumbnailsLoader> Create(ILoadersContext::ILock& context, + static boost::shared_ptr<SeriesThumbnailsLoader> Create(const ILoadersContext::ILock& context, int priority); void SetThumbnailSize(unsigned int width,
--- a/OrthancStone/Sources/Loaders/WebAssemblyLoadersContext.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Loaders/WebAssemblyLoadersContext.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -29,7 +29,7 @@ WebAssemblyLoadersContext& that_; public: - Locker(WebAssemblyLoadersContext& that) : + explicit Locker(WebAssemblyLoadersContext& that) : that_(that) { }
--- a/OrthancStone/Sources/Messages/IMessage.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Messages/IMessage.h Mon Sep 21 17:46:39 2020 +0200 @@ -115,7 +115,7 @@ const TOrigin& origin_; public: - OriginMessage(const TOrigin& origin) : + explicit OriginMessage(const TOrigin& origin) : origin_(origin) { } @@ -136,7 +136,7 @@ return id; \ } \ \ - virtual const ::OrthancStone::MessageIdentifier& GetIdentifier() const \ + virtual const ::OrthancStone::MessageIdentifier& GetIdentifier() const ORTHANC_OVERRIDE \ { \ return GetStaticIdentifier(); \ } @@ -147,7 +147,7 @@ { \ ORTHANC_STONE_MESSAGE(FILE, LINE); \ \ - NAME(const ORIGIN& origin) : \ + explicit NAME(const ORIGIN& origin) : \ OriginMessage(origin) \ { \ } \
--- a/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -30,11 +30,12 @@ { namespace OpenGL { - OpenGLProgram::OpenGLProgram(OpenGL::IOpenGLContext& context) - : context_(context) + OpenGLProgram::OpenGLProgram(OpenGL::IOpenGLContext& context) : + context_(context) { program_ = glCreateProgram(); ORTHANC_OPENGL_CHECK("glCreateProgram"); + if (program_ == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
--- a/OrthancStone/Sources/OpenGL/OpenGLProgram.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/OpenGLProgram.h Mon Sep 21 17:46:39 2020 +0200 @@ -38,7 +38,7 @@ // WARNING: A global OpenGL context must be active to create this object! // the context is only passed so that it can be checked for loss // when destructing the program resource - OpenGLProgram(OpenGL::IOpenGLContext& context); + explicit OpenGLProgram(OpenGL::IOpenGLContext& context); ~OpenGLProgram(); @@ -51,6 +51,7 @@ GLint GetUniformLocation(const std::string& name); GLint GetAttributeLocation(const std::string& name); + private: GLuint program_; OpenGL::IOpenGLContext& context_;
--- a/OrthancStone/Sources/OpenGL/OpenGLShader.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/OpenGLShader.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -79,9 +79,9 @@ OpenGLShader::OpenGLShader(GLenum type, - const std::string& source) + const std::string& source) : + shader_(CompileShader(type, source)) { - shader_ = CompileShader(type, source); isValid_ = true; }
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.h Mon Sep 21 17:46:39 2020 +0200 @@ -43,7 +43,7 @@ OpenGL::IOpenGLContext& context_; public: - OpenGLTexture(OpenGL::IOpenGLContext& context); + explicit OpenGLTexture(OpenGL::IOpenGLContext& context); ~OpenGLTexture();
--- a/OrthancStone/Sources/OpenGL/WebAssemblyOpenGLContext.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/WebAssemblyOpenGLContext.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -44,9 +44,9 @@ bool isContextLost_; public: - PImpl(const std::string& canvasSelector) - : canvasSelector_(canvasSelector) - , isContextLost_(false) + explicit PImpl(const std::string& canvasSelector) : + canvasSelector_(canvasSelector), + isContextLost_(false) { // Context configuration EmscriptenWebGLContextAttributes attr;
--- a/OrthancStone/Sources/OpenGL/WebAssemblyOpenGLContext.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/OpenGL/WebAssemblyOpenGLContext.h Mon Sep 21 17:46:39 2020 +0200 @@ -54,7 +54,7 @@ boost::shared_ptr<PImpl> pimpl_; public: - WebAssemblyOpenGLContext(const std::string& canvasSelector); + explicit WebAssemblyOpenGLContext(const std::string& canvasSelector); virtual bool IsContextLost() ORTHANC_OVERRIDE;
--- a/OrthancStone/Sources/Oracle/GenericOracleRunner.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/GenericOracleRunner.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -58,7 +58,7 @@ const Orthanc::HttpClient::HttpHeaders& headers) { for (Orthanc::HttpClient::HttpHeaders::const_iterator - it = headers.begin(); it != headers.end(); it++ ) + it = headers.begin(); it != headers.end(); ++it ) { client.AddHeader(it->first, it->second); }
--- a/OrthancStone/Sources/Oracle/GetOrthancImageCommand.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/GetOrthancImageCommand.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -32,7 +32,8 @@ GetOrthancImageCommand::GetOrthancImageCommand() : uri_("/"), timeout_(600), - hasExpectedFormat_(false) + hasExpectedFormat_(false), + expectedFormat_(Orthanc::PixelFormat_Grayscale8) { }
--- a/OrthancStone/Sources/Oracle/GetOrthancImageCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/GetOrthancImageCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -84,12 +84,12 @@ public: GetOrthancImageCommand(); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_GetOrthancImage; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new GetOrthancImageCommand(*this); }
--- a/OrthancStone/Sources/Oracle/GetOrthancWebViewerJpegCommand.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/GetOrthancWebViewerJpegCommand.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -50,7 +50,7 @@ void GetOrthancWebViewerJpegCommand::SetQuality(unsigned int quality) { - if (quality <= 0 || + if (quality == 0 || quality > 100) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
--- a/OrthancStone/Sources/Oracle/GetOrthancWebViewerJpegCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/GetOrthancWebViewerJpegCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -77,12 +77,12 @@ public: GetOrthancWebViewerJpegCommand(); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_GetOrthancWebViewerJpeg; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new GetOrthancWebViewerJpegCommand(*this); }
--- a/OrthancStone/Sources/Oracle/HttpCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/HttpCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -91,12 +91,12 @@ public: HttpCommand(); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_Http; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new HttpCommand(*this); }
--- a/OrthancStone/Sources/Oracle/OrthancRestApiCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/OrthancRestApiCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -89,12 +89,12 @@ public: OrthancRestApiCommand(); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_OrthancRestApi; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new OrthancRestApiCommand(*this); }
--- a/OrthancStone/Sources/Oracle/ParseDicomFromFileCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ParseDicomFromFileCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -63,12 +63,12 @@ static std::string GetDicomDirPath(const std::string& dicomDirPath, const std::string& file); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_ParseDicomFromFile; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new ParseDicomFromFileCommand(*this); }
--- a/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -42,12 +42,12 @@ const std::string& sopInstanceUid, IOracleCommand* restCommand); - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_ParseDicomFromWado; } - virtual IOracleCommand* Clone() const; + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE; const DicomSource& GetSource() const {
--- a/OrthancStone/Sources/Oracle/ParseDicomSuccessMessage.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ParseDicomSuccessMessage.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -41,7 +41,7 @@ virtual void HandlePart(const std::map<std::string, std::string>& headers, const void* part, - size_t size) + size_t size) ORTHANC_OVERRIDE { if (dicom_.get()) {
--- a/OrthancStone/Sources/Oracle/ReadFileCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ReadFileCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -55,17 +55,17 @@ std::string path_; public: - ReadFileCommand(const std::string& path) : + explicit ReadFileCommand(const std::string& path) : path_(path) { } - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_ReadFile; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new ReadFileCommand(path_); }
--- a/OrthancStone/Sources/Oracle/SleepOracleCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/SleepOracleCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -34,17 +34,17 @@ public: ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, TimeoutMessage, SleepOracleCommand); - SleepOracleCommand(unsigned int milliseconds) : + explicit SleepOracleCommand(unsigned int milliseconds) : milliseconds_(milliseconds) { } - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_Sleep; } - virtual IOracleCommand* Clone() const + virtual IOracleCommand* Clone() const ORTHANC_OVERRIDE { return new SleepOracleCommand(milliseconds_); }
--- a/OrthancStone/Sources/Oracle/ThreadedOracle.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ThreadedOracle.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -324,7 +324,7 @@ { boost::mutex::scoped_lock lock(mutex_); - if (count <= 0) + if (count == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } @@ -344,7 +344,7 @@ { boost::mutex::scoped_lock lock(mutex_); - if (milliseconds <= 0) + if (milliseconds == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); }
--- a/OrthancStone/Sources/Oracle/ThreadedOracle.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Oracle/ThreadedOracle.h Mon Sep 21 17:46:39 2020 +0200 @@ -85,7 +85,7 @@ void StopInternal(); public: - ThreadedOracle(IMessageEmitter& emitter); + explicit ThreadedOracle(IMessageEmitter& emitter); virtual ~ThreadedOracle();
--- a/OrthancStone/Sources/Scene2D/ColorTextureSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/ColorTextureSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -29,11 +29,11 @@ { public: // If using RGBA32, premultiplied alpha is assumed - ColorTextureSceneLayer(const Orthanc::ImageAccessor& texture); + explicit ColorTextureSceneLayer(const Orthanc::ImageAccessor& texture); - virtual ISceneLayer* Clone() const; + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_ColorTexture; }
--- a/OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -39,7 +39,7 @@ public: // The pixel format must be convertible to "Float32" - FloatTextureSceneLayer(const Orthanc::ImageAccessor& texture); + explicit FloatTextureSceneLayer(const Orthanc::ImageAccessor& texture); void SetWindowing(ImageWindowing windowing); @@ -74,9 +74,9 @@ void GetRange(float& minValue, float& maxValue); - virtual ISceneLayer* Clone() const; + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_FloatTexture; }
--- a/OrthancStone/Sources/Scene2D/GrayscaleStyleConfigurator.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/GrayscaleStyleConfigurator.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -31,6 +31,7 @@ revision_(0), linearInterpolation_(false), hasWindowingOverride_(false), + windowing_(ImageWindowing_Custom), customWindowWidth_(0), customWindowCenter_(0), hasInversionOverride_(false),
--- a/OrthancStone/Sources/Scene2D/GrayscaleStyleConfigurator.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/GrayscaleStyleConfigurator.h Mon Sep 21 17:46:39 2020 +0200 @@ -67,18 +67,18 @@ return applyLog_; } - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return revision_; } virtual TextureBaseSceneLayer* CreateTextureFromImage( - const Orthanc::ImageAccessor& image) const; + const Orthanc::ImageAccessor& image) const ORTHANC_OVERRIDE; virtual TextureBaseSceneLayer* CreateTextureFromDicom( const Orthanc::ImageAccessor& frame, - const DicomInstanceParameters& parameters) const; + const DicomInstanceParameters& parameters) const ORTHANC_OVERRIDE; - virtual void ApplyStyle(ISceneLayer& layer) const; + virtual void ApplyStyle(ISceneLayer& layer) const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -51,7 +51,7 @@ bool isLinearInterpolation, bool applySceneRotation = false); - virtual ISceneLayer* Clone() const + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE { return new InfoPanelSceneLayer(*texture_, anchor_, @@ -79,17 +79,17 @@ return isLinearInterpolation_; } - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_InfoPanel; } - virtual bool GetBoundingBox(Extent2D& target) const + virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE { return false; } - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return 0; }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoBaseRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoBaseRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -56,7 +56,7 @@ Update(layer); } - virtual void Update(const ISceneLayer& layer) + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE { layer_.reset(layer.Clone()); }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoColorTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoColorTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -41,11 +41,11 @@ CairoColorTextureRenderer(ICairoContextProvider& target, const ISceneLayer& layer); - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight) + unsigned int canvasHeight) ORTHANC_OVERRIDE { RenderColorTexture(target_, transform, texture_, textureTransform_, isLinearInterpolation_);
--- a/OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -45,11 +45,11 @@ Update(layer); } - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoInfoPanelRenderer.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoInfoPanelRenderer.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -68,9 +68,6 @@ int32_t halfHeight = static_cast<int32_t>(0.5 * texture_.GetHeight()); - AffineTransform2D translation1 = - AffineTransform2D::CreateOffset(-halfWidth, -halfHeight); - const Matrix& sceneTransformM = transform.GetHomogeneousMatrix(); Matrix r; Matrix q; @@ -82,28 +79,28 @@ &m, q(0, 0), q(1, 0), q(0, 1), q(1, 1), q(0, 2), q(1, 2)); // now let's build the transform piece by piece - // first translation (directly written in `transform`) - cairo_matrix_t transform; - cairo_matrix_init_identity(&transform); - cairo_matrix_translate(&transform, -halfWidth, -halfHeight); + // first translation (directly written in `t`) + cairo_matrix_t t; + cairo_matrix_init_identity(&t); + cairo_matrix_translate(&t, -halfWidth, -halfHeight); // then the rotation - cairo_matrix_multiply(&transform, &transform, &m); + cairo_matrix_multiply(&t, &t, &m); // then the second translation { cairo_matrix_t translation2; cairo_matrix_init_translate(&translation2, halfWidth, halfHeight); - cairo_matrix_multiply(&transform, &transform, &m); + cairo_matrix_multiply(&t, &t, &m); } // then the last translation { cairo_matrix_t translation3; cairo_matrix_init_translate(&translation3, dx, dy); - cairo_matrix_multiply(&transform, &transform, &translation3); + cairo_matrix_multiply(&t, &t, &translation3); } - cairo_transform(cr, &transform); + cairo_transform(cr, &t); } else {
--- a/OrthancStone/Sources/Scene2D/Internals/CairoInfoPanelRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoInfoPanelRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -49,11 +49,11 @@ Update(layer); } - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoLookupTableTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoLookupTableTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -45,11 +45,11 @@ Update(layer); } - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoPolylineRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoPolylineRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -38,7 +38,7 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/CairoTextRenderer.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoTextRenderer.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -38,11 +38,11 @@ { text_.SetSize(source->GetWidth(), source->GetHeight(), true); - Orthanc::ImageAccessor target; - text_.GetWriteableAccessor(target); + Orthanc::ImageAccessor accessor; + text_.GetWriteableAccessor(accessor); if (source->GetFormat() != Orthanc::PixelFormat_Grayscale8 || - target.GetFormat() != Orthanc::PixelFormat_BGRA32) + accessor.GetFormat() != Orthanc::PixelFormat_BGRA32) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } @@ -53,7 +53,7 @@ for (unsigned int y = 0; y < source->GetHeight(); y++) { const uint8_t* p = reinterpret_cast<const uint8_t*>(source->GetConstRow(y)); - uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); + uint8_t* q = reinterpret_cast<uint8_t*>(accessor.GetRow(y)); for (unsigned int x = 0; x < width; x++) {
--- a/OrthancStone/Sources/Scene2D/Internals/CairoTextRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CairoTextRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -42,7 +42,7 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/CompositorHelper.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/CompositorHelper.h Mon Sep 21 17:46:39 2020 +0200 @@ -23,8 +23,10 @@ #include "../Scene2D.h" #include "../ScenePoint2D.h" + +#include <Compatibility.h> // For ORTHANC_OVERRIDE + #include <boost/noncopyable.hpp> - #include <map> namespace OrthancStone @@ -77,12 +79,14 @@ virtual void Visit(const Scene2D& scene, const ISceneLayer& layer, uint64_t layerIdentifier, - int depth); + int depth) ORTHANC_OVERRIDE; public: - CompositorHelper(IRendererFactory& factory) : - factory_(factory), - lastScene_(NULL) + explicit CompositorHelper(IRendererFactory& factory) : + factory_(factory), + lastScene_(NULL), + canvasWidth_(0), + canvasHeight_(0) { }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLAdvancedPolylineRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLAdvancedPolylineRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -45,7 +45,7 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight) + unsigned int canvasHeight) ORTHANC_OVERRIDE { if (!context_.IsContextLost()) { @@ -53,7 +53,7 @@ } } - virtual void Update(const ISceneLayer& layer) + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE { LoadLayer(dynamic_cast<const PolylineSceneLayer&>(layer)); }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLBasicPolylineRenderer.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLBasicPolylineRenderer.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -34,12 +34,14 @@ layer_.Copy(layer); } - void OpenGLBasicPolylineRenderer::Render(const AffineTransform2D& transform) + void OpenGLBasicPolylineRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (!context_.IsContextLost()) { AffineTransform2D t = AffineTransform2D::Combine( - AffineTransform2D::CreateOpenGLClipspace(context_.GetCanvasWidth(), context_.GetCanvasHeight()), + AffineTransform2D::CreateOpenGLClipspace(canvasWidth, canvasHeight), transform); glUseProgram(0);
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLBasicPolylineRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLBasicPolylineRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -41,9 +41,11 @@ OpenGLBasicPolylineRenderer(OpenGL::IOpenGLContext& context, const PolylineSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLColorTextureProgram.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLColorTextureProgram.h Mon Sep 21 17:46:39 2020 +0200 @@ -29,15 +29,16 @@ { class OpenGLColorTextureProgram : public boost::noncopyable { + private: + OpenGLTextureProgram program_; + OpenGL::IOpenGLContext& context_; + public: - OpenGLColorTextureProgram(OpenGL::IOpenGLContext& context); + explicit OpenGLColorTextureProgram(OpenGL::IOpenGLContext& context); void Apply(OpenGL::OpenGLTexture& texture, const AffineTransform2D& transform, bool useAlpha); - private: - OpenGLTextureProgram program_; - OpenGL::IOpenGLContext& context_; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLColorTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLColorTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -46,9 +46,9 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -62,12 +62,12 @@ namespace Internals { OpenGLFloatTextureProgram::Data::Data( - OpenGL::IOpenGLContext& context - , const Orthanc::ImageAccessor& texture - , bool isLinearInterpolation) - : texture_(context) - , offset_(0.0f) - , slope_(0.0f) + OpenGL::IOpenGLContext& context, + const Orthanc::ImageAccessor& texture, + bool isLinearInterpolation) : + texture_(context), + offset_(0.0f), + slope_(0.0f) { if (texture.GetFormat() != Orthanc::PixelFormat_Float32) { @@ -107,17 +107,17 @@ * <=> texture = (value - offset) / slope **/ - float texture = (*p - offset_) / slope_; - if (texture < 0) + float value = (*p - offset_) / slope_; + if (value < 0) { - texture = 0; + value = 0; } - else if (texture >= 65535.0f) + else if (value >= 65535.0f) { - texture = 65535.0f; + value = 65535.0f; } - uint16_t t = static_cast<uint16_t>(texture); + uint16_t t = static_cast<uint16_t>(value); q[0] = t / 256; // red q[1] = t % 256; // green
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureProgram.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureProgram.h Mon Sep 21 17:46:39 2020 +0200 @@ -57,17 +57,18 @@ } }; + private: + OpenGLTextureProgram program_; + OpenGL::IOpenGLContext& context_; + public: - OpenGLFloatTextureProgram(OpenGL::IOpenGLContext& context); + explicit OpenGLFloatTextureProgram(OpenGL::IOpenGLContext& context); void Apply(Data& data, const AffineTransform2D& transform, float windowCenter, float windowWidth, bool invert); - private: - OpenGLTextureProgram program_; - OpenGL::IOpenGLContext& context_; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLFloatTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -50,9 +50,9 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLInfoPanelRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLInfoPanelRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -47,9 +47,9 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer) + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE { LoadTexture(dynamic_cast<const InfoPanelSceneLayer&>(layer)); }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLLinesProgram.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLLinesProgram.h Mon Sep 21 17:46:39 2020 +0200 @@ -78,7 +78,7 @@ std::unique_ptr<OpenGL::OpenGLProgram> program_; public: - OpenGLLinesProgram(OpenGL::IOpenGLContext& context); + explicit OpenGLLinesProgram(OpenGL::IOpenGLContext& context); void Apply(const Data& data, const AffineTransform2D& transform,
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLLookupTableTextureRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLLookupTableTextureRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -50,9 +50,9 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLTextProgram.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLTextProgram.h Mon Sep 21 17:46:39 2020 +0200 @@ -121,13 +121,13 @@ }; private: - OpenGL::IOpenGLContext& context_; + OpenGL::IOpenGLContext& context_; std::unique_ptr<OpenGL::OpenGLProgram> program_; - GLint positionLocation_; - GLint textureLocation_; + GLint positionLocation_; + GLint textureLocation_; public: - OpenGLTextProgram(OpenGL::IOpenGLContext& context); + explicit OpenGLTextProgram(OpenGL::IOpenGLContext& context); void Apply(OpenGL::OpenGLTexture& fontTexture, const Data& data,
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLTextRenderer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLTextRenderer.h Mon Sep 21 17:46:39 2020 +0200 @@ -48,9 +48,9 @@ virtual void Render(const AffineTransform2D& transform, unsigned int canvasWidth, - unsigned int canvasHeight); + unsigned int canvasHeight) ORTHANC_OVERRIDE; - virtual void Update(const ISceneLayer& layer); + virtual void Update(const ISceneLayer& layer) ORTHANC_OVERRIDE; }; } }
--- a/OrthancStone/Sources/Scene2D/LookupTableStyleConfigurator.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/LookupTableStyleConfigurator.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -40,6 +40,8 @@ revision_(0), hasLut_(false), hasRange_(false), + minValue_(0), + maxValue_(0), applyLog_(false) { }
--- a/OrthancStone/Sources/Scene2D/LookupTableStyleConfigurator.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/LookupTableStyleConfigurator.h Mon Sep 21 17:46:39 2020 +0200 @@ -59,19 +59,21 @@ return applyLog_; } - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return revision_; } - virtual TextureBaseSceneLayer* CreateTextureFromImage(const Orthanc::ImageAccessor& image) const; + virtual TextureBaseSceneLayer* CreateTextureFromImage( + const Orthanc::ImageAccessor& image) const ORTHANC_OVERRIDE; - virtual TextureBaseSceneLayer* CreateTextureFromDicom(const Orthanc::ImageAccessor& frame, - const DicomInstanceParameters& parameters) const + virtual TextureBaseSceneLayer* CreateTextureFromDicom( + const Orthanc::ImageAccessor& frame, + const DicomInstanceParameters& parameters) const ORTHANC_OVERRIDE { return parameters.CreateLookupTableTexture(frame); } - virtual void ApplyStyle(ISceneLayer& layer) const; + virtual void ApplyStyle(ISceneLayer& layer) const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -38,7 +38,7 @@ public: // The pixel format must be convertible to Float32 - LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture); + explicit LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture); void SetLookupTableGrayscale(); @@ -74,9 +74,9 @@ return applyLog_; } - virtual ISceneLayer* Clone() const; + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_LookupTableTexture; }
--- a/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -98,7 +98,7 @@ case ISceneLayer::Type_Polyline: return new Internals::OpenGLAdvancedPolylineRenderer - (context_, linesProgram_, dynamic_cast<const PolylineSceneLayer&>(layer)); + (context_, linesProgram_, dynamic_cast<const PolylineSceneLayer&>(layer)); //return new Internals::OpenGLBasicPolylineRenderer(context_, dynamic_cast<const PolylineSceneLayer&>(layer)); case ISceneLayer::Type_Text:
--- a/OrthancStone/Sources/Scene2D/OpenGLCompositor.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/OpenGLCompositor.h Mon Sep 21 17:46:39 2020 +0200 @@ -52,7 +52,7 @@ virtual Internals::CompositorHelper::ILayerRenderer* Create(const ISceneLayer& layer) ORTHANC_OVERRIDE; public: - OpenGLCompositor(OpenGL::IOpenGLContext& context); + explicit OpenGLCompositor(OpenGL::IOpenGLContext& context); virtual ~OpenGLCompositor();
--- a/OrthancStone/Sources/Scene2D/PanSceneTracker.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/PanSceneTracker.h Mon Sep 21 17:46:39 2020 +0200 @@ -32,6 +32,7 @@ const PointerEvent& event); virtual void PointerMove(const PointerEvent& event) ORTHANC_OVERRIDE; + virtual void Cancel() ORTHANC_OVERRIDE; private:
--- a/OrthancStone/Sources/Scene2D/PolylineSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/PolylineSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -25,6 +25,8 @@ #include "ScenePoint2D.h" #include "ISceneLayer.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE + #include <vector> namespace OrthancStone @@ -57,12 +59,12 @@ void Copy(const PolylineSceneLayer& other); - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return revision_; } - virtual ISceneLayer* Clone() const; + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; void SetThickness(double thickness); @@ -111,12 +113,11 @@ return GetItem(i).color_; } - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_Polyline; } - virtual bool GetBoundingBox(Extent2D& target) const; - + virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2D/RotateSceneTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/RotateSceneTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -24,17 +24,18 @@ namespace OrthancStone { RotateSceneTracker::RotateSceneTracker(boost::shared_ptr<IViewport> viewport, - const PointerEvent& event) - : OneGesturePointerTracker(viewport) - , click_(event.GetMainPosition()) - , aligner_(viewport, click_) - , isFirst_(true) + const PointerEvent& event) : + OneGesturePointerTracker(viewport), + click_(event.GetMainPosition()), + aligner_(viewport, click_), + referenceAngle_(0), + isFirst_(true) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); originalSceneToCanvas_ = lock->GetController().GetSceneToCanvasTransform(); - } + void RotateSceneTracker::PointerMove(const PointerEvent& event) { ScenePoint2D p = event.GetMainPosition(); @@ -63,6 +64,7 @@ } } + void RotateSceneTracker::Cancel() { // See remark above
--- a/OrthancStone/Sources/Scene2D/RotateSceneTracker.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/RotateSceneTracker.h Mon Sep 21 17:46:39 2020 +0200 @@ -29,18 +29,19 @@ { class RotateSceneTracker : public OneGesturePointerTracker { - public: - RotateSceneTracker(boost::shared_ptr<IViewport> viewport, - const PointerEvent& event); - - virtual void PointerMove(const PointerEvent& event) ORTHANC_OVERRIDE; - virtual void Cancel() ORTHANC_OVERRIDE; - private: ScenePoint2D click_; Internals::FixedPointAligner aligner_; double referenceAngle_; bool isFirst_; AffineTransform2D originalSceneToCanvas_; + + public: + RotateSceneTracker(boost::shared_ptr<IViewport> viewport, + const PointerEvent& event); + + virtual void PointerMove(const PointerEvent& event) ORTHANC_OVERRIDE; + + virtual void Cancel() ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2D/TextSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/TextSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -43,7 +43,7 @@ public: TextSceneLayer(); - virtual ISceneLayer* Clone() const; + virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; void SetPosition(double x, double y); @@ -86,17 +86,17 @@ return anchor_; } - virtual Type GetType() const + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_Text; } - virtual bool GetBoundingBox(Extent2D& target) const + virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE { return false; } - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return revision_; }
--- a/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h Mon Sep 21 17:46:39 2020 +0200 @@ -121,9 +121,9 @@ AffineTransform2D GetTransform() const; - virtual bool GetBoundingBox(Extent2D& target) const; + virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE; - virtual uint64_t GetRevision() const + virtual uint64_t GetRevision() const ORTHANC_OVERRIDE { return revision_; }
--- a/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -142,9 +142,9 @@ AngleMeasureTool::AngleHighlightArea AngleMeasureTool::AngleHitTest(ScenePoint2D p) const { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); - ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); - + const ViewportController& controller = lock->GetController(); + const Scene2D& scene = controller.GetScene(); + const double pixelToScene = scene.GetCanvasToSceneTransform().ComputeZoom(); const double SQUARED_HIT_TEST_MAX_DISTANCE_SCENE_COORD = @@ -203,7 +203,7 @@ { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); + const Scene2D& scene = controller.GetScene(); ScenePoint2D scenePos = e.GetMainPosition().Apply( scene.GetCanvasToSceneTransform());
--- a/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.h Mon Sep 21 17:46:39 2020 +0200 @@ -70,7 +70,7 @@ AngleHighlightArea AngleHitTest(ScenePoint2D p) const; private: - AngleMeasureTool(boost::shared_ptr<IViewport> viewport); + explicit AngleMeasureTool(boost::shared_ptr<IViewport> viewport); virtual void RefreshScene() ORTHANC_OVERRIDE; void RemoveFromScene();
--- a/OrthancStone/Sources/Scene2DViewport/CreateAngleMeasureCommand.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/CreateAngleMeasureCommand.h Mon Sep 21 17:46:39 2020 +0200 @@ -42,6 +42,7 @@ { return measureTool_; } + boost::shared_ptr<AngleMeasureTool> measureTool_; }; }
--- a/OrthancStone/Sources/Scene2DViewport/CreateAngleMeasureTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/CreateAngleMeasureTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -25,18 +25,19 @@ namespace OrthancStone { - CreateAngleMeasureTracker::CreateAngleMeasureTracker( - boost::shared_ptr<IViewport> viewport, - const PointerEvent& e) - : CreateMeasureTracker(viewport) - , state_(CreatingSide1) + CreateAngleMeasureTracker::CreateAngleMeasureTracker(boost::shared_ptr<IViewport> viewport, + const PointerEvent& e) : + CreateMeasureTracker(viewport), + state_(CreatingSide1) { - ScenePoint2D point = e.GetMainPosition(); + ScenePoint2D point; + { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); Scene2D& scene = lock->GetController().GetScene(); point = e.GetMainPosition().Apply(scene.GetCanvasToSceneTransform()); } + command_.reset(new CreateAngleMeasureCommand(viewport, point)); }
--- a/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -30,12 +30,14 @@ const PointerEvent& e) : CreateMeasureTracker(viewport) { - ScenePoint2D point = e.GetMainPosition(); + ScenePoint2D point; + { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); point = e.GetMainPosition().Apply(controller.GetScene().GetCanvasToSceneTransform()); } + command_.reset(new CreateLineMeasureCommand(viewport, point)); }
--- a/OrthancStone/Sources/Scene2DViewport/EditAngleMeasureTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/EditAngleMeasureTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -31,12 +31,14 @@ const PointerEvent& e) : EditMeasureTracker(viewport, e) { - ScenePoint2D scenePos = e.GetMainPosition(); + ScenePoint2D scenePos; + { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); scenePos = e.GetMainPosition().Apply(controller.GetScene().GetCanvasToSceneTransform()); } + modifiedZone_ = dynamic_cast<AngleMeasureTool&>(*measureTool).AngleHitTest(scenePos); command_.reset(new EditAngleMeasureCommand(measureTool, viewport)); } @@ -49,8 +51,9 @@ void EditAngleMeasureTracker::PointerMove(const PointerEvent& e) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); + ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); + const Scene2D& scene = controller.GetScene(); ScenePoint2D scenePos = e.GetMainPosition().Apply( scene.GetCanvasToSceneTransform());
--- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -32,26 +32,23 @@ const PointerEvent& e) : EditMeasureTracker(viewport, e) { - ScenePoint2D scenePos = e.GetMainPosition(); + ScenePoint2D scenePos; + { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); Scene2D& scene = lock->GetController().GetScene(); scenePos = e.GetMainPosition().Apply(scene.GetCanvasToSceneTransform()); } + modifiedZone_ = dynamic_cast<LineMeasureTool&>(*measureTool).LineHitTest(scenePos); command_.reset(new EditLineMeasureCommand(measureTool, viewport)); } - EditLineMeasureTracker::~EditLineMeasureTracker() - { - - } - void EditLineMeasureTracker::PointerMove(const PointerEvent& e) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); + const Scene2D& scene = controller.GetScene(); ScenePoint2D scenePos = e.GetMainPosition().Apply( scene.GetCanvasToSceneTransform());
--- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.h Mon Sep 21 17:46:39 2020 +0200 @@ -28,6 +28,11 @@ class EditLineMeasureTracker : public EditMeasureTracker { + private: + LineMeasureTool::LineHighlightArea modifiedZone_; + + boost::shared_ptr<EditLineMeasureCommand> GetCommand(); + public: /** When you create this tracker, you need to supply it with the undo stack @@ -38,18 +43,13 @@ */ EditLineMeasureTracker( boost::shared_ptr<MeasureTool> measureTool, - boost::shared_ptr<IViewport> viewport, - const PointerEvent& e); - - ~EditLineMeasureTracker(); + boost::shared_ptr<IViewport> viewport, + const PointerEvent& e); virtual void PointerMove(const PointerEvent& e) ORTHANC_OVERRIDE; + virtual void PointerUp(const PointerEvent& e) ORTHANC_OVERRIDE; + virtual void PointerDown(const PointerEvent& e) ORTHANC_OVERRIDE; - - private: - LineMeasureTool::LineHighlightArea modifiedZone_; - - boost::shared_ptr<EditLineMeasureCommand> GetCommand(); }; }
--- a/OrthancStone/Sources/Scene2DViewport/LayerHolder.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/LayerHolder.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -100,7 +100,7 @@ PolylineSceneLayer* LayerHolder::GetPolylineLayer(int index /*= 0*/) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); - Scene2D& scene = lock->GetController().GetScene(); + const Scene2D& scene = lock->GetController().GetScene(); using namespace Orthanc; ORTHANC_ASSERT(baseLayerIndex_ != -1); @@ -117,7 +117,7 @@ TextSceneLayer* LayerHolder::GetTextLayer(int index /*= 0*/) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); - Scene2D& scene = lock->GetController().GetScene(); + const Scene2D& scene = lock->GetController().GetScene(); using namespace Orthanc; ORTHANC_ASSERT(baseLayerIndex_ != -1);
--- a/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -30,16 +30,16 @@ namespace OrthancStone { - LineMeasureTool::LineMeasureTool( - boost::shared_ptr<IViewport> viewport) - : MeasureTool(viewport) + boost::shared_ptr<IViewport> viewport): + MeasureTool(viewport), #if ORTHANC_STONE_ENABLE_OUTLINED_TEXT == 1 - , layerHolder_(boost::shared_ptr<LayerHolder>(new LayerHolder(viewport,1,5))) + layerHolder_(boost::shared_ptr<LayerHolder>(new LayerHolder(viewport,1,5))), #else - , layerHolder_(boost::shared_ptr<LayerHolder>(new LayerHolder(viewport,1,1))) + layerHolder_(boost::shared_ptr<LayerHolder>(new LayerHolder(viewport,1,1))), #endif - , lineHighlightArea_(LineHighlightArea_None) + baseLayerIndex_(0), + lineHighlightArea_(LineHighlightArea_None) { } @@ -118,7 +118,7 @@ { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); + const Scene2D& scene = controller.GetScene(); const double pixelToScene = scene.GetCanvasToSceneTransform().ComputeZoom(); const double SQUARED_HIT_TEST_MAX_DISTANCE_SCENE_COORD = @@ -154,7 +154,7 @@ { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); ViewportController& controller = lock->GetController(); - Scene2D& scene = controller.GetScene(); + const Scene2D& scene = controller.GetScene(); ScenePoint2D scenePos = e.GetMainPosition().Apply( scene.GetCanvasToSceneTransform());
--- a/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.h Mon Sep 21 17:46:39 2020 +0200 @@ -67,7 +67,7 @@ LineHighlightArea LineHitTest(ScenePoint2D p); private: - LineMeasureTool(boost::shared_ptr<IViewport> viewport); + explicit LineMeasureTool(boost::shared_ptr<IViewport> viewport); virtual void RefreshScene() ORTHANC_OVERRIDE; void RemoveFromScene();
--- a/OrthancStone/Sources/Scene2DViewport/MeasureCommands.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureCommands.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -75,28 +75,28 @@ // we thus leave it as is } - DeleteMeasureCommand::DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport) - : MeasureCommand(viewport) - , mementoOriginal_(measureTool->GetMemento()) - , measureTool_(measureTool) - , mementoModified_(measureTool->GetMemento()) + DeleteMeasureCommand::DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, + boost::shared_ptr<IViewport> viewport) : + MeasureCommand(viewport), + measureTool_(measureTool), + mementoModified_(measureTool->GetMemento()), + mementoOriginal_(measureTool->GetMemento()) { std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); GetMeasureTool()->Disable(); lock->GetController().RemoveMeasureTool(GetMeasureTool()); } - EditMeasureCommand::EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport) - : MeasureCommand(viewport) - , mementoOriginal_(measureTool->GetMemento()) - , mementoModified_(measureTool->GetMemento()) + EditMeasureCommand::EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, + boost::shared_ptr<IViewport> viewport) : + MeasureCommand(viewport), + mementoModified_(measureTool->GetMemento()), + mementoOriginal_(measureTool->GetMemento()) { - } EditMeasureCommand::~EditMeasureCommand() { - } void EditMeasureCommand::Undo()
--- a/OrthancStone/Sources/Scene2DViewport/MeasureCommands.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureCommands.h Mon Sep 21 17:46:39 2020 +0200 @@ -34,62 +34,69 @@ { class MeasureCommand : public boost::noncopyable { - public: - MeasureCommand(boost::shared_ptr<IViewport> viewport) : viewport_(viewport) - {} - virtual void Undo() = 0; - virtual void Redo() = 0; - - virtual ~MeasureCommand() {}; - protected: boost::shared_ptr<IViewport> viewport_; + + public: + explicit MeasureCommand(boost::shared_ptr<IViewport> viewport) : + viewport_(viewport) + { + } + + virtual ~MeasureCommand() + { + } + + virtual void Undo() = 0; + + virtual void Redo() = 0; }; + class CreateMeasureCommand : public MeasureCommand { - public: - CreateMeasureCommand(boost::shared_ptr<IViewport> viewport); - virtual ~CreateMeasureCommand(); - virtual void Undo() ORTHANC_OVERRIDE; - virtual void Redo() ORTHANC_OVERRIDE; private: /** Must be implemented by the subclasses that create the actual tool */ virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0; + + public: + explicit CreateMeasureCommand(boost::shared_ptr<IViewport> viewport); + + virtual ~CreateMeasureCommand(); + + virtual void Undo() ORTHANC_OVERRIDE; + + virtual void Redo() ORTHANC_OVERRIDE; }; + class EditMeasureCommand : public MeasureCommand { - public: - EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport); - virtual ~EditMeasureCommand(); - virtual void Undo() ORTHANC_OVERRIDE; - virtual void Redo() ORTHANC_OVERRIDE; - - /** This memento is the original object state */ - boost::shared_ptr<MeasureToolMemento> mementoOriginal_; - private: /** Must be implemented by the subclasses that edit the actual tool */ virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0; protected: - /** This memento is updated by the subclasses upon modifications */ boost::shared_ptr<MeasureToolMemento> mementoModified_; + + public: + EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, + boost::shared_ptr<IViewport> viewport); + + virtual ~EditMeasureCommand(); + + virtual void Undo() ORTHANC_OVERRIDE; + + virtual void Redo() ORTHANC_OVERRIDE; + + /** This memento is the original object state */ + boost::shared_ptr<MeasureToolMemento> mementoOriginal_; }; + class DeleteMeasureCommand : public MeasureCommand { - public: - DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport); - virtual ~DeleteMeasureCommand(); - virtual void Undo() ORTHANC_OVERRIDE; - virtual void Redo() ORTHANC_OVERRIDE; - - /** This memento is the original object state */ - boost::shared_ptr<MeasureToolMemento> mementoOriginal_; - private: /** Must be implemented by the subclasses that edit the actual tool */ virtual boost::shared_ptr<MeasureTool> GetMeasureTool() @@ -100,9 +107,21 @@ boost::shared_ptr<MeasureTool> measureTool_; protected: - /** This memento is updated by the subclasses upon modifications */ boost::shared_ptr<MeasureToolMemento> mementoModified_; + + public: + DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, + boost::shared_ptr<IViewport> viewport); + + virtual ~DeleteMeasureCommand(); + + virtual void Undo() ORTHANC_OVERRIDE; + + virtual void Redo() ORTHANC_OVERRIDE; + + /** This memento is the original object state */ + boost::shared_ptr<MeasureToolMemento> mementoOriginal_; }; }
--- a/OrthancStone/Sources/Scene2DViewport/MeasureTool.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureTool.h Mon Sep 21 17:46:39 2020 +0200 @@ -40,121 +40,122 @@ class MeasureTool : public ObserverBase<MeasureTool> { + private: + bool enabled_; + public: virtual ~MeasureTool() { } /** - Enabled tools are rendered in the scene. + Enabled tools are rendered in the scene. */ void Enable(); /** - Disabled tools are not rendered in the scene. This is useful to be able - to use them as their own memento in command stacks (when a measure tool - creation command has been undone, the measure remains alive in the - command object but is disabled so that it can be redone later on easily) + Disabled tools are not rendered in the scene. This is useful to be able + to use them as their own memento in command stacks (when a measure tool + creation command has been undone, the measure remains alive in the + command object but is disabled so that it can be redone later on easily) */ void Disable(); /** - This method is called when the scene transform changes. It allows to - recompute the visual elements whose content depend upon the scene transform + This method is called when the scene transform changes. It allows to + recompute the visual elements whose content depend upon the scene transform */ void OnSceneTransformChanged( const ViewportController::SceneTransformChanged& message); /** - This function must be implemented by the measuring tool to return whether - a given point in scene coords is close to the measuring tool. + This function must be implemented by the measuring tool to return whether + a given point in scene coords is close to the measuring tool. - This is used for mouse hover highlighting. + This is used for mouse hover highlighting. - It is assumed that if the pointer position leads to this function returning - true, then a click at that position will return a tracker to edit the - measuring tool + It is assumed that if the pointer position leads to this function returning + true, then a click at that position will return a tracker to edit the + measuring tool */ virtual bool HitTest(ScenePoint2D p) = 0; /** - This method must return a memento the captures the tool state (not including - the highlighting state + This method must return a memento the captures the tool state (not including + the highlighting state */ virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const = 0; /** - This method must apply the supplied memento (this requires RTTI to check - the type) + This method must apply the supplied memento (this requires RTTI to check + the type) */ virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) = 0; /** - This must create an edition tracker suitable for the supplied click position, - or an empty pointer if no hit test (although this should have been checked - first) + This must create an edition tracker suitable for the supplied click position, + or an empty pointer if no hit test (although this should have been checked + first) */ virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) = 0; /** - Will change the measuring tool to provide visual feedback on the GUI - element that is in the pointer hit zone + Will change the measuring tool to provide visual feedback on the GUI + element that is in the pointer hit zone */ virtual void Highlight(ScenePoint2D p) = 0; /** - This function must reset the visual highlighted hot zone feedback + This function must reset the visual highlighted hot zone feedback */ virtual void ResetHighlightState() = 0; /** - A description of the measuring tool, useful in debug logs + A description of the measuring tool, useful in debug logs */ virtual std::string GetDescription() = 0; protected: - MeasureTool(boost::shared_ptr<IViewport> viewport); + explicit MeasureTool(boost::shared_ptr<IViewport> viewport); void PostConstructor(); /** - The measuring tool may exist in a standalone fashion, without any available - scene (because the controller is dead or dying). This call allows to check - before accessing the scene. + The measuring tool may exist in a standalone fashion, without any available + scene (because the controller is dead or dying). This call allows to check + before accessing the scene. */ bool IsSceneAlive() const; /** - This is the meat of the tool: this method must [create (if needed) and] - update the layers and their data according to the measure tool kind and - current state. This is repeatedly called during user interaction + This is the meat of the tool: this method must [create (if needed) and] + update the layers and their data according to the measure tool kind and + current state. This is repeatedly called during user interaction */ virtual void RefreshScene() = 0; /** - enabled_ is not accessible by subclasses because there is a state machine - that we do not wanna mess with + enabled_ is not accessible by subclasses because there is a state machine + that we do not wanna mess with */ bool IsEnabled() const; /** - Protected to allow sub-classes to use this weak pointer in factory methods - (pass them to created objects) + Protected to allow sub-classes to use this weak pointer in factory methods + (pass them to created objects) */ boost::shared_ptr<IViewport> viewport_; - - - private: - bool enabled_; }; class MeasureToolMemento { - public: - virtual ~MeasureToolMemento() {}; + public: + virtual ~MeasureToolMemento() + { + } }; } - //extern void TrackerSample_SetInfoDisplayMessage( - // std::string key, std::string value); +//extern void TrackerSample_SetInfoDisplayMessage( +// std::string key, std::string value);
--- a/OrthancStone/Sources/Scene2DViewport/MeasureTrackers.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureTrackers.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -24,10 +24,10 @@ namespace OrthancStone { - CreateMeasureTracker::CreateMeasureTracker(boost::shared_ptr<IViewport> viewport) - : viewport_(viewport) - , alive_(true) - , commitResult_(true) + CreateMeasureTracker::CreateMeasureTracker(boost::shared_ptr<IViewport> viewport) : + commitResult_(true), + viewport_(viewport), + alive_(true) { } @@ -58,10 +58,11 @@ lock->Invalidate(); } - EditMeasureTracker::EditMeasureTracker(boost::shared_ptr<IViewport> viewport, const PointerEvent& e) - : viewport_(viewport) - , alive_(true) - , commitResult_(true) + EditMeasureTracker::EditMeasureTracker(boost::shared_ptr<IViewport> viewport, + const PointerEvent& e) : + commitResult_(true), + viewport_(viewport), + alive_(true) { std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
--- a/OrthancStone/Sources/Scene2DViewport/MeasureTrackers.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/MeasureTrackers.h Mon Sep 21 17:46:39 2020 +0200 @@ -36,45 +36,50 @@ { class CreateMeasureTracker : public IFlexiblePointerTracker { + private: + bool commitResult_; + + protected: + boost::shared_ptr<CreateMeasureCommand> command_; + boost::shared_ptr<IViewport> viewport_; + bool alive_; + + explicit CreateMeasureTracker(boost::shared_ptr<IViewport> viewport); + + virtual ~CreateMeasureTracker(); + public: virtual void Cancel() ORTHANC_OVERRIDE; + virtual bool IsAlive() const ORTHANC_OVERRIDE; - protected: - CreateMeasureTracker(boost::shared_ptr<IViewport> viewport); + }; - ~CreateMeasureTracker(); - - protected: - boost::shared_ptr<CreateMeasureCommand> command_; - boost::shared_ptr<IViewport> viewport_; - bool alive_; - - private: - bool commitResult_; - }; class EditMeasureTracker : public IFlexiblePointerTracker { - public: - virtual void Cancel() ORTHANC_OVERRIDE; - virtual bool IsAlive() const ORTHANC_OVERRIDE; + private: + ScenePoint2D originalClickPosition_; + bool commitResult_; + protected: - EditMeasureTracker(boost::shared_ptr<IViewport> viewport, const PointerEvent& e); + boost::shared_ptr<EditMeasureCommand> command_; + boost::shared_ptr<IViewport> viewport_; + bool alive_; + + EditMeasureTracker(boost::shared_ptr<IViewport> viewport, + const PointerEvent& e); ~EditMeasureTracker(); - protected: - boost::shared_ptr<EditMeasureCommand> command_; - boost::shared_ptr<IViewport> viewport_; - bool alive_; - - ScenePoint2D GetOriginalClickPosition() const + ScenePoint2D GetOriginalClickPosition() const { return originalClickPosition_; } - private: - ScenePoint2D originalClickPosition_; - bool commitResult_; + + public: + virtual void Cancel() ORTHANC_OVERRIDE; + + virtual bool IsAlive() const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2DViewport/OneGesturePointerTracker.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/OneGesturePointerTracker.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -27,11 +27,10 @@ namespace OrthancStone { - OneGesturePointerTracker::OneGesturePointerTracker( - boost::shared_ptr<IViewport> viewport) - : viewport_(viewport) - , alive_(true) - , currentTouchCount_(1) + OneGesturePointerTracker::OneGesturePointerTracker(boost::shared_ptr<IViewport> viewport) : + alive_(true), + currentTouchCount_(1), + viewport_(viewport) { }
--- a/OrthancStone/Sources/Scene2DViewport/OneGesturePointerTracker.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/OneGesturePointerTracker.h Mon Sep 21 17:46:39 2020 +0200 @@ -45,18 +45,21 @@ */ class OneGesturePointerTracker : public IFlexiblePointerTracker { - public: - OneGesturePointerTracker(boost::shared_ptr<IViewport> viewport); - virtual void PointerUp(const PointerEvent& event) ORTHANC_OVERRIDE; - virtual void PointerDown(const PointerEvent& event) ORTHANC_OVERRIDE; - virtual bool IsAlive() const ORTHANC_OVERRIDE; - + private: + bool alive_; + int currentTouchCount_; + protected: boost::shared_ptr<IViewport> viewport_; - private: - bool alive_; - int currentTouchCount_; + public: + explicit OneGesturePointerTracker(boost::shared_ptr<IViewport> viewport); + + virtual void PointerUp(const PointerEvent& event) ORTHANC_OVERRIDE; + + virtual void PointerDown(const PointerEvent& event) ORTHANC_OVERRIDE; + + virtual bool IsAlive() const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Scene2DViewport/ViewportController.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.h Mon Sep 21 17:46:39 2020 +0200 @@ -87,7 +87,7 @@ SceneTransformChanged, \ ViewportController); - ViewportController(boost::shared_ptr<IViewport> viewport); + explicit ViewportController(boost::shared_ptr<IViewport> viewport); ~ViewportController();
--- a/OrthancStone/Sources/Toolbox/AffineTransform2D.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/AffineTransform2D.h Mon Sep 21 17:46:39 2020 +0200 @@ -37,7 +37,7 @@ AffineTransform2D(); // The matrix must be 3x3, without perspective effects - AffineTransform2D(const Matrix& m); + explicit AffineTransform2D(const Matrix& m); AffineTransform2D(const AffineTransform2D& other) : matrix_(other.matrix_)
--- a/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -115,8 +115,8 @@ { std::string a, b; - if (dicom.GetStringValue(a, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT) && - dicom.GetStringValue(b, Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT)) + if (dicom.GetStringValue(a, DicomPath(Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT)) && + dicom.GetStringValue(b, DicomPath(Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT))) { Setup(a, b); }
--- a/OrthancStone/Sources/Toolbox/CoordinateSystem3D.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/CoordinateSystem3D.h Mon Sep 21 17:46:39 2020 +0200 @@ -60,15 +60,15 @@ const Vector& axisX, const Vector& axisY); - CoordinateSystem3D(const IDicomDataset& dicom); - CoordinateSystem3D(const std::string& imagePositionPatient, const std::string& imageOrientationPatient) { Setup(imagePositionPatient, imageOrientationPatient); } - CoordinateSystem3D(const Orthanc::DicomMap& dicom); + explicit CoordinateSystem3D(const IDicomDataset& dicom); + + explicit CoordinateSystem3D(const Orthanc::DicomMap& dicom); const Vector& GetNormal() const {
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -72,7 +72,7 @@ DicomInstanceParameters::Data::Data(const Orthanc::DicomMap& dicom) : imageInformation_(dicom) { - if (imageInformation_.GetNumberOfFrames() <= 0) + if (imageInformation_.GetNumberOfFrames() == 0) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); }
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.h Mon Sep 21 17:46:39 2020 +0200 @@ -64,7 +64,7 @@ void ComputeDoseOffsets(const Orthanc::DicomMap& dicom); - Data(const Orthanc::DicomMap& dicom); + explicit Data(const Orthanc::DicomMap& dicom); CoordinateSystem3D GetFrameGeometry(unsigned int frame) const; @@ -84,12 +84,12 @@ public: - DicomInstanceParameters(const DicomInstanceParameters& other) : - data_(other.data_) + explicit DicomInstanceParameters(const DicomInstanceParameters& other) : + data_(other.data_) { } - DicomInstanceParameters(const Orthanc::DicomMap& dicom) : + explicit DicomInstanceParameters(const Orthanc::DicomMap& dicom) : data_(dicom) { }
--- a/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -259,12 +259,12 @@ extent_.Reset(); - for (Points::const_iterator it = points_.begin(); it != points_.end(); ++it) + for (Points::const_iterator it2 = points_.begin(); it2 != points_.end(); ++it2) { - if (IsPointOnSliceIfAny(*it)) + if (IsPointOnSliceIfAny(*it2)) { double x, y; - geometry.ProjectPoint2(x, y, *it); + geometry.ProjectPoint2(x, y, *it2); extent_.AddPoint(x, y); } } @@ -470,10 +470,10 @@ DicomDatasetReader reader(tags); size_t count, tmp; - if (!tags.GetSequenceSize(count, DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE) || - !tags.GetSequenceSize(tmp, DICOM_TAG_ROI_CONTOUR_SEQUENCE) || + if (!tags.GetSequenceSize(count, DicomPath(DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE)) || + !tags.GetSequenceSize(tmp, DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE)) || tmp != count || - !tags.GetSequenceSize(tmp, DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE) || + !tags.GetSequenceSize(tmp, DicomPath(DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE)) || tmp != count) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
--- a/OrthancStone/Sources/Toolbox/DicomStructureSet.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.h Mon Sep 21 17:46:39 2020 +0200 @@ -87,9 +87,11 @@ bool IsPointOnSliceIfAny(const Vector& v) const; public: - Polygon(const std::string& sopInstanceUid) : + explicit Polygon(const std::string& sopInstanceUid) : sopInstanceUid_(sopInstanceUid), - hasSlice_(false) + hasSlice_(false), + projectionAlongNormal_(0), + sliceThickness_(0) { }
--- a/OrthancStone/Sources/Toolbox/DynamicBitmap.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/DynamicBitmap.h Mon Sep 21 17:46:39 2020 +0200 @@ -35,7 +35,7 @@ std::unique_ptr<Orthanc::ImageAccessor> bitmap_; public: - DynamicBitmap(const Orthanc::ImageAccessor& bitmap); + explicit DynamicBitmap(const Orthanc::ImageAccessor& bitmap); const Orthanc::ImageAccessor& GetBitmap() const {
--- a/OrthancStone/Sources/Toolbox/FiniteProjectiveCamera.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/FiniteProjectiveCamera.h Mon Sep 21 17:46:39 2020 +0200 @@ -53,7 +53,7 @@ Setup(k, r, c); } - FiniteProjectiveCamera(const Matrix& p) + explicit FiniteProjectiveCamera(const Matrix& p) { Setup(p); } @@ -62,7 +62,7 @@ const double r[9], const double c[3]); - FiniteProjectiveCamera(const double p[12]); + explicit FiniteProjectiveCamera(const double p[12]); // Constructor that implements camera calibration FiniteProjectiveCamera(const Vector& camera,
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomDatasetReader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomDatasetReader.h Mon Sep 21 17:46:39 2020 +0200 @@ -34,7 +34,7 @@ const IDicomDataset& dataset_; public: - DicomDatasetReader(const IDicomDataset& dataset); + explicit DicomDatasetReader(const IDicomDataset& dataset); const IDicomDataset& GetDataset() const {
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomPath.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomPath.h Mon Sep 21 17:46:39 2020 +0200 @@ -41,7 +41,7 @@ Prefix& GetPrefixItem(size_t depth); public: - DicomPath(const Orthanc::DicomTag& finalTag) : + explicit DicomPath(const Orthanc::DicomTag& finalTag) : finalTag_(finalTag) { }
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/FullOrthancDataset.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/FullOrthancDataset.h Mon Sep 21 17:46:39 2020 +0200 @@ -24,6 +24,8 @@ #include "IOrthancConnection.h" #include "IDicomDataset.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE + #include <json/value.h> namespace OrthancStone @@ -41,18 +43,18 @@ FullOrthancDataset(IOrthancConnection& orthanc, const std::string& uri); - FullOrthancDataset(const std::string& content); + explicit FullOrthancDataset(const std::string& content); FullOrthancDataset(const void* content, size_t size); - FullOrthancDataset(const Json::Value& root); + explicit FullOrthancDataset(const Json::Value& root); virtual bool GetStringValue(std::string& result, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; virtual bool GetSequenceSize(size_t& size, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; FullOrthancDataset* Clone() const {
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/OrthancHttpConnection.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/OrthancHttpConnection.h Mon Sep 21 17:46:39 2020 +0200 @@ -23,6 +23,7 @@ #include "IOrthancConnection.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE #include <HttpClient.h> #include <boost/thread/mutex.hpp> @@ -42,19 +43,19 @@ public: OrthancHttpConnection(); - OrthancHttpConnection(const Orthanc::WebServiceParameters& parameters); + explicit OrthancHttpConnection(const Orthanc::WebServiceParameters& parameters); virtual void RestApiGet(std::string& result, - const std::string& uri); + const std::string& uri) ORTHANC_OVERRIDE; virtual void RestApiPost(std::string& result, const std::string& uri, - const std::string& body); + const std::string& body) ORTHANC_OVERRIDE; virtual void RestApiPut(std::string& result, const std::string& uri, - const std::string& body); + const std::string& body) ORTHANC_OVERRIDE; - virtual void RestApiDelete(const std::string& uri); + virtual void RestApiDelete(const std::string& uri) ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/SimplifiedOrthancDataset.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/SimplifiedOrthancDataset.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -21,6 +21,9 @@ #include "SimplifiedOrthancDataset.h" +#include <OrthancException.h> +#include <DicomParsing/FromDcmtkBridge.h> + namespace OrthancStone { const Json::Value* SimplifiedOrthancDataset::LookupPath(const DicomPath& path) const @@ -29,7 +32,8 @@ for (unsigned int depth = 0; depth < path.GetPrefixLength(); depth++) { - const char* name = path.GetPrefixTag(depth).GetName(); + const std::string name = Orthanc::FromDcmtkBridge::GetTagName( + path.GetPrefixTag(depth), "" /* no private creator */); if (content->type() != Json::objectValue) { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); @@ -57,7 +61,8 @@ } } - const char* name = path.GetFinalTag().GetName(); + const std::string name = Orthanc::FromDcmtkBridge::GetTagName( + path.GetFinalTag(), "" /* no private creator */); if (content->type() != Json::objectValue) {
--- a/OrthancStone/Sources/Toolbox/OrthancDatasets/SimplifiedOrthancDataset.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/SimplifiedOrthancDataset.h Mon Sep 21 17:46:39 2020 +0200 @@ -21,9 +21,19 @@ #pragma once +#if !defined(ORTHANC_ENABLE_DCMTK) +# error The macro ORTHANC_ENABLE_DCMTK must be defined +#endif + +#if ORTHANC_ENABLE_DCMTK != 1 +# error Support for DCMTK must be enabled to use SimplifiedOrthancDataset +#endif + #include "IOrthancConnection.h" #include "IDicomDataset.h" +#include <Compatibility.h> // For ORTHANC_OVERRIDE + namespace OrthancStone { class SimplifiedOrthancDataset : public IDicomDataset @@ -39,12 +49,12 @@ SimplifiedOrthancDataset(IOrthancConnection& orthanc, const std::string& uri); - SimplifiedOrthancDataset(const std::string& content); + explicit SimplifiedOrthancDataset(const std::string& content); virtual bool GetStringValue(std::string& result, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; virtual bool GetSequenceSize(size_t& size, - const DicomPath& path) const; + const DicomPath& path) const ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -27,8 +27,8 @@ { private: std::unique_ptr<Orthanc::ParsedDicomFile> dicom_; - size_t fileSize_; - bool hasPixelData_; + size_t fileSize_; + bool hasPixelData_; public: Item(Orthanc::ParsedDicomFile* dicom, @@ -44,7 +44,7 @@ } } - virtual size_t GetMemoryUsage() const + virtual size_t GetMemoryUsage() const ORTHANC_OVERRIDE { return fileSize_; }
--- a/OrthancStone/Sources/Toolbox/ParsedDicomCache.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/ParsedDicomCache.h Mon Sep 21 17:46:39 2020 +0200 @@ -37,7 +37,7 @@ Orthanc::MemoryObjectCache cache_; public: - ParsedDicomCache(size_t size) + explicit ParsedDicomCache(size_t size) { cache_.SetMaximumSize(size); }
--- a/OrthancStone/Sources/Toolbox/ParsedDicomDataset.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/ParsedDicomDataset.h Mon Sep 21 17:46:39 2020 +0200 @@ -34,7 +34,7 @@ Orthanc::ParsedDicomFile& dicom_; public: - ParsedDicomDataset(Orthanc::ParsedDicomFile& dicom) : + explicit ParsedDicomDataset(Orthanc::ParsedDicomFile& dicom) : dicom_(dicom) { }
--- a/OrthancStone/Sources/Toolbox/SlicesSorter.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/SlicesSorter.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -315,8 +315,8 @@ for (size_t i = 1; i < GetSlicesCount(); i++) { - OrthancStone::Vector p = reference.GetOrigin() + spacing * static_cast<double>(i) * reference.GetNormal(); - double d = boost::numeric::ublas::norm_2(p - GetSliceGeometry(i).GetOrigin()); + OrthancStone::Vector q = reference.GetOrigin() + spacing * static_cast<double>(i) * reference.GetNormal(); + double d = boost::numeric::ublas::norm_2(q - GetSliceGeometry(i).GetOrigin()); if (!OrthancStone::LinearAlgebra::IsNear(d, 0, 0.001 /* tolerance expressed in mm */)) {
--- a/OrthancStone/Sources/Toolbox/SortedFrames.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/SortedFrames.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -388,7 +388,7 @@ // The following could in theory happen if several instances // have the same SOPInstanceUID, no ordering is available for (std::set<size_t>::const_iterator it = remainingInstances.begin(); - it != remainingInstances.end(); it++) + it != remainingInstances.end(); ++it) { AddFramesOfInstance(remainingInstances, *it); }
--- a/OrthancStone/Sources/Toolbox/SortedFrames.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/SortedFrames.h Mon Sep 21 17:46:39 2020 +0200 @@ -40,7 +40,7 @@ bool monochrome1_; public: - Instance(const Orthanc::DicomMap& tags); + explicit Instance(const Orthanc::DicomMap& tags); const Orthanc::DicomMap& GetTags() const {
--- a/OrthancStone/Sources/Toolbox/SubpixelReader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/SubpixelReader.h Mon Sep 21 17:46:39 2020 +0200 @@ -41,7 +41,7 @@ unsigned int height_; public: - SubpixelReaderBase(const Orthanc::ImageAccessor& source) : + explicit SubpixelReaderBase(const Orthanc::ImageAccessor& source) : source_(source), width_(source.GetWidth()), height_(source.GetHeight()) @@ -82,7 +82,7 @@ typedef Orthanc::PixelTraits<Format> Traits; typedef typename Traits::PixelType PixelType; - SubpixelReader(const Orthanc::ImageAccessor& source) : + explicit SubpixelReader(const Orthanc::ImageAccessor& source) : SubpixelReaderBase(source) { } @@ -106,7 +106,7 @@ typedef Orthanc::PixelTraits<Format> Traits; typedef typename Traits::PixelType PixelType; - SubpixelReader(const Orthanc::ImageAccessor& source) : + explicit SubpixelReader(const Orthanc::ImageAccessor& source) : SubpixelReaderBase(source) { }
--- a/OrthancStone/Sources/Toolbox/SubvoxelReader.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Toolbox/SubvoxelReader.h Mon Sep 21 17:46:39 2020 +0200 @@ -49,7 +49,7 @@ unsigned int depth_; public: - SubvoxelReaderBase(const ImageBuffer3D& source) : + explicit SubvoxelReaderBase(const ImageBuffer3D& source) : source_(source), width_(source.GetWidth()), height_(source.GetHeight()), @@ -118,7 +118,7 @@ typedef Orthanc::PixelTraits<Format> Traits; typedef typename Traits::PixelType PixelType; - SubvoxelReader(const ImageBuffer3D& source) : + explicit SubvoxelReader(const ImageBuffer3D& source) : SubvoxelReaderBase(source) { } @@ -150,7 +150,7 @@ typedef Orthanc::PixelTraits<Format> Traits; typedef typename Traits::PixelType PixelType; - SubvoxelReader(const ImageBuffer3D& source) : + explicit SubvoxelReader(const ImageBuffer3D& source) : SubvoxelReaderBase(source) { } @@ -193,7 +193,7 @@ typedef Orthanc::PixelTraits<Format> Traits; typedef typename Traits::PixelType PixelType; - SubvoxelReader(const ImageBuffer3D& source) : + explicit SubvoxelReader(const ImageBuffer3D& source) : SubvoxelReaderBase(source), bilinear_(source) {
--- a/OrthancStone/Sources/Viewport/SdlViewport.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Viewport/SdlViewport.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -99,7 +99,7 @@ uint32_t SdlOpenGLViewport::GetSdlWindowId() { - SdlWindow& sdlWindowWrapper = context_.GetWindow(); + const SdlWindow& sdlWindowWrapper = context_.GetWindow(); SDL_Window* sdlWindow = sdlWindowWrapper.GetObject(); Uint32 sdlWindowId = SDL_GetWindowID(sdlWindow); return sdlWindowId; @@ -196,7 +196,7 @@ // Assumes that the mutex is locked - void SdlCairoViewport::CreateSdlSurfaceFromCompositor(CairoCompositor& compositor) + void SdlCairoViewport::CreateSdlSurfaceFromCompositor(const CairoCompositor& compositor) { static const uint32_t rmask = 0x00ff0000; static const uint32_t gmask = 0x0000ff00;
--- a/OrthancStone/Sources/Viewport/SdlViewport.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Viewport/SdlViewport.h Mon Sep 21 17:46:39 2020 +0200 @@ -73,9 +73,9 @@ boost::recursive_mutex::scoped_lock lock_; public: - SdlLock(SdlViewport& that) : - that_(that), - lock_(that.mutex_) + explicit SdlLock(SdlViewport& that) : + that_(that), + lock_(that.mutex_) { } @@ -168,7 +168,7 @@ SdlWindow window_; SDL_Surface* sdlSurface_; - void CreateSdlSurfaceFromCompositor(CairoCompositor& compositor); + void CreateSdlSurfaceFromCompositor(const CairoCompositor& compositor); private: SdlCairoViewport(const char* title,
--- a/OrthancStone/Sources/Viewport/WebAssemblyViewport.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Viewport/WebAssemblyViewport.h Mon Sep 21 17:46:39 2020 +0200 @@ -91,10 +91,10 @@ /** The second argument is temporary and should be deleted once the migration - to interactors is finished. + to interactors is finished. It should be set to "true" for new applications. */ WebAssemblyViewport(const std::string& canvasId, - bool enableEmscriptenMouseEvents = true); + bool enableEmscriptenMouseEvents); void PostConstructor();
--- a/OrthancStone/Sources/Viewport/WebGLViewportsRegistry.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Viewport/WebGLViewportsRegistry.h Mon Sep 21 17:46:39 2020 +0200 @@ -52,7 +52,7 @@ static void OnTimeoutCallback(void *userData); public: - WebGLViewportsRegistry(double timeoutMS /* in milliseconds */); + explicit WebGLViewportsRegistry(double timeoutMS /* in milliseconds */); ~WebGLViewportsRegistry();
--- a/OrthancStone/Sources/Volumes/DicomVolumeImageMPRSlicer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/DicomVolumeImageMPRSlicer.h Mon Sep 21 17:46:39 2020 +0200 @@ -84,7 +84,7 @@ boost::shared_ptr<DicomVolumeImage> volume_; public: - DicomVolumeImageMPRSlicer(const boost::shared_ptr<DicomVolumeImage>& volume) : + explicit DicomVolumeImageMPRSlicer(const boost::shared_ptr<DicomVolumeImage>& volume) : volume_(volume) { }
--- a/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -39,18 +39,18 @@ { } - virtual bool IsValid() + virtual bool IsValid() ORTHANC_OVERRIDE { return true; } - virtual uint64_t GetRevision() + virtual uint64_t GetRevision() ORTHANC_OVERRIDE { return that_.volume_->GetRevision(); } virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, - const CoordinateSystem3D& cuttingPlane) + const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE { VolumeReslicer& reslicer = that_.reslicer_;
--- a/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/DicomVolumeImageReslicer.h Mon Sep 21 17:46:39 2020 +0200 @@ -42,7 +42,7 @@ VolumeReslicer reslicer_; public: - DicomVolumeImageReslicer(const boost::shared_ptr<DicomVolumeImage>& volume); + explicit DicomVolumeImageReslicer(const boost::shared_ptr<DicomVolumeImage>& volume); ImageInterpolation GetInterpolation() const { @@ -64,6 +64,6 @@ reslicer_.EnableFastMode(fast); } - virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane); + virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE; }; }
--- a/OrthancStone/Sources/Volumes/IVolumeSlicer.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/IVolumeSlicer.h Mon Sep 21 17:46:39 2020 +0200 @@ -78,15 +78,15 @@ class InvalidSlice : public IExtractedSlice { public: - virtual bool IsValid() + virtual bool IsValid() ORTHANC_OVERRIDE { return false; } - virtual uint64_t GetRevision(); + virtual uint64_t GetRevision() ORTHANC_OVERRIDE; virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, - const CoordinateSystem3D& cuttingPlane); + const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE; };
--- a/OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.h Mon Sep 21 17:46:39 2020 +0200 @@ -40,7 +40,7 @@ double hw_; // half depth public: - OrientedVolumeBoundingBox(const VolumeImageGeometry& geometry); + explicit OrientedVolumeBoundingBox(const VolumeImageGeometry& geometry); const Vector& GetCenter() const {
--- a/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.cpp Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.cpp Mon Sep 21 17:46:39 2020 +0200 @@ -54,10 +54,12 @@ VolumeSceneLayerSource::VolumeSceneLayerSource( boost::shared_ptr<OrthancStone::IViewport> viewport, int layerDepth, - const boost::shared_ptr<IVolumeSlicer>& slicer) - : viewport_(viewport) - , layerDepth_(layerDepth) - , slicer_(slicer) + const boost::shared_ptr<IVolumeSlicer>& slicer) : + viewport_(viewport), + layerDepth_(layerDepth), + slicer_(slicer), + lastRevision_(0), + lastConfiguratorRevision_(0) { if (slicer == NULL) {
--- a/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Volumes/VolumeSceneLayerSource.h Mon Sep 21 17:46:39 2020 +0200 @@ -46,7 +46,6 @@ std::unique_ptr<CoordinateSystem3D> lastPlane_; uint64_t lastRevision_; uint64_t lastConfiguratorRevision_; - bool layerInScene_; void ClearLayer();
--- a/OrthancStone/Sources/Wrappers/CairoContext.h Mon Sep 21 14:50:26 2020 +0200 +++ b/OrthancStone/Sources/Wrappers/CairoContext.h Mon Sep 21 17:46:39 2020 +0200 @@ -39,7 +39,7 @@ unsigned int height_; public: - CairoContext(CairoSurface& surface); + explicit CairoContext(CairoSurface& surface); ~CairoContext();