Refine search
protected List<mxPoint> optimizeEdgePoints(List<mxPoint> unoptimizedPointsList) { List<mxPoint> optimizedPointsList = new ArrayList<mxPoint>(); for (int i = 0; i < unoptimizedPointsList.size(); i++) { boolean keepPoint = true; mxPoint currentPoint = unoptimizedPointsList.get(i); // When three points are on the same x-axis with same y value, the // middle point can be removed if (i > 0 && i != unoptimizedPointsList.size() - 1) { mxPoint previousPoint = unoptimizedPointsList.get(i - 1); mxPoint nextPoint = unoptimizedPointsList.get(i + 1); if (currentPoint.getX() >= previousPoint.getX() && currentPoint.getX() <= nextPoint.getX() && currentPoint.getY() == previousPoint.getY() && currentPoint.getY() == nextPoint.getY()) { keepPoint = false; } else if (currentPoint.getY() >= previousPoint.getY() && currentPoint.getY() <= nextPoint.getY() && currentPoint.getX() == previousPoint.getX() && currentPoint.getX() == nextPoint.getX()) { keepPoint = false; } } if (keepPoint) { optimizedPointsList.add(currentPoint); } } return optimizedPointsList; }
protected void createDiagramInterchangeInformation(BaseElement element, List<mxPoint> waypoints) { List<GraphicInfo> graphicInfoForWaypoints = new ArrayList<GraphicInfo>(); for (mxPoint waypoint : waypoints) { GraphicInfo graphicInfo = new GraphicInfo(); graphicInfo.setElement(element); graphicInfo.setX(waypoint.getX()); graphicInfo.setY(waypoint.getY()); graphicInfoForWaypoints.add(graphicInfo); } bpmnModel.addFlowGraphicInfoList(element.getId(), graphicInfoForWaypoints); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin, mxPoint c) { double x = pt.getX() - c.getX(); double y = pt.getY() - c.getY(); double x1 = x * cos - y * sin; double y1 = y * cos + x * sin; return new mxPoint(x1 + c.getX(), y1 + c.getY()); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin, mxPoint c) { double x = pt.getX() - c.getX(); double y = pt.getY() - c.getY(); double x1 = x * cos - y * sin; double y1 = y * cos + x * sin; return new mxPoint(x1 + c.getX(), y1 + c.getY()); }
/** * Transforms the given control point to an absolute point. */ public mxPoint transformControlPoint(mxCellState state, mxPoint pt) { mxPoint origin = state.getOrigin(); return new mxPoint(scale * (pt.getX() + translate.getX() + origin.getX()), scale * (pt.getY() + translate.getY() + origin.getY())); }
/** * Transforms the given control point to an absolute point. */ public mxPoint transformControlPoint(mxCellState state, mxPoint pt) { mxPoint origin = state.getOrigin(); return new mxPoint(scale * (pt.getX() + translate.getX() + origin.getX()), scale * (pt.getY() + translate.getY() + origin.getY())); }
/** * Returns the square of the shortest distance from a point to this * line segment. * * @param pt the point whose distance is being measured * @return the square of the distance from the specified point to this segment. */ public double ptSegDistSq(mxPoint pt) { return new Line2D.Double(getX(), getY(), endPoint.getX(), endPoint .getY()).ptSegDistSq(pt.getX(), pt.getY()); }
/** * Returns the square of the shortest distance from a point to this * line segment. * * @param pt the point whose distance is being measured * @return the square of the distance from the specified point to this segment. */ public double ptSegDistSq(mxPoint pt) { return new Line2D.Double(getX(), getY(), endPoint.getX(), endPoint .getY()).ptSegDistSq(pt.getX(), pt.getY()); }