|
|||||||||
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<Diagram2DComponent>
optics.graphics.Diagram2D
public class Diagram2D
Class to implement a two-dimensional diagram being
vector of Diagram2DComponents
.
This class which itself inplements the Diagram2DComponent
interface, so allowing complex line diagrams to be assembled.
Since this class extends the standard java.util.Vector
the standard inderited methods can be used to manipulare the
vector.
Field Summary | |
---|---|
static boolean |
DynamicBounds
Public static to determine if the graphical bounds are recalulated on every display update. |
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
Diagram2D()
Form a blank Diagram2D to which components can be
added. |
|
Diagram2D(Diagram2DComponent comp)
Form a Diagram2D with an initial specifed
component. |
|
Diagram2D(LensSystem lens)
Form a Diagram2D containing the specifed
LensSystem. |
Method Summary | |
---|---|
void |
addComponent(Diagram2DComponent comp)
Method to add a DiagramComponent to the current Diagram. |
void |
addComponent(LensSystem lens)
Method to add an LensSystem to the current Diagram. |
void |
clear()
Method to clear the Diagram and reset the bounds to zero. |
void |
draw(Graphics2D g)
Method to graw the Compound object in a Graphic2D
context. |
Rectangle2D |
getBounds()
Method to get the Diagram bounds. |
static void |
main(String[] args)
Test method to for the Diagram2D of an off-axis doublet and print out information about its bounds. |
void |
setAutoBounds()
Method to reset autoBounds, so they will be caualuted automatically (this is the default). |
void |
setBounds(double x,
double y,
double w,
double h)
Method to set the Bound to specifed value. |
void |
setDynamicBounds(boolean b)
Method to set the static DynamicBounds flag. |
Methods inherited from class java.util.Vector |
---|
add, add, addAll, addAll, addElement, capacity, 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 |
---|
public static boolean DynamicBounds
For complex diagrams over slow ssh links, this may result in poor graphic update speeds.
Constructor Detail |
---|
public Diagram2D()
Diagram2D
to which components can be
added.
public Diagram2D(Diagram2DComponent comp)
Diagram2D
with an initial specifed
component.
comp
- the inital componentpublic Diagram2D(LensSystem lens)
Diagram2D
containing the specifed
LensSystem.
lens
- the specifed lens systemMethod Detail |
---|
public void addComponent(Diagram2DComponent comp)
Use this is preference to the underlying
addElement()
as to ensure the bounds are correct
especially if using the static bounds option.
comp
- the componentpublic void addComponent(LensSystem lens)
LensSystem
to the current Diagram.
It is added as a self contained Diagram2D
.
lens
- the lens system.public void clear()
clear
in interface Collection<Diagram2DComponent>
clear
in interface List<Diagram2DComponent>
clear
in class Vector<Diagram2DComponent>
public void setDynamicBounds(boolean b)
true
(the default), then diagram
bounds will be recalculated on each repaint. If
set false
the bounds will be calcualted once
as the digagram is formed and then cashed.
Setting to false
will result is faster
diagram refresh rates, but
will result in display problems if componets are
interactively added/removed/changed in the
diagram. Use this feature only if you are finding
display updates to be too slow.
public Rectangle2D getBounds()
getBounds
in interface Diagram2DComponent
Rectangle
the boundspublic void setBounds(double x, double y, double w, double h)
x
- x location of rectangley
- y location of rectangew
- widthh
- heightpublic void setAutoBounds()
public void draw(Graphics2D g)
Graphic2D
context. Normnally called automatically by the renteding
class.
draw
in interface Diagram2DComponent
g
- the graphics context.public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |