jfig.canvas
Class PresentationViewerCanvas

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended byjfig.canvas.FigBasicCanvas
              extended byjfig.canvas.PresentationViewerCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, FigCanvas, FullRedraw, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, ObjectPainter, java.io.Serializable, SyncPainter

public class PresentationViewerCanvas
extends FigBasicCanvas

object canvas for the jfig presentation viewer.

PresentationViewerCanvas is the canvas for the jfig presentation viewer. It is realized as a simple subclass of FigBasicCanvas, that removes the rulers and some drag operations.

See Also:
FigBasicCanvas, Serialized Form

Nested Class Summary
 
Nested classes inherited from class jfig.canvas.FigBasicCanvas
FigBasicCanvas.Options2D
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 java.awt.Cursor moveCursor
           
 
Fields inherited from class jfig.canvas.FigBasicCanvas
backgroundColor, BASE_ANCHOR_X, BASE_ANCHOR_Y, canvasListener, cur_height, cur_width, cur_x, cur_y, debug, defaultColor, defaultCursor, enableRulerDragging, enableTimingInfo, gridColor, gridGR, gridMode, gridVisible, hasRulers, helper, mouse_drag_x, mouse_drag_y, n_grid, n_redraws, n_trials_to_create_offscreenImage, n_updates, objectEnumerator, objectGR, offscreenGR, offscreenImage, old_x, old_y, pdbg, printer, ptmp, redrawMode, rubberband, RULER_XL_OFFSET, RULER_XR_OFFSET, RULER_YB_OFFSET, RULER_YT_OFFSET, rulerFont, t_delay, t_grid, t_grid_mean, t_redraw, t_redraw_mean, theObserver, tmp_sc, tmp_wc, trafo, waitCursor, zoomListenerVector
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface jfig.canvas.FigCanvas
FullRedraw, MouseMotionRedraw, NoChanges, ObjectRedraw, panDOWN, panHOME, panLEFT, panRIGHT, panUP, SyncRedraw, SystemRedraw, TmpObjectRedraw, TmpTextRedraw
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PresentationViewerCanvas()
          PresentationViewerCanvas
 
Method Summary
 void doPanning(int direction, boolean shift)
          automatic panning of the visible viewport on the world-coordinate system.
 void doZoomIn14()
          zoom in by a factor of sqrt(two).
 void doZoomOut07()
           
 void doZoomRegion(FigBbox bbox)
           
 void doZoomRegionFree(FigBbox bbox)
           
 void doZoomRegionSnapped(FigBbox bbox)
           
 void drawSliders(java.awt.Graphics g, boolean erase)
          draw the sliders to mark the current position.
 void drawSlidersAndCursor()
           
 void mouseDragged(java.awt.event.MouseEvent evt)
          Handle MouseDrag events: Currently, mouseDrag events are used for canvas panning.
 void mouseMoved(java.awt.event.MouseEvent evt)
          Handle mouseMove events: update sliders/cross hatch, provide rubberbanding
 void mousePressed(java.awt.event.MouseEvent evt)
          Handle mouseDown events: snap to the currently active grid, then call the parent mouseDown action function.
 void mouseReleased(java.awt.event.MouseEvent evt)
          mouseReleased() is used to detect mouseDrag() events.
 
Methods inherited from class jfig.canvas.FigBasicCanvas
addCanvasListener, addZoomListener, blitOffscreenBuffer, blitOffscreenBufferClipped, canvasSizeChanged, changeRubberbandMode, changeRubberbandMode, changeRubberbandMode, clearBuffer, clippedDrawTmpObject, doFullRedraw_deadlocks, doFullRedraw, doFullRedraw, doMotionRedraw, doObjectRedraw, doSimpleRedraw, doSyncRedraw, doSystemRedraw, doTextRedraw, doToggleRubberbandDebug, doZoom11, doZoomFit, doZoomFull, doZoomIn, doZoomOut, doZoomRegion, drawAllObjects, drawGrid, drawGridByHand, drawGridViaCopyArea, drawObject, drawRulers, drawSlidersAndCursor, drawSlidersOnce, drawTmpObjects, drawTriangles, eraseObject, err, flush, get_current_canvas_size, getBackground, getComponent, getCurrentCanvasSize, getDebug, getGridColor, getMousePosition, getObjectEnumerator, getOffscreenGraphics, getOptions2D, getRedrawMode, getTrafo, getViewportWCmax, getVisibleRegionBoundingBox_OLD, getVisibleRegionBoundingBox, gotFocus, handleRedraw, initializeOffscreenBuffers, isDoubleBuffered, main, mouseClicked, mouseEntered, mouseExited, msg, notifyZoomListeners, paint, paint, paint, print, printAll, printTimingStats, removeZoomListener, repaint, repaint, repaint, repaint, requestAntiAliasing, requestRenderQuality, setBackground, setConsole, setDebug, setDefaultCursor, setEnableRulerDragging, setGrid, setGridColor, setObjectEnumerator, setRubberbandAspect, setRubberbandBasePoint, setRubberbandBasePoint, setRubberbandBasePoint2, setRubberbandBasePoint2, setRubberbandShowLineLengths, setRulerOffsets, setStatusMessage, setTrafo, showRulers, statusMessage, synchronousRepaint, update
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jfig.canvas.FigCanvas
getCursor, getSize, setCursor
 

Field Detail

moveCursor

public java.awt.Cursor moveCursor
Constructor Detail

PresentationViewerCanvas

public PresentationViewerCanvas()
PresentationViewerCanvas

The default viewer canvas doesn't use neither a grid nor snapping.

Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Description copied from class: FigBasicCanvas
Handle mouseDown events: snap to the currently active grid, then call the parent mouseDown action function.

Specified by:
mousePressed in interface FigCanvas
Overrides:
mousePressed in class FigBasicCanvas

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Description copied from class: FigBasicCanvas
mouseReleased() is used to detect mouseDrag() events. On each mouseDown() and at the end of a mouseUp() we reset the values of the mouse_drag_(x,y) variables.

If both the current and the previous mouse_drag_(x,y) position lie in the rulers and differ by more than 5 pixels (to suppress small 'jitter'), we calculate the corresponding viewport panning.

In the future, we should probably provide some kind of visual feedback about the current drag amout by using mouseDrag() to update the rulers correspondingly.

Specified by:
mouseReleased in interface FigCanvas
Overrides:
mouseReleased in class FigBasicCanvas

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Description copied from class: FigBasicCanvas
Handle mouseMove events: update sliders/cross hatch, provide rubberbanding

Specified by:
mouseMoved in interface FigCanvas
Overrides:
mouseMoved in class FigBasicCanvas

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Description copied from class: FigBasicCanvas
Handle MouseDrag events: Currently, mouseDrag events are used for canvas panning. The (global) variables mouse_drag_(x,y) are set at each mouseDown() and mouseUp() event.

However, mouseDrag() at the moment is not used: The actual panning calculations are done in mouseUp(). We should probably provide visual feedback about the drag amout by redrawing the rulers in this function.

Specified by:
mouseDragged in interface FigCanvas
Overrides:
mouseDragged in class FigBasicCanvas

drawSlidersAndCursor

public void drawSlidersAndCursor()

drawSliders

public void drawSliders(java.awt.Graphics g,
                        boolean erase)
Description copied from class: FigBasicCanvas
draw the sliders to mark the current position. For performance reasons this function uses the global variables (old_x, old_y), (cur_x, cur_y) directly.

Overrides:
drawSliders in class FigBasicCanvas

doPanning

public void doPanning(int direction,
                      boolean shift)
automatic panning of the visible viewport on the world-coordinate system. Possible directions are left, right, up, down, and home. The amount of panning is 1/5th of the current viewport, or 1/50th with the SHIFT key pressed.

Specified by:
doPanning in interface FigCanvas
Overrides:
doPanning in class FigBasicCanvas

doZoomIn14

public void doZoomIn14()
zoom in by a factor of sqrt(two). Fixed point is the viewport center.


doZoomOut07

public void doZoomOut07()

doZoomRegionSnapped

public void doZoomRegionSnapped(FigBbox bbox)

doZoomRegionFree

public void doZoomRegionFree(FigBbox bbox)

doZoomRegion

public void doZoomRegion(FigBbox bbox)