|
||||||||||
| 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
shady.common.ui.Display
shady.common.ui.GraphicsDisplay
public class GraphicsDisplay
Shady graphics display.
TBD more docCopyright (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.
| 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 |
|---|
private static final java.lang.String cvsid
CVS id.
public static final double PAN_ACCEL_FACTOR
Factor by which to accelerate pan if SHIFT is down.
public static final double ZOOM_ACCEL_FACTOR
Factor by which to accelerate zoom abscissa if SHIFT is down.
public static final double ZOOM_PER_PIXEL
Conversion factor of pixels to zoom abscissa.
public static final double WHEEL_TO_DELTA
Mouse wheel clicks to drag delta.
public static final double PAD
Border padding distance in meters.
public static final float DEFAULT_ENVIRONMENT_LINE_WIDTH
Line width for environment segments, pixels.
public static final float DEFAULT_BONE_LINE_WIDTH
Line width for shady outline, pixels.
public static final float DEFAULT_ARROW_LINE_WIDTH
Line width for shady arrows, pixels.
public static final float DEFAULT_PADDLE_LINE_WIDTH
Line width for shady paddles, pixels.
public static final boolean DEFAULT_ENABLE_TOOL_TIP
public static final vona.color.ColorScheme COLOR_SCHEME
The color scheme.
public static final java.awt.Color ENVIRONMENT_COLOR
Color of environment segments.
public static final java.awt.Color BONE_COLOR
Color of shady outline.
public static final java.awt.Color FAULT_COLOR
Color of shady outline when in fault iff useFaultColor.
public static final java.awt.Color PADDLE_COLOR
Color of shady paddles.
public static final double BONE_ASPECT_RATIO
Ratio of bone body width to center-to-center distance.
public static final double ARROW_SIZE
Ratio of arrow length to bone end diameter.
public static final double ARROW_TAIL
Ratio of size of arrow tail to arrow length.
public static final double OPEN_PADDLE_SEPARATION
Ratio of open paddle separation to bone end diameter.
public static final double CLOSED_PADDLE_SEPARATION
Ratio of closed paddle separation to bone end diameter.
public static final int DEFAULT_HEIGHT
Default canvas height.
Resizes are automatically handled.
public static final boolean DOUBLE_BUFFERED
Whether to render double-buffered.
public static final boolean ANTIALIASING
Whether to use RenderingHints.VALUE_ANTIALIAS_ON and
RenderingHints.VALUE_TEXT_ANTIALIAS_ON.
public static final java.lang.Object RENDERING_QUALITY
The rendering quality to use.
public static final java.lang.Object INTERPOLATION
The interpolation to use.
public static final boolean FRACTIONALMETRICS
Whether to use
RenderingHints.VALUE_FRACTIONALMETRICS_ON.
public static final boolean STROKE_NORMALIZATION
Whether to use RenderingHints.VALUE_STROKE_NORMALIZE.
public static final double DEFAULT_FPS
Default update frames per second.
public static final double SEGMENT_PICK_GRAVITY
Threshold distance in pixels for the cursor to pick a Point.OnSegment.
public static final double HOT_SPOT_GRAVITY
Threshold distance in pixels for the cursor to pick a
HotSpot.
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).
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).
public static final java.awt.Color CLICKED_POINT_COLOR
Clicked point color.
public static final float CLICKED_POINT_LINE_WIDTH
Clicked point line width (pixels).
public static final double CROSS_SIZE
Ratio of clicked point cross leg length to bone end radius.
public static final double DEFAULT_FLASH_RADIUS
Default flash radius.
public static final double DEFAULT_FLASH_DURATION
Default flash duration.
public static final java.awt.Color DEFAULT_FLASH_COLOR
Default flash color.
public static final boolean ALWAYS_CLIP
Whether to always do an internal clip when painting.
public static final boolean NEVER_PROXY
Whether to never use the transform proxy.
public static final java.awt.Color SHADE_COLOR
Color of the shade display.
public static final float SHADE_LINE_WIDTH
Line width of the shade display in pixels.
public static final double SHADE_RADIUS
The radius of the shade in meters.
private final java.awt.event.ComponentListener componentListener
Handle size changes.
private final javax.swing.event.MouseInputListener mouseInputListener
Displays a tooltip with the coordinates under the cursor and gets the coordinates when mouse is clicked.
protected final java.util.Collection clickPointListeners
The set of registered ClickPointListeners.
protected final DoubleFormatter nf
A floating point number format with 2 decimal places.
protected final java.awt.geom.Point2D.Double pickPoint
The pick point in the view.
protected final Point.Cartesian pickPointCartesian
The cartesian pick point.
protected final Point.Cartesian clickPointCartesian
The cartesian click point.
protected final Point.OnSegment pickPointOnSegment
The segment pick point.
protected final Environment environment
The environment.
protected boolean reFitEnvironment
Whether to re-fit the environment in environmentChanged(shady.common.Environment).
protected final java.awt.geom.AffineTransform worldToView
Transform that takes points in world (user space) coordinates to points in view (device space) coordinates.
protected final GraphicsDisplay.TransformProxy transformProxy
We use this in order to apply transforms directly to the Graphics2D.
protected java.awt.Shape[] environmentShape
The environment, in world frame.
protected java.awt.Shape[] boneEndShape
A bone end outline, in left mechanism frame.
protected java.awt.Shape[] boneBodyShape
The bone body outline, in mechanism frame.
protected java.awt.Shape[] lineBodyShape
The line body, in mechanism frame.
protected java.awt.Shape[] ccLineBodyShape
The center-to-center line body, in mechanism frame.
protected java.awt.Shape[] arrowShape
A barrel arrow, in barrel frame.
protected java.awt.geom.Line2D.Double[] paddlesShape
Paddles at y=+/-1.0, in barrel frame.
protected java.awt.geom.GeneralPath crossShape
Cross at most recent clicked point in world frame.
protected java.awt.geom.Arc2D.Double shadeShape
The shade shape.
protected java.awt.geom.AffineTransform clickPointTransform
Gives translation of the clicked crossShape.
protected double openPaddleSeparation
Separation between open paddles, in barrel frame.
protected double closedPaddleSeparation
Separation between closed paddles, in barrel frame.
protected Point.Cartesian tempPoint
A temp point.
protected ShadyState tempState
A temp state.
protected ShadyPose tempPose
A temp pose.
protected double scale
Scale that takes one world unit to one device unit.
Computed in resetWorldToView(double, double, double).
protected double cx
View center x world coord in meters.
protected double cy
View center y world coord in meters.
protected final java.awt.Color[] barrelColor
The barrel colors.
protected final java.util.Map annotations
Our GraphicsDisplay.Annotations, indexed by name.
protected boolean drawBodyArrow
Whether to draw the body arrow.
protected boolean drawBarrelArrows
Whether to draw the barrel arrows.
protected boolean drawPaddles
Whether to draw the paddles.
protected boolean drawLineBody
Whether to draw the body as a simple line segment.
protected boolean drawCCLineBody
Whether to draw the body as center-to-center line segment.
protected boolean drawShade
Whether to draw the shade.
protected double cc
Shady center-to-center distance.
protected double totalLength
Shady total length.
protected double paddleWidth
Shady paddle width.
protected double bodyWidth
Shady body width.
protected double boneEndRadius
Shady bone end radius.
protected boolean useFaultColor
Whether to use FAULT_COLOR when in fault.
protected Point.OnSegment projectionPoint
Projection point, used only as scratch in pickShady(ShadyCommonAPI, Point, double).
protected boolean renderFastest
Whether to enable fastest rendering.
protected boolean verbosePerformance
Whether to output verbose performance info.
protected java.util.List hotSpots
All known HotSpots.
protected HotSpot currentHotSpot
Currently active HotSpot, if any, else null.
protected float environmentLineWidth
Environment line width.
protected float boneLineWidth
Bone line width.
protected float arrowLineWidth
Arrow line width.
protected float paddleLineWidth
Paddle line width.
protected float relativeLineWidth
Global relative line width.
protected boolean enableToolTip
protected java.awt.Color flashColor
Current flash color, if any.
protected double flashRadius
Current flash radius in view pixels.
protected vona.time.TrapezoidInterpolator flashInterpolator
Current flash interpolator, if any.
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 tesserStartScale
viewToWorld(java.awt.geom.Point2D.Double) scale at tesser start.
protected double tesserDX
Tesser differential x translation (additive).
protected double tesserDY
Tesser differential y translation (additive).
protected double tesserDS
Tesser differential scale (multiplicative).
protected vona.time.TrapezoidInterpolator tesserInterpolator
Current tesserTo(double, double, double, double) interpolator, if any.
protected java.awt.geom.Rectangle2D.Double clipRect
Current clip rect in world coords.
protected java.awt.geom.Point2D.Double xformPoint
Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).
protected java.awt.geom.Line2D.Double xformLine
Temp space used in createTransformedShape(java.awt.geom.AffineTransform, java.awt.Shape).
protected double[] clipS
Temp space used in drawShape(Graphics2D, AffineTransform,
Shape).
protected double[] clipD
Temp space used in drawShape(Graphics2D, AffineTransform,
Shape).
protected double[] clipCorner
Temp space used in drawShape(Graphics2D, AffineTransform,
Shape).
protected double[] clipDiag
Temp space used in drawShape(Graphics2D, AffineTransform,
Shape).
protected double[] clipWhere
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.image.BufferedImage bufferedImage
Cached image buffer for pauses and file saves.
protected java.lang.Object bufferedImageLock
Synchronization lock for bufferedImage.
protected vona.time.SuperClock interpolatorClock
Timebase for interpolators.
protected boolean pausedCleanly
Whether we paused cleanly.
| Constructor Detail |
|---|
public GraphicsDisplay(UI ui,
ShadyCommonAPI shady,
Environment environment,
java.awt.Color[] barrelColor)
Create a new GraphicsDisplay.
ui - the UI that contains this Displayshady - the mechanism to display, if anyenvironment - the environment to display, null for nonebarrelColor - the barrel colors| Method Detail |
|---|
public java.lang.Exception writeToFile(java.io.File file,
java.lang.String format)
Covers writeToFile(File, String, boolean) but never shows
error dialog.
public java.lang.Exception writeToFile(java.io.File file,
java.lang.String format,
boolean showErrorDialog)
Write to file of specified format.
file - the file to save, not nullformat - "eps", "svg", "png"showErrorDialog - whether to bring up a dialog box on error
public void updateBufferedImage()
Cons bufferedImage if necessary and paint into it.
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.
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 nullcolor - the color to use to draw the annotation, if null DEFAULT_ANNOTATION_COLORlineWidth - the line width to use to draw the annotation, in pixels,
if <= 0.0 DEFAULT_ANNOTATION_LINE_WIDTH
public void addAnnotation(java.lang.String name,
java.awt.Shape shape,
java.awt.Color color)
public void addAnnotation(java.lang.String name,
java.awt.Shape shape)
Covers addAnnotation(String, Shape, Color), uses DEFAULT_ANNOTATION_COLOR.
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).
name - the name of the annotation to remove, not null
public void clearAnnotations()
Remove all annotations.
public Point.Cartesian getClickPointCartesian()
Get the cartesian click point.
Do not modify the returned value.
public void setClickPointCartesian(double x,
double y)
Sets clickPointCartesian and shows it as a red cross.
public void setDrawBodyArrow(boolean drawBodyArrow)
Set whether to draw the body arrow.
drawBodyArrow - whether to draw the body arrowpublic void setDrawBarrelArrows(boolean drawBarrelArrows)
Set whether to draw the barrel arrows.
drawBarrelArrows - whether to draw the barrel arrowspublic void setDrawPaddles(boolean drawPaddles)
Set whether to draw the paddles.
drawPaddles - whether to draw the paddlespublic void setDrawLineBody(boolean drawLineBody)
Set whether to draw the body as a simple line segment.
drawLineBody - whether to draw the body as a simple line segmentpublic 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.
drawCCLineBody - whether to draw the body as a simple line segmentpublic void setDrawShade(boolean drawShade)
Set whether to draw the shade.
drawShade - whether to draw the shadepublic void setUseFaultColor(boolean useFaultColor)
Set whether to use FAULT_COLOR when in fault.
useFaultColor - whether to use FAULT_COLOR when in faultpublic void setRenderFastest(boolean renderFastest)
Enable fastest rendering.
Render quality may be sacrificed.
renderFastest - whether to enable fastest renderingpublic void setVerbosePerformance(boolean verbosePerformance)
Set whether to output verbose performance info.
verbosePerformance - whether to output verbose performance infopublic void setEnvironmentLineWidth(float environmentLineWidth)
Set the environment line width.
Modulated by relativeLineWidth.
environmentLineWidth - the line width in pixelspublic void setBoneLineWidth(float boneLineWidth)
Set the bone line width.
Modulated by relativeLineWidth.
boneLineWidth - the line width in pixelspublic float getBoneLineWidth()
Get the bone line width.
public void setArrowLineWidth(float arrowLineWidth)
Set the arrow line width.
Modulated by relativeLineWidth.
arrowLineWidth - the line width in pixelspublic float getArrowLineWidth()
Get the arrow line width.
public void setPaddleLineWidth(float paddleLineWidth)
Set the paddle line width.
Modulated by relativeLineWidth.
paddleLineWidth - the line width in pixelspublic float getPaddleLineWidth()
Get the paddle line width.
public void setRelativeLineWidth(float relativeLineWidth)
Set the global relative line width.
This factor scales boneLineWidth, arrowLineWidth, and
paddleLineWidth.
relativeLineWidth - the relative line widthpublic float getRelativeLineWidth()
Get the relative line width.
public void setEnableToolTip(boolean enable)
public void pause(boolean cleanly)
Pause this GraphicsDisplay, and possibly updateBufferedImage().
cleanly - whether to updateBufferedImage()public void pause()
Pause this view.
This impl pause(boolean) cleanly.
pause in class Displaypublic void paintComponent(java.awt.Graphics g)
Calls paintComponent(Graphics2D).
paintComponent in class javax.swing.JComponentg - the paint contextprotected 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.
g2d - the paint contextprotected void paintEverything(java.awt.Graphics2D g2d)
paintEnvironment(java.awt.Graphics2D), paintShady(java.awt.Graphics2D), paintAnnotations(java.awt.Graphics2D), paintFlashes(java.awt.Graphics2D).
g2d - the paint contextprotected void paintEnvironment(java.awt.Graphics2D g2d)
Paint environment, if any, and if we have a Display.shady then only if it has a pose.
g2d - the paint contextprotected void paintAnnotations(java.awt.Graphics2D g2d)
Paint annotations, if any.
g2d - the paint contextprotected void paintFlashes(java.awt.Graphics2D g2d)
Paint flashes at all hotspots with flashColor, flashRadius and alpha given by flashInterpolator.
g2d - the paint context
protected void drawShape(java.awt.Graphics2D g2d,
java.awt.geom.AffineTransform xform,
java.awt.Shape[] shape)
Draw an array of shapes.
g2d - the Graphics2D in which to drawxform - the transform to apply, null for none, ignored if equal to
transformProxyshape - the shapes to draw, may be null
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).
g2d - the Graphics2D in which to drawxform - the transform to apply, null for none, ignored if equal to
transformProxyshape - the shape to draw, may be null
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.
xform - the transform, null if noneshape - the shape to transform
protected boolean isManualClip(java.awt.Graphics2D g2d)
Whether we should try to manually clip things.
g2d - the Graphics2D in which to drawprotected boolean useTransformProxy(java.awt.Graphics2D g2d)
Whether to use the transform proxy.
g2d - the Graphics2D in which to draw
protected void setAppearance(java.awt.Graphics2D g2d,
float lineWidth,
java.awt.Color color)
Set the foreground appearance in g2d.
g2d - the Graphics2D in which to set the appearancelineWidth - the line width (pixels)color - the colorprotected 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.
shady - get this guy's poseprotected void updateState(ShadyCommonAPI shady)
Get shady's state.
The state should be written to tempState. In no case should
tempState be nulled.
shady - get this guy's stateprotected 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).
g2d - the paint contextshady - the Shady to draw
protected void paintShady(java.awt.Graphics2D g2d,
ShadyCommonAPI shady,
ShadyPose pose)
Paint shady.
g2d - the paint contextshady - the Shady to draw, not nullpose - the pose of shady or null if none
protected void drawBarrel(java.awt.Graphics2D g2d,
ShadyCommonAPI shady,
java.awt.geom.AffineTransform xform,
int barrel)
Draw the arrow and paddles of a barrel.
g2d - the Graphics2D in which to drawshady - the Shady to drawxform - the barrel transform to usebarrel - the barrel to draw
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.
xform - the transform to modifypose - Shady's pose, null if noneshady - the Shadyunset - whether to actually concatenate the inverse transform
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.
xform - the transform to modifystate - Shady's state, not nullunset - whether to actually concatenate the inverse transform
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.
xform - the transform to modifyshady - the Shady, not nullunset - whether to actually concatenate the inverse transform
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.
xform - the transform to modifyshady - the Shady, not nullunset - whether to actually concatenate the inverse transform
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.
xform - the transform to modifystate - Shady's state, not nullunset - whether to actually concatenate the inverse transformpublic double getScale()
Get the view scale.
public double getCenterX()
Get the view center x.
public double getCenterY()
Get the view center y.
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.
cx - the target center x in world coordscy - the target center y in world coordsscale - the target scale (1 view unit)/(1 world unit)duration - the time in seconds to take
public boolean isTesserOngoing()
Check whether a tesser is ongoing.
public void pauseInterpolations()
PauseInterpolations.
public void unPauseInterpolations()
Un-pause interpolations.
public void resetWorldToView(double cx,
double cy,
double scale)
Updates worldToView to be centered at (cx, cy)
with the given scale.
cx - the center x world coordinate in meterscy - the center y world coordinate in metersscale - scale that takes one world unit to one device unit
public void resetWorldToView(double cx,
double cy)
Updates worldToView to be centered at (cx,
cy).
cx - the center x world coordinate in meterscy - the center y world coordinate in meterspublic void zoomWorldToView(double scale)
Updates worldToView with the given scale.
scale - scale that takes one world unit to one device unitpublic boolean resetWorldToView(double extra)
Same as resetWorldToView(boolean, double) but never
shrinks.
public boolean resetWorldToView()
Same as resetWorldToView(boolean) but never shrinks.
public boolean resetWorldToView(boolean shrink)
Same as resetWorldToView(boolean, double) but uses 0.0
extra.
public boolean resetWorldToView(boolean shrink,
double extra)
Covers resetWorldToView(boolean, double, double) but uses no
duration.
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.
shrink - if true then shrink the larger dimension to fitextra - extra border in meters to add all aroundduration - if > 0.0 then take this amount of time to effect the
transformation via tesserTo(double, double, double, double).
public java.awt.geom.Point2D.Double viewToWorld(java.awt.geom.Point2D.Double point)
Gets the world coordinates from a view point.
point - the point in view coords
public void addClickPointListener(ClickPointListener l)
Add a ClickPointListener.
l - the listener to addpublic boolean removeClickPointListener(ClickPointListener l)
Remove a ClickPointListener.
l - the listener to remove
protected void fireClickPointChanged()
Fire a ClickPointListener.clickPointChanged(shady.common.ui.GraphicsDisplay, shady.common.Point.Cartesian) to all our clickPointListeners.
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".
hotSpot - the spot to add, not nullpublic 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.
hotSpot - the spot to remove, not null
hotSpot was found and removedpublic void clearHotSpots()
Remove all HotSpots.
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.
duration - the total duration of the flash in secondscolor - the color of the circlesradius - the radius of the circles n view pixelspublic boolean isFlashOngoing()
Check whether a flash is ongoing.
public void flashHotSpots(double duration,
java.awt.Color color)
Covers flashHotSpots(double, Color, double), always uses
DEFAULT_FLASH_RADIUS.
public void flashHotSpots(double duration)
Covers flashHotSpots(double, Color), always uses DEFAULT_FLASH_COLOR.
public void flashHotSpots()
Covers flashHotSpots(double), always uses DEFAULT_FLASH_DURATION.
protected double getDefaultFPS()
Get the default frames per sec.
getDefaultFPS in class DisplayDisplay.DEFAULT_FPSprotected 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.
update in class Display
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.
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.
shady - the shady to pick or null
shady is non-null and pickedpublic javax.swing.JToolTip createToolTip()
Extends default impl to set white background.
createToolTip in class javax.swing.JComponentpublic void environmentChanged(Environment environment)
Implements EnvironmentListener.environmentChanged(shady.common.Environment).
environmentChanged in interface EnvironmentListenerenvironment - the Environment that changed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||