java.lang.Object
org.vaadin.addons.componentfactory.leaflet.types.Point
All Implemented Interfaces:
Serializable, BasicType

public class Point extends Object implements BasicType
Represents a point with x and y coordinates in pixels.
Since:
2020-03-07
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new point at coordinates (0, 0).
    Point(double x, double y)
    Creates a new point with the given coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Point point)
    Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
    double
    distanceTo(Point target)
    Returns the cartesian distance between the current and the given points.
    double
    Returns the x coordinate in pixels.
    double
    Returns the y coordinate in pixels.
    static Point
    of(double x, double y)
    Creates a new point with the given coordinates.
    void
    setX(double x)
    Sets the x coordinate in pixels.
    void
    setY(double y)
    Sets the y coordinate in pixels.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.vaadin.addons.componentfactory.leaflet.types.BasicType

    getLeafletType
  • Constructor Details

    • Point

      public Point()
      Creates a new point at coordinates (0, 0).
    • Point

      public Point(double x, double y)
      Creates a new point with the given coordinates.
      Parameters:
      x - the x coordinate in pixels
      y - the y coordinate in pixels
  • Method Details

    • distanceTo

      public double distanceTo(Point target)
      Returns the cartesian distance between the current and the given points.
      Parameters:
      target - a valid point
      Returns:
      the distance between the current and the given point
    • contains

      public boolean contains(Point point)
      Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
      Parameters:
      point - a valid point
      Returns:
      true if both coordiantes of the given point are less than current point coordinates
    • getX

      public double getX()
      Returns the x coordinate in pixels.
      Returns:
      the x coordinate
    • setX

      public void setX(double x)
      Sets the x coordinate in pixels.
      Parameters:
      x - the x coordinate to set
    • getY

      public double getY()
      Returns the y coordinate in pixels.
      Returns:
      the y coordinate
    • setY

      public void setY(double y)
      Sets the y coordinate in pixels.
      Parameters:
      y - the y coordinate to set
    • of

      public static Point of(double x, double y)
      Creates a new point with the given coordinates.
      Parameters:
      x - the x coordinate in pixels
      y - the y coordinate in pixels
      Returns:
      a new point at the given coordinates
    • toString

      public String toString()
      Overrides:
      toString in class Object