Class RoboPit
java.lang.Object
objectdraw.FramedRect
RoboPit
- All Implemented Interfaces:
- Serializable, objectdraw.Drawable2DInterface, objectdraw.DrawableInterface, objectdraw.Resizable2DInterface
public class RoboPit
- extends objectdraw.FramedRect
RoboPit
A place for robots to wander around in
It will be filled up with obstacles with the addObstacles method
default size 500*500 with top left corner at (10,10)
obstacles will be (SIZE/6)*(SIZE/50) with separation of SIZE/12
- Version:
- 21x06
- Author:
- RPJ
- See Also:
- Serialized Form
Field Summary |
(package private) objectdraw.DrawingCanvas |
canvas
|
protected objectdraw.CanvasManager |
canvasContent
|
protected Color |
color
|
protected double |
height
|
protected boolean |
shown
|
protected double |
width
|
protected double |
x
|
protected double |
y
|
Constructor Summary |
RoboPit(objectdraw.DrawingCanvas canvas)
Constructor for objects of class RoboPit |
Methods inherited from class objectdraw.FramedRect |
toString |
Methods inherited from interface objectdraw.Resizable2DInterface |
setHeight, setSize, setWidth |
Methods inherited from interface objectdraw.Drawable2DInterface |
getHeight, getLocation, getWidth, getX, getY, overlaps |
Methods inherited from interface objectdraw.DrawableInterface |
addToCanvas, contains, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show |
canvas
objectdraw.DrawingCanvas canvas
height
protected double height
width
protected double width
x
protected double x
y
protected double y
canvasContent
protected transient objectdraw.CanvasManager canvasContent
color
protected Color color
shown
protected boolean shown
RoboPit
public RoboPit(objectdraw.DrawingCanvas canvas)
- Constructor for objects of class RoboPit
addObstacles
public void addObstacles(int n)
- add several obstacles ensuring minimum separation between long sides
some will be horizontal, some will be vertical
- Parameters:
n
- the number of obstacles to add
getObstacles
public Vector<Obstacle> getObstacles()
- make obstacles available for the robots
- Returns:
- obstacles all my obstacles
getHeight
public double getHeight()
- Specified by:
getHeight
in interface objectdraw.Drawable2DInterface
getWidth
public double getWidth()
- Specified by:
getWidth
in interface objectdraw.Drawable2DInterface
setHeight
public void setHeight(double arg0)
- Specified by:
setHeight
in interface objectdraw.Resizable2DInterface
setSize
public void setSize(double arg0,
double arg1)
- Specified by:
setSize
in interface objectdraw.Resizable2DInterface
setWidth
public void setWidth(double arg0)
- Specified by:
setWidth
in interface objectdraw.Resizable2DInterface
move
public void move(double arg0,
double arg1)
- Specified by:
move
in interface objectdraw.DrawableInterface
moveTo
public void moveTo(objectdraw.Location arg0)
- Specified by:
moveTo
in interface objectdraw.DrawableInterface
contains
public boolean contains(objectdraw.Location arg0)
- Specified by:
contains
in interface objectdraw.DrawableInterface
getLocation
public objectdraw.Location getLocation()
- Specified by:
getLocation
in interface objectdraw.Drawable2DInterface
getX
public double getX()
- Specified by:
getX
in interface objectdraw.Drawable2DInterface
getY
public double getY()
- Specified by:
getY
in interface objectdraw.Drawable2DInterface
overlaps
public boolean overlaps(objectdraw.Drawable2DInterface arg0)
- Specified by:
overlaps
in interface objectdraw.Drawable2DInterface
addToCanvas
public void addToCanvas(objectdraw.DrawingCanvas arg0)
- Specified by:
addToCanvas
in interface objectdraw.DrawableInterface
clearCanvasContent
protected void clearCanvasContent()
getCanvas
public objectdraw.DrawingCanvas getCanvas()
- Specified by:
getCanvas
in interface objectdraw.DrawableInterface
getColor
public Color getColor()
- Specified by:
getColor
in interface objectdraw.DrawableInterface
hide
public void hide()
- Specified by:
hide
in interface objectdraw.DrawableInterface
isHidden
public boolean isHidden()
- Specified by:
isHidden
in interface objectdraw.DrawableInterface
moveTo
public void moveTo(double arg0,
double arg1)
- Specified by:
moveTo
in interface objectdraw.DrawableInterface
removeFromCanvas
public void removeFromCanvas()
- Specified by:
removeFromCanvas
in interface objectdraw.DrawableInterface
sendBackward
public void sendBackward()
- Specified by:
sendBackward
in interface objectdraw.DrawableInterface
sendForward
public void sendForward()
- Specified by:
sendForward
in interface objectdraw.DrawableInterface
sendToBack
public void sendToBack()
- Specified by:
sendToBack
in interface objectdraw.DrawableInterface
sendToFront
public void sendToFront()
- Specified by:
sendToFront
in interface objectdraw.DrawableInterface
setColor
public void setColor(Color arg0)
- Specified by:
setColor
in interface objectdraw.DrawableInterface
setStateChanged
protected void setStateChanged()
show
public void show()
- Specified by:
show
in interface objectdraw.DrawableInterface