diff --git a/Device/Detector/IDetector.cpp b/Device/Detector/IDetector.cpp index ba5de29c67b73ac3884008cc79d60430bf67321b..e98965be9ec1ff6fb21ebabd6479201bd285e562 100644 --- a/Device/Detector/IDetector.cpp +++ b/Device/Detector/IDetector.cpp @@ -230,7 +230,7 @@ std::vector<size_t> IDetector::activeIndices() const void IDetector::addMask(const IShape2D& shape, bool mask_value) { - m_mask->addMask(shape, mask_value); + m_mask->maskToStack(shape, mask_value); } void IDetector::maskAll() diff --git a/Device/Mask/MaskStack.cpp b/Device/Mask/MaskStack.cpp index bcd743188e7657e75bce54ceeee48bf04bd6df3d..fc9f35471f8d5e4254b76c272ba9f1d9366777a1 100644 --- a/Device/Mask/MaskStack.cpp +++ b/Device/Mask/MaskStack.cpp @@ -32,7 +32,8 @@ MaskPattern* MaskPattern::clone() const return new MaskPattern(shape->clone(), doMask); } -void MaskStack::addMask(const IShape2D& shape, bool mask_value) + +void MaskStack::maskToStack(const IShape2D& shape, bool mask_value) { m_stack.emplace_back(new MaskPattern(shape.clone(), mask_value)); } diff --git a/Device/Mask/MaskStack.h b/Device/Mask/MaskStack.h index 89d7057b5d0cf5b863472cda7cdd07fbfcf8b972..430f25b607a07e791162e6ea381e0ebefb82bcda 100644 --- a/Device/Mask/MaskStack.h +++ b/Device/Mask/MaskStack.h @@ -40,7 +40,7 @@ class MaskStack { public: //! Add mask to the stack of detector masks. //! Argument mask_value=true means that the area will be excluded from the analysis. - void addMask(const IShape2D& shape, bool mask_value); + void maskToStack(const IShape2D& shape, bool mask_value); bool isMasked(size_t i_flat, const Frame& frame) const; diff --git a/GUI/Model/Data/MaskResultsPresenter.cpp b/GUI/Model/Data/MaskResultsPresenter.cpp index 0e3d7b545b8d2e7b453f6cf99bcc7b6e99c916fe..5aa2e95ce530322e5bfa6a53e9d615ae326615d1 100644 --- a/GUI/Model/Data/MaskResultsPresenter.cpp +++ b/GUI/Model/Data/MaskResultsPresenter.cpp @@ -91,13 +91,13 @@ Datafield* MaskResultsPresenter::createMaskPresentation() const roi = roiItem->createShape(scale); else { std::unique_ptr<IShape2D> shape((*maskIter)->createShape(scale)); - detectorMask.addMask(*shape, (*maskIter)->maskValue()); + detectorMask.maskToStack(*shape, (*maskIter)->maskValue()); } } // ROI mask has to be the last one, it can not be "unmasked" by other shapes if (roi) - detectorMask.addMask(*roi, true); + detectorMask.maskToStack(*roi, true); if (!detectorMask.hasMasks()) return nullptr; diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp index 71c43b48137ac0c37a7a9a5821b8f739eae2166b..8ff27037512c5efd2f061a7a856cff4a8430ef6e 100644 --- a/GUI/Model/FromCore/ItemizeSimulation.cpp +++ b/GUI/Model/FromCore/ItemizeSimulation.cpp @@ -112,7 +112,7 @@ void setMaskContainer(MaskContainerItem* destMaskItems, const IDetector& detecto Q_UNUSED(plane); auto* planeItem = new MaskAllItem(); planeItem->setMaskValue(mask_value); - destMaskItems->addMask(planeItem); + destMaskItems->addMaskItem(planeItem); } else @@ -128,7 +128,7 @@ void setMaskContainer(MaskContainerItem* destMaskItems, const IDetector& detecto roiItem->setYLow(scale * yBounds.first); roiItem->setXUp(scale * xBounds.second); roiItem->setYUp(scale * yBounds.second); - destMaskItems->addMask(roiItem); + destMaskItems->addMaskItem(roiItem); } } diff --git a/GUI/Model/Mask/MaskItems.cpp b/GUI/Model/Mask/MaskItems.cpp index f2e4157e2265d47c822ddf05f583b3305f472632..2a5390e9e901b6a56f5d273872d92bb362ef86a0 100644 --- a/GUI/Model/Mask/MaskItems.cpp +++ b/GUI/Model/Mask/MaskItems.cpp @@ -64,7 +64,7 @@ void MaskContainerItem::insertMask(int row, MaskItem* maskItem) m_maskItems.insert_at(row, maskItem); } -void MaskContainerItem::addMask(MaskItem* maskItem) +void MaskContainerItem::addMaskItem(MaskItem* maskItem) { // takes owning of maskItem! m_maskItems.push_back(maskItem); @@ -179,7 +179,7 @@ void MaskContainerItem::readFrom(QXmlStreamReader* r, MessageService*) QString tag = r->name().toString(); if (tag == Tag::Mask) { - addMask(nullptr); + addMaskItem(nullptr); m_maskItems.back().readFrom(r); XML::gotoEndElementOfTag(r, tag); @@ -909,11 +909,11 @@ void MaskContainerModel::insertMask(int row, MaskItem* maskItem) QAbstractListModel::endInsertRows(); } -void MaskContainerModel::addMask(MaskItem* maskItem) +void MaskContainerModel::maskToModel(MaskItem* maskItem) { qsizetype row = maskContainer->size() - 1; QAbstractListModel::beginInsertRows(maskContainer->rootIndex, row, row); - maskContainer->addMask(maskItem); + maskContainer->addMaskItem(maskItem); QAbstractListModel::endInsertRows(); } @@ -975,5 +975,5 @@ void MaskContainerModel::copy(const MaskContainerModel* src) clear(); if (src) for (auto mask : src->maskContainer->maskItems()) - addMask(mask); + maskToModel(mask); } diff --git a/GUI/Model/Mask/MaskItems.h b/GUI/Model/Mask/MaskItems.h index e793da8cb5d8d088126da22475be2af493210ef7..eec5f20fcd763100ef2d83887042a7e24906b821 100644 --- a/GUI/Model/Mask/MaskItems.h +++ b/GUI/Model/Mask/MaskItems.h @@ -220,7 +220,7 @@ public: //! Insert mask at given row. virtual void insertMask(int row, MaskItem* maskItem); - virtual void addMask(MaskItem* maskItem); + virtual void addMaskItem(MaskItem* maskItem); //! Move mask to a given row virtual void moveMask(int from_row, int to_row); @@ -285,7 +285,7 @@ public: //! Insert mask at given row. void insertMask(int row, MaskItem* maskItem); - void addMask(MaskItem* maskItem); + void maskToModel(MaskItem* maskItem); //! Remove a given mask void removeMask(MaskItem* maskItem);