use of org.yakindu.base.xtext.utils.gmf.routing.EdgeLabelQuery in project statecharts by Yakindu.
the class SetLabelsOffsetOperation method computeGMFLabelOffset.
/**
* Update {@link Bounds} of a label {@link Node}.
*
* @param labelEdgeEditPart
* the editPart of the edge label to be updated
* @param connectionEditPart
* The connection having these labels
*/
private void computeGMFLabelOffset(LabelEditPart labelEditPartToUpdate, ConnectionEditPart connectionEditPart) {
Point newLabelOffset = null;
Node labelNodeToUpdate = (Node) labelEditPartToUpdate.getModel();
if (connectionEditPart.getModel() instanceof Edge) {
PointList oldBendpoints = oldBendPointsList;
if (oldBendpoints == null) {
oldBendpoints = connectionEditPart.getConnectionFigure().getPoints();
}
boolean isEdgeWithObliqueRoutingStyle = isEdgeWithObliqueRoutingStyle(connectionEditPart);
LayoutConstraint layoutConstraint = labelNodeToUpdate.getLayoutConstraint();
if (layoutConstraint instanceof Location) {
Location point = (Location) layoutConstraint;
newLabelOffset = new EdgeLabelQuery(oldBendpoints, newPointList, isEdgeWithObliqueRoutingStyle, new Point(point.getX(), point.getY()), labelEditPartToUpdate.getFigure().getSize(), labelEditPartToUpdate.getKeyPoint(), false).calculateGMFLabelOffset();
}
}
if (newLabelOffset != null) {
labelsWithNewOffset.put(labelNodeToUpdate, newLabelOffset);
}
}
Aggregations