/** * 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()); }
&& parallel != mxCurve.INVALID_POSITION) mxPoint parallelEnd = parallel.getEndPoint(); double x = parallelEnd.getX(); double rotation = (Math.atan(parallelEnd.getY() / x)); g.translate(parallel.getX(), parallel.getY()); g.rotate(rotation); Shape letter = labelGlyphs[j].glyphShape;
int closestSegment = 0; double closestSegDistSq = 10000000; mxLine segment = new mxLine(currentCurve[0], currentCurve[1]); segment.setPoints(currentCurve[i - 1], currentCurve[i]); double segDistSq = segment.ptSegDistSq(absPoint); mxPoint endSegPt = currentCurve[closestSegment + 1]; mxLine closestSeg = new mxLine(startSegPt, endSegPt); double lineDistSq = closestSeg.ptLineDistSq(absPoint);
/** * Hook to override creation of the vector that the marker is drawn along * since it may not be the same as the vector between any two control * points * @param points the guide points of the connector * @param source whether the marker is at the source end * @param markerSize the scaled maximum length of the marker * @return a line describing the vector the marker should be drawn along */ protected mxLine getMarkerVector(List<mxPoint> points, boolean source, double markerSize) { int n = points.size(); mxPoint p0 = (source) ? points.get(1) : points.get(n - 2); mxPoint pe = (source) ? points.get(0) : points.get(n - 1); int count = 1; // Uses next non-overlapping point while (count < n - 1 && Math.round(p0.getX() - pe.getX()) == 0 && Math.round(p0.getY() - pe.getY()) == 0) { p0 = (source) ? points.get(1 + count) : points.get(n - 2 - count); count++; } return new mxLine(p0, pe); }
&& parallel != mxCurve.INVALID_POSITION) mxPoint parallelEnd = parallel.getEndPoint(); double x = parallelEnd.getX(); double rotation = (Math.atan(parallelEnd.getY() / x)); g.translate(parallel.getX(), parallel.getY()); g.rotate(rotation); Shape letter = labelGlyphs[j].glyphShape;
int closestSegment = 0; double closestSegDistSq = 10000000; mxLine segment = new mxLine(currentCurve[0], currentCurve[1]); segment.setPoints(currentCurve[i - 1], currentCurve[i]); double segDistSq = segment.ptSegDistSq(absPoint); mxPoint endSegPt = currentCurve[closestSegment + 1]; mxLine closestSeg = new mxLine(startSegPt, endSegPt); double lineDistSq = closestSeg.ptLineDistSq(absPoint);
/** * 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()); }
/** * Hook to override creation of the vector that the marker is drawn along * since it may not be the same as the vector between any two control * points * @param points the guide points of the connector * @param source whether the marker is at the source end * @param markerSize the scaled maximum length of the marker * @return a line describing the vector the marker should be drawn along */ protected mxLine getMarkerVector(List<mxPoint> points, boolean source, double markerSize) { int n = points.size(); mxPoint p0 = (source) ? points.get(1) : points.get(n - 2); mxPoint pe = (source) ? points.get(0) : points.get(n - 1); int count = 1; // Uses next non-overlapping point while (count < n - 1 && Math.round(p0.getX() - pe.getX()) == 0 && Math.round(p0.getY() - pe.getY()) == 0) { p0 = (source) ? points.get(1 + count) : points.get(n - 2 - count); count++; } return new mxLine(p0, pe); }
final double x = parallel.getEndPoint().getX(); final double y = parallel.getEndPoint().getY(); double p1X = parallel.getX() - (descent * y); double minX = p1X, maxX = p1X; double p1Y = parallel.getY() + (descent * x); double minY = p1Y, maxY = p1Y; mxPoint nextVector = nextParallel.getEndPoint(); double end2X = nextVector.getX(); double end2Y = nextVector.getY(); overallLabelBounds = new mxRectangle(labelCenter.getX(), labelCenter.getY(), 1, 1);
/** * Returns the square of the shortest distance from a point to this line. * The line is considered extrapolated infinitely in both directions for * the purposes of the calculation. * * @param pt the point whose distance is being measured * @return the square of the distance from the specified point to this line. */ public double ptLineDistSq(mxPoint pt) { return new Line2D.Double(getX(), getY(), endPoint.getX(), endPoint .getY()).ptLineDistSq(pt.getX(), pt.getY()); }
final double x = parallel.getEndPoint().getX(); final double y = parallel.getEndPoint().getY(); double p1X = parallel.getX() - (descent * y); double minX = p1X, maxX = p1X; double p1Y = parallel.getY() + (descent * x); double minY = p1Y, maxY = p1Y; mxPoint nextVector = nextParallel.getEndPoint(); double end2X = nextVector.getX(); double end2Y = nextVector.getY(); overallLabelBounds = new mxRectangle(labelCenter.getX(), labelCenter.getY(), 1, 1);
/** * Returns the square of the shortest distance from a point to this line. * The line is considered extrapolated infinitely in both directions for * the purposes of the calculation. * * @param pt the point whose distance is being measured * @return the square of the distance from the specified point to this line. */ public double ptLineDistSq(mxPoint pt) { return new Line2D.Double(getX(), getY(), endPoint.getX(), endPoint .getY()).ptLineDistSq(pt.getX(), pt.getY()); }
mxPoint p0 = new mxPoint(markerVector.getX(), markerVector.getY()); mxPoint pe = markerVector.getEndPoint();