Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 409e7cc4ec78bec793ceb954e4423eec94e7b058 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*******************************************************************************
 * Copyright (c) 2012 THALES GLOBAL SERVICES.
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Obeo - initial API and implementation
 *******************************************************************************/
package org.eclipse.sirius.diagram.ui.business.internal.bracket;

import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.RelativeBendpoint;
import org.eclipse.draw2d.geometry.Dimension;

/**
 * A specific {@link RelativeBendpoint} to store direction and offset for
 * dimension figure.
 * 
 * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a>
 */
public class BracketRelativeBendpoint extends RelativeBendpoint {

    /** Side of the source figure from which begin the bracket point list. */
    private int sourceDirection;

    /** Direction of the next (from source) or previous (from target) point. */
    private int direction;

    /** offset relative to the source or the target. */
    private int offset;

    /**
     * Default constructor.
     * 
     * @param connection
     *            the {@link Connection} of the Dimension
     * 
     * @param sourceDirection
     *            the side of the source figure from which begin the bracket
     *            point list
     * @param direction
     *            Direction of the next (from source) or previous (from target)
     *            point
     * @param offset
     *            offset relative to the source or the target
     */
    public BracketRelativeBendpoint(Connection connection, int sourceDirection, int direction, int offset) {
        super(connection);
        this.sourceDirection = sourceDirection;
        this.direction = direction;
        this.offset = offset;
        setRelativeDimensions(Dimension.SINGLETON, Dimension.SINGLETON);
        setWeight(0);
    }

    /**
     * Get the integer representing the {@link Direction} (i.e. the side of the
     * source figure) from which start the bracket point list.
     * 
     * @return the integer representing the {@link Direction}
     */
    public int getSourceDirection() {
        return sourceDirection;
    }

    /**
     * Get the integer representing the {@link Direction}.
     * 
     * @return the integer representing the {@link Direction}
     */
    public int getDirection() {
        return direction;
    }

    /**
     * Get the offset.
     * 
     * @return the offset
     */
    public int getOffset() {
        return offset;
    }

}

Back to the top