From 5a83b70ef2664aa13b8a32822fb0e0a175b22f20 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 10 Nov 2023 09:58:17 +0100 Subject: [PATCH] rename -> IShapeDisplay --- GUI/View/Mask/MaskGraphicsScene.cpp | 24 ++++----- GUI/View/Mask/MaskGraphicsScene.h | 6 +-- GUI/View/Mask/MaskViewFactory.cpp | 2 +- GUI/View/Mask/MaskViewFactory.h | 4 +- GUI/View/Shape/AllMasksDisplay.cpp | 2 +- GUI/View/Shape/AllMasksDisplay.h | 4 +- GUI/View/Shape/EllipseDisplay.cpp | 2 +- ...skElementDisplay.cpp => IShapeDisplay.cpp} | 49 +++++++++---------- ...{IMaskElementDisplay.h => IShapeDisplay.h} | 16 +++--- GUI/View/Shape/LineDisplays.cpp | 4 +- GUI/View/Shape/LineDisplays.h | 6 +-- GUI/View/Shape/MaskContainerDisplay.cpp | 4 +- GUI/View/Shape/MaskContainerDisplay.h | 4 +- GUI/View/Shape/PolygonDisplay.cpp | 8 +-- GUI/View/Shape/PolygonDisplay.h | 6 +-- GUI/View/Shape/PolygonPointDisplay.cpp | 6 +-- GUI/View/Shape/PolygonPointDisplay.h | 4 +- GUI/View/Shape/RectangleBaseDisplay.cpp | 4 +- GUI/View/Shape/RectangleBaseDisplay.h | 4 +- GUI/View/Shape/RectangleDisplay.cpp | 2 +- 20 files changed, 79 insertions(+), 82 deletions(-) rename GUI/View/Shape/{IMaskElementDisplay.cpp => IShapeDisplay.cpp} (69%) rename GUI/View/Shape/{IMaskElementDisplay.h => IShapeDisplay.h} (80%) diff --git a/GUI/View/Mask/MaskGraphicsScene.cpp b/GUI/View/Mask/MaskGraphicsScene.cpp index 914ddade78c..7e56499f671 100644 --- a/GUI/View/Mask/MaskGraphicsScene.cpp +++ b/GUI/View/Mask/MaskGraphicsScene.cpp @@ -232,7 +232,7 @@ void MaskGraphicsScene::onSceneSelectionChanged() m_selectionModel->clearSelection(); for (QGraphicsItem* graphicsItem : selectedItems()) { - if (auto* view = dynamic_cast<IMaskElementDisplay*>(graphicsItem)) { + if (auto* view = dynamic_cast<IShapeDisplay*>(graphicsItem)) { QModelIndex itemIndex = m_maskContainerModel->indexOfItem(view->parameterizedItem()); ASSERT(itemIndex.isValid()); if (!m_selectionModel->isSelected(itemIndex)) @@ -292,7 +292,7 @@ void MaskGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) clearSelection(); if (m_currentItem) { // drawing ended up with item drawn, let's make it selected - if (IMaskElementDisplay* view = m_ItemToView[m_currentItem]) + if (IShapeDisplay* view = m_ItemToView[m_currentItem]) view->setSelected(true); } else { // drawing ended without item to be draw (too short mouse move) @@ -344,7 +344,7 @@ void MaskGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) if (isDrawingInProgress()) return; - if (dynamic_cast<IMaskElementDisplay*>(itemAt(event->scenePos(), QTransform()))) + if (dynamic_cast<IShapeDisplay*>(itemAt(event->scenePos(), QTransform()))) emit itemContextMenuRequest(event->screenPos()); } @@ -370,22 +370,22 @@ void MaskGraphicsScene::updateViews() { ASSERT(m_maskContainerItem); - IMaskElementDisplay* maskView = addViewForItem(m_maskContainerItem); + IShapeDisplay* maskView = addViewForItem(m_maskContainerItem); for (MaskItem* maskItem : m_maskContainerItem->maskItems()) { if (!maskItem) continue; - IMaskElementDisplay* itemView = addViewForItem(maskItem); + IShapeDisplay* itemView = addViewForItem(maskItem); if (itemView && maskView) { maskView->addView(itemView); // Add views for the points of the PolygonItem if (auto polygonItem = dynamic_cast<PolygonItem*>(maskItem)) { - IMaskElementDisplay* const polygonView = itemView; + IShapeDisplay* const polygonView = itemView; for (PolygonPointItem* pointItem : polygonItem->points()) { - IMaskElementDisplay* pointView = addViewForItem(pointItem); + IShapeDisplay* pointView = addViewForItem(pointItem); polygonView->addView(pointView); } } @@ -395,12 +395,12 @@ void MaskGraphicsScene::updateViews() //! Creates a view for given item. -IMaskElementDisplay* MaskGraphicsScene::addViewForItem(MaskRoot* item) +IShapeDisplay* MaskGraphicsScene::addViewForItem(MaskRoot* item) { ASSERT(item); subscribeMaskItem(item); - IMaskElementDisplay* view = m_ItemToView[item]; + IShapeDisplay* view = m_ItemToView[item]; if (!view) { view = MaskViewFactory::createMaskView(item); view->setViewSceneAdaptor(m_adaptor.get()); @@ -427,7 +427,7 @@ void MaskGraphicsScene::removeItemViewFromScene(MaskRoot* item) for (PolygonPointItem* pointItem : polygonItem->points()) removeItemViewFromScene(pointItem); - IMaskElementDisplay* view = it.value(); + IShapeDisplay* view = it.value(); view->setSelected(false); m_ItemToView.erase(it); delete view; @@ -554,7 +554,7 @@ void MaskGraphicsScene::setInPanAndZoomMode(bool value) m_selectionModel->clearSelection(); Qt::MouseButtons acceptedButton = (value ? Qt::NoButton : Qt::LeftButton); - for (IMaskElementDisplay* view : m_ItemToView.values()) + for (IShapeDisplay* view : m_ItemToView.values()) view->setAcceptedMouseButtons(acceptedButton); m_proxy->setInZoomMode(value); @@ -741,7 +741,7 @@ void MaskGraphicsScene::setZValues() int z = m_maskContainerItem->maskItems().size(); for (MaskItem* maskItem : m_maskContainerItem->maskItems()) { - if (IMaskElementDisplay* view = m_ItemToView[maskItem]) + if (IShapeDisplay* view = m_ItemToView[maskItem]) view->setZValue(z); --z; } diff --git a/GUI/View/Mask/MaskGraphicsScene.h b/GUI/View/Mask/MaskGraphicsScene.h index 2eca48dbe24..b55f626e142 100644 --- a/GUI/View/Mask/MaskGraphicsScene.h +++ b/GUI/View/Mask/MaskGraphicsScene.h @@ -24,7 +24,7 @@ class ColorMap; class Data2DItem; -class IMaskElementDisplay; +class IShapeDisplay; class MaskContainerItem; class MaskContainerModel; class MaskEditorAction; @@ -82,7 +82,7 @@ private: void updateProxyWidget(); void updateViews(); - IMaskElementDisplay* addViewForItem(MaskRoot* item); + IShapeDisplay* addViewForItem(MaskRoot* item); void removeItemViewFromScene(MaskRoot* item); void connectMaskContainer(MaskContainerModel* maskContainerModel); @@ -117,7 +117,7 @@ private: MaskContainerModel* m_maskContainerModel = nullptr; MaskContainerItem* m_maskContainerItem = nullptr; QItemSelectionModel* m_selectionModel = nullptr; - QMap<MaskRoot*, IMaskElementDisplay*> m_ItemToView; + QMap<MaskRoot*, IShapeDisplay*> m_ItemToView; MaskGraphicsProxy* m_proxy = nullptr; std::shared_ptr<SceneAdaptor> m_adaptor; bool m_block_selection = false; diff --git a/GUI/View/Mask/MaskViewFactory.cpp b/GUI/View/Mask/MaskViewFactory.cpp index 4497146354c..da6d9f40219 100644 --- a/GUI/View/Mask/MaskViewFactory.cpp +++ b/GUI/View/Mask/MaskViewFactory.cpp @@ -24,7 +24,7 @@ #include "GUI/View/Shape/PolygonDisplay.h" #include "GUI/View/Shape/PolygonPointDisplay.h" -IMaskElementDisplay* MaskViewFactory::createMaskView(MaskRoot* item) +IShapeDisplay* MaskViewFactory::createMaskView(MaskRoot* item) { if (auto* mask = dynamic_cast<MaskContainerItem*>(item)) return new MaskContainerDisplay(mask); diff --git a/GUI/View/Mask/MaskViewFactory.h b/GUI/View/Mask/MaskViewFactory.h index 23627b7227b..3f2af4289d4 100644 --- a/GUI/View/Mask/MaskViewFactory.h +++ b/GUI/View/Mask/MaskViewFactory.h @@ -15,13 +15,13 @@ #ifndef BORNAGAIN_GUI_VIEW_MASK_MASKVIEWFACTORY_H #define BORNAGAIN_GUI_VIEW_MASK_MASKVIEWFACTORY_H -class IMaskElementDisplay; +class IShapeDisplay; class MaskRoot; namespace MaskViewFactory { //! Factory to construct views out of MaskItems for MaskGraphicsScene -IMaskElementDisplay* createMaskView(MaskRoot* item); +IShapeDisplay* createMaskView(MaskRoot* item); } // namespace MaskViewFactory diff --git a/GUI/View/Shape/AllMasksDisplay.cpp b/GUI/View/Shape/AllMasksDisplay.cpp index a04227e8a95..e1bbd1ec032 100644 --- a/GUI/View/Shape/AllMasksDisplay.cpp +++ b/GUI/View/Shape/AllMasksDisplay.cpp @@ -20,7 +20,7 @@ #include <QStyleOptionGraphicsItem> AllMasksDisplay::AllMasksDisplay(MaskAllItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) { setFlag(QGraphicsItem::ItemIsSelectable); diff --git a/GUI/View/Shape/AllMasksDisplay.h b/GUI/View/Shape/AllMasksDisplay.h index 279d79f5e78..74d3c387146 100644 --- a/GUI/View/Shape/AllMasksDisplay.h +++ b/GUI/View/Shape/AllMasksDisplay.h @@ -15,13 +15,13 @@ #ifndef BORNAGAIN_GUI_VIEW_SHAPE_ALLMASKSDISPLAY_H #define BORNAGAIN_GUI_VIEW_SHAPE_ALLMASKSDISPLAY_H -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" class MaskAllItem; //! This is a view of MaskAllItem which covers whole detector plane with mask value=true. -class AllMasksDisplay : public IMaskElementDisplay { +class AllMasksDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::MASKALL; } diff --git a/GUI/View/Shape/EllipseDisplay.cpp b/GUI/View/Shape/EllipseDisplay.cpp index cbf197f47c8..b88fb9d7b47 100644 --- a/GUI/View/Shape/EllipseDisplay.cpp +++ b/GUI/View/Shape/EllipseDisplay.cpp @@ -85,7 +85,7 @@ void EllipseDisplay::mouseMoveEvent(QGraphicsSceneMouseEvent* event) / 2.); } } else { - IMaskElementDisplay::mouseMoveEvent(event); + IShapeDisplay::mouseMoveEvent(event); } } diff --git a/GUI/View/Shape/IMaskElementDisplay.cpp b/GUI/View/Shape/IShapeDisplay.cpp similarity index 69% rename from GUI/View/Shape/IMaskElementDisplay.cpp rename to GUI/View/Shape/IShapeDisplay.cpp index 7cb4506ed97..da93252473e 100644 --- a/GUI/View/Shape/IMaskElementDisplay.cpp +++ b/GUI/View/Shape/IShapeDisplay.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Shape/IMaskElementDisplay.cpp -//! @brief Implements interface IMaskElementDisplay. +//! @file GUI/View/Shape/IShapeDisplay.cpp +//! @brief Implements interface IShapeDisplay. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" #include "GUI/Model/Mask/MaskItems.h" #include "GUI/View/ProShape/MaskUtil.h" #include "GUI/View/ProShape/SceneAdaptor.h" @@ -32,45 +32,42 @@ bool itemMaskValue(const MaskRoot* item) } // namespace -IMaskElementDisplay::IMaskElementDisplay(MaskRoot* item) +IShapeDisplay::IShapeDisplay(MaskRoot* item) : m_adaptor(nullptr) , m_block_on_property_change(false) { ASSERT(item); - connect(this, &IMaskElementDisplay::xChanged, this, &IMaskElementDisplay::onChangedX, - Qt::UniqueConnection); - connect(this, &IMaskElementDisplay::yChanged, this, &IMaskElementDisplay::onChangedY, - Qt::UniqueConnection); + connect(this, &IShapeDisplay::xChanged, this, &IShapeDisplay::onChangedX, Qt::UniqueConnection); + connect(this, &IShapeDisplay::yChanged, this, &IShapeDisplay::onChangedY, Qt::UniqueConnection); - connect(item, &MaskRoot::maskGeometryChanged, this, &IMaskElementDisplay::onGeometryChange, + connect(item, &MaskRoot::maskGeometryChanged, this, &IShapeDisplay::onGeometryChange, Qt::UniqueConnection); - connect(item, &MaskRoot::maskVisibilityChanged, this, &IMaskElementDisplay::onVisibilityChange, + connect(item, &MaskRoot::maskVisibilityChanged, this, &IShapeDisplay::onVisibilityChange, Qt::UniqueConnection); } -QRectF IMaskElementDisplay::boundingRect() const +QRectF IShapeDisplay::boundingRect() const { return m_bounding_rect; } -void IMaskElementDisplay::setViewSceneAdaptor(const SceneAdaptor* adaptor) +void IShapeDisplay::setViewSceneAdaptor(const SceneAdaptor* adaptor) { ASSERT(adaptor); if (m_adaptor == adaptor) return; if (m_adaptor) - disconnect(m_adaptor, &SceneAdaptor::update_request, this, - &IMaskElementDisplay::update_view); + disconnect(m_adaptor, &SceneAdaptor::update_request, this, &IShapeDisplay::update_view); m_adaptor = adaptor; - connect(m_adaptor, &SceneAdaptor::update_request, this, &IMaskElementDisplay::update_view, + connect(m_adaptor, &SceneAdaptor::update_request, this, &IShapeDisplay::update_view, Qt::UniqueConnection); update_view(); } -void IMaskElementDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) +void IShapeDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { const bool is_masked = itemMaskValue(parameterizedItem()); painter->setBrush(MaskUtil::getMaskBrush(is_masked)); @@ -79,7 +76,7 @@ void IMaskElementDisplay::paint(QPainter* painter, const QStyleOptionGraphicsIte painter->drawPath(maskedShape()); } -QPainterPath IMaskElementDisplay::maskedShape() const +QPainterPath IShapeDisplay::maskedShape() const { static const QSet<MaskType> relevantMaskType = {MaskType::RECTANGLE, MaskType::POLYGON, MaskType::VERTICALLINE, @@ -87,7 +84,7 @@ QPainterPath IMaskElementDisplay::maskedShape() const QPainterPath result = mapToScene(shape()); for (const QGraphicsItem* item : scene()->items()) { - const auto* view = dynamic_cast<const IMaskElementDisplay*>(item); + const auto* view = dynamic_cast<const IShapeDisplay*>(item); if (!view) continue; if (!relevantMaskType.contains((MaskType)view->type())) @@ -111,38 +108,38 @@ QPainterPath IMaskElementDisplay::maskedShape() const return mapFromScene(result); } -qreal IMaskElementDisplay::toSceneX(qreal value) const +qreal IShapeDisplay::toSceneX(qreal value) const { return m_adaptor ? m_adaptor->toSceneX(value) : value; } -qreal IMaskElementDisplay::toSceneY(qreal value) const +qreal IShapeDisplay::toSceneY(qreal value) const { return m_adaptor ? m_adaptor->toSceneY(value) : value; } -qreal IMaskElementDisplay::fromSceneX(qreal value) const +qreal IShapeDisplay::fromSceneX(qreal value) const { return m_adaptor ? m_adaptor->fromSceneX(value) : value; } -qreal IMaskElementDisplay::fromSceneY(qreal value) const +qreal IShapeDisplay::fromSceneY(qreal value) const { return m_adaptor ? m_adaptor->fromSceneY(value) : value; } -void IMaskElementDisplay::addView(IMaskElementDisplay* childView) +void IShapeDisplay::addView(IShapeDisplay* childView) { if (!childItems().contains(childView)) childView->setParentItem(this); } -void IMaskElementDisplay::setBlockOnProperty(bool value) +void IShapeDisplay::setBlockOnProperty(bool value) { m_block_on_property_change = value; } -void IMaskElementDisplay::onGeometryChange() +void IShapeDisplay::onGeometryChange() { if (m_block_on_property_change) return; @@ -152,7 +149,7 @@ void IMaskElementDisplay::onGeometryChange() m_block_on_property_change = false; } -void IMaskElementDisplay::onVisibilityChange() +void IShapeDisplay::onVisibilityChange() { if (m_block_on_property_change) return; diff --git a/GUI/View/Shape/IMaskElementDisplay.h b/GUI/View/Shape/IShapeDisplay.h similarity index 80% rename from GUI/View/Shape/IMaskElementDisplay.h rename to GUI/View/Shape/IShapeDisplay.h index 2e7c26f688b..f1a49797cb9 100644 --- a/GUI/View/Shape/IMaskElementDisplay.h +++ b/GUI/View/Shape/IShapeDisplay.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/View/Shape/IMaskElementDisplay.h -//! @brief Defines interface IMaskElementDisplay. +//! @file GUI/View/Shape/IShapeDisplay.h +//! @brief Defines interface IShapeDisplay. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_VIEW_SHAPE_IMASKELEMENTDISPLAY_H -#define BORNAGAIN_GUI_VIEW_SHAPE_IMASKELEMENTDISPLAY_H +#ifndef BORNAGAIN_GUI_VIEW_SHAPE_ISHAPEDISPLAY_H +#define BORNAGAIN_GUI_VIEW_SHAPE_ISHAPEDISPLAY_H #include "GUI/View/ProShape/MaskType.h" #include <QGraphicsObject> @@ -24,7 +24,7 @@ class SceneAdaptor; //! Main interface class for views representing MaskItems, Projections on graphics scene. -class IMaskElementDisplay : public QGraphicsObject { +class IShapeDisplay : public QGraphicsObject { Q_OBJECT public: int type() const override { return MaskType::IMASKVIEW; } @@ -35,7 +35,7 @@ public: void setViewSceneAdaptor(const SceneAdaptor* adaptor); - virtual void addView(IMaskElementDisplay* childView); + virtual void addView(IShapeDisplay* childView); protected slots: //! update visual appearance of view (triggered by SceneAdaptor) @@ -45,7 +45,7 @@ protected slots: virtual void onPropertyChange() {} protected: - explicit IMaskElementDisplay(MaskRoot* item); + explicit IShapeDisplay(MaskRoot* item); void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) override; @@ -69,4 +69,4 @@ private: bool m_block_on_property_change; }; -#endif // BORNAGAIN_GUI_VIEW_SHAPE_IMASKELEMENTDISPLAY_H +#endif // BORNAGAIN_GUI_VIEW_SHAPE_ISHAPEDISPLAY_H diff --git a/GUI/View/Shape/LineDisplays.cpp b/GUI/View/Shape/LineDisplays.cpp index c13418d2291..9ad94e2fa1d 100644 --- a/GUI/View/Shape/LineDisplays.cpp +++ b/GUI/View/Shape/LineDisplays.cpp @@ -28,7 +28,7 @@ const double mask_visible_width = 3.0; } // namespace VerticalLineDisplay::VerticalLineDisplay(VerticalLineItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) { setFlag(QGraphicsItem::ItemIsSelectable); @@ -105,7 +105,7 @@ QVariant VerticalLineDisplay::itemChange(QGraphicsItem::GraphicsItemChange chang // --------------------------------------------------------------------------------------------- // HorizontalLineDisplay::HorizontalLineDisplay(HorizontalLineItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) { setFlag(QGraphicsItem::ItemIsSelectable); diff --git a/GUI/View/Shape/LineDisplays.h b/GUI/View/Shape/LineDisplays.h index 43380aa5a1b..af10ee91c69 100644 --- a/GUI/View/Shape/LineDisplays.h +++ b/GUI/View/Shape/LineDisplays.h @@ -15,14 +15,14 @@ #ifndef BORNAGAIN_GUI_VIEW_SHAPE_LINEDISPLAYS_H #define BORNAGAIN_GUI_VIEW_SHAPE_LINEDISPLAYS_H -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" class VerticalLineItem; class HorizontalLineItem; //! This is a view of VerticalLineItem mask -class VerticalLineDisplay : public IMaskElementDisplay { +class VerticalLineDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::VERTICALLINE; } @@ -48,7 +48,7 @@ private: //! This is a view of HorizontalLineItem mask -class HorizontalLineDisplay : public IMaskElementDisplay { +class HorizontalLineDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::HORIZONTALLINE; } diff --git a/GUI/View/Shape/MaskContainerDisplay.cpp b/GUI/View/Shape/MaskContainerDisplay.cpp index 2a46b6ae3e2..a85a362e62b 100644 --- a/GUI/View/Shape/MaskContainerDisplay.cpp +++ b/GUI/View/Shape/MaskContainerDisplay.cpp @@ -21,7 +21,7 @@ #include <QStyleOptionGraphicsItem> MaskContainerDisplay::MaskContainerDisplay(MaskContainerItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) { // the key flag to not to draw children going outside ot given shape @@ -29,7 +29,7 @@ MaskContainerDisplay::MaskContainerDisplay(MaskContainerItem* item) } MaskContainerDisplay::MaskContainerDisplay(ProjectionContainerItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) { setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); diff --git a/GUI/View/Shape/MaskContainerDisplay.h b/GUI/View/Shape/MaskContainerDisplay.h index ba0fee1c928..e6f3919ddc0 100644 --- a/GUI/View/Shape/MaskContainerDisplay.h +++ b/GUI/View/Shape/MaskContainerDisplay.h @@ -16,7 +16,7 @@ #define BORNAGAIN_GUI_VIEW_SHAPE_MASKCONTAINERDISPLAY_H #include "GUI/View/ProShape/SizeHandleElement.h" -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" #include <QMap> class MaskContainerItem; @@ -29,7 +29,7 @@ class ProjectionContainerItem; //! The size of the rectangle always matches axes viewport at any zoom level. //! All MasksViews are added to MaskContainerDisplay as children. -class MaskContainerDisplay : public IMaskElementDisplay { +class MaskContainerDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::MASKCONTAINER; } diff --git a/GUI/View/Shape/PolygonDisplay.cpp b/GUI/View/Shape/PolygonDisplay.cpp index 2674a33aea3..9b5c3762688 100644 --- a/GUI/View/Shape/PolygonDisplay.cpp +++ b/GUI/View/Shape/PolygonDisplay.cpp @@ -25,7 +25,7 @@ const double bbox_margins = 5; // additional margins around points to form bound } PolygonDisplay::PolygonDisplay(PolygonItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) , m_block_on_point_update(false) , m_close_polygon_request(false) @@ -41,7 +41,7 @@ MaskRoot* PolygonDisplay::parameterizedItem() const return m_item; } -void PolygonDisplay::addView(IMaskElementDisplay* childView) +void PolygonDisplay::addView(IShapeDisplay* childView) { if (childItems().contains(childView)) return; @@ -109,7 +109,7 @@ bool PolygonDisplay::isClosedPolygon() void PolygonDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem* o, QWidget* w) { if (isClosedPolygon()) - IMaskElementDisplay::paint(painter, o, w); + IShapeDisplay::paint(painter, o, w); else { ASSERT(m_item); const bool mask_value = static_cast<PolygonItem*>(m_item)->maskValue(); @@ -129,7 +129,7 @@ QVariant PolygonDisplay::itemChange(QGraphicsItem::GraphicsItemChange change, co void PolygonDisplay::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { - IMaskElementDisplay::mouseMoveEvent(event); + IShapeDisplay::mouseMoveEvent(event); update_points(); } diff --git a/GUI/View/Shape/PolygonDisplay.h b/GUI/View/Shape/PolygonDisplay.h index b4297a3e2aa..2443843ef3a 100644 --- a/GUI/View/Shape/PolygonDisplay.h +++ b/GUI/View/Shape/PolygonDisplay.h @@ -15,7 +15,7 @@ #ifndef BORNAGAIN_GUI_VIEW_SHAPE_POLYGONDISPLAY_H #define BORNAGAIN_GUI_VIEW_SHAPE_POLYGONDISPLAY_H -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" #include <QPolygonF> class PolygonItem; @@ -23,7 +23,7 @@ class PolygonItem; //! This is a View of polygon mask (represented by PolygonItem) on GraphicsScene. -class PolygonDisplay : public IMaskElementDisplay { +class PolygonDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::POLYGON; } @@ -32,7 +32,7 @@ public: MaskRoot* parameterizedItem() const override; - void addView(IMaskElementDisplay* childView) override; + void addView(IShapeDisplay* childView) override; bool isClosedPolygon(); QPointF lastAddedPoint() const; QPainterPath shape() const override; diff --git a/GUI/View/Shape/PolygonPointDisplay.cpp b/GUI/View/Shape/PolygonPointDisplay.cpp index 6c4adeacf96..6eddd912624 100644 --- a/GUI/View/Shape/PolygonPointDisplay.cpp +++ b/GUI/View/Shape/PolygonPointDisplay.cpp @@ -19,7 +19,7 @@ #include <QPainter> PolygonPointDisplay::PolygonPointDisplay(PolygonPointItem* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_item(item) , m_on_hover(false) { @@ -73,12 +73,12 @@ void PolygonPointDisplay::hoverEnterEvent(QGraphicsSceneHoverEvent* event) { m_on_hover = true; emit closePolygonRequest(m_on_hover); - IMaskElementDisplay::hoverEnterEvent(event); + IShapeDisplay::hoverEnterEvent(event); } void PolygonPointDisplay::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) { m_on_hover = false; emit closePolygonRequest(m_on_hover); - IMaskElementDisplay::hoverLeaveEvent(event); + IShapeDisplay::hoverLeaveEvent(event); } diff --git a/GUI/View/Shape/PolygonPointDisplay.h b/GUI/View/Shape/PolygonPointDisplay.h index a831f3e0b61..2db744991fb 100644 --- a/GUI/View/Shape/PolygonPointDisplay.h +++ b/GUI/View/Shape/PolygonPointDisplay.h @@ -15,13 +15,13 @@ #ifndef BORNAGAIN_GUI_VIEW_SHAPE_POLYGONPOINTDISPLAY_H #define BORNAGAIN_GUI_VIEW_SHAPE_POLYGONPOINTDISPLAY_H -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" class PolygonPointItem; //! This is a View of polygon point for PolygonMaskItem -class PolygonPointDisplay : public IMaskElementDisplay { +class PolygonPointDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::POLYGONPOINT; } diff --git a/GUI/View/Shape/RectangleBaseDisplay.cpp b/GUI/View/Shape/RectangleBaseDisplay.cpp index e9656c97829..374bc23304a 100644 --- a/GUI/View/Shape/RectangleBaseDisplay.cpp +++ b/GUI/View/Shape/RectangleBaseDisplay.cpp @@ -21,7 +21,7 @@ const double bbox_margins = 5; // additional margins around rectangle to form bo } RectangleBaseDisplay::RectangleBaseDisplay(MaskRoot* item) - : IMaskElementDisplay(item) + : IShapeDisplay(item) , m_activeHandleElement(nullptr) { setFlag(QGraphicsItem::ItemIsSelectable); @@ -60,7 +60,7 @@ QVariant RectangleBaseDisplay::itemChange(QGraphicsItem::GraphicsItemChange chan void RectangleBaseDisplay::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { onSizeHandleElementRequest(false); - IMaskElementDisplay::mouseReleaseEvent(event); + IShapeDisplay::mouseReleaseEvent(event); } void RectangleBaseDisplay::update_view() diff --git a/GUI/View/Shape/RectangleBaseDisplay.h b/GUI/View/Shape/RectangleBaseDisplay.h index da61111cd86..1d2c50077cc 100644 --- a/GUI/View/Shape/RectangleBaseDisplay.h +++ b/GUI/View/Shape/RectangleBaseDisplay.h @@ -16,12 +16,12 @@ #define BORNAGAIN_GUI_VIEW_SHAPE_RECTANGLEBASEDISPLAY_H #include "GUI/View/ProShape/SizeHandleElement.h" -#include "GUI/View/Shape/IMaskElementDisplay.h" +#include "GUI/View/Shape/IShapeDisplay.h" #include <QMap> //! Base view for all rectangular-like masks. -class RectangleBaseDisplay : public IMaskElementDisplay { +class RectangleBaseDisplay : public IShapeDisplay { Q_OBJECT public: int type() const override { return MaskType::RECTANGLEBASE; } diff --git a/GUI/View/Shape/RectangleDisplay.cpp b/GUI/View/Shape/RectangleDisplay.cpp index 4d472a3982d..f3be7bffe77 100644 --- a/GUI/View/Shape/RectangleDisplay.cpp +++ b/GUI/View/Shape/RectangleDisplay.cpp @@ -79,7 +79,7 @@ void RectangleDisplay::mouseMoveEvent(QGraphicsSceneMouseEvent* event) } update_view(); } else { - IMaskElementDisplay::mouseMoveEvent(event); + IShapeDisplay::mouseMoveEvent(event); } } -- GitLab