shady.common.ui
Class GraphicsDisplay

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by shady.common.ui.Display
                      extended by shady.common.ui.GraphicsDisplay
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, EnvironmentListener
Direct Known Subclasses:
MultiGraphicsDisplay

public class GraphicsDisplay
extends Display
implements EnvironmentListener

Shady graphics display.

TBD more doc

Copyright (C) 2006 Marsette A. Vona, III

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Author:
Marsette (Marty) A. Vona, III, Peter Osagie
See Also:
Serialized Form

Nested Class Summary
protected static class GraphicsDisplay.Annotation
          An annotation that gets drawn after the environment and before shady.
protected  class GraphicsDisplay.TransformProxy
          Makes a Graphics2D look like an AffineTransform.
 
Nested classes/interfaces inherited from class shady.common.ui.Display
Display.AngleField, Display.BarrelAngleField, Display.BarrelField, Display.BooleanField, Display.CharField, Display.CountField, Display.CurrentField, Display.DecimalField, Display.EnergyField, Display.FaultField, Display.Field, Display.GripperField, Display.PointField, Display.StringField, Display.TimeField, Display.TorqueField, Display.VoltageField
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static boolean ALWAYS_CLIP
          Whether to always do an internal clip when painting.
protected  java.util.Map annotations
          Our GraphicsDisplay.Annotations, indexed by name.
static boolean ANTIALIASING
          Whether to use RenderingHints.VALUE_ANTIALIAS_ON and RenderingHints.VALUE_TEXT_ANTIALIAS_ON.
static double ARROW_SIZE
          Ratio of arrow length to bone end diameter.
static double ARROW_TAIL
          Ratio of size of arrow tail to arrow length.
protected  float arrowLineWidth
          Arrow line width.
protected  java.awt.Shape[] arrowShape
          A barrel arrow, in barrel frame.
protected  java.awt.Color[] barrelColor
          The barrel colors.
protected  double bodyWidth
          Shady body width.
static double BONE_ASPECT_RATIO
          Ratio of bone body width to center-to-center distance.
static java.awt.Color BONE_COLOR
          Color of shady outline.
protected  java.awt.Shape[] boneBodyShape
          The bone body outline, in mechanism frame.
protected  double boneEndRadius
          Shady bone end radius.
protected  java.awt.Shape[] boneEndShape
          A bone end outline, in left mechanism frame.
protected  float boneLineWidth
          Bone line width.
protected  java.awt.image.BufferedImage bufferedImage
          Cached image buffer for pauses and file saves.
protected  java.lang.Object bufferedImageLock
          Synchronization lock for bufferedImage.
protected  double cc
          Shady center-to-center distance.
protected  java.awt.Shape[] ccLineBodyShape
          The center-to-center line body, in mechanism frame.
static java.awt.Color CLICKED_POINT_COLOR
          Clicked point color.
static float CLICKED_POINT_LINE_WIDTH
          Clicked point line width (pixels).
protected  Point.Cartesian clickPointCartesian
          The cartesian click point.
protected  java.util.Collection clickPointListeners
          The set of registered ClickPointListeners.
protected  java.awt.geom.AffineTransform clickPointTransform
          Gives translation of the clicked crossShape.
protected  double[] clipCorner
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
protected  double[] clipD
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
protected  double[] clipDiag
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
protected  java.awt.geom.Line2D.Double clippedLine
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
protected  java.awt.geom.Rectangle2D.Double clipRect
          Current clip rect in world coords.
protected  double[] clipS
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
protected  double[] clipWhere
          Temp space used in drawShape(Graphics2D, AffineTransform, Shape).
static double CLOSED_PADDLE_SEPARATION
          Ratio of closed paddle separation to bone end diameter.
protected  double closedPaddleSeparation
          Separation between closed paddles, in barrel frame.
static vona.color.ColorScheme COLOR_SCHEME
          The color scheme.
private  java.awt.event.ComponentListener componentListener
          Handle size changes.
static double CROSS_SIZE
          Ratio of clicked point cross leg length to bone end radius.
protected  java.awt.geom.GeneralPath crossShape
          Cross at most recent clicked point in world frame.
protected  HotSpot currentHotSpot
          Currently active HotSpot, if any, else null.
private static java.lang.String cvsid
          CVS id.
protected  double cx
          View center x world coord in meters.
protected  double cy
          View center y world coord in meters.
static java.awt.Color DEFAULT_ANNOTATION_COLOR
          Default color to use for annotations added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).
static float DEFAULT_ANNOTATION_LINE_WIDTH
          Default line width in pixels to use for annotations added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).
static float DEFAULT_ARROW_LINE_WIDTH
          Line width for shady arrows, pixels.
static float DEFAULT_BONE_LINE_WIDTH
          Line width for shady outline, pixels.
static boolean DEFAULT_ENABLE_TOOL_TIP
          whether tooltips are displayed
static float DEFAULT_ENVIRONMENT_LINE_WIDTH
          Line width for environment segments, pixels.
static java.awt.Color DEFAULT_FLASH_COLOR
          Default flash color.
static double DEFAULT_FLASH_DURATION
          Default flash duration.
static double DEFAULT_FLASH_RADIUS
          Default flash radius.
static double DEFAULT_FPS
          Default update frames per second.
static int DEFAULT_HEIGHT
          Default canvas height.
static float DEFAULT_PADDLE_LINE_WIDTH
          Line width for shady paddles, pixels.
static boolean DOUBLE_BUFFERED
          Whether to render double-buffered.
protected  boolean drawBarrelArrows
          Whether to draw the barrel arrows.
protected  boolean drawBodyArrow
          Whether to draw the body arrow.
protected  boolean drawCCLineBody
          Whether to draw the body as center-to-center line segment.
protected  boolean drawLineBody
          Whether to draw the body as a simple line segment.
protected  boolean drawPaddles
          Whether to draw the paddles.
protected  boolean drawShade
          Whether to draw the shade.
protected  boolean enableToolTip
          tooltip display
protected  Environment environment
          The environment.
static java.awt.Color ENVIRONMENT_COLOR
          Color of environment segments.
protected  float environmentLineWidth
          Environment line width.
protected  java.awt.Shape[] environmentShape
          The environment, in world frame.
static java.awt.Color FAULT_COLOR
          Color of shady outline when in fault iff useFaultColor.
protected  java.awt.Color flashColor
          Current flash color, if any.
protected  vona.time.TrapezoidInterpolator flashInterpolator
          Current flash interpolator, if any.
protected  double flashRadius
          Current flash radius in view pixels.
static boolean FRACTIONALMETRICS
          Whether to use RenderingHints.VALUE_FRACTIONALMETRICS_ON.
static double HOT_SPOT_GRAVITY
          Threshold distance in pixels for the cursor to pick a HotSpot.
protected  java.util.List hotSpots
          All known HotSpots.
static java.lang.Object INTERPOLATION
          The interpolation to use.
protected  vona.time.SuperClock interpolatorClock
          Timebase for interpolators.
protected  java.awt.Shape[] lineBodyShape
          The line body, in mechanism frame.
private  javax.swing.event.MouseInputListener mouseInputListener
          Displays a tooltip with the coordinates under the cursor and gets the coordinates when mouse is clicked.
static boolean NEVER_PROXY
          Whether to never use the transform proxy.
protected  DoubleFormatter nf
          A floating point number format with 2 decimal places.
static double OPEN_PADDLE_SEPARATION
          Ratio of open paddle separation to bone end diameter.
protected  double openPaddleSeparation
          Separation between open paddles, in barrel frame.
static double PAD
          Border padding distance in meters.
static java.awt.Color PADDLE_COLOR
          Color of shady paddles.
protected  float paddleLineWidth
          Paddle line width.
protected  java.awt.geom.Line2D.Double[] paddlesShape
          Paddles at y=+/-1.0, in barrel frame.
protected  double paddleWidth
          Shady paddle width.
static double PAN_ACCEL_FACTOR
          Factor by which to accelerate pan if SHIFT is down.
protected  boolean pausedCleanly
          Whether we paused cleanly.
protected  java.awt.geom.Point2D.Double pickPoint
          The pick point in the view.
protected  Point.Cartesian pickPointCartesian
          The cartesian pick point.
protected  Point.OnSegment pickPointOnSegment
          The segment pick point.
protected  Point.OnSegment projectionPoint
          Projection point, used only as scratch in pickShady(ShadyCommonAPI, Point, double).
protected  boolean reFitEnvironment
          Whether to re-fit the environment in environmentChanged(shady.common.Environment).
protected  float relativeLineWidth
          Global relative line width.
protected  boolean renderFastest
          Whether to enable fastest rendering.
static java.lang.Object RENDERING_QUALITY
          The rendering quality to use.
protected  double scale
          Scale that takes one world unit to one device unit.
static double SEGMENT_PICK_GRAVITY
          Threshold distance in pixels for the cursor to pick a Point.OnSegment.
static java.awt.Color SHADE_COLOR
          Color of the shade display.
static float SHADE_LINE_WIDTH
          Line width of the shade display in pixels.
static double SHADE_RADIUS
          The radius of the shade in meters.
protected  java.awt.geom.Arc2D.Double shadeShape
          The shade shape.
static boolean STROKE_NORMALIZATION
          Whether to use RenderingHints.VALUE_STROKE_NORMALIZE.
protected  Point.Cartesian tempPoint
          A temp point.
protected  ShadyPose tempPose
          A temp pose.
protected  ShadyState tempState
          A temp state.
protected  double tesserDS
          Tesser differential scale (multiplicative).
protected  double tesserDX
          Tesser differential x translation (additive).
protected  double tesserDY
          Tesser differential y translation (additive).
protected  vona.time.TrapezoidInterpolator tesserInterpolator
          Current tesserTo(double, double, double, double) interpolator, if any.
protected  double tesserStartScale
          viewToWorld(java.awt.geom.Point2D.Double) scale at tesser start.
protected  double tesserStartTX
          viewToWorld(java.awt.geom.Point2D.Double) x translation at tesser start.
protected  double tesserStartTY
          viewToWorld(java.awt.geom.Point2D.Double) y translation at tesser start.
protected  double totalLength
          Shady total length.
protected  GraphicsDisplay.TransformProxy transformProxy
          We use this in order to apply transforms directly to the Graphics2D.
protected  boolean useFaultColor
          Whether to use FAULT_COLOR when in fault.
protected  boolean verbosePerformance
          Whether to output verbose performance info.
static double WHEEL_TO_DELTA
          Mouse wheel clicks to drag delta.
protected  java.awt.geom.AffineTransform worldToView
          Transform that takes points in world (user space) coordinates to points in view (device space) coordinates.
protected  java.awt.geom.Line2D.Double xformLine
          Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).
protected  java.awt.geom.Point2D.Double xformPoint
          Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).
static double ZOOM_ACCEL_FACTOR
          Factor by which to accelerate zoom abscissa if SHIFT is down.
static double ZOOM_PER_PIXEL
          Conversion factor of pixels to zoom abscissa.
 
Fields inherited from class shady.common.ui.Display
DEFAULT_BORDER_PAD, DEFAULT_WIDTH, fields, fps, paused, shady, shadyUI, UNITS_WIDTH
 
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
GraphicsDisplay(UI ui, ShadyCommonAPI shady, Environment environment, java.awt.Color[] barrelColor)
          Create a new GraphicsDisplay.
 
Method Summary
 void addAnnotation(java.lang.String name, java.awt.Shape shape)
          Covers addAnnotation(String, Shape, Color), uses DEFAULT_ANNOTATION_COLOR.
 void addAnnotation(java.lang.String name, java.awt.Shape shape, java.awt.Color color)
          Covers addAnnotation(String, Shape, Color, float), uses DEFAULT_ANNOTATION_LINE_WIDTH.
 void addAnnotation(java.lang.String name, java.awt.Shape shape, java.awt.Color color, float lineWidth)
          Add an annotation that gets drawn in world frame after the environment and before shady.
 void addClickPointListener(ClickPointListener l)
          Add a ClickPointListener.
 void addHotSpot(HotSpot hotSpot)
          Add a HotSpot to the list of known HotSpots.
 void clearAnnotations()
          Remove all annotations.
 void clearHotSpots()
          Remove all HotSpots.
 javax.swing.JToolTip createToolTip()
          Extends default impl to set white background.
protected  java.awt.Shape createTransformedShape(java.awt.geom.AffineTransform xform, java.awt.Shape shape)
          Create a transformed shape.
protected  void drawBarrel(java.awt.Graphics2D g2d, ShadyCommonAPI shady, java.awt.geom.AffineTransform xform, int barrel)
          Draw the arrow and paddles of a barrel.
protected  void drawShape(java.awt.Graphics2D g2d, java.awt.geom.AffineTransform xform, java.awt.Shape shape)
          Draw a shape, possibly clipping it if isManualClip(java.awt.Graphics2D).
protected  void drawShape(java.awt.Graphics2D g2d, java.awt.geom.AffineTransform xform, java.awt.Shape[] shape)
          Draw an array of shapes.
 void environmentChanged(Environment environment)
          Implements EnvironmentListener.environmentChanged(shady.common.Environment).
protected  void fireClickPointChanged()
          Fire a ClickPointListener.clickPointChanged(shady.common.ui.GraphicsDisplay, shady.common.Point.Cartesian) to all our clickPointListeners.
 void flashHotSpots()
          Covers flashHotSpots(double), always uses DEFAULT_FLASH_DURATION.
 void flashHotSpots(double duration)
          Covers flashHotSpots(double, Color), always uses DEFAULT_FLASH_COLOR.
 void flashHotSpots(double duration, java.awt.Color color)
          Covers flashHotSpots(double, Color, double), always uses DEFAULT_FLASH_RADIUS.
 void flashHotSpots(double duration, java.awt.Color color, double radius)
          Smoothly flash circles over all the current hotSpots.
 float getArrowLineWidth()
          Get the arrow line width.
 float getBoneLineWidth()
          Get the bone line width.
 double getCenterX()
          Get the view center x.
 double getCenterY()
          Get the view center y.
 Point.Cartesian getClickPointCartesian()
          Get the cartesian click point.
protected  double getDefaultFPS()
          Get the default frames per sec.
 float getPaddleLineWidth()
          Get the paddle line width.
 float getRelativeLineWidth()
          Get the relative line width.
 double getScale()
          Get the view scale.
 boolean isFlashOngoing()
          Check whether a flash is ongoing.
protected  boolean isManualClip(java.awt.Graphics2D g2d)
          Whether we should try to manually clip things.
 boolean isTesserOngoing()
          Check whether a tesser is ongoing.
protected  void leftToBarrel(java.awt.geom.AffineTransform xform, ShadyState state, boolean unset)
          Concatenate an AffineTransform into xform that takes points in the left barrel-aligned frame to left mechanism-aligned frame.
protected  void leftToMechanism(java.awt.geom.AffineTransform xform, ShadyCommonAPI shady, boolean unset)
          Concatenate an AffineTransform into xform that takes points in the left mechanism-aligned frame to the mechanism-aligned frame.
protected  void mechanismToRight(java.awt.geom.AffineTransform xform, ShadyCommonAPI shady, boolean unset)
          Concatenate an AffineTransform into xform that takes points in the mechanism-aligned frame to the right mechanism-aligned frame.
protected  void paintAnnotations(java.awt.Graphics2D g2d)
          Paint annotations, if any.
 void paintComponent(java.awt.Graphics g)
          Calls paintComponent(Graphics2D).
protected  void paintComponent(java.awt.Graphics2D g2d)
          Calls superclass impl, then either draws bufferedImage if paused or paintContents(java.awt.Graphics2D) otherwise.
protected  void paintContents(java.awt.Graphics2D g2d)
          Sets worldToView, paintEverything(java.awt.Graphics2D), unset worldToView.
protected  void paintEnvironment(java.awt.Graphics2D g2d)
          Paint environment, if any, and if we have a Display.shady then only if it has a pose.
protected  void paintEverything(java.awt.Graphics2D g2d)
          paintEnvironment(java.awt.Graphics2D), paintShady(java.awt.Graphics2D), paintAnnotations(java.awt.Graphics2D), paintFlashes(java.awt.Graphics2D).
protected  void paintFlashes(java.awt.Graphics2D g2d)
          Paint flashes at all hotspots with flashColor, flashRadius and alpha given by flashInterpolator.
protected  void paintShady(java.awt.Graphics2D g2d)
          Covers paintShady(Graphics2D, ShadyCommonAPI), uses the Display's Display.shady.
protected  void paintShady(java.awt.Graphics2D g2d, ShadyCommonAPI shady)
          updatePose(shady.common.ShadyCommonAPI), then paintShady(java.awt.Graphics2D).
protected  void paintShady(java.awt.Graphics2D g2d, ShadyCommonAPI shady, ShadyPose pose)
          Paint shady.
 void pause()
          Pause this view.
 void pause(boolean cleanly)
          Pause this GraphicsDisplay, and possibly updateBufferedImage().
 void pauseInterpolations()
          PauseInterpolations.
protected  ShadyCommonAPI pickShady(Point p, double threshold)
          Pick a Shady in this GraphicsDisplay closer than threshold to p.
protected  boolean pickShady(ShadyCommonAPI shady, Point p, double threshold)
          Check if shady is closer than threshold to p.
 boolean removeAnnotation(java.lang.String name)
          Remove an annotation that had been previously added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).
 boolean removeClickPointListener(ClickPointListener l)
          Remove a ClickPointListener.
 boolean removeHotSpot(HotSpot hotSpot)
          Remove a HotSpot to the list of known HotSpots.
 boolean resetWorldToView()
          Same as resetWorldToView(boolean) but never shrinks.
 boolean resetWorldToView(boolean shrink)
          Same as resetWorldToView(boolean, double) but uses 0.0 extra.
 boolean resetWorldToView(boolean shrink, double extra)
          Covers resetWorldToView(boolean, double, double) but uses no duration.
 boolean resetWorldToView(boolean shrink, double extra, double duration)
          Updates worldToView to fit environment, or if none (or if no pose) then to fit Display.shady.
 boolean resetWorldToView(double extra)
          Same as resetWorldToView(boolean, double) but never shrinks.
 void resetWorldToView(double cx, double cy)
          Updates worldToView to be centered at (cx, cy).
 void resetWorldToView(double cx, double cy, double scale)
          Updates worldToView to be centered at (cx, cy) with the given scale.
protected  void rightToBarrel(java.awt.geom.AffineTransform xform, ShadyState state, boolean unset)
          Concatenate an AffineTransform into xform that takes points in the right barrel-aligned frame to the right mechanism-aligned frame.
protected  void setAppearance(java.awt.Graphics2D g2d, float lineWidth, java.awt.Color color)
          Set the foreground appearance in g2d.
 void setArrowLineWidth(float arrowLineWidth)
          Set the arrow line width.
 void setBoneLineWidth(float boneLineWidth)
          Set the bone line width.
 void setClickPointCartesian(double x, double y)
          Sets clickPointCartesian and shows it as a red cross.
 void setDrawBarrelArrows(boolean drawBarrelArrows)
          Set whether to draw the barrel arrows.
 void setDrawBodyArrow(boolean drawBodyArrow)
          Set whether to draw the body arrow.
 void setDrawCCLineBody(boolean drawCCLineBody)
          Set whether to draw the body as a center-to-center line segment.
 void setDrawLineBody(boolean drawLineBody)
          Set whether to draw the body as a simple line segment.
 void setDrawPaddles(boolean drawPaddles)
          Set whether to draw the paddles.
 void setDrawShade(boolean drawShade)
          Set whether to draw the shade.
 void setEnableToolTip(boolean enable)
          enable or disable tooltip display
 void setEnvironmentLineWidth(float environmentLineWidth)
          Set the environment line width.
 void setPaddleLineWidth(float paddleLineWidth)
          Set the paddle line width.
 void setRelativeLineWidth(float relativeLineWidth)
          Set the global relative line width.
 void setRenderFastest(boolean renderFastest)
          Enable fastest rendering.
 void setUseFaultColor(boolean useFaultColor)
          Set whether to use FAULT_COLOR when in fault.
 void setVerbosePerformance(boolean verbosePerformance)
          Set whether to output verbose performance info.
 boolean tesserTo(double cx, double cy, double scale, double duration)
          Smoothly transform viewpoint.
 void unPauseInterpolations()
          Un-pause interpolations.
protected  void update()
          This will be called at Display.getUpdateInterval().
 void updateBufferedImage()
          Cons bufferedImage if necessary and paint into it.
protected  void updatePose(ShadyCommonAPI shady)
          Try to get shady's pose.
protected  void updateState(ShadyCommonAPI shady)
          Get shady's state.
protected  boolean useTransformProxy(java.awt.Graphics2D g2d)
          Whether to use the transform proxy.
 java.awt.geom.Point2D.Double viewToWorld(java.awt.geom.Point2D.Double point)
          Gets the world coordinates from a view point.
protected  void worldToLeft(java.awt.geom.AffineTransform xform, ShadyPose pose, ShadyCommonAPI shady, boolean unset)
          Concatenate an AffineTransform into xform that takes points in the left mechanism-aligned frame to world frame.
 java.lang.Exception writeToFile(java.io.File file, java.lang.String format)
          Covers writeToFile(File, String, boolean) but never shows error dialog.
 java.lang.Exception writeToFile(java.io.File file, java.lang.String format, boolean showErrorDialog)
          Write to file of specified format.
 void zoomWorldToView(double scale)
          Updates worldToView with the given scale.
 
Methods inherited from class shady.common.ui.Display
getFPS, getUpdateInterval, isPaused, lockHeight, lockMinimumSize, lockPreferredSize, setBorder, setBorder, setBorder, setFPS, unPause, unPause
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, 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

cvsid

private static final java.lang.String cvsid

CVS id.

See Also:
Constant Field Values

PAN_ACCEL_FACTOR

public static final double PAN_ACCEL_FACTOR

Factor by which to accelerate pan if SHIFT is down.

See Also:
Constant Field Values

ZOOM_ACCEL_FACTOR

public static final double ZOOM_ACCEL_FACTOR

Factor by which to accelerate zoom abscissa if SHIFT is down.

See Also:
Constant Field Values

ZOOM_PER_PIXEL

public static final double ZOOM_PER_PIXEL

Conversion factor of pixels to zoom abscissa.

See Also:
Constant Field Values

WHEEL_TO_DELTA

public static final double WHEEL_TO_DELTA

Mouse wheel clicks to drag delta.

See Also:
Constant Field Values

PAD

public static final double PAD

Border padding distance in meters.

See Also:
Constant Field Values

DEFAULT_ENVIRONMENT_LINE_WIDTH

public static final float DEFAULT_ENVIRONMENT_LINE_WIDTH

Line width for environment segments, pixels.

See Also:
Constant Field Values

DEFAULT_BONE_LINE_WIDTH

public static final float DEFAULT_BONE_LINE_WIDTH

Line width for shady outline, pixels.

See Also:
Constant Field Values

DEFAULT_ARROW_LINE_WIDTH

public static final float DEFAULT_ARROW_LINE_WIDTH

Line width for shady arrows, pixels.

See Also:
Constant Field Values

DEFAULT_PADDLE_LINE_WIDTH

public static final float DEFAULT_PADDLE_LINE_WIDTH

Line width for shady paddles, pixels.

See Also:
Constant Field Values

DEFAULT_ENABLE_TOOL_TIP

public static final boolean DEFAULT_ENABLE_TOOL_TIP
whether tooltips are displayed

See Also:
Constant Field Values

COLOR_SCHEME

public static final vona.color.ColorScheme COLOR_SCHEME

The color scheme.


ENVIRONMENT_COLOR

public static final java.awt.Color ENVIRONMENT_COLOR

Color of environment segments.


BONE_COLOR

public static final java.awt.Color BONE_COLOR

Color of shady outline.


FAULT_COLOR

public static final java.awt.Color FAULT_COLOR

Color of shady outline when in fault iff useFaultColor.


PADDLE_COLOR

public static final java.awt.Color PADDLE_COLOR

Color of shady paddles.


BONE_ASPECT_RATIO

public static final double BONE_ASPECT_RATIO

Ratio of bone body width to center-to-center distance.

See Also:
Constant Field Values

ARROW_SIZE

public static final double ARROW_SIZE

Ratio of arrow length to bone end diameter.

See Also:
Constant Field Values

ARROW_TAIL

public static final double ARROW_TAIL

Ratio of size of arrow tail to arrow length.

See Also:
Constant Field Values

OPEN_PADDLE_SEPARATION

public static final double OPEN_PADDLE_SEPARATION

Ratio of open paddle separation to bone end diameter.

See Also:
Constant Field Values

CLOSED_PADDLE_SEPARATION

public static final double CLOSED_PADDLE_SEPARATION

Ratio of closed paddle separation to bone end diameter.

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT

Default canvas height.

Resizes are automatically handled.

See Also:
Constant Field Values

DOUBLE_BUFFERED

public static final boolean DOUBLE_BUFFERED

Whether to render double-buffered.

See Also:
Constant Field Values

ANTIALIASING

public static final boolean ANTIALIASING

Whether to use RenderingHints.VALUE_ANTIALIAS_ON and RenderingHints.VALUE_TEXT_ANTIALIAS_ON.

See Also:
Constant Field Values

RENDERING_QUALITY

public static final java.lang.Object RENDERING_QUALITY

The rendering quality to use.


INTERPOLATION

public static final java.lang.Object INTERPOLATION

The interpolation to use.


FRACTIONALMETRICS

public static final boolean FRACTIONALMETRICS

Whether to use RenderingHints.VALUE_FRACTIONALMETRICS_ON.

See Also:
Constant Field Values

STROKE_NORMALIZATION

public static final boolean STROKE_NORMALIZATION

Whether to use RenderingHints.VALUE_STROKE_NORMALIZE.

See Also:
Constant Field Values

DEFAULT_FPS

public static final double DEFAULT_FPS

Default update frames per second.

See Also:
Constant Field Values

SEGMENT_PICK_GRAVITY

public static final double SEGMENT_PICK_GRAVITY

Threshold distance in pixels for the cursor to pick a Point.OnSegment.

See Also:
Constant Field Values

HOT_SPOT_GRAVITY

public static final double HOT_SPOT_GRAVITY

Threshold distance in pixels for the cursor to pick a HotSpot.

See Also:
Constant Field Values

DEFAULT_ANNOTATION_LINE_WIDTH

public static final float DEFAULT_ANNOTATION_LINE_WIDTH

Default line width in pixels to use for annotations added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).

See Also:
Constant Field Values

DEFAULT_ANNOTATION_COLOR

public static final java.awt.Color DEFAULT_ANNOTATION_COLOR

Default color to use for annotations added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).


CLICKED_POINT_COLOR

public static final java.awt.Color CLICKED_POINT_COLOR

Clicked point color.


CLICKED_POINT_LINE_WIDTH

public static final float CLICKED_POINT_LINE_WIDTH

Clicked point line width (pixels).

See Also:
Constant Field Values

CROSS_SIZE

public static final double CROSS_SIZE

Ratio of clicked point cross leg length to bone end radius.

See Also:
Constant Field Values

DEFAULT_FLASH_RADIUS

public static final double DEFAULT_FLASH_RADIUS

Default flash radius.

See Also:
Constant Field Values

DEFAULT_FLASH_DURATION

public static final double DEFAULT_FLASH_DURATION

Default flash duration.

See Also:
Constant Field Values

DEFAULT_FLASH_COLOR

public static final java.awt.Color DEFAULT_FLASH_COLOR

Default flash color.


ALWAYS_CLIP

public static final boolean ALWAYS_CLIP

Whether to always do an internal clip when painting.

See Also:
Constant Field Values

NEVER_PROXY

public static final boolean NEVER_PROXY

Whether to never use the transform proxy.

See Also:
Constant Field Values

SHADE_COLOR

public static final java.awt.Color SHADE_COLOR

Color of the shade display.


SHADE_LINE_WIDTH

public static final float SHADE_LINE_WIDTH

Line width of the shade display in pixels.

See Also:
Constant Field Values

SHADE_RADIUS

public static final double SHADE_RADIUS

The radius of the shade in meters.

See Also:
Constant Field Values

componentListener

private final java.awt.event.ComponentListener componentListener

Handle size changes.


mouseInputListener

private final javax.swing.event.MouseInputListener mouseInputListener

Displays a tooltip with the coordinates under the cursor and gets the coordinates when mouse is clicked.


clickPointListeners

protected final java.util.Collection clickPointListeners

The set of registered ClickPointListeners.


nf

protected final DoubleFormatter nf

A floating point number format with 2 decimal places.


pickPoint

protected final java.awt.geom.Point2D.Double pickPoint

The pick point in the view.


pickPointCartesian

protected final Point.Cartesian pickPointCartesian

The cartesian pick point.


clickPointCartesian

protected final Point.Cartesian clickPointCartesian

The cartesian click point.


pickPointOnSegment

protected final Point.OnSegment pickPointOnSegment

The segment pick point.


environment

protected final Environment environment

The environment.


reFitEnvironment

protected boolean reFitEnvironment

Whether to re-fit the environment in environmentChanged(shady.common.Environment).


worldToView

protected final java.awt.geom.AffineTransform worldToView

Transform that takes points in world (user space) coordinates to points in view (device space) coordinates.


transformProxy

protected final GraphicsDisplay.TransformProxy transformProxy

We use this in order to apply transforms directly to the Graphics2D.


environmentShape

protected java.awt.Shape[] environmentShape

The environment, in world frame.


boneEndShape

protected java.awt.Shape[] boneEndShape

A bone end outline, in left mechanism frame.


boneBodyShape

protected java.awt.Shape[] boneBodyShape

The bone body outline, in mechanism frame.


lineBodyShape

protected java.awt.Shape[] lineBodyShape

The line body, in mechanism frame.


ccLineBodyShape

protected java.awt.Shape[] ccLineBodyShape

The center-to-center line body, in mechanism frame.


arrowShape

protected java.awt.Shape[] arrowShape

A barrel arrow, in barrel frame.


paddlesShape

protected java.awt.geom.Line2D.Double[] paddlesShape

Paddles at y=+/-1.0, in barrel frame.


crossShape

protected java.awt.geom.GeneralPath crossShape

Cross at most recent clicked point in world frame.


shadeShape

protected java.awt.geom.Arc2D.Double shadeShape

The shade shape.


clickPointTransform

protected java.awt.geom.AffineTransform clickPointTransform

Gives translation of the clicked crossShape.


openPaddleSeparation

protected double openPaddleSeparation

Separation between open paddles, in barrel frame.


closedPaddleSeparation

protected double closedPaddleSeparation

Separation between closed paddles, in barrel frame.


tempPoint

protected Point.Cartesian tempPoint

A temp point.


tempState

protected ShadyState tempState

A temp state.


tempPose

protected ShadyPose tempPose

A temp pose.


scale

protected double scale

Scale that takes one world unit to one device unit.

Computed in resetWorldToView(double, double, double).


cx

protected double cx

View center x world coord in meters.


cy

protected double cy

View center y world coord in meters.


barrelColor

protected final java.awt.Color[] barrelColor

The barrel colors.


annotations

protected final java.util.Map annotations

Our GraphicsDisplay.Annotations, indexed by name.


drawBodyArrow

protected boolean drawBodyArrow

Whether to draw the body arrow.


drawBarrelArrows

protected boolean drawBarrelArrows

Whether to draw the barrel arrows.


drawPaddles

protected boolean drawPaddles

Whether to draw the paddles.


drawLineBody

protected boolean drawLineBody

Whether to draw the body as a simple line segment.


drawCCLineBody

protected boolean drawCCLineBody

Whether to draw the body as center-to-center line segment.


drawShade

protected boolean drawShade

Whether to draw the shade.


cc

protected double cc

Shady center-to-center distance.


totalLength

protected double totalLength

Shady total length.


paddleWidth

protected double paddleWidth

Shady paddle width.


bodyWidth

protected double bodyWidth

Shady body width.


boneEndRadius

protected double boneEndRadius

Shady bone end radius.


useFaultColor

protected boolean useFaultColor

Whether to use FAULT_COLOR when in fault.


projectionPoint

protected Point.OnSegment projectionPoint

Projection point, used only as scratch in pickShady(ShadyCommonAPI, Point, double).


renderFastest

protected boolean renderFastest

Whether to enable fastest rendering.


verbosePerformance

protected boolean verbosePerformance

Whether to output verbose performance info.


hotSpots

protected java.util.List hotSpots

All known HotSpots.


currentHotSpot

protected HotSpot currentHotSpot

Currently active HotSpot, if any, else null.


environmentLineWidth

protected float environmentLineWidth

Environment line width.


boneLineWidth

protected float boneLineWidth

Bone line width.


arrowLineWidth

protected float arrowLineWidth

Arrow line width.


paddleLineWidth

protected float paddleLineWidth

Paddle line width.


relativeLineWidth

protected float relativeLineWidth

Global relative line width.


enableToolTip

protected boolean enableToolTip
tooltip display


flashColor

protected java.awt.Color flashColor

Current flash color, if any.


flashRadius

protected double flashRadius

Current flash radius in view pixels.


flashInterpolator

protected vona.time.TrapezoidInterpolator flashInterpolator

Current flash interpolator, if any.


tesserStartTX

protected double tesserStartTX

viewToWorld(java.awt.geom.Point2D.Double) x translation at tesser start.


tesserStartTY

protected double tesserStartTY

viewToWorld(java.awt.geom.Point2D.Double) y translation at tesser start.


tesserStartScale

protected double tesserStartScale

viewToWorld(java.awt.geom.Point2D.Double) scale at tesser start.


tesserDX

protected double tesserDX

Tesser differential x translation (additive).


tesserDY

protected double tesserDY

Tesser differential y translation (additive).


tesserDS

protected double tesserDS

Tesser differential scale (multiplicative).


tesserInterpolator

protected vona.time.TrapezoidInterpolator tesserInterpolator

Current tesserTo(double, double, double, double) interpolator, if any.


clipRect

protected java.awt.geom.Rectangle2D.Double clipRect

Current clip rect in world coords.


xformPoint

protected java.awt.geom.Point2D.Double xformPoint

Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).


xformLine

protected java.awt.geom.Line2D.Double xformLine

Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).


clipS

protected double[] clipS

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


clipD

protected double[] clipD

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


clipCorner

protected double[] clipCorner

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


clipDiag

protected double[] clipDiag

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


clipWhere

protected double[] clipWhere

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


clippedLine

protected java.awt.geom.Line2D.Double clippedLine

Temp space used in drawShape(Graphics2D, AffineTransform, Shape).


bufferedImage

protected java.awt.image.BufferedImage bufferedImage

Cached image buffer for pauses and file saves.


bufferedImageLock

protected java.lang.Object bufferedImageLock

Synchronization lock for bufferedImage.


interpolatorClock

protected vona.time.SuperClock interpolatorClock

Timebase for interpolators.


pausedCleanly

protected boolean pausedCleanly

Whether we paused cleanly.

Constructor Detail

GraphicsDisplay

public GraphicsDisplay(UI ui,
                       ShadyCommonAPI shady,
                       Environment environment,
                       java.awt.Color[] barrelColor)

Create a new GraphicsDisplay.

Parameters:
ui - the UI that contains this Display
shady - the mechanism to display, if any
environment - the environment to display, null for none
barrelColor - the barrel colors
Method Detail

writeToFile

public java.lang.Exception writeToFile(java.io.File file,
                                       java.lang.String format)

Covers writeToFile(File, String, boolean) but never shows error dialog.


writeToFile

public java.lang.Exception writeToFile(java.io.File file,
                                       java.lang.String format,
                                       boolean showErrorDialog)

Write to file of specified format.

Parameters:
file - the file to save, not null
format - "eps", "svg", "png"
showErrorDialog - whether to bring up a dialog box on error
Returns:
any exception that occurred while saving the file, null if none

updateBufferedImage

public void updateBufferedImage()

Cons bufferedImage if necessary and paint into it.


addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape,
                          java.awt.Color color,
                          float lineWidth)

Add an annotation that gets drawn in world frame after the environment and before shady.

Parameters:
name - the name of the annotation, not null. If an annotation with the given name already exists it is replaced.
shape - the shape to draw in meters in world frame, not null
color - the color to use to draw the annotation, if null DEFAULT_ANNOTATION_COLOR
lineWidth - the line width to use to draw the annotation, in pixels, if <= 0.0 DEFAULT_ANNOTATION_LINE_WIDTH

addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape,
                          java.awt.Color color)

Covers addAnnotation(String, Shape, Color, float), uses DEFAULT_ANNOTATION_LINE_WIDTH.


addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape)

Covers addAnnotation(String, Shape, Color), uses DEFAULT_ANNOTATION_COLOR.


removeAnnotation

public boolean removeAnnotation(java.lang.String name)

Remove an annotation that had been previously added with addAnnotation(java.lang.String, java.awt.Shape, java.awt.Color, float).

Parameters:
name - the name of the annotation to remove, not null
Returns:
true iff the annotation was found and removed

clearAnnotations

public void clearAnnotations()

Remove all annotations.


getClickPointCartesian

public Point.Cartesian getClickPointCartesian()

Get the cartesian click point.

Do not modify the returned value.

Returns:
the most recent clicked point, NaN coords if no click yet

setClickPointCartesian

public void setClickPointCartesian(double x,
                                   double y)

Sets clickPointCartesian and shows it as a red cross.


setDrawBodyArrow

public void setDrawBodyArrow(boolean drawBodyArrow)

Set whether to draw the body arrow.

Parameters:
drawBodyArrow - whether to draw the body arrow

setDrawBarrelArrows

public void setDrawBarrelArrows(boolean drawBarrelArrows)

Set whether to draw the barrel arrows.

Parameters:
drawBarrelArrows - whether to draw the barrel arrows

setDrawPaddles

public void setDrawPaddles(boolean drawPaddles)

Set whether to draw the paddles.

Parameters:
drawPaddles - whether to draw the paddles

setDrawLineBody

public void setDrawLineBody(boolean drawLineBody)

Set whether to draw the body as a simple line segment.

Parameters:
drawLineBody - whether to draw the body as a simple line segment

setDrawCCLineBody

public void setDrawCCLineBody(boolean drawCCLineBody)

Set whether to draw the body as a center-to-center line segment.

This takes precedence if drawLineBody is also set.

Parameters:
drawCCLineBody - whether to draw the body as a simple line segment

setDrawShade

public void setDrawShade(boolean drawShade)

Set whether to draw the shade.

Parameters:
drawShade - whether to draw the shade

setUseFaultColor

public void setUseFaultColor(boolean useFaultColor)

Set whether to use FAULT_COLOR when in fault.

Parameters:
useFaultColor - whether to use FAULT_COLOR when in fault

setRenderFastest

public void setRenderFastest(boolean renderFastest)

Enable fastest rendering.

Render quality may be sacrificed.

Parameters:
renderFastest - whether to enable fastest rendering

setVerbosePerformance

public void setVerbosePerformance(boolean verbosePerformance)

Set whether to output verbose performance info.

Parameters:
verbosePerformance - whether to output verbose performance info

setEnvironmentLineWidth

public void setEnvironmentLineWidth(float environmentLineWidth)

Set the environment line width.

Modulated by relativeLineWidth.

Parameters:
environmentLineWidth - the line width in pixels

setBoneLineWidth

public void setBoneLineWidth(float boneLineWidth)

Set the bone line width.

Modulated by relativeLineWidth.

Parameters:
boneLineWidth - the line width in pixels

getBoneLineWidth

public float getBoneLineWidth()

Get the bone line width.

Returns:
the bone line width in pixels

setArrowLineWidth

public void setArrowLineWidth(float arrowLineWidth)

Set the arrow line width.

Modulated by relativeLineWidth.

Parameters:
arrowLineWidth - the line width in pixels

getArrowLineWidth

public float getArrowLineWidth()

Get the arrow line width.

Returns:
the arrow line width in pixels

setPaddleLineWidth

public void setPaddleLineWidth(float paddleLineWidth)

Set the paddle line width.

Modulated by relativeLineWidth.

Parameters:
paddleLineWidth - the line width in pixels

getPaddleLineWidth

public float getPaddleLineWidth()

Get the paddle line width.

Returns:
the paddle line width in pixels

setRelativeLineWidth

public void setRelativeLineWidth(float relativeLineWidth)

Set the global relative line width.

This factor scales boneLineWidth, arrowLineWidth, and paddleLineWidth.

Parameters:
relativeLineWidth - the relative line width

getRelativeLineWidth

public float getRelativeLineWidth()

Get the relative line width.

Returns:
the relative line width in pixels

setEnableToolTip

public void setEnableToolTip(boolean enable)
enable or disable tooltip display


pause

public void pause(boolean cleanly)

Pause this GraphicsDisplay, and possibly updateBufferedImage().

Parameters:
cleanly - whether to updateBufferedImage()

pause

public void pause()

Pause this view.

This impl pause(boolean) cleanly.

Overrides:
pause in class Display

paintComponent

public void paintComponent(java.awt.Graphics g)

Calls paintComponent(Graphics2D).

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - the paint context

paintComponent

protected void paintComponent(java.awt.Graphics2D g2d)

Calls superclass impl, then either draws bufferedImage if paused or paintContents(java.awt.Graphics2D) otherwise.


paintContents

protected void paintContents(java.awt.Graphics2D g2d)

Sets worldToView, paintEverything(java.awt.Graphics2D), unset worldToView.

Parameters:
g2d - the paint context

paintEverything

protected void paintEverything(java.awt.Graphics2D g2d)

paintEnvironment(java.awt.Graphics2D), paintShady(java.awt.Graphics2D), paintAnnotations(java.awt.Graphics2D), paintFlashes(java.awt.Graphics2D).

.

Parameters:
g2d - the paint context

paintEnvironment

protected void paintEnvironment(java.awt.Graphics2D g2d)

Paint environment, if any, and if we have a Display.shady then only if it has a pose.

Parameters:
g2d - the paint context

paintAnnotations

protected void paintAnnotations(java.awt.Graphics2D g2d)

Paint annotations, if any.

Parameters:
g2d - the paint context

paintFlashes

protected void paintFlashes(java.awt.Graphics2D g2d)

Paint flashes at all hotspots with flashColor, flashRadius and alpha given by flashInterpolator.

Parameters:
g2d - the paint context

drawShape

protected void drawShape(java.awt.Graphics2D g2d,
                         java.awt.geom.AffineTransform xform,
                         java.awt.Shape[] shape)

Draw an array of shapes.

Parameters:
g2d - the Graphics2D in which to draw
xform - the transform to apply, null for none, ignored if equal to transformProxy
shape - the shapes to draw, may be null

drawShape

protected void drawShape(java.awt.Graphics2D g2d,
                         java.awt.geom.AffineTransform xform,
                         java.awt.Shape shape)

Draw a shape, possibly clipping it if isManualClip(java.awt.Graphics2D).

Parameters:
g2d - the Graphics2D in which to draw
xform - the transform to apply, null for none, ignored if equal to transformProxy
shape - the shape to draw, may be null

createTransformedShape

protected java.awt.Shape createTransformedShape(java.awt.geom.AffineTransform xform,
                                                java.awt.Shape shape)

Create a transformed shape.

Does better than AffineTransform.createTransformedShape() in some cases.

Parameters:
xform - the transform, null if none
shape - the shape to transform
Returns:
the transformed shape

isManualClip

protected boolean isManualClip(java.awt.Graphics2D g2d)

Whether we should try to manually clip things.

Parameters:
g2d - the Graphics2D in which to draw

useTransformProxy

protected boolean useTransformProxy(java.awt.Graphics2D g2d)

Whether to use the transform proxy.

Parameters:
g2d - the Graphics2D in which to draw

setAppearance

protected void setAppearance(java.awt.Graphics2D g2d,
                             float lineWidth,
                             java.awt.Color color)

Set the foreground appearance in g2d.

Parameters:
g2d - the Graphics2D in which to set the appearance
lineWidth - the line width (pixels)
color - the color

updatePose

protected void updatePose(ShadyCommonAPI shady)

Try to get shady's pose.

The pose should be written to tempPose. In no case should tempPose be nulled; if shady has no pose then tempPose.connectedBarrel should be set negative.

Parameters:
shady - get this guy's pose

updateState

protected void updateState(ShadyCommonAPI shady)

Get shady's state.

The state should be written to tempState. In no case should tempState be nulled.

Parameters:
shady - get this guy's state

paintShady

protected void paintShady(java.awt.Graphics2D g2d)

Covers paintShady(Graphics2D, ShadyCommonAPI), uses the Display's Display.shady.


paintShady

protected void paintShady(java.awt.Graphics2D g2d,
                          ShadyCommonAPI shady)

updatePose(shady.common.ShadyCommonAPI), then paintShady(java.awt.Graphics2D).

Parameters:
g2d - the paint context
shady - the Shady to draw

paintShady

protected void paintShady(java.awt.Graphics2D g2d,
                          ShadyCommonAPI shady,
                          ShadyPose pose)

Paint shady.

Parameters:
g2d - the paint context
shady - the Shady to draw, not null
pose - the pose of shady or null if none

drawBarrel

protected void drawBarrel(java.awt.Graphics2D g2d,
                          ShadyCommonAPI shady,
                          java.awt.geom.AffineTransform xform,
                          int barrel)

Draw the arrow and paddles of a barrel.

Parameters:
g2d - the Graphics2D in which to draw
shady - the Shady to draw
xform - the barrel transform to use
barrel - the barrel to draw

worldToLeft

protected void worldToLeft(java.awt.geom.AffineTransform xform,
                           ShadyPose pose,
                           ShadyCommonAPI shady,
                           boolean unset)

Concatenate an AffineTransform into xform that takes points in the left mechanism-aligned frame to world frame.

Parameters:
xform - the transform to modify
pose - Shady's pose, null if none
shady - the Shady
unset - whether to actually concatenate the inverse transform

leftToBarrel

protected void leftToBarrel(java.awt.geom.AffineTransform xform,
                            ShadyState state,
                            boolean unset)

Concatenate an AffineTransform into xform that takes points in the left barrel-aligned frame to left mechanism-aligned frame.

Parameters:
xform - the transform to modify
state - Shady's state, not null
unset - whether to actually concatenate the inverse transform

leftToMechanism

protected void leftToMechanism(java.awt.geom.AffineTransform xform,
                               ShadyCommonAPI shady,
                               boolean unset)

Concatenate an AffineTransform into xform that takes points in the left mechanism-aligned frame to the mechanism-aligned frame.

Parameters:
xform - the transform to modify
shady - the Shady, not null
unset - whether to actually concatenate the inverse transform

mechanismToRight

protected void mechanismToRight(java.awt.geom.AffineTransform xform,
                                ShadyCommonAPI shady,
                                boolean unset)

Concatenate an AffineTransform into xform that takes points in the mechanism-aligned frame to the right mechanism-aligned frame.

Parameters:
xform - the transform to modify
shady - the Shady, not null
unset - whether to actually concatenate the inverse transform

rightToBarrel

protected void rightToBarrel(java.awt.geom.AffineTransform xform,
                             ShadyState state,
                             boolean unset)

Concatenate an AffineTransform into xform that takes points in the right barrel-aligned frame to the right mechanism-aligned frame.

Parameters:
xform - the transform to modify
state - Shady's state, not null
unset - whether to actually concatenate the inverse transform

getScale

public double getScale()

Get the view scale.

Returns:
the scale that takes one world unit to one device unit

getCenterX

public double getCenterX()

Get the view center x.

Returns:
the view center x world coord in meters

getCenterY

public double getCenterY()

Get the view center y.

Returns:
the view center y world coord in meters

tesserTo

public boolean tesserTo(double cx,
                        double cy,
                        double scale,
                        double duration)

Smoothly transform viewpoint.

Does nothing if target viewpoint is already VonaMath.epsilonEquals(double, double, double) current or if another tesser is currently ongoing.

Parameters:
cx - the target center x in world coords
cy - the target center y in world coords
scale - the target scale (1 view unit)/(1 world unit)
duration - the time in seconds to take
Returns:
whether a transform will occur

isTesserOngoing

public boolean isTesserOngoing()

Check whether a tesser is ongoing.


pauseInterpolations

public void pauseInterpolations()

PauseInterpolations.


unPauseInterpolations

public void unPauseInterpolations()

Un-pause interpolations.


resetWorldToView

public void resetWorldToView(double cx,
                             double cy,
                             double scale)

Updates worldToView to be centered at (cx, cy) with the given scale.

Parameters:
cx - the center x world coordinate in meters
cy - the center y world coordinate in meters
scale - scale that takes one world unit to one device unit

resetWorldToView

public void resetWorldToView(double cx,
                             double cy)

Updates worldToView to be centered at (cx, cy).

Parameters:
cx - the center x world coordinate in meters
cy - the center y world coordinate in meters

zoomWorldToView

public void zoomWorldToView(double scale)

Updates worldToView with the given scale.

Parameters:
scale - scale that takes one world unit to one device unit

resetWorldToView

public boolean resetWorldToView(double extra)

Same as resetWorldToView(boolean, double) but never shrinks.


resetWorldToView

public boolean resetWorldToView()

Same as resetWorldToView(boolean) but never shrinks.


resetWorldToView

public boolean resetWorldToView(boolean shrink)

Same as resetWorldToView(boolean, double) but uses 0.0 extra.


resetWorldToView

public boolean resetWorldToView(boolean shrink,
                                double extra)

Covers resetWorldToView(boolean, double, double) but uses no duration.


resetWorldToView

public boolean resetWorldToView(boolean shrink,
                                double extra,
                                double duration)

Updates worldToView to fit environment, or if none (or if no pose) then to fit Display.shady.

Parameters:
shrink - if true then shrink the larger dimension to fit
extra - extra border in meters to add all around
duration - if > 0.0 then take this amount of time to effect the transformation via tesserTo(double, double, double, double).
Returns:
true iff a transformation will occur

viewToWorld

public java.awt.geom.Point2D.Double viewToWorld(java.awt.geom.Point2D.Double point)

Gets the world coordinates from a view point.

Parameters:
point - the point in view coords
Returns:
the point in world coords

addClickPointListener

public void addClickPointListener(ClickPointListener l)

Add a ClickPointListener.

Parameters:
l - the listener to add

removeClickPointListener

public boolean removeClickPointListener(ClickPointListener l)

Remove a ClickPointListener.

Parameters:
l - the listener to remove
Returns:
true iff the listener existed

fireClickPointChanged

protected void fireClickPointChanged()

Fire a ClickPointListener.clickPointChanged(shady.common.ui.GraphicsDisplay, shady.common.Point.Cartesian) to all our clickPointListeners.


addHotSpot

public void addHotSpot(HotSpot hotSpot)

Add a HotSpot to the list of known HotSpots.

Will not be activated till the mouse (re-)moves over it, even if it's "under" the mouse "at birth".

Parameters:
hotSpot - the spot to add, not null

removeHotSpot

public boolean removeHotSpot(HotSpot hotSpot)

Remove a HotSpot to the list of known HotSpots.

If the removed spot was the current spot the current spot is nulled.

Parameters:
hotSpot - the spot to remove, not null
Returns:
true iff hotSpot was found and removed

clearHotSpots

public void clearHotSpots()

Remove all HotSpots.


flashHotSpots

public void flashHotSpots(double duration,
                          java.awt.Color color,
                          double radius)

Smoothly flash circles over all the current hotSpots.

Does nothing if another flash is currently ongoing.

Parameters:
duration - the total duration of the flash in seconds
color - the color of the circles
radius - the radius of the circles n view pixels

isFlashOngoing

public boolean isFlashOngoing()

Check whether a flash is ongoing.


flashHotSpots

public void flashHotSpots(double duration,
                          java.awt.Color color)

Covers flashHotSpots(double, Color, double), always uses DEFAULT_FLASH_RADIUS.


flashHotSpots

public void flashHotSpots(double duration)

Covers flashHotSpots(double, Color), always uses DEFAULT_FLASH_COLOR.


flashHotSpots

public void flashHotSpots()

Covers flashHotSpots(double), always uses DEFAULT_FLASH_DURATION.


getDefaultFPS

protected double getDefaultFPS()

Get the default frames per sec.

Overrides:
getDefaultFPS in class Display
Returns:
Display.DEFAULT_FPS

update

protected void update()

This will be called at Display.getUpdateInterval().

Default impl updates any Display.Fields (in Display.fields).

Call superclass impl, then repaint() if not paused.

Overrides:
update in class Display

pickShady

protected ShadyCommonAPI pickShady(Point p,
                                   double threshold)

Pick a Shady in this GraphicsDisplay closer than threshold to p.

Default impl calls pickShady(ShadyCommonAPI, Point, double) on Display.shady.


pickShady

protected boolean pickShady(ShadyCommonAPI shady,
                            Point p,
                            double threshold)

Check if shady is closer than threshold to p.

See ShadyCommonAPI.pick(shady.common.Point, double) for argument semantics.

Default impl defers to shady.pick() iff non-null.

Parameters:
shady - the shady to pick or null
Returns:
true iff shady is non-null and picked

createToolTip

public javax.swing.JToolTip createToolTip()

Extends default impl to set white background.

Overrides:
createToolTip in class javax.swing.JComponent

environmentChanged

public void environmentChanged(Environment environment)

Implements EnvironmentListener.environmentChanged(shady.common.Environment).

Specified by:
environmentChanged in interface EnvironmentListener
Parameters:
environment - the Environment that changed