Class CssPoint2D

java.lang.Object
org.jhotdraw8.draw.css.value.CssPoint2D

public class CssPoint2D extends Object
Represents a point with x, y values specified as CssSizes.
Author:
Werner Randelshofer
  • Field Details

  • Constructor Details

    • CssPoint2D

      public CssPoint2D(@NonNull CssSize x, @NonNull CssSize y)
    • CssPoint2D

      public CssPoint2D(double x, double y, @NonNull String units)
    • CssPoint2D

      public CssPoint2D()
    • CssPoint2D

      public CssPoint2D(double x, double y)
    • CssPoint2D

      public CssPoint2D(@NonNull javafx.geometry.Point2D p)
  • Method Details

    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • getX

      public @NonNull CssSize getX()
    • getY

      public @NonNull CssSize getY()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object
    • getConvertedValue

      public @NonNull javafx.geometry.Point2D getConvertedValue()
    • subtract

      public @NonNull CssPoint2D subtract(@NonNull CssPoint2D that)
    • add

    • getPointInBounds

      public static javafx.geometry.Point2D getPointInBounds(CssPoint2D p, javafx.geometry.Bounds bounds)
      Gets a point that was given in relative coordinates to a bounds.

      If the x- or y-coordinate of the point is given as a percentage, then the returned point is bounds.minX + p.x/100 * bounds.width, bounds.minY + p.y/100 * bounds.height.

      If the x- or y-coordinate of the point is given with default units, then the returned point is bounds.minX + p.x * bounds.width, bounds.minY + p.y * bounds.height.

      Otherwise the returned point is bounds.minX + p.x, bounds.minY + p.y.

      Parameters:
      p - point in relative coordinates
      bounds - the bounds
      Returns:
      point in absolute coordinates