public class FunctionGraphCustom
extends marytts.signalproc.display.FunctionGraph
Modifier and Type | Class and Description |
---|---|
class |
FunctionGraphCustom.DoublePoint |
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoYMinMax |
protected Color |
axisColor |
protected Color |
backgroundColor |
protected List |
cursorListeners |
protected List<double[]> |
dataseries |
static int |
DEFAULT_HEIGHT |
static int |
DEFAULT_WIDTH |
static int |
DOT_EMPTYCIRCLE |
static int |
DOT_EMPTYDIAMOND |
static int |
DOT_EMPTYSQUARE |
static int |
DOT_FULLCIRCLE |
static int |
DOT_FULLDIAMOND |
static int |
DOT_FULLSQUARE |
protected int |
dotSize |
protected List<Integer> |
dotStyle |
static int |
DRAW_DOTS |
static int |
DRAW_HISTOGRAM |
static int |
DRAW_LINE |
static int |
DRAW_LINEWITHDOTS |
protected List<Color> |
graphColor |
protected BufferedImage |
graphImage |
protected List<Integer> |
graphStyle |
protected Color |
histogramBorderColor |
protected int |
histogramWidth |
protected int |
paddingBottom |
protected int |
paddingLeft |
protected int |
paddingRight |
protected int |
paddingTop |
protected FunctionGraphCustom.DoublePoint |
positionCursor |
protected FunctionGraphCustom.DoublePoint |
rangeCursor |
protected boolean |
showXAxis |
protected boolean |
showYAxis |
protected double |
x0 |
protected double |
xStep |
protected double |
ymax |
protected double |
ymin |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Modifier | Constructor and Description |
---|---|
protected |
FunctionGraphCustom()
Display a 2d graph showing y(x), with labelled scales.
|
|
FunctionGraphCustom(double x0,
double xStep,
double[] y)
Display a 2d graph showing y(x), with labelled scales.
|
|
FunctionGraphCustom(int width,
int height,
double x0,
double xStep,
double[] y)
Display a 2d graph showing y(x), with labelled scales.
|
Modifier and Type | Method and Description |
---|---|
void |
addCursorListener(marytts.signalproc.display.CursorListener l) |
void |
addDataSeries(double[] data,
Color newGraphColor,
int newGraphStyle,
int newDotStyle)
Add a secondary data series to this graph.
|
protected void |
createGraphImage() |
protected void |
drawData(Graphics2D g,
int image_fromX,
int image_toX,
int image_refX,
int image_refY,
int startY,
int image_height,
double[] data,
Color currentGraphColor,
int currentGraphStyle,
int currentDotStyle)
While painting the graph, draw the actual function data.
|
protected void |
drawDot(Graphics2D g,
int x,
int y,
int currentDotStyle) |
protected void |
drawXAxis(Graphics2D g,
double width,
int startX,
int startY,
int image_y_origin) |
protected void |
drawYAxis(Graphics2D g,
double height,
int startX,
int startY,
int image_x_origin) |
protected JPanel |
getControls()
Subclasses may provide specific controls here.
|
marytts.signalproc.display.CursorListener[] |
getCursorListeners() |
protected String |
getLabel(double x,
double y) |
marytts.signalproc.display.CursorDisplayer.CursorLine |
getPositionCursor() |
marytts.signalproc.display.CursorDisplayer.CursorLine |
getRangeCursor() |
marytts.signalproc.display.CursorDisplayer.Label |
getValueLabel() |
protected double |
getXRange() |
protected double |
getYRange() |
double |
getZoomX() |
protected int |
imageX2indexX(int imageX) |
protected double |
imageX2X(int imageX) |
protected double |
imageY2Y(int imageY) |
protected int |
indexX2imageX(int indexX) |
void |
initialise(int width,
int height,
double newX0,
double newXStep,
double[] data) |
protected void |
notifyCursorListeners() |
void |
paintComponent(Graphics gr) |
boolean |
removeCursorListener(marytts.signalproc.display.CursorListener l) |
void |
setPrimaryDataSeriesStyle(Color newGraphColor,
int newGraphStyle,
int newDotStyle) |
void |
setYMinMax(double theYMin,
double theYMax)
Manually set the min and max values for the y axis.
|
void |
setZoomX(double factor)
Set the zoom of the X
|
JFrame |
showInJFrame(String title,
boolean allowZoom,
boolean exitOnClose) |
JFrame |
showInJFrame(String title,
boolean allowZoom,
boolean showControls,
boolean exitOnClose) |
JFrame |
showInJFrame(String title,
int width,
int height,
boolean allowZoom,
boolean exitOnClose) |
JFrame |
showInJFrame(String title,
int width,
int height,
boolean allowZoom,
boolean showControls,
boolean exitOnClose) |
void |
updateCursorPosition(marytts.signalproc.display.CursorEvent e)
Used when keeping several FunctionGraphs' cursor positions in synchrony.
|
void |
updateData(double newX0,
double newXStep,
double[] data)
Replace the previous data with the given new data.
|
protected int |
X2imageX(double x) |
protected int |
X2indexX(double x) |
protected int |
y2imageY(double y) |
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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, revalidate, 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 static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public static final int DRAW_LINE
public static final int DRAW_DOTS
public static final int DRAW_LINEWITHDOTS
public static final int DRAW_HISTOGRAM
public static final int DOT_FULLCIRCLE
public static final int DOT_FULLSQUARE
public static final int DOT_FULLDIAMOND
public static final int DOT_EMPTYCIRCLE
public static final int DOT_EMPTYSQUARE
public static final int DOT_EMPTYDIAMOND
protected int paddingLeft
protected int paddingRight
protected int paddingTop
protected int paddingBottom
protected double x0
protected double xStep
protected List<double[]> dataseries
protected double ymin
protected double ymax
protected boolean showXAxis
protected boolean showYAxis
protected BufferedImage graphImage
protected Color backgroundColor
protected Color axisColor
protected Color histogramBorderColor
protected int dotSize
protected int histogramWidth
protected boolean autoYMinMax
protected FunctionGraphCustom.DoublePoint positionCursor
protected FunctionGraphCustom.DoublePoint rangeCursor
protected List cursorListeners
protected FunctionGraphCustom()
public FunctionGraphCustom(double x0, double xStep, double[] y)
public FunctionGraphCustom(int width, int height, double x0, double xStep, double[] y)
public void initialise(int width, int height, double newX0, double newXStep, double[] data)
initialise
in class marytts.signalproc.display.FunctionGraph
public void updateData(double newX0, double newXStep, double[] data)
addDataSeries(double[], Color, int, int)
are removed.updateData
in class marytts.signalproc.display.FunctionGraph
newX0
- x position of first data pointnewXStep
- distance between data points on X axisdata
- all data pointspublic void setPrimaryDataSeriesStyle(Color newGraphColor, int newGraphStyle, int newDotStyle)
setPrimaryDataSeriesStyle
in class marytts.signalproc.display.FunctionGraph
public void setYMinMax(double theYMin, double theYMax)
setYMinMax
in class marytts.signalproc.display.FunctionGraph
theYMin
- theYMax
- public void addDataSeries(double[] data, Color newGraphColor, int newGraphStyle, int newDotStyle)
addDataSeries
in class marytts.signalproc.display.FunctionGraph
data
- the function data, which must be of same length as the original data. updateData(double, double, double[])
newGraphColor
- a colournewGraphStyle
- the style for painting this data series. One of DRAW_LINE
, DRAW_DOTS
, 3, DRAW_HISTOGRAM
.newDotStyle
- the shape of any dots to use (meaningful only with newGraphStyle == DRAW_DOTS
or DRAW_LINEWITHDOTS
).
One of DOT_EMPTYCIRCLE
, DOT_EMPTYDIAMOND
, DOT_EMPTYSQUARE
, DOT_FULLCIRCLE
, DOT_FULLDIAMOND
, DOT_FULLSQUARE
.
For other graph styles, this is ignored, and it is recommended to set it to -1 for clarity.public double getZoomX()
getZoomX
in class marytts.signalproc.display.FunctionGraph
public void setZoomX(double factor)
setZoomX
in class marytts.signalproc.display.FunctionGraph
factor
- the zoom factor for X; 1 means that each data point corresponds to one pixel;
0.5 means that 2 data points are mapped onto one pixel; etc.protected void createGraphImage()
createGraphImage
in class marytts.signalproc.display.FunctionGraph
protected void drawData(Graphics2D g, int image_fromX, int image_toX, int image_refX, int image_refY, int startY, int image_height, double[] data, Color currentGraphColor, int currentGraphStyle, int currentDotStyle)
drawData
in class marytts.signalproc.display.FunctionGraph
g
- the graphics2d object to paint inimage_fromX
- first visible X coordinate of the Graph display area (= after subtracting space reserved for Y axis)image_toX
- last visible X coordinate of the Graph display area (= after subtracting space reserved for Y axis)image_refX
- X coordinate of the origin, in the display areaimage_refY
- Y coordinate of the origin, in the display areaxScaleFactor
- conversion factor between data space and image space, image_x = xScaleFactor * data_xyScaleFactor
- conversion factor between data space and image space, image_y = yScaleFactor * data_ystartY
- the start position on the Y axis (= the lower bound of the drawing area)image_height
- the height of the drawable region for the y valuesprotected void drawDot(Graphics2D g, int x, int y, int currentDotStyle)
drawDot
in class marytts.signalproc.display.FunctionGraph
protected void drawYAxis(Graphics2D g, double height, int startX, int startY, int image_x_origin)
drawYAxis
in class marytts.signalproc.display.FunctionGraph
protected void drawXAxis(Graphics2D g, double width, int startX, int startY, int image_y_origin)
drawXAxis
in class marytts.signalproc.display.FunctionGraph
public void paintComponent(Graphics gr)
paintComponent
in class marytts.signalproc.display.FunctionGraph
protected int imageX2indexX(int imageX)
imageX2indexX
in class marytts.signalproc.display.FunctionGraph
protected double imageX2X(int imageX)
imageX2X
in class marytts.signalproc.display.FunctionGraph
protected int indexX2imageX(int indexX)
indexX2imageX
in class marytts.signalproc.display.FunctionGraph
protected int X2imageX(double x)
X2imageX
in class marytts.signalproc.display.FunctionGraph
protected int X2indexX(double x)
X2indexX
in class marytts.signalproc.display.FunctionGraph
protected double imageY2Y(int imageY)
imageY2Y
in class marytts.signalproc.display.FunctionGraph
protected int y2imageY(double y)
y2imageY
in class marytts.signalproc.display.FunctionGraph
protected double getYRange()
getYRange
in class marytts.signalproc.display.FunctionGraph
protected double getXRange()
getXRange
in class marytts.signalproc.display.FunctionGraph
public marytts.signalproc.display.CursorDisplayer.CursorLine getPositionCursor()
getPositionCursor
in interface marytts.signalproc.display.CursorSource
getPositionCursor
in class marytts.signalproc.display.FunctionGraph
public marytts.signalproc.display.CursorDisplayer.CursorLine getRangeCursor()
getRangeCursor
in interface marytts.signalproc.display.CursorSource
getRangeCursor
in class marytts.signalproc.display.FunctionGraph
public marytts.signalproc.display.CursorDisplayer.Label getValueLabel()
getValueLabel
in interface marytts.signalproc.display.CursorSource
getValueLabel
in class marytts.signalproc.display.FunctionGraph
public void addCursorListener(marytts.signalproc.display.CursorListener l)
addCursorListener
in class marytts.signalproc.display.FunctionGraph
public marytts.signalproc.display.CursorListener[] getCursorListeners()
getCursorListeners
in class marytts.signalproc.display.FunctionGraph
public boolean removeCursorListener(marytts.signalproc.display.CursorListener l)
removeCursorListener
in class marytts.signalproc.display.FunctionGraph
protected void notifyCursorListeners()
notifyCursorListeners
in class marytts.signalproc.display.FunctionGraph
public void updateCursorPosition(marytts.signalproc.display.CursorEvent e)
updateCursorPosition
in interface marytts.signalproc.display.CursorListener
updateCursorPosition
in class marytts.signalproc.display.FunctionGraph
public JFrame showInJFrame(String title, boolean allowZoom, boolean exitOnClose)
showInJFrame
in class marytts.signalproc.display.FunctionGraph
public JFrame showInJFrame(String title, boolean allowZoom, boolean showControls, boolean exitOnClose)
showInJFrame
in class marytts.signalproc.display.FunctionGraph
public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean exitOnClose)
showInJFrame
in class marytts.signalproc.display.FunctionGraph
public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose)
showInJFrame
in class marytts.signalproc.display.FunctionGraph
protected JPanel getControls()
getControls
in class marytts.signalproc.display.FunctionGraph
protected String getLabel(double x, double y)
getLabel
in class marytts.signalproc.display.FunctionGraph
Copyright © 2017. All Rights Reserved.