public final class FractalPanel
extends javax.swing.JPanel
implements java.awt.print.Printable
FractalPanel
class provides the main GUI for the fractal iterators.
The system keeps (and calculates) a fractal result buffer (containing the raw results), which is then transformed into a fractal image buffer taking into account the current settings of the colour map, drawing, and post-processing filter techniques. When the panel is repainted, the fractal image buffer is each time copied into a render buffer, which is then copied onto the screen.
Drawing is controlled via the repaint()
and recolor()
methods. Explicit recalculation of the fractal is handled via
the IteratorController.recalc()
method.
Note that this class cannot be subclassed!
Modifier and Type | Class and Description |
---|---|
static class |
FractalPanel.EBifurcationAxisSelectionMode
The different modes for selecting the bifurcation axis.
|
static class |
FractalPanel.EPanDirection
The different directions of panning.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
FractalPanel(IteratorController iteratorController)
Creates a
FractalPanel object and initialises it with the main fractal. |
Modifier and Type | Method and Description |
---|---|
void |
calibrateColorRange(int maxNrOfIterations)
Calibrates the range in the colouring parameters to the maximum number of iterations to use.
|
void |
disableSelecting()
Disables a current selection mode.
|
boolean |
exportMainFractal(java.lang.String filename)
Exports the main fractal to a PNG file.
|
void |
finaliseFractalImage()
Copies the fractal result buffer to the fractal image buffer,
taking into account the current settings of the colour map, drawing, and post-processing techniques.
|
void |
fixHorizontalBifurcationAxis()
Fixes the horizontal bifurcation axis.
|
boolean |
getAutoSuppressDualFractal()
Returns whether or not the dual fractal is automatically supressed for high iteration counts.
|
FractalPanel.EBifurcationAxisSelectionMode |
getBifurcationAxisSelectionMode()
Returns the bifurcation axis selection mode.
|
boolean |
getCentredZooming()
Returns whether or not the zooming region is centred around the selection anchor.
|
java.awt.image.BufferedImage |
getFractalImage()
Returns an image containing the last rendered main fractal.
|
int |
getInsetSize()
Returns the inset size.
|
int |
getMagnifyingGlassRegion()
Returns the region of the magnifying glass.
|
int |
getMagnifyingGlassSize()
Returns the size of the magnifying glass.
|
java.awt.Dimension |
getMaximumSize() |
int |
getMaxNrOfIterationsInOrbitAnalyses()
Returns the maximum number of iterations in the orbit analyses panel.
|
java.awt.Dimension |
getMinimumSize() |
int |
getOrbitAnalysesPanelSize()
Returns the orbit analyses panel size.
|
java.awt.Dimension |
getPreferredSize() |
int |
getSelectedZoomLevel()
Returns the last selected zoom level.
|
boolean |
getSelecting()
Returns whether or not selection mode is active.
|
boolean |
getShowBifurcationDiagram()
Returns whether or not the bifurcation diagram is shown.
|
boolean |
getShowInset()
Returns whether or not the dual fractal inset should be shown.
|
boolean |
getShowMainFractalOverview()
Returns whether or not a rescaled overview version of the main fractal is shown as an inset.
|
boolean |
getShowOverlayGrid()
Returns whether or not an overlay grid is shown.
|
ZoomStack |
getZoomStack()
Returns the zoom stack.
|
boolean |
getZoomThumbnailSelectionMode()
Returns whether or not zoom thumbnails should be shown and can be selected.
|
boolean |
isDualFractalSuppressed()
Returns whether or not the dual fractal is suppressed.
|
boolean |
isLandscapeOriented()
Returns whether or not the screensize is in landscape orientation.
|
boolean |
isMouseInsideComplexPlane()
Returns
true if the mouse cursor is currently inside the complex plane, false otherwise. |
void |
paintComponent(java.awt.Graphics g) |
void |
pan(FractalPanel.EPanDirection panDirection,
double panFactor,
boolean inversePanning)
Pans the current fractal in the complex plane.
|
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
void |
recolor()
Reinitialises the colour information and automatically applies the post-processing filters.
|
void |
resetZoom()
Resets the zoom to the default region in the complex plane.
|
void |
revalidate() |
void |
setAutoSelectMaxNrOfIterations(boolean autoSelectMaxNrOfIterations)
Sets whether or not the maximum number of iterations should be auto selected.
|
void |
setAutoSuppressDualFractal(boolean autoSuppressDualFractal)
Sets whether or not the dual fractal is automatically supressed for high iteration counts.
|
void |
setAutoZoomInset(boolean autoZoomInset)
Controls whether or not the dual fractal inset should automatically zoom with the main fractal.
|
void |
setBifurcationAxisSelectionMode(FractalPanel.EBifurcationAxisSelectionMode bifurcationAxisSelectionMode)
Sets the bifurcation axis selection mode.
|
void |
setBifurcationDiagramDirty()
Explicitly forces a recalculation of the bifurcation diagram.
|
void |
setBifurcationOutlierPercentileOffset(double bifurcationOutlierPercentileOffset)
Sets the bifurcation outlier percentage offset.
|
void |
setCentredZooming(boolean centredZooming)
Controls whether or not the zooming region is centred around the selection anchor.
|
void |
setDeformedMainfractal(boolean showDeformedMainFractal)
Sets whether or not to show the deformed main fractal (because of another initial complex point) in the inset.
|
void |
setGeneralBifurcationAxis(org.sm.smtools.math.complex.ComplexNumber z1,
org.sm.smtools.math.complex.ComplexNumber z2)
Sets a general bifurcation axis.
|
void |
setInsetSize(int insetSize)
Sets the inset size as a percentage between 0 and 100.
|
void |
setMagnifyingGlassSize(int magnifyingGlassRegion,
int magnifyingGlassSize)
Controls the region and size of the magnifying glass.
|
void |
setMaxNrOfIterationsInOrbitAnalyses(int maxNrOfIterationsInOrbitAnalyses)
Sets the maximum number of iterations in the orbit analyses panel
|
void |
setNrOfBifurcationPointsPerOrbit(int nrOfBifurcationPointsPerOrbit)
Sets the number of bifurcation points per orbit.
|
void |
setNrOfBifurcationPointsToDiscard(int nrOfBifurcationPointsToDiscard)
Sets the number of bifurcation points to discard.
|
void |
setOrbitAnalysesPanelSize(int orbitAnalysesPanelSize)
Sets the orbit analyses panel size as a percentage between 0 and 100.
|
void |
setScaleOrbitsToScreen(boolean scaleOrbitsToScreen)
Controls whether or not the orbits should be scaled to the screen dimensions.
|
void |
setSelectionAnchor(ScreenLocation selectionAnchor)
Sets the selection anchor point.
|
void |
setSelectionExtent(ScreenLocation selectionExtent)
Sets the selection extent and draws it on the screen.
|
void |
setShowAxes(boolean showAxes)
Controls whether or not the axes should be shown.
|
void |
setShowBifurcationDiagram(boolean showBifurcationDiagram)
Controls whether or not the bifurcation diagram should be shown.
|
void |
setShowCurrentLocation(boolean showCurrentLocation)
Controls whether or not the current location should be shown.
|
void |
setShowInset(boolean showInset)
Controls whether or not the dual fractal inset should be shown.
|
void |
setShowMagnifyingGlass(boolean showMagnifyingGlass)
Controls whether or not a magnifying glass is shown at the current location.
|
void |
setShowMainFractalOverview(boolean showMainFractalOverview)
Controls whether or not a rescaled overview version of the main fractal is shown as an inset.
|
void |
setShowOrbitAnalyses(boolean showOrbitAnalyses)
Controls whether or not the orbit analyses should be shown.
|
void |
setShowOrbitPaths(boolean showOrbitPaths)
Controls whether or not the orbit paths should be shown.
|
void |
setShowOrbits(boolean showOrbits)
Controls whether or not the orbits should be shown.
|
void |
setShowOverlayGrid(boolean showOverlayGrid)
Controls whether or not an overlay grid is shown.
|
void |
setShowZoomInformation(boolean showZoomInformation)
Controls whether or not the information of the zoom area should be shown.
|
void |
setViewport(javax.swing.JViewport viewport)
Sets the viewport in which the fractal panel is displayed.
|
void |
setZoomStack(ZoomStack zoomStack)
Externally sets the zoom stack.
|
void |
setZoomThumbnailSelectionMode(boolean zoomThumbnailSelectionMode)
Sets whether or not zoom thumbnails should be shown and can be selected.
|
void |
zoomIn(org.sm.smtools.math.complex.ComplexNumber p1,
org.sm.smtools.math.complex.ComplexNumber p2)
Zooms in on a specific region.
|
void |
zoomOut()
Zooms to the previous location on the zoom stack if it's not empty.
|
void |
zoomToLevel(int zoomLevel)
Zooms to a specified existing zoom level.
|
void |
zoomToSelection()
Zooms in on the current selection.
|
void |
zoomToStack(int... canvasSize)
Sets the current zoom boundaries to those at the top of the zoom stack
and adjusts their aspect ratio if necessary.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public FractalPanel(IteratorController iteratorController)
FractalPanel
object and initialises it with the main fractal.iteratorController
- a reference to the iterator controller that will be usedpublic final void calibrateColorRange(int maxNrOfIterations)
maxNrOfIterations
- the maximum number of iterations to usepublic void disableSelecting()
public boolean exportMainFractal(java.lang.String filename)
filename
- the name of the file to export the main fractal totrue
if the export was successful, false
otherwisepublic void finaliseFractalImage()
repaint()
.public void fixHorizontalBifurcationAxis()
public boolean getAutoSuppressDualFractal()
boolean
indicating whether or not the dual fractal is automatically supressed for high iteration countspublic FractalPanel.EBifurcationAxisSelectionMode getBifurcationAxisSelectionMode()
public boolean getCentredZooming()
boolean
that indicates whether or not the zooming region is centred around the selection anchorpublic java.awt.image.BufferedImage getFractalImage()
public int getInsetSize()
public int getMagnifyingGlassRegion()
public int getMagnifyingGlassSize()
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
public int getMaxNrOfIterationsInOrbitAnalyses()
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public int getOrbitAnalysesPanelSize()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public int getSelectedZoomLevel()
public boolean getSelecting()
boolean
indicating whether or not selection mode is activepublic boolean getShowBifurcationDiagram()
boolean
that indicates whether or not the bifurcation diagram is shownpublic boolean getShowInset()
boolean
that indicates whether or not the dual fractal inset should be shownpublic boolean getShowMainFractalOverview()
boolean
that indicates whether or not a rescaled overview version of the main fractal is shown as an insetpublic boolean getShowOverlayGrid()
boolean
that indicates whether or not an overlay grid is shownpublic ZoomStack getZoomStack()
public boolean getZoomThumbnailSelectionMode()
boolean
that indicates whether or not zoom thumbnails should be shown and can be selectedpublic boolean isDualFractalSuppressed()
boolean
indicating whether or not the dual fractal is suppressedpublic boolean isLandscapeOriented()
boolean
indicating whether or not the screensize is in landscape orientationpublic boolean isMouseInsideComplexPlane()
true
if the mouse cursor is currently inside the complex plane, false
otherwise.boolean
indicating whether or not the mouse cursor is currently inside the complex planepublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void pan(FractalPanel.EPanDirection panDirection, double panFactor, boolean inversePanning)
panDirection
- the direction to pan topanFactor
- the percentage of the width and height to paninversePanning
- a boolean
indicating whether or not the panning direction is invertedpublic int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
print
in interface java.awt.print.Printable
g
- -pageFormat
- -pageIndex
- -public void recolor()
public void resetZoom()
public void revalidate()
revalidate
in class javax.swing.JComponent
public void setAutoSelectMaxNrOfIterations(boolean autoSelectMaxNrOfIterations)
autoSelectMaxNrOfIterations
- a boolean
indicating whether or not the maximum number of iterations should be auto selectedpublic void setAutoSuppressDualFractal(boolean autoSuppressDualFractal)
autoSuppressDualFractal
- a boolean
indicating whether or not the dual fractal is automatically supressed for high iteration countspublic void setAutoZoomInset(boolean autoZoomInset)
autoZoomInset
- a boolean
that indicates whether or not the dual fractal inset should automatically zoom with the main fractalpublic void setBifurcationAxisSelectionMode(FractalPanel.EBifurcationAxisSelectionMode bifurcationAxisSelectionMode)
bifurcationAxisSelectionMode
- the bifurcation axis selection modepublic void setBifurcationDiagramDirty()
public void setBifurcationOutlierPercentileOffset(double bifurcationOutlierPercentileOffset)
bifurcationOutlierPercentileOffset
- the bifurcation outlier percentage offsetpublic void setCentredZooming(boolean centredZooming)
centredZooming
- a boolean
that indicates whether or not the zooming region is centred around the selection anchorpublic void setDeformedMainfractal(boolean showDeformedMainFractal)
showDeformedMainFractal
- a boolean
indicating whether or not to show the deformed main fractal in the insetpublic void setGeneralBifurcationAxis(org.sm.smtools.math.complex.ComplexNumber z1, org.sm.smtools.math.complex.ComplexNumber z2)
z1
- the starting point of the bifurcation axisz2
- the ending point of the bifurcation axispublic void setInsetSize(int insetSize)
insetSize
- the inset size as a percentage between 0 and 100public void setMagnifyingGlassSize(int magnifyingGlassRegion, int magnifyingGlassSize)
magnifyingGlassRegion
- the region of the magnifying glassmagnifyingGlassSize
- the size of the magnifying glasspublic void setMaxNrOfIterationsInOrbitAnalyses(int maxNrOfIterationsInOrbitAnalyses)
maxNrOfIterationsInOrbitAnalyses
- the maximum number of iterations in the orbit analyses panelpublic void setNrOfBifurcationPointsPerOrbit(int nrOfBifurcationPointsPerOrbit)
nrOfBifurcationPointsPerOrbit
- the number of bifurcation points per orbitpublic void setNrOfBifurcationPointsToDiscard(int nrOfBifurcationPointsToDiscard)
nrOfBifurcationPointsToDiscard
- the number of bifurcation points to discardpublic void setOrbitAnalysesPanelSize(int orbitAnalysesPanelSize)
orbitAnalysesPanelSize
- the orbit analyses panel size as a percentage between 0 and 100public void setScaleOrbitsToScreen(boolean scaleOrbitsToScreen)
scaleOrbitsToScreen
- a boolean
that indicates whether or not the orbits should be scaled to the screen dimensionspublic void setSelectionAnchor(ScreenLocation selectionAnchor)
selectionAnchor
- the selection anchor point to setpublic void setSelectionExtent(ScreenLocation selectionExtent)
selectionExtent
- the selection extent to setpublic void setShowAxes(boolean showAxes)
showAxes
- a boolean
that indicates whether or not the axes should be shownpublic void setShowBifurcationDiagram(boolean showBifurcationDiagram)
showBifurcationDiagram
- a boolean
that indicates whether or not the bifurcation diagram should be shownpublic void setShowCurrentLocation(boolean showCurrentLocation)
showCurrentLocation
- a boolean
that indicates whether or not the current location should be shownpublic void setShowInset(boolean showInset)
showInset
- a boolean
that indicates whether or not the dual fractal inset should be shownpublic void setShowMagnifyingGlass(boolean showMagnifyingGlass)
showMagnifyingGlass
- a boolean
that indicates whether or not a magnifying glass is shown at the current locationpublic void setShowMainFractalOverview(boolean showMainFractalOverview)
showMainFractalOverview
- a boolean
that indicates whether or not a rescaled overview version of the main fractal is shown as an insetpublic void setShowOrbitAnalyses(boolean showOrbitAnalyses)
showOrbitAnalyses
- a boolean
that indicates whether or not the orbit analyses should be shownpublic void setShowOrbitPaths(boolean showOrbitPaths)
showOrbitPaths
- a boolean
that indicates whether or not the orbit paths should be shownpublic void setShowOrbits(boolean showOrbits)
showOrbits
- a boolean
that indicates whether or not the orbits should be shownpublic void setShowOverlayGrid(boolean showOverlayGrid)
showOverlayGrid
- a boolean
that indicates whether or not an overlay grid is shownpublic void setShowZoomInformation(boolean showZoomInformation)
showZoomInformation
- a boolean
that indicates whether or not the information of the zoom area should be shownpublic void setViewport(javax.swing.JViewport viewport)
viewport
- the viewport in which the fractal panel is displayedpublic void setZoomStack(ZoomStack zoomStack)
zoomStack
- the zoom stackpublic void setZoomThumbnailSelectionMode(boolean zoomThumbnailSelectionMode)
zoomThumbnailSelectionMode
- a boolean
that indicates whether or not zoom thumbnails should be shown and can be selectedpublic void zoomIn(org.sm.smtools.math.complex.ComplexNumber p1, org.sm.smtools.math.complex.ComplexNumber p2)
p1
- the lower-left corner in the complex planep2
- the upper-right corner in the complex planepublic void zoomOut()
public void zoomToLevel(int zoomLevel)
zoomLevel
- the existing level to zoom topublic void zoomToSelection()
public void zoomToStack(int... canvasSize)
canvasSize
- the optional width and height as an array of 2 int
s