1.32 class connection

Class connection is a subclass of class line. A connection is a line that connects two graphical objects and is automatically updated if either of them changes. A connection is the instantiation of a link. The link object describes the generic properties of the line: what the line looks like and handle objects it can connect too.

A connection may be created between any two graphical object displayed on the same window object. The connected graphicals may be arbitrary deeply nested on device objects. The connection itself is displayed in the deepest nested device that displays both connected graphicals.

See also class link, class handle, graphical->connect,‘graphical graphical<-connected’and class connect_gesture.

The drawing program PceDraw exploits connections.

See also
- graphical<-common_device
- topic Connections
- graphical->connect
- graphical->handle
- class connect_gesture
- class line
- class constraint
- class link
- class handle

1.32.1 Instance variables

connection <- fixed_from: bool
The slots connection<-fixed_from and connection<-fixed_to are used internally to represent that the handles the connection is related to (connection<-from_handle and connection<-to_handle) should not be reconsidered if the connection is updated. These values are normally @off and set to @on by connection->initialise if the corresponding handle is specified.
connection <- fixed_to: bool
Inherits description from: connection-fixed_from
connection <- from: graphical*
Related graphical and the indicated end of the connection. See also graphical<-connections, graphical<-connected,‘connection connection<-opposite’.
connection <- from_handle: name*
Name of the handle used at the indicated end. Depending on connection<-fixed_from/fixed_to, this handle is or is not updated if either of the connected graphicals is moved or changed otherwise.
connection <- to: graphical*
Inherits description from: connection-from
connection <- to_handle: name*
Inherits description from: connection-from_handle

1.32.2 Send methods

connection ->compute:
Performs the following operations:

connection ->geometry: x=[int], y=[int], width=[int], height=[int]
No-op. The coordinates of a connection are determined by the graphical objects related. See also connection->points.
connection ->initialise: from=graphical, to=graphical, link=[link], handle_from=[name]*, handle_to=[name]*
Create a connection object (automatically updating line) between the two graphicals. The first becomes connection<-from; the second connection<-to. Link is a link object describing the handles and characteristics of the line (graphical<-pen, joint<-arrows, ...). The two name arguments define the name of the handle to connect to at the connection<-from resp. connection<-to side. When omitted and there are multiple matching handles PCE will connect to the best-looking one.

Always succeeds, also if the line cannot (yet) been created because there is no common device to display the graphical on.

See also
graphical->connect
connection ->points: start_x=[int], start_y=[int], end_x=[int], end_y=[int]
Define the start and end-point of the connection. This method is called from connection->compute. connection->points is the only method to change a connection as all other methods are discarded by a redefined connection->geometry method.

connection->points may be used to manage a label for the connection.

connection ->update_link_attributes:
Re-read joint<-arrows, graphical<-texture and graphical<-pen from the connection<-link and update accordingly.

1.32.3 Get methods

connection <-opposite: graphical -> graphical
If the argument graphical is either connection<-from or connection<-to, return the other end. Fail silently otherwise.