|
|||||||||
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 maslab.vis.VisCanvas
public class VisCanvas
Draws VisObjects and implements navigational controls
Nested Class Summary | |
---|---|
static class |
VisCanvas.POSITION
Determine whether to add an object to the top or bottom. |
static class |
VisCanvas.ZOOM
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
---|---|
java.awt.Color |
backgroundColor
|
double |
cx
|
double |
cy
|
static double |
DEFAULTSCALE
|
static double |
FASTZOOMSPEED
|
java.awt.Color |
gridColor
|
double |
gridLineSpacing
|
double |
gridLineWidthPx
|
static double |
MAXZOOM
|
static double |
MINZOOM
|
static double |
PANAMOUNT
|
static double |
PANAMOUNTFAST
|
static double |
ROTATEAMOUNT
|
double |
scale
|
double |
theta
|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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 | |
---|---|
VisCanvas()
Create a new canvas |
Method Summary | |
---|---|
void |
add(VisObject vo)
Add a new mutable object on top of existing objects. |
void |
add(VisObject vo,
VisCanvas.POSITION pos)
Add a new mutable object at the specified layer |
void |
addBuffered(VisObject vo)
Add an object to the back buffer. |
void |
addBuffered(VisObject vo,
VisCanvas.POSITION pos)
|
void |
addEventListener(VisCanvasEventListener el)
Add a listener to receive notification whenever an unhandled user interface event occurs. |
void |
addImmutable(VisObject vo)
|
void |
addImmutable(VisObject vo,
VisCanvas.POSITION pos)
Add a new immutable object (one which does not have to be redrawn) at the specified layer. |
void |
addMutable(VisObject vo,
VisCanvas.POSITION pos)
Add a new mutable object at the specified layer |
void |
addViewChangeListener(VisCanvasViewChangeListener vcvcl)
Add a listener to receive notification whenever the view of this canvas is changed. |
void |
clear()
|
void |
draw()
Call this method, rather than repaint(), to schedule a redraw. |
void |
drawNow()
Cause a repaint() ASAP, without regard for the maximum frame rate |
void |
drawSync()
|
java.awt.Font |
getFont(java.lang.String family,
int type,
double heightm)
Create a font with the appropriate affine transform for the canvas. |
double |
getScale()
The current scale of the display, in pixels per unit (meter). |
void |
goHome()
Restore the view to the start-up default. |
boolean |
handleKeyPress(java.awt.event.KeyEvent e)
|
void |
paint(java.awt.Graphics gin)
|
java.awt.image.BufferedImage |
paintIntoImage(int width,
int height)
Render the display into a new BufferedImage object of the requested width and height. |
java.awt.image.BufferedImage |
paintIntoImageScale(int width,
int height)
Render the current display into an image of width and height, zooming in as much as possible while displaying an area at least as large as is currently displayed. |
void |
paintObjects(java.awt.image.BufferedImage bi,
java.awt.Graphics2D g,
java.util.ArrayList<VisObject> objects)
Paint objects into a graphics context. |
void |
pan(double right,
double down,
boolean fast)
|
void |
rotateLeft()
|
void |
rotateRight()
|
void |
setCenter(double cx,
double cy)
Move the center of the display to the specified coordinates. |
void |
setGreedyFocus(boolean enable)
Set whether the canvas should steal the focus whenver the mouse hovers over it. |
void |
setMaximumFrameRate(double fps)
Set the maximum redraw rate. |
void |
showHotKeys()
|
void |
switchBuffer()
Make all objects added via addBuffered since last call to switchBuffer() visible, and discard the objects that were added before. |
void |
synchronizeView(VisCanvas vc)
Cause this VisCanvas's view to follow another VisCanvas's view. |
void |
zoom(VisCanvas.ZOOM dir,
boolean fast)
|
void |
zoom(VisCanvas.ZOOM dir,
int mousex,
int mousey,
boolean fast)
|
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static double DEFAULTSCALE
public double cx
public double cy
public double scale
public double theta
public java.awt.Color gridColor
public java.awt.Color backgroundColor
public double gridLineWidthPx
public double gridLineSpacing
public static final double MAXZOOM
public static final double MINZOOM
public static final double FASTZOOMSPEED
public static final double PANAMOUNT
public static final double PANAMOUNTFAST
public static final double ROTATEAMOUNT
Constructor Detail |
---|
public VisCanvas()
Method Detail |
---|
public void addViewChangeListener(VisCanvasViewChangeListener vcvcl)
public void addEventListener(VisCanvasEventListener el)
public void synchronizeView(VisCanvas vc)
public void setGreedyFocus(boolean enable)
public void addBuffered(VisObject vo)
public void addBuffered(VisObject vo, VisCanvas.POSITION pos)
public void switchBuffer()
public void clear()
public void add(VisObject vo)
public void draw()
public void drawNow()
public void drawSync()
public void add(VisObject vo, VisCanvas.POSITION pos)
public void addMutable(VisObject vo, VisCanvas.POSITION pos)
public void addImmutable(VisObject vo)
public void addImmutable(VisObject vo, VisCanvas.POSITION pos)
public void setCenter(double cx, double cy)
public void zoom(VisCanvas.ZOOM dir, boolean fast)
public void zoom(VisCanvas.ZOOM dir, int mousex, int mousey, boolean fast)
public void goHome()
public void pan(double right, double down, boolean fast)
public void rotateRight()
public void rotateLeft()
public boolean handleKeyPress(java.awt.event.KeyEvent e)
public void showHotKeys()
public void paint(java.awt.Graphics gin)
paint
in class javax.swing.JComponent
public java.awt.image.BufferedImage paintIntoImageScale(int width, int height)
public java.awt.image.BufferedImage paintIntoImage(int width, int height)
public void paintObjects(java.awt.image.BufferedImage bi, java.awt.Graphics2D g, java.util.ArrayList<VisObject> objects)
public java.awt.Font getFont(java.lang.String family, int type, double heightm)
family
- e.g. "Helvetica"type
- e.g. Font.PLAINheightm
- The height of the font, in meters.
public void setMaximumFrameRate(double fps)
fps
- The maximum frame rate.public double getScale()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |