# HG changeset patch # User Sebastien Jodogne # Date 1556193282 -7200 # Node ID 2a8ac2d426dba8ba2356d4b57e3428d88b9d40da # Parent 5b4890d289cf6f582c6532e3e4e9d020091cfe6a renamed ColorTextureSceneLayer, dropped dependency on boost::chrono diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Scene2D/ColorTextureSceneLayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/Scene2D/ColorTextureSceneLayer.cpp Thu Apr 25 13:54:42 2019 +0200 @@ -0,0 +1,107 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2019 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + + +#include "ColorTextureSceneLayer.h" + +#include +#include + +namespace OrthancStone +{ + ColorTextureSceneLayer::ColorTextureSceneLayer(const Orthanc::ImageAccessor& texture, + double originX, // Center of the top-left pixel + double originY, + double pixelSpacingX, + double pixelSpacingY, + double angle, + bool isLinearInterpolation) : + texture_(Orthanc::Image::Clone(texture)), + originX_(originX), + originY_(originY), + pixelSpacingX_(pixelSpacingX), + pixelSpacingY_(pixelSpacingY), + angle_(angle), + isLinearInterpolation_(isLinearInterpolation) + { + if (texture_->GetFormat() != Orthanc::PixelFormat_Grayscale8 && + texture_->GetFormat() != Orthanc::PixelFormat_RGBA32 && + texture_->GetFormat() != Orthanc::PixelFormat_RGB24) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); + } + + if (pixelSpacingX_ <= 0 || + pixelSpacingY_ <= 0) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); + } + } + + + ISceneLayer* ColorTextureSceneLayer::Clone() const + { + return new ColorTextureSceneLayer(*texture_, originX_, originY_, + pixelSpacingX_, pixelSpacingY_, angle_, + isLinearInterpolation_); + } + + + AffineTransform2D ColorTextureSceneLayer::GetTransform() const + { + return AffineTransform2D::Combine( + AffineTransform2D::CreateOffset(originX_, originY_), + AffineTransform2D::CreateRotation(angle_), + AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_), + AffineTransform2D::CreateOffset(-0.5, -0.5)); + } + + + bool ColorTextureSceneLayer::GetBoundingBox(Extent2D& target) const + { + const AffineTransform2D t = GetTransform(); + + target.Reset(); + + double x, y; + + x = 0; + y = 0; + t.Apply(x, y); + target.AddPoint(x, y); + + x = static_cast(texture_->GetWidth()); + y = 0; + t.Apply(x, y); + target.AddPoint(x, y); + + x = 0; + y = static_cast(texture_->GetHeight()); + t.Apply(x, y); + target.AddPoint(x, y); + + x = static_cast(texture_->GetWidth()); + y = static_cast(texture_->GetHeight()); + t.Apply(x, y); + target.AddPoint(x, y); + + return true; + } +} diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Scene2D/ColorTextureSceneLayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/Scene2D/ColorTextureSceneLayer.h Thu Apr 25 13:54:42 2019 +0200 @@ -0,0 +1,78 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2019 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + + +#pragma once + +#include "ISceneLayer.h" +#include "../Toolbox/AffineTransform2D.h" + +#include +#include + +namespace OrthancStone +{ + class ColorTextureSceneLayer : public ISceneLayer + { + private: + std::auto_ptr texture_; + double originX_; + double originY_; + double pixelSpacingX_; + double pixelSpacingY_; + double angle_; + bool isLinearInterpolation_; + + public: + ColorTextureSceneLayer(const Orthanc::ImageAccessor& texture, + double originX, // Center of the top-left pixel + double originY, + double pixelSpacingX, + double pixelSpacingY, + double angle, + bool isLinearInterpolation); + + virtual ISceneLayer* Clone() const; + + const Orthanc::ImageAccessor& GetTexture() const + { + return *texture_; + } + + AffineTransform2D GetTransform() const; + + bool IsLinearInterpolation() const + { + return isLinearInterpolation_; + } + + virtual Type GetType() const + { + return Type_ColorTexture; + } + + virtual bool GetBoundingBox(Extent2D& target) const; + + virtual uint64_t GetRevision() const + { + return 0; + } + }; +} diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Scene2D/ISceneLayer.h --- a/Framework/Scene2D/ISceneLayer.h Mon Apr 22 10:07:34 2019 +0200 +++ b/Framework/Scene2D/ISceneLayer.h Thu Apr 25 13:54:42 2019 +0200 @@ -34,7 +34,7 @@ enum Type { Type_InfoPanel, - Type_Texture, + Type_ColorTexture, Type_Polyline, Type_Text }; diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Scene2D/TextureSceneLayer.cpp --- a/Framework/Scene2D/TextureSceneLayer.cpp Mon Apr 22 10:07:34 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - **/ - - -#include "TextureSceneLayer.h" - -#include -#include - -namespace OrthancStone -{ - TextureSceneLayer::TextureSceneLayer(const Orthanc::ImageAccessor& texture, - double originX, // Center of the top-left pixel - double originY, - double pixelSpacingX, - double pixelSpacingY, - double angle, - bool isLinearInterpolation) : - texture_(Orthanc::Image::Clone(texture)), - originX_(originX), - originY_(originY), - pixelSpacingX_(pixelSpacingX), - pixelSpacingY_(pixelSpacingY), - angle_(angle), - isLinearInterpolation_(isLinearInterpolation) - { - if (texture_->GetFormat() != Orthanc::PixelFormat_Grayscale8 && - texture_->GetFormat() != Orthanc::PixelFormat_RGBA32 && - texture_->GetFormat() != Orthanc::PixelFormat_RGB24) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); - } - - if (pixelSpacingX_ <= 0 || - pixelSpacingY_ <= 0) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); - } - } - - - ISceneLayer* TextureSceneLayer::Clone() const - { - return new TextureSceneLayer(*texture_, originX_, originY_, - pixelSpacingX_, pixelSpacingY_, angle_, - isLinearInterpolation_); - } - - - AffineTransform2D TextureSceneLayer::GetTransform() const - { - return AffineTransform2D::Combine( - AffineTransform2D::CreateOffset(originX_, originY_), - AffineTransform2D::CreateRotation(angle_), - AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_), - AffineTransform2D::CreateOffset(-0.5, -0.5)); - } - - - bool TextureSceneLayer::GetBoundingBox(Extent2D& target) const - { - const AffineTransform2D t = GetTransform(); - - target.Reset(); - - double x, y; - - x = 0; - y = 0; - t.Apply(x, y); - target.AddPoint(x, y); - - x = static_cast(texture_->GetWidth()); - y = 0; - t.Apply(x, y); - target.AddPoint(x, y); - - x = 0; - y = static_cast(texture_->GetHeight()); - t.Apply(x, y); - target.AddPoint(x, y); - - x = static_cast(texture_->GetWidth()); - y = static_cast(texture_->GetHeight()); - t.Apply(x, y); - target.AddPoint(x, y); - - return true; - } -} diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Scene2D/TextureSceneLayer.h --- a/Framework/Scene2D/TextureSceneLayer.h Mon Apr 22 10:07:34 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - **/ - - -#pragma once - -#include "ISceneLayer.h" -#include "../Toolbox/AffineTransform2D.h" - -#include -#include - -namespace OrthancStone -{ - class TextureSceneLayer : public ISceneLayer - { - private: - std::auto_ptr texture_; - double originX_; - double originY_; - double pixelSpacingX_; - double pixelSpacingY_; - double angle_; - bool isLinearInterpolation_; - - public: - TextureSceneLayer(const Orthanc::ImageAccessor& texture, - double originX, // Center of the top-left pixel - double originY, - double pixelSpacingX, - double pixelSpacingY, - double angle, - bool isLinearInterpolation); - - virtual ISceneLayer* Clone() const; - - const Orthanc::ImageAccessor& GetTexture() const - { - return *texture_; - } - - AffineTransform2D GetTransform() const; - - bool IsLinearInterpolation() const - { - return isLinearInterpolation_; - } - - virtual Type GetType() const - { - return Type_Texture; - } - - virtual bool GetBoundingBox(Extent2D& target) const; - - virtual uint64_t GetRevision() const - { - return 0; - } - }; -} diff -r 5b4890d289cf -r 2a8ac2d426db Framework/Toolbox/BaseWebService.h --- a/Framework/Toolbox/BaseWebService.h Mon Apr 22 10:07:34 2019 +0200 +++ b/Framework/Toolbox/BaseWebService.h Thu Apr 25 13:54:42 2019 +0200 @@ -81,7 +81,7 @@ class BaseWebServicePayload; bool cacheEnabled_; - std::map> cache_; // TODO: this is currently an infinite cache ! + std::map > cache_; // TODO: this is currently an infinite cache ! public: diff -r 5b4890d289cf -r 2a8ac2d426db Platforms/Generic/DelayedCallCommand.cpp --- a/Platforms/Generic/DelayedCallCommand.cpp Mon Apr 22 10:07:34 2019 +0200 +++ b/Platforms/Generic/DelayedCallCommand.cpp Thu Apr 25 13:54:42 2019 +0200 @@ -36,7 +36,7 @@ callback_(callback), payload_(payload), context_(context), - expirationTimePoint_(boost::chrono::system_clock::now() + boost::chrono::milliseconds(timeoutInMs)), + expirationTimePoint_(boost::posix_time::microsec_clock::local_time() + boost::posix_time::milliseconds(timeoutInMs)), timeoutInMs_(timeoutInMs) { } @@ -44,9 +44,9 @@ void DelayedCallCommand::Execute() { - while (boost::chrono::system_clock::now() < expirationTimePoint_) + while (boost::posix_time::microsec_clock::local_time() < expirationTimePoint_) { - boost::this_thread::sleep_for(boost::chrono::milliseconds(1)); + boost::this_thread::sleep(boost::posix_time::milliseconds(1)); } } diff -r 5b4890d289cf -r 2a8ac2d426db Platforms/Generic/DelayedCallCommand.h --- a/Platforms/Generic/DelayedCallCommand.h Mon Apr 22 10:07:34 2019 +0200 +++ b/Platforms/Generic/DelayedCallCommand.h Thu Apr 25 13:54:42 2019 +0200 @@ -27,7 +27,8 @@ #include "../../Framework/Messages/IObservable.h" #include "../../Framework/Messages/ICallable.h" #include "../../Applications/Generic/NativeStoneApplicationContext.h" -#include + +#include namespace OrthancStone { @@ -37,7 +38,7 @@ std::auto_ptr > callback_; std::auto_ptr payload_; NativeStoneApplicationContext& context_; - boost::chrono::system_clock::time_point expirationTimePoint_; + boost::posix_time::ptime expirationTimePoint_; unsigned int timeoutInMs_; public: diff -r 5b4890d289cf -r 2a8ac2d426db Resources/CMake/OrthancStoneConfiguration.cmake --- a/Resources/CMake/OrthancStoneConfiguration.cmake Mon Apr 22 10:07:34 2019 +0200 +++ b/Resources/CMake/OrthancStoneConfiguration.cmake Thu Apr 25 13:54:42 2019 +0200 @@ -294,7 +294,7 @@ ${ORTHANC_STONE_ROOT}/Framework/Scene2D/PolylineSceneLayer.cpp ${ORTHANC_STONE_ROOT}/Framework/Scene2D/Scene2D.cpp ${ORTHANC_STONE_ROOT}/Framework/Scene2D/TextSceneLayer.cpp - ${ORTHANC_STONE_ROOT}/Framework/Scene2D/TextureSceneLayer.cpp + ${ORTHANC_STONE_ROOT}/Framework/Scene2D/ColorTextureSceneLayer.cpp ${ORTHANC_STONE_ROOT}/Framework/SmartLoader.cpp ${ORTHANC_STONE_ROOT}/Framework/StoneEnumerations.cpp ${ORTHANC_STONE_ROOT}/Framework/StoneException.h