Class Point
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.types.Point
- All Implemented Interfaces:
Serializable,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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).doubledistanceTo(Point target) Returns the cartesian distance between the current and the given points.doublegetX()Returns the x coordinate in pixels.doublegetY()Returns the y coordinate in pixels.static Pointof(double x, double y) Creates a new point with the given coordinates.voidsetX(double x) Sets the x coordinate in pixels.voidsetY(double y) Sets the y coordinate in pixels.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 pixelsy- the y coordinate in pixels
-
-
Method Details
-
distanceTo
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
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
Creates a new point with the given coordinates.- Parameters:
x- the x coordinate in pixelsy- the y coordinate in pixels- Returns:
- a new point at the given coordinates
-
toString
-