Skip to content
Snippets Groups Projects
Commit bd07c99b authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

consistent name LineDisplay

parent 5bd9d705
No related branches found
No related tags found
1 merge request!2103GUI Mask cleanup ctd
......@@ -264,7 +264,7 @@ void MaskGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent* event)
else if (isValidForRectangleShapeDrawing(event))
processRectangleOrEllipseItem(event);
else
QGraphicsScene::mousePressEvent(event);
QGraphicsScene::mousePressEvent(event);
}
void MaskGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
......@@ -601,8 +601,8 @@ void MaskGraphicsScene::processRectangleOrEllipseItem(QGraphicsSceneMouseEvent*
newMaskItem = new EllipseItem;
else if (m_context.isROIMode())
newMaskItem = new RegionOfInterestItem;
else
ASSERT_NEVER;
else
ASSERT_NEVER;
m_maskContainerModel->insertMask(0, newMaskItem);
m_currentItem = newMaskItem; // downcast MaskItem* -> MaskRoot*
......
......@@ -18,7 +18,7 @@
#include "GUI/View/Mask/RegionOfInterestDisplay.h"
#include "GUI/View/Shape/AllMasksDisplay.h"
#include "GUI/View/Shape/EllipseDisplay.h"
#include "GUI/View/Shape/LineViews.h"
#include "GUI/View/Shape/LineDisplays.h"
#include "GUI/View/Shape/MaskContainerDisplay.h"
#include "GUI/View/Shape/PolygonDisplay.h"
#include "GUI/View/Shape/PolygonPointDisplay.h"
......@@ -41,10 +41,10 @@ IMaskElementDisplay* MaskViewFactory::createMaskView(MaskRoot* item)
return new PolygonPointDisplay(mask);
if (auto* mask = dynamic_cast<VerticalLineItem*>(item))
return new VerticalLineView(mask);
return new VerticalLineDisplay(mask);
if (auto* mask = dynamic_cast<HorizontalLineItem*>(item))
return new HorizontalLineView(mask);
return new HorizontalLineDisplay(mask);
if (auto* mask = dynamic_cast<EllipseItem*>(item))
return new EllipseDisplay(mask);
......
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Shape/LineViews.cpp
//! @brief Implements classes VerticalLineView and HorizontalLineView
//! @file GUI/View/Shape/LineDisplays.cpp
//! @brief Implements classes VerticalLineDisplay and HorizontalLineDisplay
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -12,7 +12,7 @@
//
// ************************************************************************************************
#include "GUI/View/Shape/LineViews.h"
#include "GUI/View/Shape/LineDisplays.h"
#include "GUI/Model/Mask/MaskItems.h"
#include "GUI/View/Shape/MaskUtil.h"
#include "GUI/View/Shape/SceneAdaptor.h"
......@@ -27,7 +27,7 @@ const double mask_visible_width = 3.0;
} // namespace
VerticalLineView::VerticalLineView(VerticalLineItem* item)
VerticalLineDisplay::VerticalLineDisplay(VerticalLineItem* item)
: IMaskElementDisplay(item)
, m_item(item)
{
......@@ -37,31 +37,31 @@ VerticalLineView::VerticalLineView(VerticalLineItem* item)
setCursor(Qt::SizeHorCursor);
}
QPainterPath VerticalLineView::shape() const
QPainterPath VerticalLineDisplay::shape() const
{
QPainterPath p;
p.addRect(QRectF(-mask_visible_width / 2., 0.0, mask_visible_width, m_bounding_rect.height()));
return p;
}
MaskRoot* VerticalLineView::parameterizedItem() const
MaskRoot* VerticalLineDisplay::parameterizedItem() const
{
return m_item;
}
void VerticalLineView::onChangedX()
void VerticalLineDisplay::onChangedX()
{
setBlockOnProperty(true);
m_item->setPosX(fromSceneX(this->x()));
setBlockOnProperty(false);
}
void VerticalLineView::onPropertyChange()
void VerticalLineDisplay::onPropertyChange()
{
setX(toSceneX(m_item->posX()));
}
void VerticalLineView::update_view()
void VerticalLineDisplay::update_view()
{
QRectF plot_scene_rectangle = m_adaptor->viewportRectangle();
......@@ -72,7 +72,7 @@ void VerticalLineView::update_view()
update();
}
void VerticalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
void VerticalLineDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
{
bool mask_value = static_cast<VerticalLineItem*>(m_item)->maskValue();
painter->setBrush(MaskUtil::getMaskBrush(mask_value));
......@@ -91,8 +91,8 @@ void VerticalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem*,
}
//! Allows item movement along x, prevent movement along y
QVariant VerticalLineView::itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant& value)
QVariant VerticalLineDisplay::itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant& value)
{
if (isSelected() && change == ItemPositionChange && scene()) {
QPointF newPos = value.toPointF();
......@@ -104,7 +104,7 @@ QVariant VerticalLineView::itemChange(QGraphicsItem::GraphicsItemChange change,
// --------------------------------------------------------------------------------------------- //
HorizontalLineView::HorizontalLineView(HorizontalLineItem* item)
HorizontalLineDisplay::HorizontalLineDisplay(HorizontalLineItem* item)
: IMaskElementDisplay(item)
, m_item(item)
{
......@@ -114,7 +114,7 @@ HorizontalLineView::HorizontalLineView(HorizontalLineItem* item)
setCursor(Qt::SizeVerCursor);
}
QPainterPath HorizontalLineView::shape() const
QPainterPath HorizontalLineDisplay::shape() const
{
QPainterPath path;
path.addRect(
......@@ -122,24 +122,24 @@ QPainterPath HorizontalLineView::shape() const
return path;
}
MaskRoot* HorizontalLineView::parameterizedItem() const
MaskRoot* HorizontalLineDisplay::parameterizedItem() const
{
return m_item;
}
void HorizontalLineView::onChangedY()
void HorizontalLineDisplay::onChangedY()
{
setBlockOnProperty(true);
m_item->setPosY(fromSceneY(this->y()));
setBlockOnProperty(false);
}
void HorizontalLineView::onPropertyChange()
void HorizontalLineDisplay::onPropertyChange()
{
setY(toSceneY(m_item->posY()));
}
void HorizontalLineView::update_view()
void HorizontalLineDisplay::update_view()
{
QRectF plot_scene_rectangle = m_adaptor->viewportRectangle();
......@@ -150,7 +150,7 @@ void HorizontalLineView::update_view()
update();
}
void HorizontalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
void HorizontalLineDisplay::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
{
bool mask_value = static_cast<HorizontalLineItem*>(m_item)->maskValue();
painter->setBrush(MaskUtil::getMaskBrush(mask_value));
......@@ -169,8 +169,8 @@ void HorizontalLineView::paint(QPainter* painter, const QStyleOptionGraphicsItem
}
//! Allows item movement along y, prevent movement along x
QVariant HorizontalLineView::itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant& value)
QVariant HorizontalLineDisplay::itemChange(QGraphicsItem::GraphicsItemChange change,
const QVariant& value)
{
if (isSelected() && change == ItemPositionChange && scene()) {
QPointF newPos = value.toPointF();
......
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Shape/LineViews.h
//! @brief Defines classes VerticalLineView and HorizontalLineView
//! @file GUI/View/Shape/LineDisplays.h
//! @brief Defines classes VerticalLineDisplay and HorizontalLineDisplay
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......@@ -12,8 +12,8 @@
//
// ************************************************************************************************
#ifndef BORNAGAIN_GUI_VIEW_SHAPE_LINEVIEWS_H
#define BORNAGAIN_GUI_VIEW_SHAPE_LINEVIEWS_H
#ifndef BORNAGAIN_GUI_VIEW_SHAPE_LINEDISPLAYS_H
#define BORNAGAIN_GUI_VIEW_SHAPE_LINEDISPLAYS_H
#include "GUI/View/Shape/IMaskElementDisplay.h"
......@@ -22,12 +22,12 @@ class HorizontalLineItem;
//! This is a view of VerticalLineItem mask
class VerticalLineView : public IMaskElementDisplay {
class VerticalLineDisplay : public IMaskElementDisplay {
Q_OBJECT
public:
int type() const override { return MaskType::VERTICALLINE; }
explicit VerticalLineView(VerticalLineItem* item);
explicit VerticalLineDisplay(VerticalLineItem* item);
QPainterPath shape() const override;
MaskRoot* parameterizedItem() const override;
......@@ -48,12 +48,12 @@ private:
//! This is a view of HorizontalLineItem mask
class HorizontalLineView : public IMaskElementDisplay {
class HorizontalLineDisplay : public IMaskElementDisplay {
Q_OBJECT
public:
int type() const override { return MaskType::HORIZONTALLINE; }
explicit HorizontalLineView(HorizontalLineItem* item);
explicit HorizontalLineDisplay(HorizontalLineItem* item);
QPainterPath shape() const override;
MaskRoot* parameterizedItem() const override;
......@@ -71,4 +71,4 @@ private:
HorizontalLineItem* m_item;
};
#endif // BORNAGAIN_GUI_VIEW_SHAPE_LINEVIEWS_H
#endif // BORNAGAIN_GUI_VIEW_SHAPE_LINEDISPLAYS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment