BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
EllipseView Class Reference

Description

This is a View of ellipse mask (represented by EllipseItem) on GraphicsScene. Given view follows standard QGraphicsScene notations: (x,y) is top left corner.

Definition at line 25 of file EllipseView.h.

Inheritance diagram for EllipseView:
[legend]
Collaboration diagram for EllipseView:
[legend]

Public Member Functions

 EllipseView (EllipseItem *item)
 
 ~EllipseView () override
 
virtual void addView (IShape2DView *childView, int row=0)
 
QRectF boundingRect () const override
 
SessionItemparameterizedItem () const override
 
void setSceneAdaptor (const ISceneAdaptor *adaptor)
 
int type () const override
 

Protected Slots

void onChangedX () override
 
void onChangedY () override
 
void onPropertyChange () override
 

Protected Member Functions

bool blockOnProperty () const
 
void create_size_handle_elements ()
 
void disconnectFromItem (SessionItem *item)
 
qreal fromSceneX (qreal value) const
 convert scene coordinates to ColorMap plot coordinates More...
 
qreal fromSceneY (qreal value) const
 
qreal height () const
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 Track if item selected/deselected and show/hide size handles. More...
 
QPainterPath maskedShape () const
 Returns the shape with all masking already applied. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
 
void setBlockOnProperty (bool value)
 
QPainterPath shape () const override
 
qreal toSceneX (qreal value) const
 
qreal toSceneY (qreal value) const
 
virtual void update_bounding_rect ()
 updates view's bounding rectangle using item properties More...
 
void update_view () override
 update visual appearance of view (triggered by ISceneAdaptor) More...
 
qreal width () const
 Returns width of the rectangle. More...
 

Protected Attributes

SizeHandleElementm_activeHandleElement
 
const ISceneAdaptorm_adaptor
 
bool m_block_on_property_change
 
QRectF m_bounding_rect
 
QRectF m_mask_rect
 mask rectangle in scene coordinates More...
 
QMap< SizeHandleElement::EHandleLocation, SizeHandleElement * > m_resize_handles
 coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates More...
 
QPointF m_resize_opposite_origin
 

Private Slots

void onSizeHandleElementRequest (bool going_to_resize)
 triggered by SizeHandleElement More...
 

Private Member Functions

qreal bottom () const override
 Returns the y-coordinate of the rectangle's bottom edge. More...
 
qreal left () const override
 Returns the x-coordinate of the rectangle's left edge. More...
 
QRectF mask_rectangle () override
 
void onItemDestroyed () override
 
void onItemPropertyChange (const QString &propertyName)
 
qreal right () const override
 Returns the x-coordinate of the rectangle's right edge. More...
 
qreal top () const override
 Returns the y-coordinate of the rectangle's top edge. More...
 
void update_position () override
 updates position of view using item properties More...
 

Private Attributes

EllipseItemm_item
 

Constructor & Destructor Documentation

◆ EllipseView()

EllipseView::EllipseView ( EllipseItem item)
explicit

Definition at line 20 of file EllipseView.cpp.

21  : RectangleBaseView(item)
22  , m_item(item)
23 {
24 }
EllipseItem * m_item
Definition: EllipseView.h:55
RectangleBaseView(SessionItem *item)

◆ ~EllipseView()

EllipseView::~EllipseView ( )
override

Definition at line 26 of file EllipseView.cpp.

27 {
29 }
void disconnectFromItem(SessionItem *item)

References IShape2DView::disconnectFromItem(), and m_item.

Here is the call graph for this function:

Member Function Documentation

◆ addView()

void IShape2DView::addView ( IShape2DView childView,
int  row = 0 
)
virtualinherited

Reimplemented in PolygonView.

Definition at line 129 of file IShape2DView.cpp.

130 {
131  if (!childItems().contains(childView))
132  childView->setParentItem(this);
133 }

Referenced by MaskGraphicsScene::updateViews().

◆ blockOnProperty()

bool IShape2DView::blockOnProperty ( ) const
protectedinherited

Definition at line 140 of file IShape2DView.cpp.

141 {
143 }
bool m_block_on_property_change
Definition: IShape2DView.h:69

References IShape2DView::m_block_on_property_change.

◆ bottom()

qreal EllipseView::bottom ( ) const
overrideprivatevirtual

Returns the y-coordinate of the rectangle's bottom edge.

Implements RectangleBaseView.

Definition at line 153 of file EllipseView.cpp.

154 {
155  return toSceneY(m_item->yCenter() - m_item->yRadius());
156 }
DoubleDescriptor yRadius() const
Definition: MaskItems.cpp:436
DoubleDescriptor yCenter() const
Definition: MaskItems.cpp:416
qreal toSceneY(qreal value) const

References m_item, IShape2DView::toSceneY(), EllipseItem::yCenter(), and EllipseItem::yRadius().

Here is the call graph for this function:

◆ boundingRect()

QRectF IShape2DView::boundingRect ( ) const
overrideinherited

Definition at line 50 of file IShape2DView.cpp.

51 {
52  return m_bounding_rect;
53 }
QRectF m_bounding_rect
Definition: IShape2DView.h:68

References IShape2DView::m_bounding_rect.

◆ create_size_handle_elements()

void RectangleBaseView::create_size_handle_elements ( )
protectedinherited

Definition at line 103 of file RectangleBaseView.cpp.

104 {
105  QList<SizeHandleElement::EHandleLocation> points;
110 
111  for (SizeHandleElement::EHandleLocation point_type : points) {
112  auto* el = new SizeHandleElement(point_type, this);
113  connect(el, &SizeHandleElement::resize_request, this,
115  el->setVisible(false);
116  m_resize_handles[point_type] = el;
117  }
118 }
void onSizeHandleElementRequest(bool going_to_resize)
triggered by SizeHandleElement
QMap< SizeHandleElement::EHandleLocation, SizeHandleElement * > m_resize_handles
coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates
Size handle on top of RectangleView represented as small circle or small rectangle....
void resize_request(bool going_to_resize)

References SizeHandleElement::BOTTOMLEFT, SizeHandleElement::BOTTOMMIDLE, SizeHandleElement::BOTTOMRIGHT, RectangleBaseView::m_resize_handles, SizeHandleElement::MIDDLELEFT, SizeHandleElement::MIDDLERIGHT, RectangleBaseView::onSizeHandleElementRequest(), SizeHandleElement::resize_request(), SizeHandleElement::TOPLEFT, SizeHandleElement::TOPMIDDLE, and SizeHandleElement::TOPRIGHT.

Referenced by RectangleBaseView::RectangleBaseView().

Here is the call graph for this function:

◆ disconnectFromItem()

void IShape2DView::disconnectFromItem ( SessionItem item)
protectedinherited

Definition at line 145 of file IShape2DView.cpp.

146 {
147  if (item)
148  item->mapper()->unsubscribe(this);
149 }
void unsubscribe(const void *caller)
Cancels all subscriptions of given caller.
Definition: ModelMapper.cpp:78
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.

References SessionItem::mapper(), and ModelMapper::unsubscribe().

Referenced by ~EllipseView(), HorizontalLineView::~HorizontalLineView(), MaskAllView::~MaskAllView(), MaskContainerView::~MaskContainerView(), PolygonPointView::~PolygonPointView(), PolygonView::~PolygonView(), RectangleView::~RectangleView(), and VerticalLineView::~VerticalLineView().

Here is the call graph for this function:

◆ fromSceneX()

qreal IShape2DView::fromSceneX ( qreal  value) const
protectedinherited

convert scene coordinates to ColorMap plot coordinates

Definition at line 119 of file IShape2DView.cpp.

120 {
121  return m_adaptor ? m_adaptor->fromSceneX(value) : value;
122 }
virtual qreal fromSceneX(qreal) const =0
convert scene x-coordinate to native mask coordinate
const ISceneAdaptor * m_adaptor
Definition: IShape2DView.h:67

References ISceneAdaptor::fromSceneX(), and IShape2DView::m_adaptor.

Referenced by mouseMoveEvent(), RectangleView::mouseMoveEvent(), onChangedX(), VerticalLineView::onChangedX(), RectangleView::onChangedX(), and PolygonPointView::updateParameterizedItem().

Here is the call graph for this function:

◆ fromSceneY()

qreal IShape2DView::fromSceneY ( qreal  value) const
protectedinherited

Definition at line 124 of file IShape2DView.cpp.

125 {
126  return m_adaptor ? m_adaptor->fromSceneY(value) : value;
127 }
virtual qreal fromSceneY(qreal) const =0
convert scene y-coordinate to native mask coordinate

References ISceneAdaptor::fromSceneY(), and IShape2DView::m_adaptor.

Referenced by mouseMoveEvent(), RectangleView::mouseMoveEvent(), onChangedY(), HorizontalLineView::onChangedY(), RectangleView::onChangedY(), and PolygonPointView::updateParameterizedItem().

Here is the call graph for this function:

◆ height()

qreal RectangleBaseView::height ( ) const
protectedinherited

Definition at line 98 of file RectangleBaseView.cpp.

99 {
100  return bottom() - top();
101 }
virtual qreal top() const =0
virtual qreal bottom() const =0

References RectangleBaseView::bottom(), and RectangleBaseView::top().

Referenced by mask_rectangle(), RectangleView::mask_rectangle(), and mouseMoveEvent().

Here is the call graph for this function:

◆ itemChange()

QVariant RectangleBaseView::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprotectedinherited

Track if item selected/deselected and show/hide size handles.

Definition at line 51 of file RectangleBaseView.cpp.

53 {
54  if (change == QGraphicsItem::ItemSelectedChange) {
55  for (auto it = m_resize_handles.begin(); it != m_resize_handles.end(); ++it)
56  it.value()->setVisible(!this->isSelected());
57  }
58  return value;
59 }

References RectangleBaseView::m_resize_handles.

◆ left()

qreal EllipseView::left ( ) const
overrideprivatevirtual

Returns the x-coordinate of the rectangle's left edge.

Implements RectangleBaseView.

Definition at line 132 of file EllipseView.cpp.

133 {
134  return toSceneX(m_item->xCenter() - m_item->xRadius());
135 }
DoubleDescriptor xRadius() const
Definition: MaskItems.cpp:426
DoubleDescriptor xCenter() const
Definition: MaskItems.cpp:406
qreal toSceneX(qreal value) const

References m_item, IShape2DView::toSceneX(), EllipseItem::xCenter(), and EllipseItem::xRadius().

Here is the call graph for this function:

◆ mask_rectangle()

QRectF EllipseView::mask_rectangle ( )
overrideprivatevirtual

Implements RectangleBaseView.

Definition at line 125 of file EllipseView.cpp.

126 {
127  return QRectF(-width() / 2., -height() / 2., width(), height());
128 }
qreal width() const
Returns width of the rectangle.

References RectangleBaseView::height(), and RectangleBaseView::width().

Here is the call graph for this function:

◆ maskedShape()

QPainterPath IShape2DView::maskedShape ( ) const
protectedinherited

Returns the shape with all masking already applied.

Definition at line 79 of file IShape2DView.cpp.

80 {
81  static const QSet<MaskEditorHelper::EViewTypes> relevantMaskTypes = {
84 
85  QPainterPath resultingShape = mapToScene(shape());
86  for (auto* item : scene()->items()) {
87  auto* const maskItem = dynamic_cast<IShape2DView*>(item);
88  if (!maskItem
89  || !relevantMaskTypes.contains((MaskEditorHelper::EViewTypes)maskItem->type()))
90  continue;
91 
92  const bool isMaskingItem = itemMaskValue(maskItem->parameterizedItem());
93  const bool isOnTop = maskItem->zValue() > zValue();
94  if (isMaskingItem || !isOnTop)
95  continue;
96 
97  const auto maskItemShape = maskItem->mapToScene(maskItem->shape());
98  if (!maskItemShape.intersects(resultingShape))
99  continue;
100 
101  // Item lays on top and is non-masking -> subtract the
102  // path of the item
103  resultingShape = resultingShape.subtracted(maskItemShape);
104  }
105 
106  return mapFromScene(resultingShape);
107 }
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27

References MaskEditorHelper::ELLIPSE, MaskEditorHelper::HORIZONTALLINE, MaskEditorHelper::POLYGON, MaskEditorHelper::RECTANGLE, and MaskEditorHelper::VERTICALLINE.

Referenced by IShape2DView::paint().

◆ mouseMoveEvent()

void EllipseView::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Definition at line 53 of file EllipseView.cpp.

54 {
56  QPointF opposPos = mapFromScene(m_resize_opposite_origin);
57  qreal xmin = std::min(event->pos().x(), opposPos.x());
58  qreal xmax = std::max(event->pos().x(), opposPos.x());
59  qreal ymin = std::min(event->pos().y(), opposPos.y());
60  qreal ymax = std::max(event->pos().y(), opposPos.y());
61  qreal width = xmax - xmin;
62  qreal height = ymax - ymin;
63 
64  qreal xcenter = xmin + (xmax - xmin) / 2.;
65  qreal ycenter = ymin + (ymax - ymin) / 2.;
66 
67  QPointF center(xcenter, ycenter);
68  QPointF centerInScene = mapToScene(center);
69 
71  m_item->setXCenter(fromSceneX(centerInScene.x()));
72  m_item->setYCenter(fromSceneY(centerInScene.y()));
73 
74  m_item->setXRadius((fromSceneX(centerInScene.x() + width / 2.)
75  - fromSceneX(centerInScene.x() - width / 2.))
76  / 2.);
77  m_item->setYRadius((fromSceneY(centerInScene.y() - height / 2.)
78  - fromSceneY(centerInScene.y() + height / 2.))
79  / 2.);
81  m_item->setYCenter(fromSceneY(centerInScene.y()));
82  m_item->setYRadius((fromSceneY(centerInScene.y() - height / 2.)
83  - fromSceneY(centerInScene.y() + height / 2.))
84  / 2.);
86  m_item->setXCenter(fromSceneX(centerInScene.x()));
87  m_item->setXRadius((fromSceneX(centerInScene.x() + width / 2.)
88  - fromSceneX(centerInScene.x() - width / 2.))
89  / 2.);
90  }
91  } else {
92  IShape2DView::mouseMoveEvent(event);
93  }
94 }
void setYRadius(double y_radius)
Definition: MaskItems.cpp:441
void setYCenter(double y_center)
Definition: MaskItems.cpp:421
void setXCenter(double x_center)
Definition: MaskItems.cpp:411
void setXRadius(double x_radius)
Definition: MaskItems.cpp:431
qreal fromSceneY(qreal value) const
qreal fromSceneX(qreal value) const
convert scene coordinates to ColorMap plot coordinates
SizeHandleElement * m_activeHandleElement
QPointF m_resize_opposite_origin
EHandleType getHandleType() const

References IShape2DView::fromSceneX(), IShape2DView::fromSceneY(), SizeHandleElement::getHandleType(), RectangleBaseView::height(), RectangleBaseView::m_activeHandleElement, m_item, RectangleBaseView::m_resize_opposite_origin, SizeHandleElement::RESIZE, SizeHandleElement::RESIZE_HEIGHT, SizeHandleElement::RESIZE_WIDTH, EllipseItem::setXCenter(), EllipseItem::setXRadius(), EllipseItem::setYCenter(), EllipseItem::setYRadius(), and RectangleBaseView::width().

Here is the call graph for this function:

◆ mouseReleaseEvent()

void RectangleBaseView::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotectedinherited

Definition at line 61 of file RectangleBaseView.cpp.

62 {
64  IShape2DView::mouseReleaseEvent(event);
65 }

References RectangleBaseView::onSizeHandleElementRequest().

Here is the call graph for this function:

◆ onChangedX

void EllipseView::onChangedX ( )
overrideprotectedslot

Definition at line 31 of file EllipseView.cpp.

32 {
33  setBlockOnProperty(true);
34  m_item->setXCenter(fromSceneX(this->x()));
35  setBlockOnProperty(false);
36 }
void setBlockOnProperty(bool value)

References IShape2DView::fromSceneX(), m_item, IShape2DView::setBlockOnProperty(), and EllipseItem::setXCenter().

Referenced by update_position().

Here is the call graph for this function:

◆ onChangedY

void EllipseView::onChangedY ( )
overrideprotectedslot

Definition at line 38 of file EllipseView.cpp.

39 {
40  setBlockOnProperty(true);
41  m_item->setYCenter(fromSceneY(this->y()));
42  setBlockOnProperty(false);
43 }

References IShape2DView::fromSceneY(), m_item, IShape2DView::setBlockOnProperty(), and EllipseItem::setYCenter().

Referenced by update_position().

Here is the call graph for this function:

◆ onItemDestroyed()

void EllipseView::onItemDestroyed ( )
overrideprivatevirtual

Implements IShape2DView.

Definition at line 158 of file EllipseView.cpp.

159 {
160  m_item = nullptr;
161 }

References m_item.

◆ onItemPropertyChange()

void IShape2DView::onItemPropertyChange ( const QString &  propertyName)
privateinherited

Definition at line 151 of file IShape2DView.cpp.

152 {
154  return;
155 
157 
158  bool schedule_update = false;
159  if (MaskItem::isMaskValuePropertyName(propertyName))
160  schedule_update = true;
161  else if (MaskItem::isIsVisiblePropertyName(propertyName)) {
162  bool visible = false;
163  if (auto* maskItem = dynamic_cast<MaskItem*>(parameterizedItem()))
164  visible = maskItem->isVisibleValue();
165  this->setVisible(visible);
166  schedule_update = true;
167  }
168 
170 
171  if (schedule_update)
172  update();
173 
175 }
virtual void onPropertyChange()
Definition: IShape2DView.h:46
virtual SessionItem * parameterizedItem() const =0
A base class for all mask items.
Definition: MaskItems.h:27
static bool isIsVisiblePropertyName(const QString &name)
Definition: MaskItems.cpp:105
static bool isMaskValuePropertyName(const QString &name)
Definition: MaskItems.cpp:90

References MaskItem::isIsVisiblePropertyName(), MaskItem::isMaskValuePropertyName(), IShape2DView::m_block_on_property_change, IShape2DView::onPropertyChange(), and IShape2DView::parameterizedItem().

Referenced by IShape2DView::IShape2DView().

Here is the call graph for this function:

◆ onPropertyChange

void EllipseView::onPropertyChange ( )
overrideprotectedslot

Definition at line 45 of file EllipseView.cpp.

46 {
47  update_view();
48  setX(toSceneX(m_item->xCenter()));
49  setY(toSceneY(m_item->yCenter()));
50  setTransform(QTransform().rotate(-1.0 * m_item->angle()));
51 }
DoubleDescriptor angle() const
Definition: MaskItems.cpp:446
void update_view() override
update visual appearance of view (triggered by ISceneAdaptor)

References EllipseItem::angle(), m_item, IShape2DView::toSceneX(), IShape2DView::toSceneY(), RectangleBaseView::update_view(), EllipseItem::xCenter(), and EllipseItem::yCenter().

Here is the call graph for this function:

◆ onSizeHandleElementRequest

void RectangleBaseView::onSizeHandleElementRequest ( bool  going_to_resize)
privateslotinherited

triggered by SizeHandleElement

Definition at line 35 of file RectangleBaseView.cpp.

36 {
37  if (going_to_resize) {
38  setFlag(QGraphicsItem::ItemIsMovable, false);
39  m_activeHandleElement = qobject_cast<SizeHandleElement*>(sender());
40  ASSERT(m_activeHandleElement);
41  SizeHandleElement::EHandleLocation oposite_corner =
43  m_resize_opposite_origin = m_resize_handles[oposite_corner]->scenePos();
44  } else {
45  setFlag(QGraphicsItem::ItemIsMovable, true);
46  m_activeHandleElement = nullptr;
47  }
48 }
EHandleLocation getOppositeHandleLocation() const

References SizeHandleElement::getOppositeHandleLocation(), RectangleBaseView::m_activeHandleElement, RectangleBaseView::m_resize_handles, and RectangleBaseView::m_resize_opposite_origin.

Referenced by RectangleBaseView::create_size_handle_elements(), and RectangleBaseView::mouseReleaseEvent().

Here is the call graph for this function:

◆ paint()

void IShape2DView::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  ,
QWidget *   
)
overrideprotectedinherited

Definition at line 70 of file IShape2DView.cpp.

71 {
72  const bool isMasked = itemMaskValue(parameterizedItem());
73  painter->setBrush(MaskEditorHelper::getMaskBrush(isMasked));
74  painter->setPen(MaskEditorHelper::getMaskPen(isMasked));
75  painter->setRenderHints(QPainter::Antialiasing);
76  painter->drawPath(maskedShape());
77 }
QPainterPath maskedShape() const
Returns the shape with all masking already applied.
static QBrush getMaskBrush(bool mask_value)
static QPen getMaskPen(bool mask_value)

References MaskEditorHelper::getMaskBrush(), MaskEditorHelper::getMaskPen(), IShape2DView::maskedShape(), and IShape2DView::parameterizedItem().

Referenced by PolygonView::paint().

Here is the call graph for this function:

◆ parameterizedItem()

SessionItem * EllipseView::parameterizedItem ( ) const
overridevirtual

Implements IShape2DView.

Definition at line 103 of file EllipseView.cpp.

104 {
105  return m_item;
106 }

References m_item.

◆ right()

qreal EllipseView::right ( ) const
overrideprivatevirtual

Returns the x-coordinate of the rectangle's right edge.

Implements RectangleBaseView.

Definition at line 139 of file EllipseView.cpp.

140 {
141  return toSceneX(m_item->xCenter() + m_item->xRadius());
142 }

References m_item, IShape2DView::toSceneX(), EllipseItem::xCenter(), and EllipseItem::xRadius().

Here is the call graph for this function:

◆ setBlockOnProperty()

void IShape2DView::setBlockOnProperty ( bool  value)
protectedinherited

◆ setSceneAdaptor()

void IShape2DView::setSceneAdaptor ( const ISceneAdaptor adaptor)
inherited

Definition at line 55 of file IShape2DView.cpp.

56 {
57  ASSERT(adaptor);
58 
59  if (m_adaptor != adaptor) {
60  if (m_adaptor)
62 
63  m_adaptor = adaptor;
65  Qt::UniqueConnection);
66  update_view();
67  }
68 }
void update_request()
virtual void update_view()=0
update visual appearance of view (triggered by ISceneAdaptor)

References IShape2DView::m_adaptor, ISceneAdaptor::update_request(), and IShape2DView::update_view().

Referenced by MaskViewFactory::createMaskView().

Here is the call graph for this function:

◆ shape()

QPainterPath EllipseView::shape ( ) const
overrideprotected

Definition at line 96 of file EllipseView.cpp.

97 {
98  QPainterPath path;
99  path.addEllipse(m_mask_rect);
100  return path;
101 }
QRectF m_mask_rect
mask rectangle in scene coordinates

References RectangleBaseView::m_mask_rect.

◆ top()

qreal EllipseView::top ( ) const
overrideprivatevirtual

Returns the y-coordinate of the rectangle's top edge.

Implements RectangleBaseView.

Definition at line 146 of file EllipseView.cpp.

147 {
148  return toSceneY(m_item->yCenter() + m_item->yRadius());
149 }

References m_item, IShape2DView::toSceneY(), EllipseItem::yCenter(), and EllipseItem::yRadius().

Here is the call graph for this function:

◆ toSceneX()

qreal IShape2DView::toSceneX ( qreal  value) const
protectedinherited

Definition at line 109 of file IShape2DView.cpp.

110 {
111  return m_adaptor ? m_adaptor->toSceneX(value) : value;
112 }
virtual qreal toSceneX(qreal) const =0
convert native mask x-coordinate to scene coordinate

References IShape2DView::m_adaptor, and ISceneAdaptor::toSceneX().

Referenced by left(), RectangleView::left(), onPropertyChange(), VerticalLineView::onPropertyChange(), right(), RectangleView::right(), PolygonView::update_polygon(), update_position(), RectangleView::update_position(), and VerticalLineView::update_view().

Here is the call graph for this function:

◆ toSceneY()

qreal IShape2DView::toSceneY ( qreal  value) const
protectedinherited

Definition at line 114 of file IShape2DView.cpp.

115 {
116  return m_adaptor ? m_adaptor->toSceneY(value) : value;
117 }
virtual qreal toSceneY(qreal) const =0
convert native mask y-coordinate to scene coordinate

References IShape2DView::m_adaptor, and ISceneAdaptor::toSceneY().

Referenced by bottom(), RectangleView::bottom(), onPropertyChange(), HorizontalLineView::onPropertyChange(), top(), RectangleView::top(), PolygonView::update_polygon(), update_position(), RectangleView::update_position(), and HorizontalLineView::update_view().

Here is the call graph for this function:

◆ type()

int EllipseView::type ( ) const
inlineoverride

Definition at line 29 of file EllipseView.h.

29 { return MaskEditorHelper::ELLIPSE; }

References MaskEditorHelper::ELLIPSE.

◆ update_bounding_rect()

void RectangleBaseView::update_bounding_rect ( )
protectedvirtualinherited

updates view's bounding rectangle using item properties

Definition at line 76 of file RectangleBaseView.cpp.

77 {
78  if (parameterizedItem()) {
81  m_bounding_rect = m_mask_rect.marginsAdded(
82  QMarginsF(bbox_margins, bbox_margins, bbox_margins, bbox_margins));
83  }
84  for (QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*>::iterator it =
85  m_resize_handles.begin();
86  it != m_resize_handles.end(); ++it) {
87  it.value()->updateHandleElementPosition(m_mask_rect);
88  }
89 }
virtual QRectF mask_rectangle()=0
int type() const override

References IShape2DView::m_bounding_rect, RectangleBaseView::m_mask_rect, RectangleBaseView::m_resize_handles, RectangleBaseView::mask_rectangle(), IShape2DView::parameterizedItem(), MaskEditorHelper::REGIONOFINTEREST, and RectangleBaseView::type().

Referenced by RectangleBaseView::update_view().

Here is the call graph for this function:

◆ update_position()

void EllipseView::update_position ( )
overrideprivatevirtual

updates position of view using item properties

Implements RectangleBaseView.

Definition at line 110 of file EllipseView.cpp.

111 {
112  disconnect(this, &EllipseView::xChanged, this, &EllipseView::onChangedX);
113  disconnect(this, &EllipseView::yChanged, this, &EllipseView::onChangedY);
114 
115  setX(toSceneX(m_item->xCenter()));
116  setY(toSceneY(m_item->yCenter()));
117 
118  connect(this, &EllipseView::xChanged, this, &EllipseView::onChangedX);
119  connect(this, &EllipseView::yChanged, this, &EllipseView::onChangedY);
120 
121  if (m_item->angle() != 0.0)
122  setTransform(QTransform().rotate(-1.0 * m_item->angle()));
123 }
void onChangedY() override
Definition: EllipseView.cpp:38
void onChangedX() override
Definition: EllipseView.cpp:31

References EllipseItem::angle(), m_item, onChangedX(), onChangedY(), IShape2DView::toSceneX(), IShape2DView::toSceneY(), EllipseItem::xCenter(), and EllipseItem::yCenter().

Here is the call graph for this function:

◆ update_view()

void RectangleBaseView::update_view ( )
overrideprotectedvirtualinherited

update visual appearance of view (triggered by ISceneAdaptor)

Implements IShape2DView.

Definition at line 67 of file RectangleBaseView.cpp.

68 {
69  prepareGeometryChange();
72 }
virtual void update_position()=0
virtual void update_bounding_rect()
updates view's bounding rectangle using item properties

References RectangleBaseView::update_bounding_rect(), and RectangleBaseView::update_position().

Referenced by RectangleView::mouseMoveEvent(), onPropertyChange(), RectangleView::onPropertyChange(), and RegionOfInterestView::update_view().

Here is the call graph for this function:

◆ width()

qreal RectangleBaseView::width ( ) const
protectedinherited

Returns width of the rectangle.

Definition at line 93 of file RectangleBaseView.cpp.

94 {
95  return right() - left();
96 }
virtual qreal right() const =0
virtual qreal left() const =0

References RectangleBaseView::left(), and RectangleBaseView::right().

Referenced by mask_rectangle(), RectangleView::mask_rectangle(), and mouseMoveEvent().

Here is the call graph for this function:

Member Data Documentation

◆ m_activeHandleElement

SizeHandleElement* RectangleBaseView::m_activeHandleElement
protectedinherited

◆ m_adaptor

◆ m_block_on_property_change

bool IShape2DView::m_block_on_property_change
protectedinherited

◆ m_bounding_rect

◆ m_item

◆ m_mask_rect

QRectF RectangleBaseView::m_mask_rect
protectedinherited

◆ m_resize_handles

QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*> RectangleBaseView::m_resize_handles
protectedinherited

coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates

Definition at line 53 of file RectangleBaseView.h.

Referenced by RectangleBaseView::create_size_handle_elements(), RectangleBaseView::itemChange(), RectangleBaseView::onSizeHandleElementRequest(), and RectangleBaseView::update_bounding_rect().

◆ m_resize_opposite_origin

QPointF RectangleBaseView::m_resize_opposite_origin
protectedinherited

The documentation for this class was generated from the following files: