Mercurial > hg > orthanc-stone
changeset 896:875bd6aca5e6 am-dev
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 12 Jul 2019 14:57:48 +0200 |
parents | 6073c980323a (current diff) 6e79e8c9021c (diff) |
children | 9c2f6d6b9f4a |
files | Samples/Shared/SharedBasicScene.cpp |
diffstat | 32 files changed, 142 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Scene2D/CairoCompositor.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/CairoCompositor.h Fri Jul 12 14:57:48 2019 +0200 @@ -54,20 +54,20 @@ ~CairoCompositor(); - virtual unsigned int GetWidth() const + const CairoSurface& GetCanvas() const + { + return canvas_; + } + + virtual unsigned int GetCanvasWidth() const { return canvas_.GetWidth(); } - virtual unsigned int GetHeight() const + virtual unsigned int GetCanvasHeight() const { return canvas_.GetHeight(); } - - const CairoSurface& GetCanvas() const - { - return canvas_; - } void SetFont(size_t index, GlyphBitmapAlphabet* dict); // Takes ownership
--- a/Framework/Scene2D/Internals/CairoBaseRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoBaseRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -57,7 +57,7 @@ virtual void Update(const ISceneLayer& layer) { layer_.reset(layer.Clone()); - } + } }; } }
--- a/Framework/Scene2D/Internals/CairoColorTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoColorTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -43,7 +43,9 @@ virtual void Update(const ISceneLayer& layer); - virtual void Render(const AffineTransform2D& transform) + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { RenderColorTexture(target_, transform, texture_, textureTransform_, isLinearInterpolation_);
--- a/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoFloatTextureRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -88,7 +88,9 @@ } - void CairoFloatTextureRenderer::Render(const AffineTransform2D& transform) + void CairoFloatTextureRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { CairoColorTextureRenderer::RenderColorTexture(target_, transform, texture_, textureTransform_, isLinearInterpolation_);
--- a/Framework/Scene2D/Internals/CairoFloatTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoFloatTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -47,7 +47,9 @@ virtual void Update(const ISceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); }; } }
--- a/Framework/Scene2D/Internals/CairoInfoPanelRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoInfoPanelRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -37,12 +37,14 @@ } - void CairoInfoPanelRenderer::Render(const AffineTransform2D& transform) + void CairoInfoPanelRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { int dx, dy; InfoPanelSceneLayer::ComputeAnchorLocation( dx, dy, anchor_, texture_.GetWidth(), texture_.GetHeight(), - target_.GetWidth(), target_.GetHeight()); + canvasWidth, canvasHeight); cairo_t* cr = target_.GetCairoContext();
--- a/Framework/Scene2D/Internals/CairoInfoPanelRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoInfoPanelRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -47,7 +47,9 @@ virtual void Update(const ISceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); }; } }
--- a/Framework/Scene2D/Internals/CairoLookupTableTextureRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoLookupTableTextureRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -99,7 +99,9 @@ cairo_surface_mark_dirty(texture_.GetObject()); } - void CairoLookupTableTextureRenderer::Render(const AffineTransform2D& transform) + void CairoLookupTableTextureRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { CairoColorTextureRenderer::RenderColorTexture(target_, transform, texture_, textureTransform_, isLinearInterpolation_);
--- a/Framework/Scene2D/Internals/CairoLookupTableTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoLookupTableTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -47,7 +47,9 @@ virtual void Update(const ISceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); }; } }
--- a/Framework/Scene2D/Internals/CairoPolylineRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoPolylineRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -27,7 +27,9 @@ { namespace Internals { - void CairoPolylineRenderer::Render(const AffineTransform2D& transform) + void CairoPolylineRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { const PolylineSceneLayer& layer = GetLayer<PolylineSceneLayer>();
--- a/Framework/Scene2D/Internals/CairoPolylineRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoPolylineRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -36,7 +36,9 @@ { } - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); }; } }
--- a/Framework/Scene2D/Internals/CairoTextRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoTextRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -75,7 +75,9 @@ } - void CairoTextRenderer::Render(const AffineTransform2D& transform) + void CairoTextRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (text_.GetWidth() != 0 && text_.GetHeight() != 0)
--- a/Framework/Scene2D/Internals/CairoTextRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CairoTextRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -40,7 +40,9 @@ const GlyphBitmapAlphabet& alphabet, const TextSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); }; } }
--- a/Framework/Scene2D/Internals/CompositorHelper.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CompositorHelper.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -107,7 +107,7 @@ if (renderer.get() != NULL) { - renderer->Render(sceneTransform_); + renderer->Render(sceneTransform_, canvasWidth_, canvasHeight_); content_[depth] = new Item(renderer.release(), layer, layerIdentifier); } } @@ -121,7 +121,7 @@ found->second->UpdateRenderer(); } - found->second->GetRenderer().Render(sceneTransform_); + found->second->GetRenderer().Render(sceneTransform_, canvasWidth_, canvasHeight_); } // Check invariants @@ -150,6 +150,8 @@ static_cast<double>(canvasHeight) / 2.0); sceneTransform_ = AffineTransform2D::Combine(offset, scene_.GetSceneToCanvasTransform()); + canvasWidth_ = canvasWidth; + canvasHeight_ = canvasHeight; scene_.Apply(*this); } }
--- a/Framework/Scene2D/Internals/CompositorHelper.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/CompositorHelper.h Fri Jul 12 14:57:48 2019 +0200 @@ -29,18 +29,22 @@ namespace OrthancStone { - class ICompositor + class ICompositor : public boost::noncopyable { public: - virtual unsigned int GetWidth() const = 0; - virtual unsigned int GetHeight() const = 0; + virtual ~ICompositor() + { + } + + virtual unsigned int GetCanvasWidth() const = 0; + virtual unsigned int GetCanvasHeight() const = 0; virtual void Refresh() = 0; ScenePoint2D GetPixelCenterCoordinates(int x, int y) const { return ScenePoint2D( - static_cast<double>(x) + 0.5 - static_cast<double>(GetWidth()) / 2.0, - static_cast<double>(y) + 0.5 - static_cast<double>(GetHeight()) / 2.0); + static_cast<double>(x) + 0.5 - static_cast<double>(GetCanvasWidth()) / 2.0, + static_cast<double>(y) + 0.5 - static_cast<double>(GetCanvasHeight()) / 2.0); } }; @@ -57,7 +61,9 @@ { } - virtual void Render(const AffineTransform2D& transform) = 0; + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) = 0; // "Update()" is only called if the type of the layer has not changed virtual void Update(const ISceneLayer& layer) = 0; @@ -81,8 +87,12 @@ const Scene2D& scene_; IRendererFactory& factory_; Content content_; + + // Only valid during a call to Refresh() AffineTransform2D sceneTransform_; - + unsigned int canvasWidth_; + unsigned int canvasHeight_; + protected: virtual void Visit(const ISceneLayer& layer, uint64_t layerIdentifier,
--- a/Framework/Scene2D/Internals/ICairoContextProvider.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/ICairoContextProvider.h Fri Jul 12 14:57:48 2019 +0200 @@ -37,10 +37,6 @@ } virtual cairo_t* GetCairoContext() = 0; - - virtual unsigned int GetWidth() const = 0; - - virtual unsigned int GetHeight() const = 0; }; } }
--- a/Framework/Scene2D/Internals/OpenGLAdvancedPolylineRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLAdvancedPolylineRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -43,7 +43,9 @@ OpenGLLinesProgram& program, const PolylineSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform) + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { program_.Apply(*data_, transform, true, true); }
--- a/Framework/Scene2D/Internals/OpenGLColorTextureRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLColorTextureRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -44,7 +44,9 @@ } - void OpenGLColorTextureRenderer::Render(const AffineTransform2D& transform) + void OpenGLColorTextureRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (texture_.get() != NULL) {
--- a/Framework/Scene2D/Internals/OpenGLColorTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLColorTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -44,7 +44,9 @@ OpenGLColorTextureProgram& program, const ColorTextureSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); virtual void Update(const ISceneLayer& layer); };
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -49,7 +49,9 @@ } - void OpenGLFloatTextureRenderer::Render(const AffineTransform2D& transform) + void OpenGLFloatTextureRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (texture_.get() != NULL) {
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -47,7 +47,9 @@ OpenGLFloatTextureProgram& program, const FloatTextureSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); virtual void Update(const ISceneLayer& layer); };
--- a/Framework/Scene2D/Internals/OpenGLInfoPanelRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLInfoPanelRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -44,14 +44,16 @@ } - void OpenGLInfoPanelRenderer::Render(const AffineTransform2D& transform) + void OpenGLInfoPanelRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (texture_.get() != NULL) { int dx, dy; InfoPanelSceneLayer::ComputeAnchorLocation( dx, dy, anchor_, texture_->GetWidth(), texture_->GetHeight(), - context_.GetCanvasWidth(), context_.GetCanvasHeight()); + canvasWidth, canvasHeight); // The position of this type of layer is layer: Ignore the // "transform" coming from the scene
--- a/Framework/Scene2D/Internals/OpenGLInfoPanelRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLInfoPanelRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -44,7 +44,9 @@ OpenGLColorTextureProgram& program, const InfoPanelSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); virtual void Update(const ISceneLayer& layer) {
--- a/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -119,7 +119,9 @@ } - void OpenGLLookupTableTextureRenderer::Render(const AffineTransform2D& transform) + void OpenGLLookupTableTextureRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (glTexture_.get() != NULL) {
--- a/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -48,7 +48,9 @@ OpenGLColorTextureProgram& program, const LookupTableTextureSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); virtual void Update(const ISceneLayer& layer); };
--- a/Framework/Scene2D/Internals/OpenGLTextRenderer.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLTextRenderer.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -45,7 +45,9 @@ } - void OpenGLTextRenderer::Render(const AffineTransform2D& transform) + void OpenGLTextRenderer::Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight) { if (data_.get() != NULL) {
--- a/Framework/Scene2D/Internals/OpenGLTextRenderer.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLTextRenderer.h Fri Jul 12 14:57:48 2019 +0200 @@ -46,7 +46,9 @@ OpenGL::OpenGLTexture& texture, const TextSceneLayer& layer); - virtual void Render(const AffineTransform2D& transform); + virtual void Render(const AffineTransform2D& transform, + unsigned int canvasWidth, + unsigned int canvasHeight); virtual void Update(const ISceneLayer& layer); };
--- a/Framework/Scene2D/OpenGLCompositor.h Fri Jul 12 14:57:06 2019 +0200 +++ b/Framework/Scene2D/OpenGLCompositor.h Fri Jul 12 14:57:48 2019 +0200 @@ -72,15 +72,14 @@ Orthanc::Encoding codepage); #endif - virtual unsigned int GetWidth() const + virtual unsigned int GetCanvasWidth() const { return canvasWidth_; } - unsigned int GetHeight() const + virtual unsigned int GetCanvasHeight() const { return canvasHeight_; } - }; }
--- a/Samples/Sdl/FusionMprSdl.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Samples/Sdl/FusionMprSdl.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -135,8 +135,8 @@ } // position the fixed info text in the upper right corner layerP->SetText(msgS.c_str()); - double cX = compositor_->GetWidth() * (-0.5); - double cY = compositor_->GetHeight() * (-0.5); + double cX = compositor_->GetCanvasWidth() * (-0.5); + double cY = compositor_->GetCanvasHeight() * (-0.5); GetScene()->GetCanvasToSceneTransform().Apply(cX,cY); layerP->SetPosition(cX, cY); } @@ -270,8 +270,8 @@ } break; case SDLK_s: - controller_->FitContent(compositor_->GetWidth(), - compositor_->GetHeight()); + controller_->FitContent(compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; case SDLK_z: @@ -309,8 +309,8 @@ case SDLK_c: TakeScreenshot( "screenshot.png", - compositor_->GetWidth(), - compositor_->GetHeight()); + compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; default: @@ -340,7 +340,7 @@ case SDL_BUTTON_RIGHT: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker - (controller_, e, compositor_->GetHeight())); + (controller_, e, compositor_->GetCanvasHeight())); case SDL_BUTTON_LEFT: { @@ -372,7 +372,7 @@ controller_, e)); case FusionMprGuiTool_Zoom: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker( - controller_, e, compositor_->GetHeight())); + controller_, e, compositor_->GetCanvasHeight())); //case GuiTool_AngleMeasure: // return new AngleMeasureTracker(GetScene(), e); //case GuiTool_CircleMeasure:
--- a/Samples/Sdl/TrackerSampleApp.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Samples/Sdl/TrackerSampleApp.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -121,8 +121,8 @@ } // position the fixed info text in the upper right corner layerP->SetText(msgS.c_str()); - double cX = compositor_->GetWidth() * (-0.5); - double cY = compositor_->GetHeight() * (-0.5); + double cX = compositor_->GetCanvasWidth() * (-0.5); + double cY = compositor_->GetCanvasHeight() * (-0.5); GetScene()->GetCanvasToSceneTransform().Apply(cX,cY); layerP->SetPosition(cX, cY); } @@ -162,12 +162,12 @@ ScenePoint2D TrackerSampleApp::GetRandomPointInScene() const { - unsigned int w = compositor_->GetWidth(); - LOG(TRACE) << "compositor_->GetWidth() = " << - compositor_->GetWidth(); - unsigned int h = compositor_->GetHeight(); - LOG(TRACE) << "compositor_->GetHeight() = " << - compositor_->GetHeight(); + unsigned int w = compositor_->GetCanvasWidth(); + LOG(TRACE) << "compositor_->GetCanvasWidth() = " << + compositor_->GetCanvasWidth(); + unsigned int h = compositor_->GetCanvasHeight(); + LOG(TRACE) << "compositor_->GetCanvasHeight() = " << + compositor_->GetCanvasHeight(); if ((w >= RAND_MAX) || (h >= RAND_MAX)) LOG(WARNING) << "Canvas is too big : tools will not be randomly placed"; @@ -351,8 +351,8 @@ CreateRandomMeasureTool(); break; case SDLK_s: - controller_->FitContent(compositor_->GetWidth(), - compositor_->GetHeight()); + controller_->FitContent(compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; case SDLK_z: @@ -390,8 +390,8 @@ case SDLK_c: TakeScreenshot( "screenshot.png", - compositor_->GetWidth(), - compositor_->GetHeight()); + compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; default: @@ -421,7 +421,7 @@ case SDL_BUTTON_RIGHT: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker - (controller_, e, compositor_->GetHeight())); + (controller_, e, compositor_->GetCanvasHeight())); case SDL_BUTTON_LEFT: { @@ -453,7 +453,7 @@ controller_, e)); case GuiTool_Zoom: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker( - controller_, e, compositor_->GetHeight())); + controller_, e, compositor_->GetCanvasHeight())); //case GuiTool_AngleMeasure: // return new AngleMeasureTracker(GetScene(), e); //case GuiTool_CircleMeasure:
--- a/Samples/Shared/RadiographyEditorApp.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Samples/Shared/RadiographyEditorApp.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -121,8 +121,8 @@ } // position the fixed info text in the upper right corner layerP->SetText(msgS.c_str()); - double cX = compositor_->GetWidth() * (-0.5); - double cY = compositor_->GetHeight() * (-0.5); + double cX = compositor_->GetCanvasWidth() * (-0.5); + double cY = compositor_->GetCanvasHeight() * (-0.5); GetScene()->GetCanvasToSceneTransform().Apply(cX,cY); layerP->SetPosition(cX, cY); } @@ -162,12 +162,12 @@ ScenePoint2D RadiographyEditorApp::GetRandomPointInScene() const { - unsigned int w = compositor_->GetWidth(); - LOG(TRACE) << "compositor_->GetWidth() = " << - compositor_->GetWidth(); - unsigned int h = compositor_->GetHeight(); - LOG(TRACE) << "compositor_->GetHeight() = " << - compositor_->GetHeight(); + unsigned int w = compositor_->GetCanvasWidth(); + LOG(TRACE) << "compositor_->GetCanvasWidth() = " << + compositor_->GetCanvasWidth(); + unsigned int h = compositor_->GetCanvasHeight(); + LOG(TRACE) << "compositor_->GetCanvasHeight() = " << + compositor_->GetCanvasHeight(); if ((w >= RAND_MAX) || (h >= RAND_MAX)) LOG(WARNING) << "Canvas is too big : tools will not be randomly placed"; @@ -287,8 +287,8 @@ CreateRandomMeasureTool(); break; case 's': - controller_->FitContent(compositor_->GetWidth(), - compositor_->GetHeight()); + controller_->FitContent(compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; case 'z': LOG(TRACE) << "z has been pressed. modifier = " << modifiers; @@ -325,8 +325,8 @@ case 'c': TakeScreenshot( "screenshot.png", - compositor_->GetWidth(), - compositor_->GetHeight()); + compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; } @@ -471,8 +471,8 @@ CreateRandomMeasureTool(); break; case SDLK_s: - controller_->FitContent(compositor_->GetWidth(), - compositor_->GetHeight()); + controller_->FitContent(compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; case SDLK_z: @@ -510,8 +510,8 @@ case SDLK_c: TakeScreenshot( "screenshot.png", - compositor_->GetWidth(), - compositor_->GetHeight()); + compositor_->GetCanvasWidth(), + compositor_->GetCanvasHeight()); break; default: @@ -541,7 +541,7 @@ case OrthancStone::MouseButton_Right: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker - (controller_, e, compositor_->GetHeight())); + (controller_, e, compositor_->GetCanvasHeight())); case OrthancStone::MouseButton_Left: { @@ -573,7 +573,7 @@ controller_, e)); case GuiTool_Zoom: return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker( - controller_, e, compositor_->GetHeight())); + controller_, e, compositor_->GetCanvasHeight())); //case GuiTool_AngleMeasure: // return new AngleMeasureTracker(GetScene(), e); //case GuiTool_CircleMeasure:
--- a/Samples/Shared/SharedBasicScene.cpp Fri Jul 12 14:57:06 2019 +0200 +++ b/Samples/Shared/SharedBasicScene.cpp Fri Jul 12 14:57:48 2019 +0200 @@ -218,7 +218,7 @@ } else if (event.button == GUIADAPTER_MOUSEBUTTON_RIGHT && compositor_.get() != NULL) { - currentTracker_.reset(new ZoomSceneTracker(viewportController_, pointerEvent, compositor_->GetHeight())); + currentTracker_.reset(new ZoomSceneTracker(viewportController_, pointerEvent, compositor_->GetCanvasHeight())); } } else if (event.type == GUIADAPTER_EVENT_MOUSEMOVE) @@ -241,14 +241,14 @@ { case 's': { - viewportController_->FitContent(compositor_->GetWidth(), compositor_->GetHeight()); + viewportController_->FitContent(compositor_->GetCanvasWidth(), compositor_->GetCanvasHeight()); return true; }; #if ORTHANC_SANDBOXED == 0 case 'c': { Scene2D& scene(*(viewportController_->GetScene())); - TakeScreenshot("screenshot.png", scene, compositor_->GetWidth(), compositor_->GetHeight()); + TakeScreenshot("screenshot.png", scene, compositor_->GetCanvasWidth(), compositor_->GetCanvasHeight()); return true; } #endif