Class Connection
- java.lang.Object
-
- com.nomagic.magicdraw.ui.pathicon.Connection
-
@OpenApiAll public final class Connection extends java.lang.Object
Constants defining the kind of connection using for painting the path icons
-
-
Field Summary
Fields Modifier and Type Field Description private static int
_ARROW
Equilateral triangle can be used with CLOSED, FILLEDprivate static int
_ARROW_SMALL
triangle can be used with CLOSED, FILLEDprivate static int
_ARROW_THIN
triangle can be used with CLOSED, FILLEDprivate static int
_ARROW_WIDE
triangle can be used with CLOSED, FILLEDprivate static int
_CIRCLE
circle can be used with FILLEDprivate static int
_CROSSED_CIRCLE
circle with cross can't be used with FILLED or CLOSEDprivate static int
_CROSSED_CIRCLE_DIAG
circle with diagonal cross can't be used with FILLED or CLOSEDprivate static int
_DIAMOND_1
diamond.private static int
_DIAMOND_SQUARE
square.private static int
_GENERALIZATION
basic generalization (closed)private static int
_GENERALIZATION2
basic generalization (filled)private static int
_HALF_CIRCLE
half of circle can be used with FILLEDprivate static int
_SLASH
slash on line can't be used with FILLED or CLOSEDprivate static int
_SQUARE
Square.static int
ARROW
static int
ARROW_SMALL
static int
ARROW_THIN
static int
ARROW_WIDE
static int
CIRCLE
static int
CLOSED
Should figure be closed (none is the same as opened) in some cases this mask is not used, example drawing circlestatic int
CROSSED_CIRCLE
static int
CROSSED_CIRCLE_DIAG
static int
DIAMOND_1
static int
DIAMOND_SQUARE
private static int
FIGURE_MASK
private static int
FIGURE_START_BIT
static int
FILLED
should be filled, this field is already combined with CLOSEDstatic int
GENERALIZATION
static int
GENERALIZATION2
static int
HALF_CIRCLE
private static int
MODIFIER_MASK
static int
NONE
no drawings, just simple linestatic int
SLASH
static int
SQUARE
static int[]
STYLES
-
Constructor Summary
Constructors Constructor Description Connection()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Point
drawConnection(java.awt.Graphics2D g, int type, int x, int y, int x2, int y2, int preferredSize, java.awt.Rectangle shapeBounds)
method for Path end shape drawing draw lots of shapesstatic java.awt.Point
drawConnection(java.awt.Graphics2D g, int type, int x, int y, int x2, int y2, int preferredSize, java.awt.Shape boundingShape, boolean useCorrecting)
Method for Path end shape drawing.static java.awt.Point
drawConnection(java.awt.Graphics2D g, com.nomagic.magicdraw.ui.pathicon.PathIcon icon, boolean left, int x, int y, int x2, int y2, int size, java.awt.Rectangle shapeBounds, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
static java.awt.Point
drawConnection(java.awt.Graphics2D g, com.nomagic.magicdraw.ui.pathicon.PathIcon icon, boolean left, int x, int y, int x2, int y2, int size, java.awt.Shape boundingShape, boolean fixOverlapping, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
Paints connection end.static java.awt.Point
drawConnection(java.awt.Graphics2D g, ResizableIcon icon, int x, int y, int x2, int y2, int size, java.awt.Rectangle shapeBounds, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
private static java.awt.Rectangle
getBoundingShapeBounds(java.awt.Shape boundingShape)
private static java.awt.geom.Point2D
getConnectionPoint(int type, int x, int y, int x2, int y2, java.awt.geom.Ellipse2D ellipse, double size, boolean fixOverlapping)
Calculates the point where the path end shape touches client shape.private static java.awt.Point
getConnectionPoint(int type, int x, int y, int x2, int y2, java.awt.Rectangle bounds, double size, boolean useCorrecting)
Counts the point where path end shape would touch client shape.private static int
getFigure(int mask)
private static int
getModifier(int mask)
-
-
-
Field Detail
-
FIGURE_START_BIT
private static final int FIGURE_START_BIT
- See Also:
- Constant Field Values
-
MODIFIER_MASK
private static final int MODIFIER_MASK
- See Also:
- Constant Field Values
-
FIGURE_MASK
private static final int FIGURE_MASK
- See Also:
- Constant Field Values
-
CLOSED
public static final int CLOSED
Should figure be closed (none is the same as opened) in some cases this mask is not used, example drawing circle- See Also:
- Constant Field Values
-
FILLED
public static final int FILLED
should be filled, this field is already combined with CLOSED- See Also:
- Constant Field Values
-
NONE
public static final int NONE
no drawings, just simple line- See Also:
- Constant Field Values
-
_ARROW
private static final int _ARROW
Equilateral triangle can be used with CLOSED, FILLED- See Also:
- Constant Field Values
-
ARROW
public static final int ARROW
- See Also:
- Constant Field Values
-
_GENERALIZATION
private static final int _GENERALIZATION
basic generalization (closed)- See Also:
- Constant Field Values
-
GENERALIZATION
public static final int GENERALIZATION
- See Also:
- Constant Field Values
-
_GENERALIZATION2
private static final int _GENERALIZATION2
basic generalization (filled)- See Also:
- Constant Field Values
-
GENERALIZATION2
public static final int GENERALIZATION2
- See Also:
- Constant Field Values
-
_CIRCLE
private static final int _CIRCLE
circle can be used with FILLED- See Also:
- Constant Field Values
-
CIRCLE
public static final int CIRCLE
- See Also:
- Constant Field Values
-
_SQUARE
private static final int _SQUARE
Square. connected to line at border. @see DIAMOND_SQUARE can be used with FILLED- See Also:
- Constant Field Values
-
SQUARE
public static final int SQUARE
- See Also:
- Constant Field Values
-
_DIAMOND_SQUARE
private static final int _DIAMOND_SQUARE
square. connected to line at corner. @see SQUARE can be used with FILLED- See Also:
- Constant Field Values
-
DIAMOND_SQUARE
public static final int DIAMOND_SQUARE
- See Also:
- Constant Field Values
-
_DIAMOND_1
private static final int _DIAMOND_1
diamond. can be used with FILLED- See Also:
- Constant Field Values
-
DIAMOND_1
public static final int DIAMOND_1
- See Also:
- Constant Field Values
-
_ARROW_WIDE
private static final int _ARROW_WIDE
triangle can be used with CLOSED, FILLED- See Also:
- Constant Field Values
-
ARROW_WIDE
public static final int ARROW_WIDE
- See Also:
- Constant Field Values
-
_ARROW_THIN
private static final int _ARROW_THIN
triangle can be used with CLOSED, FILLED- See Also:
- Constant Field Values
-
ARROW_THIN
public static final int ARROW_THIN
- See Also:
- Constant Field Values
-
_CROSSED_CIRCLE
private static final int _CROSSED_CIRCLE
circle with cross can't be used with FILLED or CLOSED- See Also:
- Constant Field Values
-
CROSSED_CIRCLE
public static final int CROSSED_CIRCLE
- See Also:
- Constant Field Values
-
_ARROW_SMALL
private static final int _ARROW_SMALL
triangle can be used with CLOSED, FILLED- See Also:
- Constant Field Values
-
ARROW_SMALL
public static final int ARROW_SMALL
- See Also:
- Constant Field Values
-
_CROSSED_CIRCLE_DIAG
private static final int _CROSSED_CIRCLE_DIAG
circle with diagonal cross can't be used with FILLED or CLOSED- See Also:
- Constant Field Values
-
CROSSED_CIRCLE_DIAG
public static final int CROSSED_CIRCLE_DIAG
- See Also:
- Constant Field Values
-
_SLASH
private static final int _SLASH
slash on line can't be used with FILLED or CLOSED- See Also:
- Constant Field Values
-
SLASH
public static final int SLASH
- See Also:
- Constant Field Values
-
_HALF_CIRCLE
private static final int _HALF_CIRCLE
half of circle can be used with FILLED- See Also:
- Constant Field Values
-
HALF_CIRCLE
public static final int HALF_CIRCLE
- See Also:
- Constant Field Values
-
STYLES
public static final int[] STYLES
-
-
Method Detail
-
getFigure
private static int getFigure(int mask)
-
getModifier
private static int getModifier(int mask)
-
getConnectionPoint
private static java.awt.Point getConnectionPoint(int type, int x, int y, int x2, int y2, @CheckForNull java.awt.Rectangle bounds, double size, boolean useCorrecting)
Counts the point where path end shape would touch client shape. This is important for circle style path end shapes- Parameters:
type
- CONNECTION_TYPEx
- point1 xy
- point1 yx2
- point2 xy2
- point2 ybounds
- boundssize
- sizeuseCorrecting
- use correcting in case the link end symbol covers specified bounds.- Returns:
- connection point
- See Also:
Connection
-
getConnectionPoint
private static java.awt.geom.Point2D getConnectionPoint(int type, int x, int y, int x2, int y2, java.awt.geom.Ellipse2D ellipse, double size, boolean fixOverlapping)
Calculates the point where the path end shape touches client shape.- Parameters:
type
- type of the connection.x
- x coordinate of the first point.y
- y coordinate of the first point.x2
- x coordinate of the second point.y2
- y coordinate of the second point.ellipse
- ellipse that represents bounding shape.size
- radius of the link end circle.fixOverlapping
- use correcting of the shape covering the ellipse.- Returns:
- connection point.
-
drawConnection
public static java.awt.Point drawConnection(java.awt.Graphics2D g, int type, int x, int y, int x2, int y2, int preferredSize, @CheckForNull java.awt.Shape boundingShape, boolean useCorrecting)
Method for Path end shape drawing.- Parameters:
g
- graphics context.type
- path end draw style.x
- from point.y
- from point.x2
- to point.y2
- to point.preferredSize
- preferred size of path end shape.boundingShape
- client bounding shape.useCorrecting
- use correcting in case the link end symbol covers specified bounds.- Returns:
- Point where path line should begin.
- See Also:
Connection
-
drawConnection
public static java.awt.Point drawConnection(java.awt.Graphics2D g, int type, int x, int y, int x2, int y2, int preferredSize, @CheckForNull java.awt.Rectangle shapeBounds)
method for Path end shape drawing draw lots of shapes- Parameters:
g
- graphics contexttype
- path end draw stylex
- from pointy
- from pointx2
- to pointy2
- to pointpreferredSize
- preferred size of path end shapeshapeBounds
- client shape bounds- Returns:
- Point where path line should begin
- See Also:
Connection
-
drawConnection
public static java.awt.Point drawConnection(java.awt.Graphics2D g, com.nomagic.magicdraw.ui.pathicon.PathIcon icon, boolean left, int x, int y, int x2, int y2, int size, @CheckForNull java.awt.Shape boundingShape, boolean fixOverlapping, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
Paints connection end.- Parameters:
g
- graphics context.icon
- icon of the end.left
- left connection.x
- x coordinate of the intersection with the shape point.y
- y coordinate of the intersection with the shape point.x2
- x coordinate of the next link segment point.y2
- y coordinate of the next link segment point.size
- size of the icon.boundingShape
- bounding shape.fixOverlapping
- if true then correcting of the link end shape covering client or supplier shape should be used.- Returns:
- connection point from which link must be painted.
-
getBoundingShapeBounds
@CheckForNull private static java.awt.Rectangle getBoundingShapeBounds(@CheckForNull java.awt.Shape boundingShape)
-
drawConnection
public static java.awt.Point drawConnection(java.awt.Graphics2D g, com.nomagic.magicdraw.ui.pathicon.PathIcon icon, boolean left, int x, int y, int x2, int y2, int size, @CheckForNull java.awt.Rectangle shapeBounds, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
-
drawConnection
public static java.awt.Point drawConnection(java.awt.Graphics2D g, ResizableIcon icon, int x, int y, int x2, int y2, int size, @CheckForNull java.awt.Rectangle shapeBounds, java.util.function.Function<ResizableIcon,ResizableIcon> iconTransformer)
-
-