diff options
| author | Laurent Redor | 2020-01-27 11:14:17 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2020-03-11 10:47:25 +0000 |
| commit | 1abc41fc9c4500033ebd0fe0e36037798e3febaf (patch) | |
| tree | 61eee247f07c1fe5d74fd879f5b592606f276d0a | |
| parent | 5fa296936b00b9116f3cddae529b995955f8580d (diff) | |
| download | org.eclipse.sirius-1abc41fc9c4500033ebd0fe0e36037798e3febaf.tar.gz org.eclipse.sirius-1abc41fc9c4500033ebd0fe0e36037798e3febaf.tar.xz org.eclipse.sirius-1abc41fc9c4500033ebd0fe0e36037798e3febaf.zip | |
[553776] Adapt some Sirius code to use more precise GMF computing
Bug: 553776
Change-Id: I7affe00435e179b00ae792fd508cf6ef97951fd9
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
2 files changed, 6 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java index 5c23f06f03..1524f79cd8 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2019 THALES GLOBAL SERVICES and others. + * Copyright (c) 2017, 2020 THALES GLOBAL SERVICES and others. * 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 @@ -406,7 +406,7 @@ public class SnapBackDistantLabelsMigrationParticipant extends AbstractRepresent @SuppressWarnings("rawtypes") List segments = PointListUtilities.getLineSegments(ptList); LineSeg nearestSegment = PointListUtilities.getNearestSegment(segments, labelCenter.x, labelCenter.y); - double distance = nearestSegment.distanceToPoint(labelCenter.x(), labelCenter.y()); + double distance = nearestSegment.preciseDistanceToPoint(labelCenter.x(), labelCenter.y()); isLabelDistant = distance > nearestSegment.length() * 4; } // CHECKSTYLE:OFF diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/locator/EdgeLabelQuery.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/locator/EdgeLabelQuery.java index 64f0600401..5125c3f578 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/locator/EdgeLabelQuery.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/locator/EdgeLabelQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2017 THALES GLOBAL SERVICES and others + * Copyright (c) 2015, 2020 THALES GLOBAL SERVICES and others * 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 @@ -369,7 +369,7 @@ public class EdgeLabelQuery { for (LineSeg lineSeg : newEdgeSegments) { PointList linesIntersections = oldRefVectorIntoSegment.getLinesIntersections(lineSeg); // intersection should be, at more, one point - if (linesIntersections.size() == 1 && lineSeg.distanceToPoint(linesIntersections.getPoint(0).x, linesIntersections.getPoint(0).y) <= Math.sqrt(2)) { + if (linesIntersections.size() == 1 && lineSeg.preciseDistanceToPoint(linesIntersections.getPoint(0).x, linesIntersections.getPoint(0).y) <= Math.sqrt(2)) { Vector tempLabelMove = new Vector(linesIntersections.getPoint(0).x - oldNearestPoint.x, linesIntersections.getPoint(0).y - oldNearestPoint.y); if (fromOldToNewCenterVector == null || tempLabelMove.getLength() < fromOldToNewCenterVector.getLength()) { fromOldToNewCenterVector = tempLabelMove; @@ -397,9 +397,9 @@ public class EdgeLabelQuery { // ensure that the distance between the label and the edge // is not higher than before. In this case, we reset the // location to its default. - double oldDistance = oldNearestSeg.distanceToPoint(oldCenterLabel.x(), oldCenterLabel.y()); + double oldDistance = oldNearestSeg.preciseDistanceToPoint(oldCenterLabel.x(), oldCenterLabel.y()); Point potentialNewCenter = oldCenterLabel.getTranslated(fromOldToNewCenterVector.x, fromOldToNewCenterVector.y); - double newDistance = newRefSeg.distanceToPoint(potentialNewCenter.x(), potentialNewCenter.y()); + double newDistance = newRefSeg.preciseDistanceToPoint(potentialNewCenter.x(), potentialNewCenter.y()); if (newDistance > oldDistance) { fromOldToNewCenterVector = null; } |
