#include <node.h>
Inheritance diagram for Node:


Public Types | |
| enum | node_type { ec_pin, ec_junction, fp_in, fp_out, fp_junction } |
| enum | node_dir { dir_up = 270, dir_right = 0, dir_down = 90, dir_left = 180 } |
Public Slots | |
| void | moveBy (double dx, double dy) |
| void | removeNode (Item *) |
| void | removeNode () |
| void | checkForRemoval (Connector *connector) |
| void | setNodeSelected (bool yes) |
Signals | |
| void | moved (Node *node) |
| void | removed (Node *node) |
Public Member Functions | |
| Node (ICNDocument *icnDocument, Node::node_type type, node_dir dir, const QPoint &pos, QString *id=0) | |
| virtual | ~Node () |
| virtual void | setVisible (bool yes) |
| const QString | id () const |
| const QString | childId () const |
| void | setChildId (const QString &id) |
| virtual int | rtti () const |
| virtual void | setLevel (const int level) |
| int | level () const |
| node_type | type () const |
| bool | acceptInput () const |
| bool | acceptOutput () const |
| void | setOrientation (node_dir dir) |
| virtual void | setParentItem (CNItem *parentItem) |
| bool | isChildNode () const |
| CNItem * | parentItem () const |
| void | removeConnector (Connector *connector) |
| Connector * | createInputConnector (Node *startNode) |
| void | addInputConnector (Connector *const connector) |
| void | addOutputConnector (Connector *const connector) |
| int | numCon (bool includeParentItem, bool includeHiddenConnectors) const |
| NodeData | nodeData () const |
| ConnectorList | inputConnectorList () const |
| ConnectorList | outputConnectorList () const |
| void | setNodeGroup (NodeGroup *ng) |
| NodeGroup * | nodeGroup () const |
| bool | isConnected (Node *node, NodeList *checkedNodes=0) |
| void | removeNullConnectors () |
| virtual void | drawShape (QPainter &p)=0 |
Protected Member Functions | |
| QPoint | findConnectorDivergePoint (bool *found) |
| void | initPoints () |
| bool | handleNewConnector (Connector *newConnector) |
Protected Attributes | |
| node_type | m_type |
| QString | m_id |
| QString | m_childId |
| node_dir | m_dir |
| ICNDocument * | p_icnDocument |
| CNItem * | p_parentItem |
| ConnectorList | m_inputConnectorList |
| ConnectorList | m_outputConnectorList |
| int | m_level |
| NodeGroup * | p_nodeGroup |
| QColor | m_selectedColor |
Definition at line 34 of file node.h.
| enum Node::node_type |
| void Node::setVisible | ( | bool | yes | ) | [virtual] |
Sets the node's visibility, as well as updating the visibility of the attached connectors as appropriate
Definition at line 77 of file node.cpp.
References m_inputConnectorList, and m_outputConnectorList.
Referenced by NodeGroup::nodeRemoved(), and FlowContainer::updateContainedVisibility().
| const QString Node::id | ( | ) | const [inline] |
Returns the global id, that is unique to the node amongst all the nodes on the canvas
Definition at line 71 of file node.h.
References m_id.
Referenced by ICNDocument::createConnector(), and CNItem::createNode().
| const QString Node::childId | ( | ) | const [inline] |
Returns the id that is internal to the CNItem to which the node belongs to. Returns a null QString if no parentitem
Definition at line 76 of file node.h.
References m_childId.
Referenced by FlowContainer::filterEndPartIDs().
| void Node::setChildId | ( | const QString & | id | ) | [inline] |
Use this function to set the child-id, that is unique to the node amongst the other nodes associated with its parent CNItem
Definition at line 81 of file node.h.
References m_childId.
Referenced by CNItem::createNode().
| int Node::rtti | ( | ) | const [virtual] |
| void Node::setLevel | ( | const int | level | ) | [virtual] |
Sets the "level" of the node. By default, the level is 0. The level of the node tells the node what CNItems it can be connected to through a connector.
Definition at line 61 of file node.cpp.
References m_level.
Referenced by FlowContainer::createBotContainerNode(), CNItem::createNode(), FlowContainer::createTopContainerNode(), setParentItem(), and FlowContainer::updateNodeLevels().
| int Node::level | ( | ) | const [inline] |
Returns the level of the nodes
Definition at line 97 of file node.h.
References m_level.
Referenced by ICNDocument::canConnect().
| node_type Node::type | ( | ) | const [inline] |
Use this to identify the type of node - eg ECNode or FPNode
Definition at line 101 of file node.h.
References m_type.
Referenced by acceptInput(), acceptOutput(), addInputConnector(), addOutputConnector(), checkForRemoval(), ICNDocument::createConnector(), createInputConnector(), FPNode::drawShape(), ECNode::drawShape(), ECNode::ECNode(), initPoints(), FPNode::inputFlowParts(), FPNode::outputFlowPart(), FlowPart::outputPart(), and Connector::syncWiresWithNodes().
| bool Node::acceptInput | ( | ) | const |
Returns true if the node can accept input connections. This will depend on the node type and number of input / output connections.
Definition at line 66 of file node.cpp.
References type().
Referenced by ICNDocument::canConnect().
| bool Node::acceptOutput | ( | ) | const |
Returns true if the node can accept output connections. This will depend on the node type and number of input / output connections.
Definition at line 72 of file node.cpp.
References type().
Referenced by ICNDocument::canConnect().
| void Node::setOrientation | ( | node_dir | dir | ) |
Sets the orientation of the node.
Definition at line 177 of file node.cpp.
References initPoints(), and m_dir.
| void Node::setParentItem | ( | CNItem * | parentItem | ) | [virtual] |
Associates a CNItem with the node - ie the node belongs to the CNItem, and hence gets deleted when the CNItem gets deleted.s
Reimplemented in ECNode.
Definition at line 281 of file node.cpp.
References Item::level(), moveBy(), p_parentItem, parentItem(), removed(), removeNode(), and setLevel().
Referenced by CNItem::createNode(), and ECNode::setParentItem().
| bool Node::isChildNode | ( | ) | const [inline] |
Returns true if the node is part of a CNItem (i.e. not between multiple connectors)
Definition at line 125 of file node.h.
References p_parentItem.
Referenced by NodeGroup::addNode(), CNItemGroup::addNode(), ICNDocument::copy(), ICNDocument::createNodeGroup(), ICNDocument::deleteNodeGroup(), handleNewConnector(), and numCon().
| CNItem* Node::parentItem | ( | ) | const [inline] |
Returns a pointer to the CNItem to which the node belongs, or Null if it doesn't.
Definition at line 130 of file node.h.
References p_parentItem.
Referenced by ICNDocument::getTranslatable(), FPNode::inputFlowParts(), ICNDocument::joinConnectors(), FPNode::outputFlowPart(), setParentItem(), and ECNode::setParentItem().
| void Node::removeConnector | ( | Connector * | connector | ) |
Remove a specific connector
Definition at line 398 of file node.cpp.
References m_inputConnectorList, and m_outputConnectorList.
Referenced by checkForRemoval(), and handleNewConnector().
Creates a new connector, sets this as the end node to the connector (i.e. this node is the connector's input node), and returns a pointer to the connector.
Definition at line 388 of file node.cpp.
References addInputConnector(), p_icnDocument, and type().
Referenced by ICNDocument::createConnector(), and ICNDocument::joinConnectors().
| void Node::addInputConnector | ( | Connector *const | connector | ) |
Registers an input connector (i.e. this is the end node) as connected to this node.
Definition at line 361 of file node.cpp.
References handleNewConnector(), m_inputConnectorList, and type().
Referenced by createInputConnector(), and ItemDocumentData::mergeWithDocument().
| void Node::addOutputConnector | ( | Connector *const | connector | ) |
Registers an input connector (i.e. this is the start node) as connected to this node.
Definition at line 336 of file node.cpp.
References handleNewConnector(), m_outputConnectorList, and type().
Referenced by ICNDocument::createConnector(), ICNDocument::joinConnectors(), and ItemDocumentData::mergeWithDocument().
| int Node::numCon | ( | bool | includeParentItem, | |
| bool | includeHiddenConnectors | |||
| ) | const |
Returns the total number of connections to the node. This is the number of input connectors, the number of output connectors, and the parent item connector if it exists and is requested.
| includeParentItem | Count the parent item as a connector if it exists | |
| includeHiddenConnectors | hidden connectors are those as e.g. part of a subcircuit |
Definition at line 313 of file node.cpp.
References isChildNode(), m_inputConnectorList, and m_outputConnectorList.
Referenced by ICNDocument::canConnect(), findConnectorDivergePoint(), ConnectorDraw::grabEndStuff(), and ConnectorDraw::toConnector().
| bool Node::isConnected | ( | Node * | node, | |
| NodeList * | checkedNodes = 0 | |||
| ) |
Returns true if this node is connected (or is the same as) the node given by other connectors or nodes (although not through CNItems) checkedNodes is a list of nodes that have already been checked for being the connected nodes, and so can simply return if they are in there. If it is null, it will assume that it is the first ndoe & will create a list
Definition at line 120 of file node.cpp.
References isConnected(), m_inputConnectorList, and m_outputConnectorList.
Referenced by isConnected().
| virtual void Node::drawShape | ( | QPainter & | p | ) | [pure virtual] |
| void Node::removed | ( | Node * | node | ) | [signal] |
Emitted when the CNItem is removed. Normally, this signal is caught by associated nodes, who will remove themselves as well.
Referenced by handleNewConnector(), removeNode(), and setParentItem().
| QPoint Node::findConnectorDivergePoint | ( | bool * | found | ) | [protected] |
If this node has precisely two connectors emerging from it, then this function will trace thw two connectors until the point where they diverge; this point is returned.
Definition at line 230 of file node.cpp.
References m_inputConnectorList, m_outputConnectorList, and numCon().
Referenced by ECNode::drawShape().
1.5.1