|
Sun SPOT Telemetry Demo -- Host side v1.1 |
||||||||
| 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
org.sunspotworld.demo.GraphView
public class GraphView
A simple class to store up to 10 minutes of telemetry data, display it on the screen, do some simple filtering of the data and read/write it to a file.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
AXIS_WIDTH
Specifies the width of the y-axis display. |
| 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 | |
|---|---|
GraphView()
Creates a new instance of GraphPanel. |
|
| Method Summary | |
|---|---|
void |
clearGraph()
Flush any current data and clear the display. |
int |
getMaxWidth()
Return the width that the current telemetry data occupies. |
boolean |
is2G()
Returns whether the accelerometer data using the 2G or 6G scales. |
void |
paintComponent(java.awt.Graphics g)
Paint the X-axis & the G forces recorded. |
void |
paintYaxis(java.awt.Graphics g)
Draw the tick marks on the acceleration axis (= y-axis). |
boolean |
readTelemetryFile(java.io.File file)
Read in acceleration telemetry data from a file. |
void |
repaint()
Cause the display to be repainted. |
void |
setAxisPanel(javax.swing.JPanel ax)
Specify the panel displaying the Y-axis. |
void |
setFiltertype(boolean b)
Select which filter to use when smoothing the data. |
void |
setFilterWidth(int w)
Specify the filter's window size. |
void |
setGOffset(double gx,
double gy,
double gz)
Set the rest offsets used by the accelerometer. |
void |
setIncludeGravity(boolean includeGravity)
Specify whether the forces displayed should include gravity or not. |
void |
setMaxGLabel(javax.swing.JLabel lab)
Label to use to display maximum G force recorded. |
void |
setShowG(boolean b)
Enable/disable the display of the combined G forces. |
void |
setShowX(boolean b)
Enable/disable the display of the x-axis G forces. |
void |
setShowY(boolean b)
Enable/disable the display of the y-axis G forces. |
void |
setShowZ(boolean b)
Enable/disable the display of the z-axis G forces. |
void |
setSmooth(boolean b)
Enable/disable the smoothing of the data with a filter. |
void |
setViewport(javax.swing.JViewport viewport)
Connect us with the view port that is displaying us. |
void |
setZoomX(int s)
Set the scale factor for the x-axis. |
void |
setZoomY(int s)
Set the scale factor for the y-axis. |
void |
takeData(java.lang.String id,
long tMS,
int index,
double x,
double y,
double z,
double g,
boolean twoG)
Add new telemetry data from remote SPOT. |
boolean |
writeData(java.io.File file)
Write the current acceleration telemetry data out to a file. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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 |
| Methods inherited from class java.awt.Container |
|---|
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
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, hide, 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, 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 |
| Field Detail |
|---|
public static final int AXIS_WIDTH
| Constructor Detail |
|---|
public GraphView()
| Method Detail |
|---|
public void setAxisPanel(javax.swing.JPanel ax)
ax - the panel to be used to display the y-axispublic boolean is2G()
public int getMaxWidth()
public boolean writeData(java.io.File file)
file - the file to write the data into
public boolean readTelemetryFile(java.io.File file)
file - the file to read the data from
public void takeData(java.lang.String id,
long tMS,
int index,
double x,
double y,
double z,
double g,
boolean twoG)
id - IEEE address of SPOT sending the datatMS - time in milliseconds when the data was recordedindex - index of this readingg - the combined accelerations of all three dimensions (in gravities)x - the x-axis acceleration (in gravities)y - the y-axis acceleration (in gravities)z - the z-axis acceleration (in gravities)twoG - true if measured using the 2 G accelerometer scalepublic void setViewport(javax.swing.JViewport viewport)
viewport - the JViewport to scroll to control what data is displayedpublic void setMaxGLabel(javax.swing.JLabel lab)
lab - the label to use to display the maximum G force encounteredpublic void clearGraph()
public void setShowG(boolean b)
b - true if the combined G forces should be displayedpublic void setShowX(boolean b)
b - true if the x-axis G forces should be displayedpublic void setShowY(boolean b)
b - true if the y-axis G forces should be displayedpublic void setShowZ(boolean b)
b - true if the z-axis G forces should be displayedpublic void setSmooth(boolean b)
b - true if the data displayed should be smoothed.public void setFiltertype(boolean b)
b - true for the boxcar filter, false for the triangle filterpublic void setFilterWidth(int w)
w - the number of samples to use when filteringpublic void setZoomX(int s)
s - the scale / 2, so s = 1, means 1/2 size, s = 4 means double sizepublic void setZoomY(int s)
s - the scale, so s = 1, means normal size, s = 2 means double size
public void setGOffset(double gx,
double gy,
double gz)
gx - the X-axis rest offsetgy - the Y-axis rest offsetgz - the Z-axis rest offsetpublic void setIncludeGravity(boolean includeGravity)
includeGravity - true if gravity should be shownpublic void repaint()
repaint in class java.awt.Componentpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the graphics component to use to paint thingspublic void paintYaxis(java.awt.Graphics g)
g - the graphics component to use
|
Sun SPOT Telemetry Demo -- Host side v1.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||