JLogView_.datastructs
Class LGShape

java.lang.Object
  extended by 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
           
 
Constructor Summary
LGShape()
           
 
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
 

Field Detail

coords

protected float[] coords

colour

protected java.awt.Color colour
Constructor Detail

LGShape

public LGShape()
Method Detail

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 on
w - the width of the canvas in pixels
h - the height of the canvas in pixels
minX - the minimum value of the x axis
maxX - the maximum value of the x axis
minY - the minimum value of the y axis
maxY - 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 on
x1 - the first x coordinate in pixels
y1 - the first y coordinate in pixels
x2 - the second x coordinate in pixels
y2 - the second y coordinate in pixels
See Also:
Graphics