Class EdgeRatioAlignmentSelector

  • All Implemented Interfaces:
    IWorkflowBpmnAlignmentSelector

    public final class EdgeRatioAlignmentSelector
    extends Object
    implements IWorkflowBpmnAlignmentSelector
    A IWorkflowBpmnAlignmentSelector that select a point on the edge in the given direction of an item's bounding box. Allows specifying the ratio of the point to select, relative to the length of the edge in that direction. 0 is the start of the edge, 1 is the end of the edge. Also allows specifying a value for each item to align. When a value is given, uses the bounding box of the child alignment item with that value instead of the bounding box of the item itself. If the value is null or no child with that value is found, uses the bounding box of the item itself.
    Since:
    8.4.0
    • Constructor Detail

      • EdgeRatioAlignmentSelector

        public EdgeRatioAlignmentSelector​(double ratio,
                                          Object[] values)
        Creates a new selector that selects a point on the edge in the given direction of an item's bounding box. Allows specifying the ratio of the point to select, relative to the length of the edge in that direction. 0 is the start of the edge, 1 is the end of the edge. Also allows specifying a value for each item to align. When a value is given, uses the bounding box of the child alignment item with that value instead of the bounding box of the item itself. If the value is null or no child with that value is found, uses the bounding box of the item itself.
        Parameters:
        ratio - The ratio of the point to select, relative to the length of the edge in that direction.
        values - For each item to align, the value of the child alignment item whose bounding box should be used for the alignment. When no such child is found, uses the bounding box of the item itself instead.
    • Method Detail

      • selectInPoint

        public double selectInPoint​(IWorkflowBpmnAlignmentItem<?,​?> item,
                                    int index,
                                    ECardinalDirection2D side)
        Description copied from interface: IWorkflowBpmnAlignmentSelector
        Selects the in-point of the given item at the specified index and side. The returned value is relative to the start of the edge at the given side. For example, when the side is NORTH and has a length of 50, a return value of 0 indicates the start of the top edge (the top-left corner of the item's bounding box), a return value of 25 indicates the middle of the top edge, and a return value of 50 indicates the end of the top edge (the top-right corner).
        Specified by:
        selectInPoint in interface IWorkflowBpmnAlignmentSelector
        Parameters:
        item - The item for which to select the in-point.
        index - The index of the item for which to select its in-point.
        side - The side on which to select the in-point.
        Returns:
        The selected in-point, between 0 and the length of the edge at the given side.
      • selectOutPoint

        public double selectOutPoint​(IWorkflowBpmnAlignmentItem<?,​?> item,
                                     int index,
                                     ECardinalDirection2D side)
        Description copied from interface: IWorkflowBpmnAlignmentSelector
        Selects the out-point of the given item at the specified index and side. The returned value is relative to the start of the edge at the given side. For example, when the side is NORTH and has a length of 50, a return value of 0 indicates the start of the top edge (the top-left corner of the item's bounding box), a return value of 25 indicates the middle of the top edge, and a return value of 50 indicates the end of the top edge (the top-right corner).
        Specified by:
        selectOutPoint in interface IWorkflowBpmnAlignmentSelector
        Parameters:
        item - The item for which to select the out-point.
        index - The index of the item for which to select its out-point.
        side - The side on which to select the out-point.
        Returns:
        The selected out-point, between 0 and the length of the edge at the given side.