![]() |
HAL
|
Base class for all specific layouters. More...
#include <graph_layouter.h>
Public Member Functions | |
GraphLayouter (GraphContext *context, QObject *parent=nullptr) | |
~GraphLayouter () | |
virtual QString | name () const =0 |
virtual QString | mDescription () const =0 |
virtual void | add (const QSet< u32 > modules, const QSet< u32 > gates, const QSet< u32 > nets, PlacementHint placement=PlacementHint())=0 |
virtual void | remove (const QSet< u32 > modules, const QSet< u32 > gates, const QSet< u32 > nets)=0 |
void | layout () |
GraphicsScene * | scene () const |
const QMap< Node, QPoint > | nodeToPositionMap () const |
const QMap< QPoint, Node > | positionToNodeMap () const |
GridPlacement * | gridPlacementFactory () const |
NetLayoutPoint | positonForNode (const Node &nd) const |
Node | nodeAtPosition (const QPoint &p) const |
QPoint | gridPointByItem (GraphicsNode *item) const |
void | dumpNodePositions (const QPoint &search) const |
void | updatePlacement (const GridPlacement &plc) |
void | setNodePosition (const Node &n, const QPoint &p) |
void | swapNodePositions (const Node &n1, const Node &n2) |
void | removeNodeFromMaps (const Node &n) |
int | minXIndex () const |
int | minYIndex () const |
bool | done () const |
bool | dumpJunctionEnabled () |
void | setDumpJunctionEnabled (bool enabled) |
QVector< qreal > | xValues () const |
QVector< qreal > | yValues () const |
qreal | maxNodeWidth () const |
qreal | maxNodeHeight () const |
qreal | defaultGridWidth () const |
qreal | defaultGridHeight () const |
qreal | gridXposition (int ix) const |
qreal | gridYposition (int iy) const |
const NodeBoxes & | boxes () const |
void | prepareRollback () |
bool | canRollback () const |
bool | rollback () |
![]() | |
virtual const QMetaObject * | metaObject () const const |
QObject (QObject *parent) | |
virtual | ~QObject () |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
Q_CLASSINFO (Name, Value) | |
Q_INTERFACES (...) | |
Q_PROPERTY (...) | |
Q_ENUMS (...) | |
Q_FLAGS (...) | |
Q_ENUM (...) | |
Q_FLAG (...) | |
Q_ENUM_NS (...) | |
Q_FLAG_NS (...) | |
Q_OBJECT Q_OBJECT | |
Q_GADGET Q_GADGET | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_SIGNALS Q_SIGNALS | |
Q_SIGNAL Q_SIGNAL | |
Q_SLOTS Q_SLOTS | |
Q_SLOT Q_SLOT | |
Q_EMIT Q_EMIT | |
Q_INVOKABLE Q_INVOKABLE | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
Protected Attributes | |
GraphicsScene * | mScene |
GraphContext * | mParentContext |
QMap< Node, QPoint > | mNodeToPositionMap |
QMap< QPoint, Node > | mPositionToNodeMap |
QMap< Node, QPoint > | mNodeToPositionRollback |
Friends | |
class | DrawNetThread |
Additional Inherited Members | |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
![]() | |
typedef | QObjectList |
![]() | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
![]() | |
objectName | |
Base class for all specific layouters.
The abstract parent class for all graph layouters. The graph layouter is responsible for building up the scene using the information given in the passed GraphContext. It places the respective GraphicItems for the given gates and modules in positions that are calculated intelligently considering their order, connections and dimensions. Afterwards, the paths of GraphicsNet objects will be computed to visualize the nets between gates/modules.
If the GraphContext changes later on (e.g. gates/modules are added/removed), the GraphLayouter has the task to apply the changes in the scene.
Definition at line 77 of file graph_layouter.h.
|
explicit |
Constructor.
context | - The GraphContext the layouter works on |
parent | - The parent QObject |
Definition at line 44 of file graph_layouter.cpp.
References QObject::connect(), hal::CommentManager::entryAboutToBeDeleted(), hal::CommentManager::entryAdded(), hal::CommentManager::entryModified(), hal::gCommentManager, hal::gContentManager, hal::ContentManager::getSelectionDetailsWidget(), hal::GraphicsScene::handleHighlight(), mScene, and hal::SelectionDetailsWidget::triggerHighlight().
hal::GraphLayouter::~GraphLayouter | ( | ) |
Destructor.
Definition at line 56 of file graph_layouter.cpp.
References QObject::deleteLater(), and mScene.
|
pure virtual |
Implemented in hal::StandardGraphLayouter, and hal::PhysicalGraphLayouter.
|
inline |
Definition at line 313 of file graph_layouter.h.
Referenced by hal::NetlistRelay::addToModuleDialog(), hal::GraphContext::getNetDestination(), hal::GraphContext::getNetSource(), hal::GraphGraphicsView::handleShortestPath(), hal::DragController::isDropAllowed(), hal::GraphContext::refreshModule(), and hal::DragController::set().
bool hal::GraphLayouter::canRollback | ( | ) | const |
Definition at line 305 of file graph_layouter.cpp.
References mNodeToPositionRollback.
Referenced by rollback(), and hal::GraphWidget::showProgress().
qreal hal::GraphLayouter::defaultGridHeight | ( | ) | const |
Definition at line 223 of file graph_layouter.cpp.
Referenced by gridYposition(), and layout().
qreal hal::GraphLayouter::defaultGridWidth | ( | ) | const |
Definition at line 218 of file graph_layouter.cpp.
Referenced by gridXposition(), and layout().
bool hal::GraphLayouter::done | ( | ) | const |
Definition at line 193 of file graph_layouter.cpp.
Referenced by hal::GraphGraphicsView::dropEvent(), hal::DragController::set(), and hal::GraphWidget::storeViewport().
bool hal::GraphLayouter::dumpJunctionEnabled | ( | ) |
Definition at line 1364 of file graph_layouter.cpp.
void hal::GraphLayouter::dumpNodePositions | ( | const QPoint & | search | ) | const |
Definition at line 92 of file graph_layouter.cpp.
References QTextStream::AlignRight, hal::Node::Module, mPositionToNodeMap, QTextStream::setFieldAlignment(), QTextStream::setFieldWidth(), QIODevice::WriteOnly, QPoint::x(), and QPoint::y().
GridPlacement * hal::GraphLayouter::gridPlacementFactory | ( | ) | const |
Creates a new GridPlacement instance (node to position hash) and returns the pointer The caller has the ownership and responsibility to delete that instance
Definition at line 71 of file graph_layouter.cpp.
References QHash::insert(), and mNodeToPositionMap.
Referenced by hal::ActionAddItemsToObject::exec(), hal::DragController::finalGridPlacement(), and hal::GuiApiClasses::View::getGridPlacement().
QPoint hal::GraphLayouter::gridPointByItem | ( | GraphicsNode * | item | ) | const |
Definition at line 172 of file graph_layouter.cpp.
References hal::NodeBoxes::boxForItem(), hal::NodeBox::x(), and hal::NodeBox::y().
qreal hal::GraphLayouter::gridXposition | ( | int | ix | ) | const |
Definition at line 228 of file graph_layouter.cpp.
References defaultGridWidth(), QVector::isEmpty(), QVector::last(), and QVector::size().
Referenced by hal::DragController::move().
qreal hal::GraphLayouter::gridYposition | ( | int | iy | ) | const |
Definition at line 239 of file graph_layouter.cpp.
References defaultGridHeight(), QVector::isEmpty(), QVector::last(), and QVector::size().
Referenced by hal::DragController::move().
void hal::GraphLayouter::layout | ( | ) |
Does the actual layout process.
Definition at line 250 of file graph_layouter.cpp.
References defaultGridHeight(), defaultGridWidth(), hal::GraphicsScene::deleteAllItems(), QElapsedTimer::elapsed(), hal::GraphicsScene::handleExternSelectionChanged(), hal::GraphContext::layoutProgress(), hal::GraphicsScene::moveNetsToBackground(), mParentContext, mScene, hal::NetLayoutJunctionEntries::resetFile(), QElapsedTimer::start(), xValues(), and yValues().
Referenced by hal::GraphContext::abortLayout().
qreal hal::GraphLayouter::maxNodeHeight | ( | ) | const |
Definition at line 213 of file graph_layouter.cpp.
qreal hal::GraphLayouter::maxNodeWidth | ( | ) | const |
Definition at line 208 of file graph_layouter.cpp.
|
pure virtual |
Gets an inforaml description of the layouter.
Implemented in hal::StandardGraphLayouter, and hal::PhysicalGraphLayouter.
int hal::GraphLayouter::minXIndex | ( | ) | const |
Definition at line 183 of file graph_layouter.cpp.
int hal::GraphLayouter::minYIndex | ( | ) | const |
Definition at line 188 of file graph_layouter.cpp.
|
pure virtual |
Gets the name of the layouter.
Implemented in hal::StandardGraphLayouter, and hal::PhysicalGraphLayouter.
Definition at line 79 of file graph_layouter.cpp.
References mPositionToNodeMap.
Referenced by hal::DragController::finalGridPlacement().
Definition at line 66 of file graph_layouter.cpp.
References mNodeToPositionMap.
Referenced by hal::GraphContext::abortLayout(), hal::ActionDeleteObject::exec(), and hal::ActionMoveNode::exec().
Definition at line 105 of file graph_layouter.cpp.
References mPositionToNodeMap.
NetLayoutPoint hal::GraphLayouter::positonForNode | ( | const Node & | nd | ) | const |
Definition at line 84 of file graph_layouter.cpp.
References hal::Node::isNull(), and mNodeToPositionMap.
Referenced by hal::ActionFoldModule::exec(), hal::ActionRemoveItemsFromObject::exec(), hal::ActionUnfoldModule::exec(), hal::GraphContext::unfoldModule(), and hal::GraphContext::writeToFile().
void hal::GraphLayouter::prepareRollback | ( | ) |
Definition at line 299 of file graph_layouter.cpp.
References mNodeToPositionMap, and mNodeToPositionRollback.
Referenced by hal::GraphContext::unfoldModule().
|
pure virtual |
Implemented in hal::StandardGraphLayouter, and hal::PhysicalGraphLayouter.
void hal::GraphLayouter::removeNodeFromMaps | ( | const Node & | n | ) |
Definition at line 162 of file graph_layouter.cpp.
References mNodeToPositionMap, mPositionToNodeMap, and test::n.
Referenced by hal::PhysicalGraphLayouter::remove(), and hal::StandardGraphLayouter::remove().
bool hal::GraphLayouter::rollback | ( | ) |
Definition at line 310 of file graph_layouter.cpp.
References canRollback(), mNodeToPositionMap, mNodeToPositionRollback, and mPositionToNodeMap.
Referenced by hal::GraphContext::abortLayout().
GraphicsScene * hal::GraphLayouter::scene | ( | ) | const |
Gets the GraphicsScene the layouter works on.
Definition at line 61 of file graph_layouter.cpp.
References mScene.
Referenced by hal::DragController::clear(), and hal::GraphContext::scene().
void hal::GraphLayouter::setDumpJunctionEnabled | ( | bool | enabled | ) |
Definition at line 1369 of file graph_layouter.cpp.
Referenced by hal::GraphContextManager::getDefaultLayouter().
Definition at line 133 of file graph_layouter.cpp.
References mNodeToPositionMap, mPositionToNodeMap, and test::n.
Referenced by hal::GraphContext::readFromFile().
Definition at line 147 of file graph_layouter.cpp.
References mNodeToPositionMap, and mPositionToNodeMap.
void hal::GraphLayouter::updatePlacement | ( | const GridPlacement & | plc | ) |
Definition at line 110 of file graph_layouter.cpp.
References QHash::begin(), QHash::constBegin(), QHash::constEnd(), QHash::end(), mNodeToPositionMap, mPositionToNodeMap, and QHash::value().
Referenced by hal::GraphContext::updatePlacement().
QVector< qreal > hal::GraphLayouter::xValues | ( | ) | const |
Definition at line 198 of file graph_layouter.cpp.
Referenced by layout().
QVector< qreal > hal::GraphLayouter::yValues | ( | ) | const |
Definition at line 203 of file graph_layouter.cpp.
Referenced by layout().
|
friend |
Definition at line 81 of file graph_layouter.h.
Definition at line 325 of file graph_layouter.h.
Referenced by gridPlacementFactory(), nodeToPositionMap(), positonForNode(), prepareRollback(), removeNodeFromMaps(), rollback(), setNodePosition(), swapNodePositions(), and updatePlacement().
Definition at line 327 of file graph_layouter.h.
Referenced by canRollback(), prepareRollback(), and rollback().
|
protected |
Definition at line 324 of file graph_layouter.h.
Referenced by layout().
Definition at line 326 of file graph_layouter.h.
Referenced by dumpNodePositions(), nodeAtPosition(), positionToNodeMap(), removeNodeFromMaps(), rollback(), setNodePosition(), swapNodePositions(), and updatePlacement().
|
protected |
Definition at line 323 of file graph_layouter.h.
Referenced by GraphLayouter(), layout(), scene(), and ~GraphLayouter().