Commit a096aa33 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unused functions removed

parent 6182114f
......@@ -202,7 +202,7 @@ public class ModelToGPML {
* This function calculates PolylineData based on ReactionNode.
*
* @param rn
* rection node for which polyline is calculated
* reaction node for which polyline is calculated
* @param mainLine
* main line to which polyline is attached
* @return polyline for {@link ReactionNode}
......
......@@ -15,12 +15,12 @@ import lcsb.mapviewer.model.graphics.PolylineData;
public final class Geo {
/**
* Max distance betwen point and line that still allows to match intersection.
* Max distance between point and line that still allows to match intersection.
*/
private static final int DISTANCE_PROXIMITY = 10;
/**
* Default class constructor. Prevents instatiation.
* Default class constructor. Prevents instantiation.
*/
private Geo() {
......@@ -134,55 +134,11 @@ public final class Geo {
return res;
}
/**
* This function returns point on the middle of rectangle side, that is closest
* to the given point.
*
* @param rect
* rectangle on which we look for a point
* @param point
* point to which result should be as close as possible
* @return point on the middle of rectangle side that is as close as possible to
* the input point
*/
public static Point2D pointOnRectangle(Rectangle2D rect, Point2D point) {
Point2D p1 = new Point2D.Double(rect.getX(), rect.getY());
Point2D p2 = new Point2D.Double(rect.getX(), rect.getY() + rect.getHeight());
Point2D p3 = new Point2D.Double(rect.getX() + rect.getWidth(), rect.getY() + rect.getHeight());
Point2D p4 = new Point2D.Double(rect.getX() + rect.getWidth(), rect.getY());
Point2D p12 = new Point2D.Double((p1.getX() + p2.getX()) / 2, (p1.getY() + p2.getY()) / 2);
Point2D p23 = new Point2D.Double((p2.getX() + p3.getX()) / 2, (p2.getY() + p3.getY()) / 2);
Point2D p34 = new Point2D.Double((p3.getX() + p4.getX()) / 2, (p3.getY() + p4.getY()) / 2);
Point2D p41 = new Point2D.Double((p4.getX() + p1.getX()) / 2, (p4.getY() + p1.getY()) / 2);
double dis1, dis2, dis3, dis4, min;
dis1 = point.distance(p12);
dis2 = point.distance(p23);
dis3 = point.distance(p34);
dis4 = point.distance(p41);
min = Math.min(dis1, dis2);
min = Math.min(min, dis3);
min = Math.min(min, dis4);
if (min == dis1) {
return p12;
} else if (min == dis2) {
return p23;
} else if (min == dis3) {
return p34;
} else {
return p41;
}
}
/**
* This function returns point on rectangle that is closest to given point.
*
* @param rect
* rectangle on which the result poiint will be placed
* rectangle on which the result point will be placed
* @param point
* point for which we look the closest reference on rectangle
* @return the closest possible point on rectangle
......@@ -213,47 +169,6 @@ public final class Geo {
}
}
/**
* Returns point that is outside given rectangle, but still close to the given
* point. If the given point is inside rec then the given point is returned.
*
* @param rec
* rectangle
* @param point
* point
* @return point that is outside given rectangle, but still close to the given
* point
*/
public static Point2D pointRightOutsideRec(Rectangle2D rec, Point2D point) {
if (!rec.contains(point)) {
return (Point2D) point.clone();
} else {
double lx = rec.getX();
double rx = lx + rec.getWidth();
double uy = rec.getY();
double dy = uy + rec.getHeight();
double dis1 = Math.abs(point.getX() - lx);
double dis2 = Math.abs(point.getX() - rx);
double dis3 = Math.abs(point.getY() - uy);
double dis4 = Math.abs(point.getY() - dy);
double min = Math.min(dis1, dis2);
min = Math.min(min, dis3);
min = Math.min(min, dis4);
if (min == dis1) {
return new Point2D.Double(lx - 1.0, point.getY());
} else if (min == dis2) {
return new Point2D.Double(rx + 1.0, point.getY());
} else if (min == dis3) {
return new Point2D.Double(point.getX(), uy - 1.0);
} else {
return new Point2D.Double(point.getX(), uy + 1.0);
}
}
}
/**
* Creates a {@link PolylineData} that is identical to parameter line, but
* doesn't contain duplicate points.
......@@ -293,13 +208,13 @@ public final class Geo {
}
/**
* Returns point on line that is as closse as possible to point.
* Returns point on line that is as close as possible to point.
*
* @param point
* point
* @param mainLine
* line
* @return point on line that is as closse as possible to point
* @return point on line that is as close as possible to point
*/
public static Point2D closestPointOnPolyline(PolylineData mainLine, Point2D point) {
Point2D res = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment