public Point2D apply(V v) { return getCoordinates(v); }
public Point2D transform(V v) { return getCoordinates(v); }
/** * Returns the y coordinate of the vertex from the Coordinates object. * In most cases you will be better off calling transform(v). */ public double getY(V v) { assert getCoordinates(v) != null : "Cannot getY for an unmapped vertex "+v; return getCoordinates(v).getY(); }
/** * Returns the x coordinate of the vertex from the Coordinates object. * in most cases you will be better off calling transform(v). */ public double getX(V v) { assert getCoordinates(v) != null : "Cannot getX for an unmapped vertex "+v; return getCoordinates(v).getX(); }
/** * Returns the y coordinate of the vertex from the Coordinates object. * In most cases you will be better off calling transform(v). * * @param v the vertex whose y coordinate is to be returned * @return the y coordinate of {@code v} */ public double getY(V v) { Preconditions.checkNotNull(getCoordinates(v), "Cannot getY for an unmapped vertex "+v); return getCoordinates(v).getY(); }
/** * Forcibly moves a vertex to the (x,y) location by setting its x and y * locations to the inputted location. Does not add the vertex to the * "dontmove" list, and (in the default implementation) does not make any * adjustments to the rest of the graph. */ public void setLocation(V picked, double x, double y) { Point2D coord = getCoordinates(picked); coord.setLocation(x, y); }
/** * Returns the x coordinate of the vertex from the Coordinates object. * in most cases you will be better off calling transform(v). * * @param v the vertex whose x coordinate is to be returned * @return the x coordinate of {@code v} */ public double getX(V v) { Preconditions.checkNotNull(getCoordinates(v), "Cannot getX for an unmapped vertex "+v); return getCoordinates(v).getX(); }
/** * Forcibly moves a vertex to the (x,y) location by setting its x and y * locations to the specified location. Does not add the vertex to the * "dontmove" list, and (in the default implementation) does not make any * adjustments to the rest of the graph. * @param picked the vertex whose location is being set * @param x the x coordinate of the location to set * @param y the y coordinate of the location to set */ public void setLocation(V picked, double x, double y) { Point2D coord = getCoordinates(picked); coord.setLocation(x, y); }
public void setLocation(V picked, Point2D p) { Point2D coord = getCoordinates(picked); coord.setLocation(p); }
public void setLocation(V picked, Point2D p) { Point2D coord = getCoordinates(picked); coord.setLocation(p); }
/** * @param v * @param xOffset * @param yOffset */ protected void offsetVertex(V v, double xOffset, double yOffset) { Point2D c = getCoordinates(v); c.setLocation(c.getX()+xOffset, c.getY()+yOffset); setLocation(v, c); }
/** * @param v the vertex whose coordinates are to be offset * @param xOffset the change to apply to this vertex's x coordinate * @param yOffset the change to apply to this vertex's y coordinate */ protected void offsetVertex(V v, double xOffset, double yOffset) { Point2D c = getCoordinates(v); c.setLocation(c.getX()+xOffset, c.getY()+yOffset); setLocation(v, c); }