Search in sources :

Example 16 with PointList

use of org.eclipse.draw2d.geometry.PointList in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method getDistanceOrthogonal.

public static double getDistanceOrthogonal(double x, double y, PolylineConnection connection, double zoom) {
    double distance = 1000000000;
    double a = 0, b = 0, c = 0;
    PointList points = connection.getPoints();
    for (int i = 0; i < points.size() - 1; i++) {
        Point point1 = points.getPoint(i);
        Point point2 = points.getPoint(i + 1);
        double dis = CreateComponentOnLinkHelper.getDistanceOrthogonal(x, y, point1, point2, zoom);
        if (dis < distance) {
            distance = dis;
        }
    }
    return distance;
}
Also used : PointList(org.eclipse.draw2d.geometry.PointList) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

PointList (org.eclipse.draw2d.geometry.PointList)16 Point (org.eclipse.draw2d.geometry.Point)12 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 CreateConnectionRequest (org.eclipse.gef.requests.CreateConnectionRequest)2 EConnectionCategory (org.talend.core.model.process.EConnectionCategory)2 EConnectionType (org.talend.core.model.process.EConnectionType)2 IConnection (org.talend.core.model.process.IConnection)2 Node (org.talend.designer.core.ui.editor.nodes.Node)2 PolygonDecoration (org.eclipse.draw2d.PolygonDecoration)1 PolylineConnection (org.eclipse.draw2d.PolylineConnection)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Ray (org.eclipse.draw2d.geometry.Ray)1 ReconnectRequest (org.eclipse.gef.requests.ReconnectRequest)1 PolylineConnectionEx (org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx)1 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)1