| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_COLOR
The default color of a shape.
|
| Constructor and Description |
|---|
Shape()
Creates a shape of default color and no label
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
contains(Point point)
Determines if this shape contains the given point.
|
static double |
distance_squared(Shape s1,
Shape s2)
Computes the squared distance between the given shapes.
|
static double |
distance(Shape s1,
Shape s2)
Computes the distance between the given shapes.
|
void |
draw()
Draws this shape on the canvas.
|
abstract void |
draw(android.graphics.Canvas canvas)
Draws this shape on the given canvas.
|
void |
erase()
Removes this shape from the canvas.
|
abstract Point |
getCenter()
Returns the center of this shape.
|
int |
getColor()
Returns the color of this shape.
|
java.lang.String |
getLabel()
Returns the label associated with this shape.
|
abstract void |
move(double dx,
double dy)
Moves this shape by the given displacement.
|
void |
setColor(int c)
Changes the color of this shape.
|
void |
setColor(java.lang.String name)
Changes the color of this shape.
|
void |
setLabel(java.lang.String label)
Changes the label of this shape.
|
public static final java.lang.String DEFAULT_COLOR
public abstract boolean contains(Point point)
point - the point to check for containmenttrue if this shape contains the given pointpublic static double distance_squared(Shape s1, Shape s2)
s1 - the first shapes2 - the second shapepublic static double distance(Shape s1, Shape s2)
s1 - the first shapes2 - the second shapepublic void draw()
public abstract void draw(android.graphics.Canvas canvas)
canvas - the canvas in which to draw this shapepublic void erase()
public abstract Point getCenter()
public int getColor()
public java.lang.String getLabel()
public abstract void move(double dx,
double dy)
dx - the displacement in xdy - the displacement in ypublic void setColor(int c)
c - the value of the new colorpublic void setColor(java.lang.String name)
name - the name of the new colorpublic void setLabel(java.lang.String label)
label - the new label