|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent org.geotools.gui.swing.ZoomPane org.geotools.gui.swing.Plot2D
A lightweight widget displaying two axis and an arbitrary amount of data series
with zoom capability. Axis may have arbitrary orientation (they don't need to be
perpendicular). This widget is not a replacement for full featured toolkit like
JGraph; it just provides a mean to
quickly display a time serie.
Axis color and font can bet set with JComponent.setForeground(java.awt.Color)
and JComponent.setFont(java.awt.Font)
.
A scroll pane can be created with ZoomPane.createScrollPane()
.
Nested Class Summary | |
static interface |
Plot2D.Series
A series to be displayed in a Plot2D widget. |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class org.geotools.gui.swing.ZoomPane |
DEFAULT_ZOOM, RESET, ROTATE, SCALE_X, SCALE_Y, TRANSLATE_X, TRANSLATE_Y, UNIFORM_SCALE, zoom |
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 | |
Plot2D()
Construct an initially empty Plot2D with
zoom capabilities on horizontal and vertical axis. |
|
Plot2D(boolean zoomX,
boolean zoomY)
Construct an initially empty Plot2D with
zoom capabilities on the specified axis. |
Method Summary | |
Plot2D.Series |
addSeries(Plot2D.Series series)
Add a new serie to the chart. |
Plot2D.Series |
addSeries(java.lang.String name,
java.lang.Object x,
java.lang.Object y)
Add a new serie to the chart. |
Plot2D.Series |
addSeries(java.lang.String name,
java.lang.Object x,
java.lang.Object y,
int lower,
int upper)
Add a new serie to the chart. |
void |
clear(boolean removeAxis)
Remove all series. |
java.awt.geom.Rectangle2D |
getArea()
Returns a bounding box that contains the logical coordinates of all data that may be displayed in this Plot2D . |
Axis2D[] |
getAxis(Plot2D.Series series)
Returns the {x, y} axis for the specified series. |
java.util.Set |
getSeries()
Returns the set of series to be draw. |
protected java.awt.Rectangle |
getZoomableBounds(java.awt.Rectangle bounds)
Returns the zoomable area in pixel coordinates. |
void |
newAxis(int dimension,
java.lang.String title)
Advises that the next series to be added with addSeries(...)
|
protected void |
paintComponent(java.awt.Graphics2D graphics)
Paints the axis and all series. |
void |
reset()
Reinitialize the zoom to its default value. |
void |
transform(java.awt.geom.AffineTransform transform)
Apply a zoom. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Plot2D()
Plot2D
with
zoom capabilities on horizontal and vertical axis.
public Plot2D(boolean zoomX, boolean zoomY)
Plot2D
with
zoom capabilities on the specified axis.
zoomX
- true
for allowing zooming on the x axis.zoomY
- true
for allowing zooming on the y axis.Method Detail |
public void newAxis(int dimension, java.lang.String title)
addSeries(...)
should uses a new axis for the specified dimension. Dimension 0 is for the x
axis while dimension 1 is for the y axis. If this method is never invoked,
then addSeries(...)
will automatically create untitled axis.
dimension
- 0 for adding a new x axis, or
1 for adding a new y axis.title
- The axis title.public Plot2D.Series addSeries(java.lang.String name, java.lang.Object x, java.lang.Object y) throws java.lang.ClassCastException, javax.vecmath.MismatchedSizeException
double[]
, float[]
, long[]
,
int[]
, short[]
, byte[]
, char[]
(which
may be used as a kind of unsigned short) or boolean[]
(0 or 1 values). The
x and y arrays doesn't need to be of the same type. Arrays are stored
by reference only; they are not cloned.
name
- The series name.x
- x values.y
- y values.
java.lang.ClassCastException
- if x and y are not arrays
of a primitive type.
javax.vecmath.MismatchedSizeException
- if arrays doesn't have the same length.public Plot2D.Series addSeries(java.lang.String name, java.lang.Object x, java.lang.Object y, int lower, int upper) throws java.lang.ClassCastException
name
- The series name.x
- x values.y
- y values.lower
- Index of first point, inclusive.upper
- Index of last point, exclusive.
java.lang.ClassCastException
- if x and y are not arrays
of a primitive type.public Plot2D.Series addSeries(Plot2D.Series series)
series
- The serie to add.
public java.util.Set getSeries()
public Axis2D[] getAxis(Plot2D.Series series) throws java.util.NoSuchElementException
series
- The series for which axis are wanted.
java.util.NoSuchElementException
- if this widget doesn't contains the specified series.public java.awt.geom.Rectangle2D getArea()
Plot2D
.
getArea
in class ZoomPane
Plot2D
.protected java.awt.Rectangle getZoomableBounds(java.awt.Rectangle bounds)
getZoomableBounds
in class ZoomPane
bounds
- An optional pre-allocated rectangle, or to create a new one. This
argument is useful if the caller wants to avoid allocating a new object on the heap.
public void reset()
ZoomPane
and usually doesn't need to be explicitely
invoked.
reset
in class ZoomPane
public void transform(java.awt.geom.AffineTransform transform)
ZoomPane
and usually
doesn't need to be explicitely invoked.
transform
in class ZoomPane
transform
- The zoom change, as an affine transform in logical coordinates. If
is the identity transform, then this method does nothing and
listeners are not notified.protected void paintComponent(java.awt.Graphics2D graphics)
paintComponent
in class ZoomPane
public void clear(boolean removeAxis)
removeAxis
is true
,
then all axis are removed as well. Otherwise, the last pair of axis is keep.
removeAxis
- true
for removing axis as well,
or false
for keeping the last used axis.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |