Package pamViewFX.fxNodes.connectionPane
Interface ConnectorNode
- All Known Implementing Classes:
ConnectionLine
,StandardConnectionPlug
,StandardConnectionSocket
public interface ConnectorNode
Interface for any interactive shape in a
ConnectionPane
.- Author:
- Jamie Macaulay
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The shape is connected to another shape.static final int
The shape is disabled and therefore no connections can be made.static final int
No connection to any other shapes.static final int
No connection to any other shapes.static final int
A possible connection to other shapes. -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkPossibleConnection
(boolean notify) Check whether a connection hasGet the connected shape- the shape this shape is connected to.Get the connection node the shape is associated with;int
Check if the shape is currently connected to another shape.double
getDistance
(javafx.scene.shape.Shape shape) Get the distance form the CollisionShape to another shape.javafx.geometry.Orientation
Get the orientation of the shape .javafx.scene.shape.Shape
getShape()
Get the Shape associated with the Collision shape.boolean
isError()
Check whether there is an error in the connectionvoid
setConnectedShape
(ConnectorNode connecionShape) Set the connected shape- the shape which this shape is connected to.void
setConnectionStatus
(int type, ConnectorNode shape) Set the connection status.void
setError
(boolean error) Set the connection to have an error flag.
-
Field Details
-
NO_CONNECTION
static final int NO_CONNECTIONNo connection to any other shapes.- See Also:
-
POSSIBLE_CONNECTION
static final int POSSIBLE_CONNECTIONA possible connection to other shapes.- See Also:
-
CONNECTED
static final int CONNECTEDThe shape is connected to another shape.- See Also:
-
CONNECTION_DISABLED
static final int CONNECTION_DISABLEDThe shape is disabled and therefore no connections can be made.- See Also:
-
CONNECTOR_MOVED
static final int CONNECTOR_MOVEDNo connection to any other shapes.- See Also:
-
-
Method Details
-
getDistance
double getDistance(javafx.scene.shape.Shape shape) Get the distance form the CollisionShape to another shape. Usually this is just the centre point of the shape to the other shape centre, however in some cases might be slightly different e.g. for a line you want the closest point on the line to a shape rather than just the centre of the line.- Parameters:
shape
- - shape to get distance to.- Returns:
- the distance in pixels from the CollisionShape to the shape.
-
getShape
javafx.scene.shape.Shape getShape()Get the Shape associated with the Collision shape.- Returns:
- the shape
-
setConnectionStatus
Set the connection status.- Parameters:
type
- - type of connection status,shape
- - the connected or possibly connected shape. Can be null if NO_CONNECTION FLAG.
-
getConnectionStatus
int getConnectionStatus()Check if the shape is currently connected to another shape.- Returns:
- true if the shape is connected to another shape.
-
getOrientation
javafx.geometry.Orientation getOrientation()Get the orientation of the shape .- Returns:
- orientation of the shape.
-
setConnectedShape
Set the connected shape- the shape which this shape is connected to. null if no shape is connected;- Parameters:
connecionShape
- - the connected shape. Can be null.
-
getConnectedShape
ConnectorNode getConnectedShape()Get the connected shape- the shape this shape is connected to. null if shape is not connected to anything;- Parameters:
connecionShape
- - the connected shape. Can be null.
-
getConnectionNode
ConnectionNode getConnectionNode()Get the connection node the shape is associated with;- Returns:
- the connection node the shape is associated with;
-
checkPossibleConnection
boolean checkPossibleConnection(boolean notify) Check whether a connection has- Parameters:
notify
-- Returns:
-
isError
boolean isError()Check whether there is an error in the connection- Returns:
- true if error in connection.
-
setError
void setError(boolean error) Set the connection to have an error flag.- Parameters:
error
- - true if error in connection
-