Search in sources :

Example 1 with IDiagramModelBendpoint

use of com.archimatetool.model.IDiagramModelBendpoint in project archi by archimatetool.

the class DiagramConnectionEditPart method refreshBendpoints.

/**
 * Updates the bendpoints, based on the model
 */
protected void refreshBendpoints() {
    if (getConnectionFigure().getConnectionRouter() instanceof ManhattanConnectionRouter) {
        return;
    }
    List<Bendpoint> figureConstraint = new ArrayList<Bendpoint>();
    EList<IDiagramModelBendpoint> bendpoints = getModel().getBendpoints();
    for (int i = 0; i < bendpoints.size(); i++) {
        IDiagramModelBendpoint bendpoint = bendpoints.get(i);
        RelativeBendpoint rbp = new RelativeBendpoint(getConnectionFigure());
        Dimension dim1 = new Dimension(bendpoint.getStartX(), bendpoint.getStartY());
        Dimension dim2 = new Dimension(bendpoint.getEndX(), bendpoint.getEndY());
        rbp.setRelativeDimensions(dim1, dim2);
        rbp.setWeight((i + 1) / ((float) bendpoints.size() + 1));
        figureConstraint.add(rbp);
    }
    getConnectionFigure().setRoutingConstraint(figureConstraint);
}
Also used : RelativeBendpoint(org.eclipse.draw2d.RelativeBendpoint) ArrayList(java.util.ArrayList) ManhattanConnectionRouter(org.eclipse.draw2d.ManhattanConnectionRouter) Dimension(org.eclipse.draw2d.geometry.Dimension) IDiagramModelBendpoint(com.archimatetool.model.IDiagramModelBendpoint) RelativeBendpoint(org.eclipse.draw2d.RelativeBendpoint) Bendpoint(org.eclipse.draw2d.Bendpoint) IDiagramModelBendpoint(com.archimatetool.model.IDiagramModelBendpoint) RelativeBendpoint(org.eclipse.draw2d.RelativeBendpoint) Bendpoint(org.eclipse.draw2d.Bendpoint) IDiagramModelBendpoint(com.archimatetool.model.IDiagramModelBendpoint)

Aggregations

IDiagramModelBendpoint (com.archimatetool.model.IDiagramModelBendpoint)1 ArrayList (java.util.ArrayList)1 Bendpoint (org.eclipse.draw2d.Bendpoint)1 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)1 RelativeBendpoint (org.eclipse.draw2d.RelativeBendpoint)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1