|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<Spot>
optics.graphics.SpotDiagram2D
public class SpotDiagram2D
Class to implement a SpotDiagram2D
using the Diagram2DComponent
interface scheme.
The diagram consists of a java.util.Vector
of
Spots
that can be added to a Diagram2D
Field Summary | |
---|---|
protected javax.vecmath.Point2d |
centre
The centre of the diagram |
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
SpotDiagram2D(double range)
Form SpotDiagram2D with specifed
range and centre at (0,0). |
|
SpotDiagram2D(double x,
double y,
double range)
Form a SpotDiagram2D with a specific centre and
range. |
|
SpotDiagram2D(javax.vecmath.Point2d c,
double range)
Form a SpotDiagram2D with a specific centre and
range. |
Method Summary | |
---|---|
void |
addSpot(double x,
double y)
Method to add a spot to the diagram in default colour Colour.SpotColour . |
void |
addSpot(double x,
double y,
java.awt.Color c)
Method to add a spot to the diagram in specified colour |
void |
addSpot(javax.vecmath.Point2d p)
Method to add a spot to the diagram in default colour Colour.SpotColour . |
void |
addSpot(javax.vecmath.Point2d p,
java.awt.Color c)
Method to add spot to the diagram specifting the colour |
void |
addSpot(Spot s)
Method to add a predefned Spot to the diagram. |
void |
addToCentre(double dx,
double dy)
Method to add to the current centre |
void |
addToCentre(javax.vecmath.Point2d delta)
Method to add to the current centre |
void |
draw(java.awt.Graphics2D g)
Method to draw the spot diagram in a Graphics2D context. |
java.awt.geom.Rectangle2D |
getBounds()
Method to calculate the bounds of the diagram taking into account the centre and range. |
javax.vecmath.Point2d |
getCentre()
Method get the current centre of the diagram |
int |
getNumber()
Method to get the number of spots, being just the length of the underlying vector. |
double |
getRange()
Method to get the current range |
Spot |
getSpot(int i)
Method to get a specified Spot |
void |
setCentre(double x,
double y)
Method to set centre with two doubles. |
void |
setCentre(javax.vecmath.Point2d c)
Method to set the centre |
void |
setCrossAxis(boolean b)
Method to control if a cross is drawn in the centre of the diagram, default is on (true). |
void |
setRange(double r)
Method to set the range of the diagram. |
void |
setRings(int n)
Void to set the number of rings drwen on the diagram, the default is 2. |
void |
setSpotSize(double f)
Method to set the spot size as fraction of width of the diagram. |
Methods inherited from class java.util.Vector |
---|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
iterator, listIterator, listIterator |
Field Detail |
---|
protected javax.vecmath.Point2d centre
Constructor Detail |
---|
public SpotDiagram2D(javax.vecmath.Point2d c, double range)
SpotDiagram2D
with a specific centre and
range.
c
- the centre of the diagramrange
- the rangepublic SpotDiagram2D(double x, double y, double range)
SpotDiagram2D
with a specific centre and
range.
x
- x-location of centrey
- y-location of centrerange
- the rangepublic SpotDiagram2D(double range)
SpotDiagram2D
with specifed
range and centre at (0,0).
range
- the rangeMethod Detail |
---|
public void setRings(int n)
The colour of the rings is controlled by
Colour.AxisColour
.
n
- Number of ringspublic void setCrossAxis(boolean b)
The colour of the cross is controlled by
Colour.AxisColour
.
b
- on/off switch (default is on)public void setCentre(javax.vecmath.Point2d c)
c
- the centre point of the diagram.public void setCentre(double x, double y)
x
- the x location.y
- the y location.public void addToCentre(javax.vecmath.Point2d delta)
delta
- x/y values added to centrepublic void addToCentre(double dx, double dy)
dx
- the delta x valuedy
- the delta y valuepublic javax.vecmath.Point2d getCentre()
Point2d
the centrepublic void setRange(double r)
r
about the centre.
r
- the rangepublic double getRange()
double
current rangepublic void setSpotSize(double f)
f
- the factional sizepublic void addSpot(javax.vecmath.Point2d p)
Colour.SpotColour
.
p
- the pointpublic void addSpot(double x, double y)
Colour.SpotColour
.
x
- The x componenty
- The y componentpublic void addSpot(javax.vecmath.Point2d p, java.awt.Color c)
p
- the pointc
- the Color.public void addSpot(double x, double y, java.awt.Color c)
x
- The x componenty
- The y componentc
- The colourpublic void addSpot(Spot s)
Spot
to the diagram.
s
- The Spotpublic Spot getSpot(int i)
Spot
i
- the index
Spot
the specified Spot.public int getNumber()
int
number of spotspublic java.awt.geom.Rectangle2D getBounds()
getBounds
in interface Diagram2DComponent
Rectangle
bounding rectangle.public void draw(java.awt.Graphics2D g)
draw
in interface Diagram2DComponent
g
- the Graphics2D context
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |