|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nasa.ial.mde.ui.graph.CartesianGraph
public class CartesianGraph
The CartesianGraph class is used to draw the solutions
found by the Solver.
Solver,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
CartesianGraph(Solver solver,
MdeSettings settings)
Creates an instance of CartesianGraph using the specified
solver and settings. |
|
| Method Summary | |
|---|---|
void |
clearGraph()
Clears the graph which will result in the sonification trace and simulation ball indicators being cleared, the one-to-one aspect ratio is disabled, and the AWT Thread will be notified to repaint the CartesianGraph component. |
void |
dilate(double factor)
Dialate (change the size of) the graph given the specified scale factor. |
void |
drawGraph()
Draws a graph of the solutions from the solver. |
void |
drawGraph(MdeSettings settings)
Draws a graph of the solutions from the solver using the specified settings. |
void |
drawGraphToImage(Image graphImage)
Draws a graph of the solutions from the solver to the specified image. |
void |
drawSimulationBall(double x,
double y,
double xNormal,
double yNormal)
Draws the simulation ball if it is enabled at the specified X and Y coordinates and normal vector. |
void |
drawTrace(double x,
double y)
Draws a trace at the given X and Y coordinates if the trace is enabled in the MdeSettings. |
CartesianGraph |
duplicate()
Create a duplicate of this CartesianGraph instance. |
void |
enableBlackAndWhite(boolean useBlackWhiteShade)
If true the graph will be drawn using black and white with shades of gray. |
void |
enableOneToOneAspectRatio(boolean enable)
If true the graph will be drawn with a width to height aspect ratio of one-to-one (1:1). |
boolean |
isBlackAndWhite()
Returns true if the graph will be drawn using black and white with shades of gray. |
boolean |
isOneToOneAspectRatio()
Returns true if the graph will be drawn with a width to height aspect ratio of one-to-one (1:1). |
boolean |
isSimulationBallEnabled()
Returns true if the simulation ball is enabled. |
void |
paintComponent(Graphics g)
Paints the CartesianGraph component. |
void |
setSimulationBallEnabled(boolean enable)
If true the simulation ball will be drawn. |
void |
translate(double dx,
double dy)
Translate the center of the graph given the specified X and Y offsets. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CartesianGraph(Solver solver,
MdeSettings settings)
CartesianGraph using the specified
solver and settings.
solver - The solutions from this solver will be graphed.settings - The settings to use for the graph.| Method Detail |
|---|
public CartesianGraph duplicate()
CartesianGraph instance.
CartesianGraph instance
public void translate(double dx,
double dy)
dx - the amount to shift the X-axis bydy - the amount to shift the Y-axis bydilate(double)public void dilate(double factor)
factor - the amount to scale the size of the graph bytranslate(double,double)public boolean isOneToOneAspectRatio()
With a one-to-one aspect ratio a circle will appear as a perfectly round circle and not stretched out like an egg.
The default value for this property is true.
enableOneToOneAspectRatio(boolean)public void enableOneToOneAspectRatio(boolean enable)
With a one-to-one aspect ratio a circle will appear as a perfectly round
circle. Otherwise the graph will be drawn using the the current size of the
CartesianGraph component and a circle could appear to be stretched
out in an egg shape because the aspect ration may not be one-to-one.
The default value for this property is true.
enable - true to enable a one-to-one aspect ratio, false to use the full size
of the CartesianGraph component for drawing.isOneToOneAspectRatio()public boolean isBlackAndWhite()
The default value for this property is false.
enableBlackAndWhite(boolean)public void enableBlackAndWhite(boolean useBlackWhiteShade)
The default value for this property is false.
useBlackWhiteShade - true for a black and white graph, false for a color graphisBlackAndWhite()public void clearGraph()
CartesianGraph component.
paintComponent(Graphics)public void drawGraph()
CartesianGraph component.
public void drawGraph(MdeSettings settings)
drawGraph() method is called.
settings - drawGraph()public void drawGraphToImage(Image graphImage)
graphImage - the image to draw the graph to
public void drawTrace(double x,
double y)
MdeSettings. If the solution is polar then a ball will
be drawn at the given coordinates, otherwise a vertical line will be drawn
at the given Y cordinate.
x - the X coordinate of the tracey - the Y coordinate of the traceMdeSettingspublic boolean isSimulationBallEnabled()
The default value for this property is false.
setSimulationBallEnabled(boolean),
drawSimulationBall(double,double,double,double)public void setSimulationBallEnabled(boolean enable)
CartesianGraph component.
The default value for this property is false.
enable - true to enable/show the simulation ball, false to disable/hide itisSimulationBallEnabled(),
drawSimulationBall(double,double,double,double)
public void drawSimulationBall(double x,
double y,
double xNormal,
double yNormal)
CartesianGraph component.
The normal vector is used to allow the ball to roll along the given point.
x - the X coordinate of the ball locationy - the Y coordinate of the ball locationxNormal - the X-axis component of the normal vector for the ballyNormal - the Y-axis component of the normal vector for the ballisSimulationBallEnabled(),
setSimulationBallEnabled(boolean)public void paintComponent(Graphics g)
CartesianGraph component.
paintComponent in class JComponentg - the Graphics context to paint toJComponent.paintComponent(java.awt.Graphics)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||