void dmz::MBRAPluginFaultTreeAutoLayout::_update_tree ( const Handle SuperHandle, const Handle SubHandle, const Int32 Column, Int32 &count) { ObjectModule *objMod (get_object_module ()); if (objMod && SuperHandle && SubHandle) { Vector rootPos (0.0, 0.0, 0.0); Vector superPos; objMod->lookup_position (SuperHandle, _defaultAttrHandle, superPos); Vector offset ((Column * _hOffset), 0.0, (count * _vOffset)); Vector topPos (rootPos + offset); HandleContainer children; objMod->lookup_sub_links (SubHandle, _linkAttrHandle, children); if (children.get_count ()) { Int32 startCount (count); Handle current (children.get_first ()); while (current) { _update_tree (SubHandle, current, Column + 1, count); current = children.get_next (); } Int32 endCount (count); offset.set_xyz (0.0, 0.0, ((endCount - startCount - 1) * 0.5f * _vOffset)); objMod->store_position (SubHandle, _defaultAttrHandle, topPos + offset); _update_logic (SubHandle); _update_path (SubHandle); } else { offset.set_xyz ((Column * _hOffset), 0.0, (count * _vOffset)); objMod->store_position (SubHandle, _defaultAttrHandle, rootPos + offset); count++; } } }
void dmz::MBRAPluginFaultTreeAutoLayout::_update_path (const Handle Object) { ObjectModule *objMod (get_object_module ()); if (objMod && Object) { Vector rootPos; objMod->lookup_position (Object, _defaultAttrHandle, rootPos); const QPointF RootPoint (rootPos.get_x (), rootPos.get_z ()); Vector logicPos ( rootPos.get_x () + (0.5f * _hOffset), rootPos.get_y (), rootPos.get_z ()); const QPointF LogicPoint (logicPos.get_x (), logicPos.get_z ()); _path.moveTo (RootPoint); _path.lineTo (LogicPoint); HandleContainer children; objMod->lookup_sub_links (Object, _linkAttrHandle, children); if (children.get_count ()) { Vector pos; Handle current (children.get_first ()); while (current) { Vector pos; objMod->lookup_position (current, _defaultAttrHandle, pos); QPointF end (pos.get_x (), pos.get_z ()); _path.moveTo (LogicPoint); _path.lineTo (LogicPoint.x (), end.y ()); _path.lineTo (end); current = children.get_next (); } } } }
void dmz::MBRAPluginFaultTreeAutoLayout::_update_tree () { ObjectModule *objMod (get_object_module ()); if (objMod && _root) { HandleContainer children; objMod->lookup_sub_links (_root, _linkAttrHandle, children); _path = QPainterPath (); Int32 count (0); Handle current (children.get_first ()); while (current) { _update_tree (_root, current, 1, count); current = children.get_next (); } Vector offset (0.0, 0.0, 0.0); if (count) { offset.set_z ((count - 1) * 0.5f * _vOffset); } objMod->store_position (_root, _defaultAttrHandle, offset); _update_logic (_root); if (children.get_count ()) { _update_path (_root); } if (_pathItem) { _pathItem->setPath (_path); } } }
/*! \brief Relational "equal to" operator. \details Test that each container has the same content and that the content is stored in the same order. \param[in] Container HandleContainer to test against. \return Returns dmz::True if the two HandleContainer objects have the same content stored in the same order. */ dmz::Boolean dmz::HandleContainer::operator== (const HandleContainer &Container) const { Boolean result (False); if (get_count () == Container.get_count ()) { result = True; HandleContainerIterator it1, it2; Handle v1, v2; while (result && get_next (it1, v1) && Container.get_next (it2, v2)) { if (v1 != v2) { result = False; } } } return result; }
/*! \brief Tests if two HandleContainer object have the same content. \param[in] Container HandleContainer to test against. \return Returns dmz::True if the two HandleContainer objects have the same content. */ dmz::Boolean dmz::HandleContainer::has_same_content (const HandleContainer &Container) const { Boolean result (False); if (get_count () == Container.get_count ()) { result = True; HandleContainerIterator it; Handle value; while (result && get_next (it, value)) { if (!Container.contains (value)) { result = False; } } } return result; }
void dmz::MBRAPluginFaultTreeAutoLayout::_update_logic (const Handle Parent) { ObjectModule *objMod (get_object_module ()); if (objMod) { HandleContainer logic; objMod->lookup_sub_links (Parent, _logicAttrHandle, logic); if (logic.get_count ()) { Vector pos; objMod->lookup_position (Parent, _defaultAttrHandle, pos); pos.set_x (pos.get_x () + (_hOffset * 0.5f)); objMod->store_position (logic.get_first (), _defaultAttrHandle, pos); } } }