|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.View vmm.fractals.Mandelbrot.MandelbrotView
public class Mandelbrot.MandelbrotView
A View class suitable for viewing a Mandelbrot exhibit. The view for a Mandelbrot exhibit MUST be of this type. This class modifies the usual behavior of a View extensively to account for the fact that the basic data for a Mandelbrot exhibit is the bitmap on which the Mandelbrot is drawn. This view class has been rigged to make sure that this bitmap is not redrawn more often than necessary. For example, decorations are not drawn to the bitmap; instead, they are drawn over the bitmap each time the view is repainted.
Field Summary | |
---|---|
static int |
SHOW_BOTH
|
static int |
SHOW_JULIA
|
static int |
SHOW_NONE
|
static int |
SHOW_ORBIT
|
Fields inherited from class vmm.core.View |
---|
backgroundCommands, buildAnimation, buildingImageForFilmstrip, currentGraphics, decorations, directOffscreenDrawing, fullOSI, needsRedraw, offscreenImageType, parameters, showAxesAction |
Constructor Summary | |
---|---|
Mandelbrot.MandelbrotView()
|
Method Summary | |
---|---|
void |
doZoom(double magnificationFactor)
Zooms the display by a specified magnification factor. |
void |
drawOvalDirect(java.awt.Color c,
int x,
int y,
int width,
int height)
|
void |
fillOvalDirect(java.awt.Color c,
int x,
int y,
int width,
int height)
|
ActionList |
getActions()
Generates a list of "Action commands" that can be applied to this View. |
MouseTask |
getDefaultMouseTask()
Overridden to return a mouse task that will let the user drag the Julia set point. |
java.awt.image.BufferedImage |
getImage(boolean alwaysCopy)
Has been overridden because the usual bitmap for this view does not contain the decorations. |
int |
getShowJuliaAndOrbit()
Returns the value of the showJuliaAndOrbit property. |
java.lang.String |
getStatusText()
This method is called by the display to determine what message to show in the status bar when this view is active. |
void |
parameterChanged(Parameter param,
java.lang.Object oldValue,
java.lang.Object newValue)
Overridden to force a redraw of the Mandelbrot bitmap if it is the maximum iteration count that is changing. |
void |
render(java.awt.Graphics2D g,
int width,
int height)
The render method has been modified to draw the mandelbrot set directly to the bitmap. |
void |
setFastDrawing(boolean fast,
boolean redrawSynchronizedViews)
Overridden to force a redraw of the Mandelbrot bitmap. |
void |
setShowJuliaAndOrbit(int showJuliaAndOrbit)
Sets the value of the showJuliaAndOrbit property. |
void |
stateChanged(javax.swing.event.ChangeEvent evt)
Overridden to force a redraw of the Mandelbrot bitmap if it is the transform that is changing. |
void |
takeExhibit(View view,
boolean shareTransform)
Has been overridden to copy the maximum iteration count, if the shareTransform parameter is true. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SHOW_JULIA
public static final int SHOW_ORBIT
public static final int SHOW_BOTH
public static final int SHOW_NONE
Constructor Detail |
---|
public Mandelbrot.MandelbrotView()
Method Detail |
---|
public void doZoom(double magnificationFactor)
public int getShowJuliaAndOrbit()
setShowJuliaAndOrbit(int)
public void setShowJuliaAndOrbit(int showJuliaAndOrbit)
public ActionList getActions()
View
ActionItem
interface and will generally
belong to one of the classes AbstractActionVMM
,
ToggleAction
, ActionRadioGroup
, or
ActionList
. Null items represent separators.
The idea is that the list items will be added to a menu or otherwise presented to the user
so that the user can invoke the commands (with ActionList items representing submenus).
Null values can occur in the list; they are meant to become separaters in the menu.
Subclasses that override this method should generally call super.getActionss() and add their commands to the list retured by that method. This top-level View class does not define any Action commands; the return value is an empty non-null ArrayList.
getActions
in class View
public java.lang.String getStatusText()
View
getStatusText
in class View
public void setFastDrawing(boolean fast, boolean redrawSynchronizedViews)
setFastDrawing
in class View
View.setFastDrawing(boolean)
public void stateChanged(javax.swing.event.ChangeEvent evt)
stateChanged
in interface javax.swing.event.ChangeListener
stateChanged
in class View
View.forceRedraw()
public void parameterChanged(Parameter param, java.lang.Object oldValue, java.lang.Object newValue)
parameterChanged
in interface Parameterizable
parameterChanged
in class View
param
- The Parmeter whose value has been set.oldValue
- The previous value of the parameter.newValue
- The new, current value of the parameter. This is not
necessarily guaranteed to be different from the old value (although it
is for parameters definedin the VMM core).View.forceRedraw()
public void drawOvalDirect(java.awt.Color c, int x, int y, int width, int height)
public void fillOvalDirect(java.awt.Color c, int x, int y, int width, int height)
public void render(java.awt.Graphics2D g, int width, int height)
render
in class View
g
- The graphics context where the Exhibit is to be drawn. It is assumed
that the upper left corner of the drawing area has coordinates (0,0). The off-screen
image is simply drawn in g, except that when no exhibit exists, it is filled with
the background color.width
- The width, in pixels, of the drawing area where the exhibit is to be drawn.height
- The height, in pixels, of the drawing area where the exhibit is to be drawn.public java.awt.image.BufferedImage getImage(boolean alwaysCopy)
getImage
in class View
alwaysCopy
- If this is false, it is possible that the image that is returned is the
actual image that the View uses to store its content; this image will be modified whenever
the view is redrawn. (alwaysCopy = true is used to get the frame for a filmstrip;
alwaysCopy = false is used to get an image to save to a file)public void takeExhibit(View view, boolean shareTransform)
takeExhibit
in class View
view
- The view whose Exhibit is to be copied. After the method is called, both views will
be drawing the same exhibit. If null, then the exhibit of this view will also be set to null.shareTransform
- If true, the two views will share the same Transform, so that changes made to the transform in
one will also result in a change in the other.public MouseTask getDefaultMouseTask()
getDefaultMouseTask
in class View
BasicMouseTask2D
, which allows
dragging and zooming of the 2D window.MouseTask
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |