Version: 8.3.0
YACS::HMI::SceneNodeItem Class Reference

#include <SceneNodeItem.hxx>

Inheritance diagram for YACS::HMI::SceneNodeItem:
Collaboration diagram for YACS::HMI::SceneNodeItem:

Public Member Functions

 SceneNodeItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneNodeItem ()
 
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 addHeader ()
 
virtual SceneHeaderItemgetHeader ()
 
virtual void addProgressItem ()
 
virtual SceneProgressItemgetProgressItem ()
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual qreal getHeaderBottom ()
 
virtual void autoPosNewPort (AbstractSceneItem *item, int nbPorts)
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
virtual SceneComposedNodeItemgetParent ()
 
virtual void removeInPortFromList (AbstractSceneItem *inPort)
 
virtual void removeOutPortFromList (AbstractSceneItem *outPort)
 
virtual void setMoving (bool moving)
 
virtual void setTopLeft (QPointF topLeft)
 
virtual void adjustHeader ()
 
virtual ScenePortItemgetCtrlInPortItem ()
 
virtual ScenePortItemgetCtrlOutPortItem ()
 
virtual void updateName ()
 
virtual void arrangeNodes (bool isRecursive)
 generic method to compute a graph for child nodes. implemented in some derived classes More...
 
virtual void arrangeChildNodes ()
 
virtual void reorganizeShrinkExpand (ShrinkMode theShrinkMode)
 
virtual void updateChildItems ()
 
virtual void shrinkExpandLink (bool se)
 
virtual void showOutScopeLinks ()
 
virtual void updateLinks ()
 
virtual void setShownState (shownState ss)
 
bool isExpanded ()
 
void setExpanded (bool e)
 
void setExpandedPos (QPointF epos)
 
qreal getExpandedX ()
 
qreal getExpandedY ()
 
void setExpandedWH ()
 
void setExpandedWH (qreal w, qreal h)
 
qreal getExpandedWidth ()
 
qreal getExpandedHeight ()
 
shownState getShownState ()
 
bool hasProgressBar () const
 
- 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 checkGeometryChange ()
 
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 ()
 
qreal getWidth ()
 
qreal getHeight ()
 
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 ()
 

Protected Member Functions

virtual QString getMimeFormat ()
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
virtual void updateState ()
 
virtual void setExecState (int execState)
 
QString getHeaderLabel ()
 
- Protected Member Functions inherited from YACS::HMI::SceneObserverItem
virtual QColor getBrushColor ()
 
- Protected Member Functions inherited from YACS::HMI::SceneItem
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
virtual QColor getPenColor ()
 
QColor hoverColor (QColor origColor)
 
- Protected Member Functions inherited from YACS::HMI::AbstractSceneItem
virtual QRectF childBoundingRect (AbstractSceneItem *child) const
 

Protected Attributes

std::list< AbstractSceneItem * > _inPorts
 
std::list< AbstractSceneItem * > _outPorts
 
SceneHeaderNodeItem_header
 
SceneProgressItem_progressItem
 
int _execState
 
bool _moving
 
bool _moved
 
bool _expanded
 
QPointF _prevPos
 
QPointF _expandedPos
 
qreal _expandedWidth
 
qreal _expandedHeight
 
shownState _shownState
 
- Protected Attributes inherited from YACS::HMI::SceneObserverItem
Subject_subject
 
bool _draging
 
bool _dragModifier
 
bool _emphasized
 
- Protected Attributes inherited from YACS::HMI::SceneItem
bool _hover
 
bool _ancestorShrinked
 
QPointF _eventPos
 
- Protected Attributes inherited from YACS::HMI::AbstractSceneItem
SceneItem_parent
 
YACS::HMI::Scene_scene
 
QString _label
 
int _level
 
qreal _width
 
qreal _height
 
qreal _incHeight
 
QColor _penColor
 
QColor _brushColor
 
QColor _hiPenColor
 
QColor _hiBrushColor
 
bool _hasHeader
 
bool _optimize
 
bool _dragable
 
enum Qt::MouseButton _dragButton
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

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
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 44 of file SceneNodeItem.hxx.

Constructor & Destructor Documentation

SceneNodeItem::~SceneNodeItem ( )
virtual

Definition at line 78 of file SceneNodeItem.cxx.

References getParent().

79 {
80  if (SceneComposedNodeItem* parent = getParent())
81  parent->removeChildFromList(this);
82 }

Member Function Documentation

void SceneNodeItem::addHeader ( )
virtual

Reimplemented from YACS::HMI::AbstractSceneItem.

Definition at line 107 of file SceneNodeItem.cxx.

References YACS::HMI::AbstractSceneItem::_hasHeader, _header, YACS::HMI::AbstractSceneItem::_label, YACS::HMI::AbstractSceneItem::_scene, YACS::HMI::SceneItem::checkGeometryChange(), DEBTRACE, getHeaderLabel(), and updateState().

Referenced by YACS::HMI::RootSceneItem::setNewRoot().

108 {
109  DEBTRACE("SceneNodeItem::addHeader " << _label.toStdString());
110  if (!_hasHeader)
111  {
112  _hasHeader = true;
114  this,
115  getHeaderLabel());
116  updateState();
118  }
119 }
void SceneNodeItem::addProgressItem ( )
virtual

Reimplemented from YACS::HMI::AbstractSceneItem.

Definition at line 126 of file SceneNodeItem.cxx.

References _progressItem, YACS::HMI::AbstractSceneItem::_scene, YACS::HMI::SceneItem::checkGeometryChange(), DEBTRACE, YACS::HMI::SceneProgressItem::setText(), and updateState().

127 {
128  DEBTRACE("SceneNodeItem::addProgressItem ");
129  if (!_progressItem)
130  {
132  this,
133  "progress");
134  _progressItem->setText("0");
135  updateState();
137  }
138 }
void SceneNodeItem::arrangeChildNodes ( )
virtual

Reimplemented in YACS::HMI::SceneComposedNodeItem, and YACS::HMI::SceneBlocItem.

Definition at line 178 of file SceneNodeItem.cxx.

179 {
180 }
void SceneNodeItem::arrangeNodes ( bool  isRecursive)
virtual

generic method to compute a graph for child nodes. implemented in some derived classes

Reimplemented in YACS::HMI::SceneComposedNodeItem.

Definition at line 174 of file SceneNodeItem.cxx.

175 {
176 }
void SceneNodeItem::autoPosNewPort ( AbstractSceneItem item,
int  nbPorts 
)
virtual

Reimplemented in YACS::HMI::SceneElementaryNodeItem.

Definition at line 195 of file SceneNodeItem.cxx.

195  {
196 }
ScenePortItem * SceneNodeItem::getCtrlInPortItem ( )
virtual

Definition at line 230 of file SceneNodeItem.cxx.

References _header, and YACS::HMI::SceneHeaderNodeItem::getCtrlInPortItem().

Referenced by YACS::HMI::SceneComposedNodeItem::update().

231 {
232  if (! _header) return 0;
233  return _header->getCtrlInPortItem();
234 }
ScenePortItem * SceneNodeItem::getCtrlOutPortItem ( )
virtual

Definition at line 236 of file SceneNodeItem.cxx.

References _header, and YACS::HMI::SceneHeaderNodeItem::getCtrlOutPortItem().

Referenced by YACS::HMI::SceneComposedNodeItem::update().

237 {
238  if (! _header) return 0;
239  return _header->getCtrlOutPortItem();
240 }
qreal YACS::HMI::SceneNodeItem::getExpandedHeight ( )
inline

Definition at line 89 of file SceneNodeItem.hxx.

References _expandedHeight.

Referenced by YACS::HMI::VisitorSaveGuiSchema::writeItem().

89 { return _expandedHeight; };
qreal YACS::HMI::SceneNodeItem::getExpandedWidth ( )
inline

Definition at line 88 of file SceneNodeItem.hxx.

References _expandedWidth.

Referenced by YACS::HMI::VisitorSaveGuiSchema::writeItem().

88 { return _expandedWidth; };
qreal YACS::HMI::SceneNodeItem::getExpandedX ( )
inline
qreal YACS::HMI::SceneNodeItem::getExpandedY ( )
inline
SceneHeaderItem * SceneNodeItem::getHeader ( )
virtual

Definition at line 121 of file SceneNodeItem.cxx.

References _header.

Referenced by YACS::HMI::LinkMatrix::cellFrom(), YACS::HMI::LinkMatrix::cellTo(), and YACS::HMI::LinkMatrix::explore().

122 {
123  return _header;
124 }
QString SceneNodeItem::getHeaderLabel ( )
protected

Definition at line 368 of file SceneNodeItem.cxx.

References YACS::HMI::AbstractSceneItem::_parent, YACS::HMI::SceneObserverItem::_subject, DEBTRACE, YACS::HMI::Subject::getName(), YACS::HMI::SubjectNode::getNode(), YACS::ENGINE::Switch::getRankOfNode(), and YACS::HMI::SceneObserverItem::getSubject().

Referenced by addHeader(), and updateName().

369 {
370  DEBTRACE("SceneNodeItem::getHeaderLabel");
371  QString extLabel = _subject->getName().c_str();
372 
373  SceneObserverItem *soi = 0;
374  SubjectSwitch* sswi = 0;
375 
376  if ((_parent)
377  && (soi = dynamic_cast<SceneObserverItem*>(_parent))
378  && (sswi = dynamic_cast<SubjectSwitch*>(soi->getSubject())))
379  {
380  Switch *aswi = dynamic_cast<Switch*>(sswi->getNode());
381  SubjectNode *sno = dynamic_cast<SubjectNode*>(_subject);
382  int idcase = aswi->getRankOfNode(sno->getNode());
383  stringstream caseid;
384  if (idcase == Switch::ID_FOR_DEFAULT_NODE)
385  caseid << "default";
386  else
387  caseid << idcase;
388  extLabel += " (";
389  //extLabel += aswi->getCaseId(sno->getNode()).c_str();
390  extLabel += caseid.str().c_str();
391  extLabel += ")";
392  DEBTRACE(extLabel.toStdString());
393  }
394 
395  return extLabel;
396 }
QString SceneNodeItem::getMimeFormat ( )
protectedvirtual

Reimplemented from YACS::HMI::SceneObserverItem.

Definition at line 247 of file SceneNodeItem.cxx.

248 {
249  return "yacs/subjectNode";
250 }
SceneComposedNodeItem * SceneNodeItem::getParent ( )
virtual

Definition at line 204 of file SceneNodeItem.cxx.

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

Referenced by YACS::HMI::GenericGui::setLoadedPresentation(), and ~SceneNodeItem().

205 {
206  if (_parent)
207  return dynamic_cast<SceneComposedNodeItem*>(_parent);
208  else
209  return 0;
210 }
virtual SceneProgressItem* YACS::HMI::SceneNodeItem::getProgressItem ( )
inlinevirtual

Definition at line 56 of file SceneNodeItem.hxx.

References _progressItem.

Referenced by YACS::HMI::SceneComposedNodeItem::update().

56 { return _progressItem; };
shownState YACS::HMI::SceneNodeItem::getShownState ( )
inline
void SceneNodeItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Definition at line 310 of file SceneNodeItem.cxx.

References YACS::HMI::GenericGui::_guiEditor, DEBTRACE, YACS::HMI::QtGuiContext::getGMain(), YACS::HMI::QtGuiContext::getQtCurrent(), and YACS::HMI::GuiEditor::shrinkExpand().

311 {
312  DEBTRACE("SceneNodeItem::mouseDoubleClickEvent");
313  QtGuiContext::getQtCurrent()->getGMain()->_guiEditor->shrinkExpand(QApplication::keyboardModifiers());
314 }
void SceneNodeItem::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

creation of mime data if drag detected. setData mime type must be coherent with SchemaModel::mimeTypes to allow drop on port item in tree view

Reimplemented from YACS::HMI::SceneObserverItem.

Definition at line 281 of file SceneNodeItem.cxx.

References YACS::HMI::SceneItem::_blocX, YACS::HMI::SceneItem::_blocY, _moved, _moving, YACS::HMI::AbstractSceneItem::_parent, YACS::HMI::Resource::Border_Margin, YACS::HMI::SceneObserverItem::mouseMoveEvent(), and setTopLeft().

282 {
284  if (_moving)
285  {
286  if (SceneComposedNodeItem *bloc = dynamic_cast<SceneComposedNodeItem*>(_parent))
287  {
288  QPointF oldPos = pos();
289  QPointF aPos = oldPos + event->scenePos() - event->lastScenePos();
290  if (aPos != oldPos)
291  _moved = true;
292  if (aPos.x() > oldPos.x()) _blocX = false;
293  if (aPos.y() > oldPos.y()) _blocY = false;
294  if (aPos.x() < Resource::Border_Margin)
295  {
296  aPos.setX(Resource::Border_Margin);
297  _blocX = true;
298  }
299  if ( aPos.y() < bloc->getHeaderBottom() )
300  {
301  aPos.setY(bloc->getHeaderBottom());
302  _blocY = true;
303  }
304  setTopLeft(aPos);
305  bloc->collisionResolv(this, oldPos);
306  }
307  }
308 }
void SceneNodeItem::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

When Zooming, filter all mouse events to items: do not work, scene do not receive...

Reimplemented from YACS::HMI::SceneObserverItem.

Definition at line 252 of file SceneNodeItem.cxx.

References YACS::HMI::SceneObserverItem::_draging, YACS::HMI::AbstractSceneItem::_label, _prevPos, YACS::HMI::AbstractSceneItem::_scene, DEBTRACE, YACS::HMI::Scene::isZooming(), YACS::HMI::SceneObserverItem::mousePressEvent(), and setMoving().

253 {
254  DEBTRACE("SceneNodeItem::mousePressEvent " << _label.toStdString());
256  if (!_scene->isZooming())
257  {
258  if (!_draging) setMoving(true);
259  _prevPos = pos();
260  }
261 }
void SceneNodeItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual
void SceneNodeItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget widget 
)
virtual

Reimplemented from YACS::HMI::SceneItem.

Reimplemented in YACS::HMI::SceneElementaryNodeItem, and YACS::HMI::SceneComposedNodeItem.

Definition at line 140 of file SceneNodeItem.cxx.

143 {
144  //DEBTRACE("SceneNodeItem::paint");
145 }
void SceneNodeItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SceneItem.

Reimplemented in YACS::HMI::SceneComposedNodeItem, YACS::HMI::SceneElementaryNodeItem, and YACS::HMI::SceneProcItem.

Definition at line 198 of file SceneNodeItem.cxx.

References gui.GraphViewer::m, and YACS::HMI::NodeMenu::popupMenu().

199 {
200  NodeMenu m;
201  m.popupMenu(caller, globalPos);
202 }
void SceneNodeItem::removeInPortFromList ( AbstractSceneItem inPort)
virtual

Definition at line 211 of file SceneNodeItem.cxx.

References _inPorts.

212 {
213  _inPorts.remove(inPort);
214 }
void SceneNodeItem::removeOutPortFromList ( AbstractSceneItem outPort)
virtual

Definition at line 216 of file SceneNodeItem.cxx.

References _outPorts.

217 {
218  _outPorts.remove(outPort);
219 }
void SceneNodeItem::reorganizeShrinkExpand ( ShrinkMode  theShrinkMode)
virtual

Reimplemented in YACS::HMI::SceneComposedNodeItem, and YACS::HMI::SceneElementaryNodeItem.

Definition at line 182 of file SceneNodeItem.cxx.

Referenced by YACS::HMI::GuiEditor::shrinkExpand().

183 {
184 }
void SceneNodeItem::setExecState ( int  execState)
protectedvirtual

Definition at line 361 of file SceneNodeItem.cxx.

References _execState, _header, DEBTRACE, and YACS::HMI::SceneHeaderNodeItem::setExecState().

Referenced by update().

362 {
363  DEBTRACE("SceneNodeItem::setExecState " << execState);
364  _execState = execState;
365  if (_header) _header->setExecState(execState);
366 }
void YACS::HMI::SceneNodeItem::setExpanded ( bool  e)
inline
void YACS::HMI::SceneNodeItem::setExpandedPos ( QPointF  epos)
inline
void YACS::HMI::SceneNodeItem::setExpandedWH ( qreal  w,
qreal  h 
)
inline

Definition at line 87 of file SceneNodeItem.hxx.

References _expandedHeight, _expandedWidth, gui.graph::h(), and gui.logview::w.

void SceneNodeItem::setHeight ( qreal  height)
virtual

AbstractSceneItem cannot be resized (only ComposedNodeItem can)

Reimplemented from YACS::HMI::AbstractSceneItem.

Reimplemented in YACS::HMI::SceneElementaryNodeItem.

Definition at line 96 of file SceneNodeItem.cxx.

References _expandedHeight, and YACS::HMI::AbstractSceneItem::_height.

Referenced by YACS::HMI::GenericGui::setLoadedPresentation().

97 {
98  if (height != _height)
99  {
100  prepareGeometryChange();
101  _height = height;
103  QGraphicsItem::update();
104  }
105 }
void SceneNodeItem::setMoving ( bool  moving)
virtual

Definition at line 221 of file SceneNodeItem.cxx.

References _moving, YACS::HMI::AbstractSceneItem::_parent, and setMoving().

Referenced by mousePressEvent(), mouseReleaseEvent(), and setMoving().

222 {
223  //DEBTRACE("SceneNodeItem::setMoving " << _label.toStdString() << " " << moving);
224  _moving = moving;
225  SceneNodeItem *nodep = 0;
226  if (_parent && (nodep = dynamic_cast<SceneNodeItem*>(_parent)))
227  nodep->setMoving(false);
228 }
void SceneNodeItem::setShownState ( shownState  ss)
virtual

Reimplemented in YACS::HMI::SceneComposedNodeItem, and YACS::HMI::SceneElementaryNodeItem.

Definition at line 460 of file SceneNodeItem.cxx.

References _shownState.

Referenced by YACS::HMI::GenericGui::setLoadedPresentation().

461 {
462  _shownState = ss;
463 }
void SceneNodeItem::setTopLeft ( QPointF  topLeft)
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 316 of file SceneNodeItem.cxx.

References _expandedPos, YACS::HMI::AbstractSceneItem::_parent, _shownState, YACS::HMI::SceneItem::checkGeometryChange(), YACS::HMI::shrinkHidden, and updateLinks().

Referenced by YACS::HMI::SceneComposedNodeItem::collisionResolv(), and mouseMoveEvent().

317 {
318  if (_shownState == shrinkHidden) {
319  _expandedPos = topLeft;
320  return;
321  }
322  QPointF oldPos = pos();
323  setPos(topLeft);
324 
325  //update links
326  updateLinks();
327 
328  if (_parent)
329  {
330  if (SceneComposedNodeItem *bloc = dynamic_cast<SceneComposedNodeItem*>(_parent))
331  bloc->collisionResolv(this, oldPos);
333  }
334  _expandedPos = pos();
335 }
void SceneNodeItem::setWidth ( qreal  width)
virtual

AbstractSceneItem cannot be resized (only ComposedNodeItem can)

Reimplemented from YACS::HMI::AbstractSceneItem.

Reimplemented in YACS::HMI::SceneElementaryNodeItem.

Definition at line 84 of file SceneNodeItem.cxx.

References _expandedWidth, YACS::HMI::AbstractSceneItem::_width, and adjustHeader().

Referenced by YACS::HMI::GenericGui::setLoadedPresentation().

85 {
86  if (width != _width)
87  {
88  prepareGeometryChange();
89  _width = width;
91  adjustHeader();
92  QGraphicsItem::update();
93  }
94 }
void SceneNodeItem::showOutScopeLinks ( )
virtual

Definition at line 434 of file SceneNodeItem.cxx.

References YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::GuiContext::_mapOfSubjectLink, YACS::HMI::SceneObserverItem::_subject, YACS::HMI::SubjectNode::getNode(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::ENGINE::Node::getSetOfLinksComingInCurrentScope(), YACS::ENGINE::Node::getSetOfLinksLeavingCurrentScope(), and YASSERT.

Referenced by YACS::HMI::GuiEditor::shrinkExpand().

435 {
436  SubjectNode *snode = dynamic_cast<SubjectNode*>(_subject);
437  YASSERT(snode);
438  Node *node = snode->getNode();
439  YASSERT(node);
440  vector<pair<OutPort *, InPort *> > listLeaving = node->getSetOfLinksLeavingCurrentScope();
441  vector<pair<InPort *, OutPort *> > listIncoming = node->getSetOfLinksComingInCurrentScope();
442  vector<pair<OutPort *, InPort *> > outScope = listLeaving;
443  vector<pair<InPort *, OutPort *> >::iterator it1;
444  for (it1 = listIncoming.begin(); it1 != listIncoming.end(); ++it1)
445  {
446  pair<OutPort *, InPort *> outin = pair<OutPort *, InPort *>((*it1).second, (*it1).first);
447  outScope.push_back(outin);
448  }
449  vector<pair<OutPort*, InPort*> >::const_iterator it = outScope.begin();
450  for( ; it != outScope.end(); ++it)
451  {
452  YASSERT(QtGuiContext::getQtCurrent()->_mapOfSubjectLink.count(*it));
454  YASSERT(QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(slink));
456  item->show();
457  }
458 }
void SceneNodeItem::shrinkExpandLink ( bool  se)
virtual

Reimplemented from YACS::HMI::SceneItem.

Reimplemented in YACS::HMI::SceneComposedNodeItem.

Definition at line 423 of file SceneNodeItem.cxx.

424 {
425  foreach (QGraphicsItem *child, childItems())
426  {
427  if (SceneItem *sci = dynamic_cast<SceneItem*>(child))
428  {
429  sci->shrinkExpandLink(se);
430  }
431  }
432 }
void SceneNodeItem::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::SceneObserverItem.

Reimplemented in YACS::HMI::SceneElementaryNodeItem, and YACS::HMI::SceneComposedNodeItem.

Definition at line 147 of file SceneNodeItem.cxx.

References _header, YACS::HMI::SceneObserverItem::_subject, DEBTRACE, YACS::HMI::EDIT, YACS::HMI::GuiObserver::eventName(), YACS::HMI::Subject::getName(), YACS::HMI::RENAME, YACS::HMI::SceneHeaderNodeItem::setEdited(), setExecState(), YACS::HMI::SceneObserverItem::update(), YACS::HMI::UPDATE, updateName(), YACS::HMI::UPDATEPROGRESS, and updateState().

Referenced by gui.graph.MyCanvas::customEvent(), YACS::HMI::SceneComposedNodeItem::update(), and YACS::HMI::SceneElementaryNodeItem::update().

148 {
149  DEBTRACE("SceneNodeItem::update "<< eventName(event)<<" "<<type<<" "<<son);
150  SceneObserverItem::update(event, type, son);
151  SubjectNode *snode = 0;
152  Node *node = 0;
153  switch (event)
154  {
155  case YACS::HMI::RENAME:
156  DEBTRACE("SceneNodeItem::update RENAME " << _subject->getName());
157  updateName();
158  break;
159  case YACS::HMI::EDIT:
160  if (_header) _header->setEdited(type);
161  break;
162  case YACS::HMI::UPDATE:
163  updateState();
164  break;
166  setExecState(type);
167  break;
168  default:
169  ;
170  }
171 }
void SceneNodeItem::updateChildItems ( )
virtual

Reimplemented from YACS::HMI::SceneItem.

Reimplemented in YACS::HMI::SceneComposedNodeItem.

Definition at line 412 of file SceneNodeItem.cxx.

Referenced by YACS::HMI::SceneComposedNodeItem::updateChildItems(), and updateLinks().

413 {
414  foreach (QGraphicsItem *child, childItems())
415  {
416  if (SceneItem *sci = dynamic_cast<SceneItem*>(child))
417  {
418  sci->updateLinks();
419  }
420  }
421 }
void SceneNodeItem::updateLinks ( )
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 398 of file SceneNodeItem.cxx.

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

Referenced by YACS::HMI::SceneItem::checkGeometryChange(), YACS::HMI::SceneElementaryNodeItem::reorganize(), YACS::HMI::GenericGui::setLoadedPresentation(), setTopLeft(), and YACS::HMI::GuiEditor::shrinkExpand().

399 {
400  //update control links
401  std::list<SubjectControlLink*> lscl=dynamic_cast<SubjectNode*>(_subject)->getSubjectControlLinks();
402  for (std::list<SubjectControlLink*>::const_iterator it = lscl.begin(); it != lscl.end(); ++it)
403  {
405  item->updateShape();
406  }
407 
408  //update data links through child items update (SceneDataPortItem)
410 }
void SceneNodeItem::updateName ( )
virtual
void SceneNodeItem::updateState ( )
protectedvirtual

Definition at line 342 of file SceneNodeItem.cxx.

References _header, YACS::HMI::SceneObserverItem::_subject, YACS::HMI::SubjectNode::getNode(), YACS::ENGINE::Node::getState(), YACS::INVALID, YACS::READY, YACS::HMI::SceneHeaderNodeItem::setValid(), and YASSERT.

Referenced by addHeader(), addProgressItem(), and update().

343 {
344  SubjectNode *snode = dynamic_cast<SubjectNode*>(_subject);
345  YASSERT(snode);
346  Node *node = snode->getNode();
347  YASSERT(node);
348  switch (node->getState())
349  {
350  case YACS::INVALID:
351  if (_header) _header->setValid(false);
352  break;
353  case YACS::READY:
354  if (_header) _header->setValid(true);
355  break;
356  default:
357  break;
358  }
359 }

Member Data Documentation

int YACS::HMI::SceneNodeItem::_execState
protected

Definition at line 108 of file SceneNodeItem.hxx.

Referenced by SceneNodeItem(), and setExecState().

bool YACS::HMI::SceneNodeItem::_expanded
protected
std::list<AbstractSceneItem*> YACS::HMI::SceneNodeItem::_inPorts
protected
bool YACS::HMI::SceneNodeItem::_moved
protected

Definition at line 110 of file SceneNodeItem.hxx.

Referenced by mouseMoveEvent(), mouseReleaseEvent(), and SceneNodeItem().

bool YACS::HMI::SceneNodeItem::_moving
protected

Definition at line 109 of file SceneNodeItem.hxx.

Referenced by mouseMoveEvent(), SceneNodeItem(), and setMoving().

std::list<AbstractSceneItem*> YACS::HMI::SceneNodeItem::_outPorts
protected
QPointF YACS::HMI::SceneNodeItem::_prevPos
protected

Definition at line 112 of file SceneNodeItem.hxx.

Referenced by mousePressEvent(), and mouseReleaseEvent().


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