public class PointImpl extends BaseShape<SpatialContext> implements Point
Constructor and Description |
---|
PointImpl(double x,
double y,
SpatialContext ctx)
A simple constructor without normalization / validation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
The sub-classes of Shape generally implement the
same contract for
Object.equals(Object) and Object.hashCode()
amongst the same sub-interface type. |
static boolean |
equals(Point thiz,
Object o)
All
Point implementations should use this definition of Object.equals(Object) . |
double |
getArea(SpatialContext ctx)
Calculates the area of the shape, in square-degrees.
|
Rectangle |
getBoundingBox()
Get the bounding box for this Shape.
|
Circle |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
PointImpl |
getCenter()
Returns the center point of this shape.
|
double |
getLat()
Convenience method that usually maps on
Point.getY() |
double |
getLon()
Convenience method that usually maps on
Point.getX() |
double |
getX()
The X coordinate, or Longitude in geospatial contexts.
|
double |
getY()
The Y coordinate, or Latitude in geospatial contexts.
|
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
int |
hashCode() |
static int |
hashCode(Point thiz)
All
Point implementations should use this definition of Object.hashCode() . |
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
void |
reset(double x,
double y)
Expert: Resets the state of this shape given the arguments.
|
String |
toString() |
getContext
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getContext
public PointImpl(double x, double y, SpatialContext ctx)
public boolean isEmpty()
Shape
public void reset(double x, double y)
Point
public double getX()
Point
public double getY()
Point
public double getLat()
Point
Point.getY()
public double getLon()
Point
Point.getX()
public Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
getBoundingBox
in interface Shape
public PointImpl getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public Circle getBuffered(double distance, SpatialContext ctx)
Shape
getBuffered
in interface Shape
public SpatialRelation relate(Shape other)
Shape
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public boolean hasArea()
Shape
public double getArea(SpatialContext ctx)
Shape
public boolean equals(Object o)
Shape
Object.equals(Object)
and Object.hashCode()
amongst the same sub-interface type. This means, for example, that multiple
Point implementations of different classes are equal if they share the same x
& y.public static boolean equals(Point thiz, Object o)
Point
implementations should use this definition of Object.equals(Object)
.public static int hashCode(Point thiz)
Point
implementations should use this definition of Object.hashCode()
.Copyright © 2020 LocationTech. All rights reserved.