MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / NodeConnectionInteraction

Class NodeConnectionInteraction

QtNodeEditor/src/NodeConnectionInteraction.hpp:16–67  ·  view source on GitHub ↗

Class performs various operations on the Node and Connection pair. An instance should be created on the stack and destroyed when the operation is completed

Source from the content-addressed store, hash-verified

14/// An instance should be created on the stack and destroyed when
15/// the operation is completed
16class NodeConnectionInteraction
17{
18public:
19 NodeConnectionInteraction(Node& node,
20 Connection& connection,
21 FlowScene& scene);
22
23 /// Can connect when following conditions are met:
24 /// 1) Connection 'requires' a port
25 /// 2) Connection's vacant end is above the node port
26 /// 3) Node port is vacant
27 /// 4) Connection type equals node port type, or there is a registered type conversion that can translate between the two
28 bool canConnect(PortIndex & portIndex,
29 TypeConverter & converter) const;
30
31 /// 1) Check conditions from 'canConnect'
32 /// 1.5) If the connection is possible but a type conversion is needed, add a converter node to the scene, and connect it properly
33 /// 2) Assign node to required port in Connection
34 /// 3) Assign Connection to empty port in NodeState
35 /// 4) Adjust Connection geometry
36 /// 5) Poke model to initiate data transfer
37 bool tryConnect() const;
38
39
40 /// 1) Node and Connection should be already connected
41 /// 2) If so, clear Connection entry in the NodeState
42 /// 3) Propagate invalid data to IN node
43 /// 4) Set Connection end to 'requiring a port'
44 bool disconnect(PortType portToDisconnect) const;
45
46private:
47
48 PortType connectionRequiredPort() const;
49
50 QPointF connectionEndScenePosition(PortType) const;
51
52 QPointF nodePortScenePosition(PortType portType,
53 PortIndex portIndex) const;
54
55 PortIndex nodePortIndexUnderScenePoint(PortType portType,
56 QPointF const &p) const;
57
58 bool nodePortIsEmpty(PortType portType, PortIndex portIndex) const;
59
60private:
61
62 Node* _node;
63
64 Connection* _connection;
65
66 FlowScene* _scene;
67};
68}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected