Version: 8.3.0
YACS::HMI::SceneDataPortItem Class Reference

#include <SceneDataPortItem.hxx>

Inheritance diagram for YACS::HMI::SceneDataPortItem:
Collaboration diagram for YACS::HMI::SceneDataPortItem:

Public Member Functions

 SceneDataPortItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneDataPortItem ()
 
virtual void setText (QString label)
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual SceneNodeItemgetParent ()
 
virtual void updateChildItems ()
 
virtual void updateLinks ()
 
virtual void shrinkExpandLink (bool se)
 
- Public Member Functions inherited from YACS::HMI::SceneObserverItem
 SceneObserverItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneObserverItem ()
 
virtual void select (bool isSelected)
 
virtual void activateSelection (bool selected)
 
virtual SubjectgetSubject ()
 
virtual QString getToolTip ()
 
- Public Member Functions inherited from YACS::HMI::SceneItem
 SceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~SceneItem ()
 
virtual QRectF boundingRect () const
 
virtual QRectF childrenBoundingRect () const
 
virtual void setTopLeft (QPointF topLeft)
 
virtual void checkGeometryChange ()
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
void setParent (SceneItem *parent)
 
void setEventPos (QPointF point)
 
virtual void shrinkExpandRecursive (bool isExpanding, bool fromHere, ShrinkMode theShrinkMode)
 
bool isAncestorShrinked ()
 
- Public Member Functions inherited from YACS::HMI::AbstractSceneItem
 AbstractSceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~AbstractSceneItem ()
 
int getLevel ()
 
void setLevel ()
 
virtual void reorganize ()
 
virtual QString getLabel ()
 
virtual void addHeader ()
 
virtual void addProgressItem ()
 
virtual qreal getHeaderBottom ()
 
qreal getWidth ()
 
qreal getHeight ()
 
virtual void setWidth (qreal width)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setHeight (qreal height)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setGeometryOptimization (bool optimize)
 
SceneItemgetParent ()
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 
- Public Member Functions inherited from YACS::HMI::ScenePortItem
 ScenePortItem (QString label)
 
virtual ~ScenePortItem ()
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Public Attributes inherited from YACS::HMI::SceneItem
bool _blocX
 
bool _blocY
 
- Protected Member Functions inherited from YACS::HMI::SceneObserverItem
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
virtual QColor getBrushColor ()
 
virtual QString getMimeFormat ()
 
- Protected Attributes inherited from YACS::HMI::SceneObserverItem
Subject_subject
 
bool _draging
 
bool _dragModifier
 
bool _emphasized
 
- Protected Attributes inherited from YACS::HMI::ScenePortItem
SceneTextItem_text
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 32 of file SceneDataPortItem.hxx.

Constructor & Destructor Documentation

SceneDataPortItem::SceneDataPortItem ( QGraphicsScene scene,
SceneItem parent,
QString  label,
Subject subject 
)

Definition at line 38 of file SceneDataPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_brushColor, YACS::HMI::AbstractSceneItem::_height, YACS::HMI::AbstractSceneItem::_hiBrushColor, YACS::HMI::AbstractSceneItem::_hiPenColor, YACS::HMI::AbstractSceneItem::_penColor, YACS::HMI::AbstractSceneItem::_width, YACS::HMI::Resource::DataPort_brush, YACS::HMI::Resource::DataPort_Height, YACS::HMI::Resource::DataPort_hiBrush, YACS::HMI::Resource::DataPort_hiPen, YACS::HMI::Resource::DataPort_pen, YACS::HMI::Resource::DataPort_Width, YACS::HMI::Resource::DataStreamPort_brush, YACS::HMI::Resource::DataStreamPort_hiBrush, YACS::HMI::Resource::DataStreamPort_hiPen, YACS::HMI::Resource::DataStreamPort_pen, YACS::HMI::SceneObserverItem::getSubject(), YACS::HMI::INPUTDATASTREAMPORT, YACS::HMI::INPUTPORT, YACS::HMI::OUTPUTDATASTREAMPORT, YACS::HMI::OUTPUTPORT, and setText().

SceneDataPortItem::~SceneDataPortItem ( )
virtual

Definition at line 64 of file SceneDataPortItem.cxx.

References DEBTRACE.

65 {
66  DEBTRACE("ScenePortItem::~SceneDataPortItem");
67 }

Member Function Documentation

SceneNodeItem * SceneDataPortItem::getParent ( )
virtual

Definition at line 110 of file SceneDataPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_parent.

Referenced by YACS::HMI::SceneInPortItem::~SceneInPortItem(), and YACS::HMI::SceneOutPortItem::~SceneOutPortItem().

111 {
112  if (_parent)
113  return dynamic_cast<SceneNodeItem*>(_parent);
114  else
115  return 0;
116 }
void SceneDataPortItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget widget 
)
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 69 of file SceneDataPortItem.cxx.

References YACS::HMI::Resource::DataPort_Height, YACS::HMI::Resource::DataPort_Width, DEBTRACE, YACS::HMI::SceneObserverItem::getBrushColor(), YACS::HMI::SceneItem::getPenColor(), YACS::HMI::Resource::Radius, and YACS::HMI::Resource::Thickness.

72 {
73  DEBTRACE("ScenePortItem::paint");
74  painter->save();
75 
76  QPen pen(getPenColor());
77  pen.setWidth(Resource::Thickness);
78  painter->setPen(pen);
79  painter->setBrush(getBrushColor());
81  painter->drawRoundedRect(rect, Resource::Radius, Resource::Radius);
82 
83  painter->restore();
84 }
void SceneDataPortItem::setText ( QString  label)
virtual

Implements YACS::HMI::ScenePortItem.

Definition at line 86 of file SceneDataPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_scene, and YACS::HMI::ScenePortItem::_text.

Referenced by SceneDataPortItem().

87 {
88  if (!_text)
90  this,
91  label );
92 }
void SceneDataPortItem::shrinkExpandLink ( bool  se)
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 146 of file SceneDataPortItem.cxx.

References YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::SceneObserverItem::_subject, and YACS::HMI::QtGuiContext::getQtCurrent().

147 {
148  if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
149  {
150  std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
151  for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
152  {
154  if (se) {
155  item->show();
156  } else {
157  item->hide();
158  };
159  }
160  }
161 }
void SceneDataPortItem::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::SceneObserverItem.

Definition at line 94 of file SceneDataPortItem.cxx.

References YACS::HMI::ScenePortItem::_text, DEBTRACE, YACS::HMI::GuiObserver::eventName(), YACS::HMI::Subject::getName(), YACS::HMI::REMOVE, YACS::HMI::RENAME, YACS::HMI::SceneTextItem::setPlainTextTrunc(), and YACS::HMI::SceneObserverItem::update().

Referenced by gui.graph.MyCanvas::customEvent().

95 {
96  DEBTRACE("SceneDataPortItem::update "<< eventName(event)<<" "<<type<<" "<<son);
97  SceneObserverItem::update(event, type, son);
98  switch (event)
99  {
100  case YACS::HMI::RENAME:
101  _text->setPlainTextTrunc(son->getName().c_str());
102  QGraphicsItem::update();
103  break;
104  case YACS::HMI::REMOVE:
105  SceneObserverItem::update(event, type, son);
106  break;
107  }
108 }
void SceneDataPortItem::updateChildItems ( )
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 118 of file SceneDataPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_label, YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::SceneObserverItem::_subject, DEBTRACE, YACS::HMI::QtGuiContext::getQtCurrent(), and YACS::HMI::SceneLinkItem::updateShape().

119 {
120  DEBTRACE("SceneDataPortItem::updateChildItems " << _label.toStdString());
121  if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
122  {
123  std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
124  for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
125  {
127  item->updateShape();
128  }
129  }
130 }
void SceneDataPortItem::updateLinks ( )
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 132 of file SceneDataPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_label, YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::SceneObserverItem::_subject, DEBTRACE, YACS::HMI::QtGuiContext::getQtCurrent(), and YACS::HMI::SceneLinkItem::updateShape().

133 {
134  DEBTRACE("SceneDataPortItem::updateLinks " << _label.toStdString());
135  if(SubjectDataPort* sdp=dynamic_cast<SubjectDataPort*>(_subject))
136  {
137  std::list<SubjectLink*> lsl=sdp->getListOfSubjectLink();
138  for (std::list<SubjectLink*>::const_iterator it = lsl.begin(); it != lsl.end(); ++it)
139  {
141  item->updateShape();
142  }
143  }
144 }

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