JLogView_.datastructs
Class LGShape
java.lang.Object
JLogView_.datastructs.LGShape
- Direct Known Subclasses:
- LGBox, LGLine, LGOval
public abstract class LGShape
- extends java.lang.Object
LGShape is an abstract class representing the shape definitions. Since it is
abstract it can not be instantiated. Only classes inheriting from since class
implementing its drawShape method can be instantiated.
- See Also:
LGBox
,
LGLine
,
LGOval
Field Summary |
protected java.awt.Color |
colour
|
protected float[] |
coords
|
Method Summary |
void |
draw(java.awt.Graphics gr,
int w,
int h,
float minX,
float maxX,
float minY,
float maxY)
This method draws the shape, whichever shape it is. |
protected abstract void |
drawShape(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
This abstract method draws the shape itself, it has to be implemented/overriden
by any class inheriting from this class |
void |
setColour(java.awt.Color col)
This method sets the colour of the shape. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
coords
protected float[] coords
colour
protected java.awt.Color colour
LGShape
public LGShape()
draw
public void draw(java.awt.Graphics gr,
int w,
int h,
float minX,
float maxX,
float minY,
float maxY)
- This method draws the shape, whichever shape it is. It converting the position
into pixels coordinates and then calling the abstract method that draws the
shape to ensure that the right shape is drawn.
- Parameters:
gr
- a Graphics object, the graphic context to draw onw
- the width of the canvas in pixelsh
- the height of the canvas in pixelsminX
- the minimum value of the x axismaxX
- the maximum value of the x axisminY
- the minimum value of the y axismaxY
- the maximum value of the y axis- See Also:
Graphics
setColour
public void setColour(java.awt.Color col)
- This method sets the colour of the shape.
- Parameters:
col
- a Color object representing the colour we want for the shape- See Also:
Color
drawShape
protected abstract void drawShape(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
- This abstract method draws the shape itself, it has to be implemented/overriden
by any class inheriting from this class
- Parameters:
g
- a Graphics object, the graphic context to draw onx1
- the first x coordinate in pixelsy1
- the first y coordinate in pixelsx2
- the second x coordinate in pixelsy2
- the second y coordinate in pixels- See Also:
Graphics