Mercurial > hg > orthanc-stone
changeset 492:64d90190a08c am-touch-events
template GetLayer
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 20 Feb 2019 20:57:43 +0100 |
parents | aede9b042cb7 |
children | 3ae7563b4fe1 |
files | Framework/Radiography/RadiographyScene.h Framework/Radiography/RadiographyWidget.cpp Framework/Radiography/RadiographyWidget.h README |
diffstat | 4 files changed, 65 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyScene.h Tue Feb 19 11:40:14 2019 +0100 +++ b/Framework/Radiography/RadiographyScene.h Wed Feb 20 20:57:43 2019 +0100 @@ -174,6 +174,30 @@ const RadiographyLayer& GetLayer(size_t layerIndex) const; + template <typename TypeLayer> + TypeLayer* GetLayer(size_t index = 0) + { + std::vector<size_t> layerIndexes; + GetLayersIndexes(layerIndexes); + + size_t count = 0; + + for (size_t i = 0; i < layerIndexes.size(); ++i) + { + TypeLayer* typedLayer = dynamic_cast<TypeLayer*>(layers_[layerIndexes[i]]); + if (typedLayer != NULL) + { + if (count == index) + { + return typedLayer; + } + count++; + } + } + + return NULL; + } + void GetLayersIndexes(std::vector<size_t>& output) const; Extent2D GetSceneExtent() const;
--- a/Framework/Radiography/RadiographyWidget.cpp Tue Feb 19 11:40:14 2019 +0100 +++ b/Framework/Radiography/RadiographyWidget.cpp Wed Feb 20 20:57:43 2019 +0100 @@ -25,6 +25,7 @@ #include <Core/Images/Image.h> #include <Core/Images/ImageProcessing.h> +#include "RadiographyMaskLayer.h" namespace OrthancStone { @@ -194,6 +195,28 @@ selectedLayer_ = layer; } + bool RadiographyWidget::SelectMaskLayer(size_t index) + { + std::vector<size_t> layerIndexes; + size_t count = 0; + scene_->GetLayersIndexes(layerIndexes); + + for (size_t i = 0; i < layerIndexes.size(); ++i) + { + const RadiographyMaskLayer* maskLayer = dynamic_cast<const RadiographyMaskLayer*>(&(scene_->GetLayer(layerIndexes[i]))); + if (maskLayer != NULL) + { + if (count == index) + { + Select(layerIndexes[i]); + return true; + } + count++; + } + } + + return false; + } bool RadiographyWidget::LookupSelectedLayer(size_t& layer) {
--- a/Framework/Radiography/RadiographyWidget.h Tue Feb 19 11:40:14 2019 +0100 +++ b/Framework/Radiography/RadiographyWidget.h Wed Feb 20 20:57:43 2019 +0100 @@ -27,6 +27,8 @@ namespace OrthancStone { + class RadiographyMaskLayer; + class RadiographyWidget : public WorldSceneWidget, public IObserver @@ -76,6 +78,8 @@ void Select(size_t layer); + bool SelectMaskLayer(size_t index = 0); + bool LookupSelectedLayer(size_t& layer); void OnGeometryChanged(const RadiographyScene::GeometryChangedMessage& message);
--- a/README Tue Feb 19 11:40:14 2019 +0100 +++ b/README Wed Feb 20 20:57:43 2019 +0100 @@ -125,6 +125,20 @@ ./OrthancStoneSimpleViewer --studyId=XX ``` +to build the Qt native samples on Windows: +----------------------------------------- + +In a VS2015 x64 Native Tools Command Prompt: + +``` +mkdir -p C:\Users\alain\osimis\builds\orthanc-stone-build +cd C:\Users\alain\osimis\builds\orthanc-stone-build +cmake -G Ninja -DSTATIC_BUILD=ON -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=C:\Users\alain\osimis\orthanc -DCMAKE_PREFIX_PATH=C:\Qt\5.9.3\msvc2015_64 ..\..\orthanc-stone\Applications\Samples + +cmake -G Ninja -DALLOW_DOWNLOADS=ON -DENABLE_QT=ON ~/orthanc-stone/Applications/Samples/ +cmake --build . --target OrthancStoneSimpleViewer -- -j 5 +``` + Licensing ---------