|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--com.jjt.utbeg.SwathViewer
Component for drawing the swath image used in Applet1.
Inner classes inherited from class java.awt.Component |
Component.AWTTreeLock,
Component.NativeInLightFixer |
Field Summary | |
private int |
backgroundImageIndex
|
private Applet |
imageLoader
|
private Image[] |
images
|
private String[] |
imageURLs
|
private double |
magnification
|
private int |
numberOfReceiverLines
|
private int |
numberOfSourceLines
|
private Image |
offscreenImage
|
private UserParameters |
parameters
|
private Dimension |
preferredSize
|
private Color |
receiverColor
|
private int |
receiverLineSpacing
|
private int |
receiverStationSpacing
|
private Color |
referenceLineColor
|
private int |
referenceLineLength
|
private double |
scale
|
private Dimension |
sizeAt1x
|
private Color |
sourceColor
|
private int |
sourceLineSpacing
|
private int |
sourceStationSpacing
|
private Point |
swathUpperLeft
|
Fields inherited from class java.awt.Panel |
base,
nameCounter,
serialVersionUID |
Fields inherited from class java.awt.Container |
component,
containerListener,
containerSerializedDataVersion,
dispatcher,
layoutMgr,
maxSize,
ncomponents,
serialVersionUID |
Constructor Summary | |
SwathViewer(Applet imageLoader,
String[] imageURLs,
UserParameters parameters)
Creates a SwathViewer. |
Method Summary | |
private void |
drawReceiver(Graphics g,
int x,
int y)
Draws a single receiver station at the specified point. |
private void |
drawReceivers(Graphics g)
Draws all the lines of receivers onto the Graphics. |
private void |
drawReferenceLines(Graphics g)
Paints the swath size reference lines on the Graphics. |
private void |
drawSource(Graphics g,
int x,
int y)
Draws a single source station at the specified point. |
private void |
drawSources(Graphics g)
Draws all the lines of sources onto the Graphics. |
private void |
drawSwath(Graphics g)
Draws the swath onto the Graphics. |
private Point |
getCenterSwathPoint()
Calculates the swath center point based on the upper left point and the swath size. |
protected Image |
getImage()
Loads and returns the current background image. |
double |
getMagnification()
Returns the current "zoom" magnification for this viewer. |
Dimension |
getMaximumSize()
Over-ridden Component class method. |
Dimension |
getMinimumSize()
Over-ridden Component class method. |
Dimension |
getPreferredSize()
Over-ridden Component class method. |
private Point |
getUpperLeftSwathPoint()
Returns the upper-left coordinate for the drawn swath. |
void |
paint(Graphics g)
Over-ridden Component-class method for drawing this Component on the screen. |
protected void |
populateSwath()
Fetches values for this viewer from the current values stored in the UserParameters Object. |
void |
propertyChange(PropertyChangeEvent event)
This method is public as an implementation side-effect. |
private void |
reallyRepaint()
Resets the offscreen image cache and repaint()s. |
private void |
rescale(Dimension componentSize)
Sets the pixel-to-feet scale based on the given pixel size. |
private int |
scale(double lengthInFeet)
Scales the given value (in feet) into a length in pixels. |
void |
setBackgroundImage(int index)
Sets the currently displayed background image to the nth image in the image array. |
void |
setMagnification(double zoomX)
Sets the "zoom" factor for this viewer. |
private void |
setNewSwathPosition(Point centerPoint)
Sets a new position for the swath drawn within the viewer. |
Methods inherited from class java.awt.Panel |
addNotify,
constructComponentName |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
Field Detail |
private String[] imageURLs
private Image[] images
private int backgroundImageIndex
private Applet imageLoader
private UserParameters parameters
private Dimension preferredSize
private Image offscreenImage
private double magnification
private double scale
private int sourceStationSpacing
private int receiverStationSpacing
private int sourceLineSpacing
private int receiverLineSpacing
private int numberOfSourceLines
private int numberOfReceiverLines
private Point swathUpperLeft
private int referenceLineLength
private Color referenceLineColor
private Color sourceColor
private Color receiverColor
private Dimension sizeAt1x
Constructor Detail |
public SwathViewer(Applet imageLoader, String[] imageURLs, UserParameters parameters)
imageLoader
- the Applet to use for loading Image Objects from URL Strings.
The Applet.getImage(URL) method is used for loading images.imageURLs
- the URL Strings for the 8 images to display for the various
depths.parameters
- the UserParameters Object that will determine how the swath
is drawn. Values in the Object will be modified real-time
by the human.Method Detail |
public void setBackgroundImage(int index)
The imageURLs array has 8 images, representing various depths. This method sets which one should be painted.
index
- the 0-based index of the image to display.public void paint(Graphics g)
private void drawSwath(Graphics g)
This method calls drawReferenceLines(), drawSources(), and drawReceivers().
#drawReferenceLines()
,
#drawSources()
,
#drawReceivers()
private void drawReferenceLines(Graphics g)
private void drawSources(Graphics g)
private void drawReceivers(Graphics g)
private void reallyRepaint()
private Point getUpperLeftSwathPoint()
private Point getCenterSwathPoint()
private void setNewSwathPosition(Point centerPoint)
The swath position is actually remembered as the upper left corner, but the position given is the center point, where the human clicked. This method must calculate the upper left point relative to the given center point.
private int scale(double lengthInFeet)
lengthInFeet
- the number of feet to scale.private void rescale(Dimension componentSize)
This component should be roughly 12000 feet in the y dimension by 6000 feet in the x.
private void drawSource(Graphics g, int x, int y)
A source station is drawn as an O.
private void drawReceiver(Graphics g, int x, int y)
A receiver station is drawn as an X.
protected void populateSwath()
protected Image getImage()
public void propertyChange(PropertyChangeEvent event)
Called when a user parameter is changed.
public Dimension getPreferredSize()
getPreferredSize(), getMinimumSize(), and getMaximumSize() are over-ridden to return the same fixed size.
public Dimension getMinimumSize()
getPreferredSize(), getMinimumSize(), and getMaximumSize() are over-ridden to return the same fixed size.
public Dimension getMaximumSize()
getPreferredSize(), getMinimumSize(), and getMaximumSize() are over-ridden to return the same fixed size.
public void setMagnification(double zoomX)
zoomX
- the number of "times" normal size this viewer should appear.
For example, a value of 3.0 would make the viewer 3 times
its normal size.public double getMagnification()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |