org.jscience.physics.waves.optics.elements
Class OpticalDevice

java.lang.Object
  extended by org.jscience.physics.waves.optics.elements.OpticalElement
      extended by org.jscience.physics.waves.optics.elements.OpticalDevice
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ThickLens

public class OpticalDevice
extends OpticalElement

The OpticalDevice class is a child of OpticalElement and enables the user to build a complete optical system of OpticalElement objects. since OpticalDevice inherits from OpticalElement, devices can be nested to an arbitrary depth, making it easy to split the system into functional blocks.

The standard use of this class is to build a system using OpticalElement subclasses into an OpticalDevice object and to use an OpticalCanvas object to display it.

See Also:
OpticalDevice, OpticalCanvas

Constructor Summary
OpticalDevice()
           
 
Method Summary
 void append(OpticalElement e)
          Adds an element to the end of the child elements list, and calls its PutAfter method to align it on the previous element.
 java.lang.Object clone()
           
 void draw(java.awt.Graphics g)
          Draws the device by calling the Draw method for all of its child elements.
 int drawRay(java.awt.Graphics g, Ray r, int index)
          Draws the part of the Ray going through the device.
 void drawSelf(java.awt.Graphics g)
          Draws the device's symbol into a Graphics object.
 void propagate(Ray r)
          Propagates a Ray through each of its child elements, by calling their Propagate method.
 void propagateRayPointSelf(RayPoint r)
          Does nothing since all the work is done by the Device's and the child elements Propagate methods.
 void rearrange()
          Realigns each child element on the previous one and sets the width of the device to the cumulated width of the child elements.
 
Methods inherited from class org.jscience.physics.waves.optics.elements.OpticalElement
getAxis, getCenter, getOffAxis, getWidth, getX, moveAxis, moveOffAxis, moveOnAxis, propagateRayPoint, putAfter, setWidth, translateOrigin, translateOriginBack
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpticalDevice

public OpticalDevice()
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class OpticalElement

draw

public void draw(java.awt.Graphics g)
Draws the device by calling the Draw method for all of its child elements.

Overrides:
draw in class OpticalElement
Parameters:
g - the Graphics object into which the device must be drawn.
See Also:
OpticalElement.draw(java.awt.Graphics)

drawSelf

public void drawSelf(java.awt.Graphics g)
Draws the device's symbol into a Graphics object. Does nothing since the device is drawn by drawing each of its child elements. Override this method to add extra drawings to the device.

Specified by:
drawSelf in class OpticalElement
Parameters:
g - the Graphics object into which the device must be drawn.

drawRay

public int drawRay(java.awt.Graphics g,
                   Ray r,
                   int index)
Draws the part of the Ray going through the device. The DrawRay method is called for every element in the device.

Overrides:
drawRay in class OpticalElement
Parameters:
g - the Graphics object in which the Ray must be drawn.
r - the Ray to draw.
index - the index of the RayPoint to draw. Used to keep track of the position in the Ray in case of multiple OpticalDevice nesting.
Returns:
the index of the next RayPoint to be drawn by the next element.
See Also:
Ray, RayPoint

propagate

public void propagate(Ray r)
Propagates a Ray through each of its child elements, by calling their Propagate method.

Overrides:
propagate in class OpticalElement
Parameters:
r - the Ray to propagate.
See Also:
OpticalElement.propagate(org.jscience.physics.waves.optics.rays.Ray)

propagateRayPointSelf

public void propagateRayPointSelf(RayPoint r)
Does nothing since all the work is done by the Device's and the child elements Propagate methods.

Specified by:
propagateRayPointSelf in class OpticalElement
Parameters:
r - the RayPoint to propagate.
See Also:
RayPoint, propagate(org.jscience.physics.waves.optics.rays.Ray), OpticalElement.propagate(org.jscience.physics.waves.optics.rays.Ray)

append

public void append(OpticalElement e)
Adds an element to the end of the child elements list, and calls its PutAfter method to align it on the previous element.

Parameters:
e - the element to add.
See Also:
OpticalElement, OpticalElement.putAfter(org.jscience.physics.waves.optics.elements.OpticalElement)

rearrange

public void rearrange()
Realigns each child element on the previous one and sets the width of the device to the cumulated width of the child elements.

Overrides:
rearrange in class OpticalElement
See Also:
OpticalElement, OpticalElement.putAfter(org.jscience.physics.waves.optics.elements.OpticalElement)