Constructor and Description |
---|
Point() |
Point(double x,
double y) |
Point(Point s)
A copy constructor from any shape of type Point (or subclass of Point)
|
Modifier and Type | Method and Description |
---|---|
Point |
clone()
Returns a clone of this shape
|
int |
compareTo(Point o) |
int |
compareTo(Shape s) |
double |
distanceTo(double px,
double py)
Gets the distance of this shape to the given point.
|
double |
distanceTo(Point s) |
void |
draw(java.awt.Graphics g,
double xscale,
double yscale)
Draws the shape to the given graphics and scale.
|
void |
draw(java.awt.Graphics g,
Rectangle fileMBR,
int imageWidth,
int imageHeight,
double scale)
Draws a shape to the given graphics.
|
boolean |
equals(java.lang.Object obj) |
void |
fromText(Text text)
Retrieve information from the given text.
|
Shape |
getIntersection(Shape s) |
Rectangle |
getMBR()
Returns the minimal bounding rectangle of this point.
|
boolean |
isIntersected(Shape s)
Returns true if this shape is intersected with the given shape
|
void |
readFields(java.io.DataInput in) |
void |
set(double x,
double y) |
java.lang.String |
toString() |
Text |
toText(Text text)
Store current object as string in the given text appending text already there.
|
void |
write(java.io.DataOutput out) |
public Point()
public Point(double x, double y)
public Point(Point s)
s
- public void set(double x, double y)
public void write(java.io.DataOutput out) throws java.io.IOException
java.io.IOException
public void readFields(java.io.DataInput in) throws java.io.IOException
java.io.IOException
public int compareTo(Shape s)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public double distanceTo(Point s)
public Rectangle getMBR()
Rectangle.isIntersected(Shape)
, the rectangle
cannot have a zero width or height. Thus, we use the method
Math.ulp(double)
to compute the smallest non-zero rectangle that
contains this point. In other words, for a point p
the
following statement should return true.
p.getMBR().isIntersected(p);
public double distanceTo(double px, double py)
Shape
distanceTo
in interface Shape
public boolean isIntersected(Shape s)
Shape
isIntersected
in interface Shape
public java.lang.String toString()
toString
in class java.lang.Object
public Text toText(Text text)
TextSerializable
toText
in interface TextSerializable
public void fromText(Text text)
TextSerializable
fromText
in interface TextSerializable
public int compareTo(Point o)
compareTo
in interface java.lang.Comparable<Point>
public void draw(java.awt.Graphics g, Rectangle fileMBR, int imageWidth, int imageHeight, double scale)
Shape
draw
in interface Shape
g
- - the graphics or canvas to draw tofileMBR
- - the MBR of the file in which the shape is containedimageWidth
- - width of the image to drawimageHeight
- - height of the image to drawscale
- - the scale used to convert shape coordinates to image coordinatespublic void draw(java.awt.Graphics g, double xscale, double yscale)
Shape