Search in sources :

Example 1 with MoveBendpointCommand

use of com.archimatetool.editor.diagram.commands.MoveBendpointCommand in project archi by archimatetool.

the class ManualBendpointEditPolicy method getMoveBendpointCommand.

@Override
protected Command getMoveBendpointCommand(BendpointRequest request) {
    MoveBendpointCommand command = new MoveBendpointCommand();
    Point p = request.getLocation();
    Connection conn = getConnection();
    conn.translateToRelative(p);
    command.setLocation(p);
    Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
    Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
    conn.translateToRelative(ref1);
    conn.translateToRelative(ref2);
    command.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
    command.setDiagramModelConnection((IDiagramModelConnection) request.getSource().getModel());
    command.setIndex(request.getIndex());
    return command;
}
Also used : MoveBendpointCommand(com.archimatetool.editor.diagram.commands.MoveBendpointCommand) IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) Connection(org.eclipse.draw2d.Connection) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

MoveBendpointCommand (com.archimatetool.editor.diagram.commands.MoveBendpointCommand)1 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)1 Connection (org.eclipse.draw2d.Connection)1 Point (org.eclipse.draw2d.geometry.Point)1