jhplot
Class HVisAd
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
public class HVisAdextends JFrame
Interactive canvas for visualizing and experimenting with a variety of mathematical objects in 2D and 3D using the VisAd environment.- See Also:
- Serialized Form
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Window
Window.Type
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
Field Summary
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor Summary
Constructors Constructor and Description HVisAd()
Construct a 3D canvas with a plot with the default parameters.HVisAd(String title)
Construct a 3D canvas with a plot with the default parameters.HVisAd(String title, boolean is3D)
Create 2D/3D canvas based on VisAd classes.HVisAd(String title, int xsize, int ysize)
Create 3D canvas based on VisAd classes.HVisAd(String title, int xsize, int ysize, boolean is3D)
Create 2D/3D canvas based on VisAd classes.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
clear()
Clear the current graph including graph settings.void
close()
Close the canvas (and dispose all components) Note: a memory leak is found - no time to study it.void
doc()
Show online documentation.void
draw(float[][] ntuple)
Draw 3D data points.void
draw(float[][] ntuple, String title)
Draw 3D data points.void
draw(P2D p)
Draw 3D data points.void
export(String filename)
Export graph into an image file.void
export(String filename, int width, int height)
Export graph into an image file.GraphicsModeControl
getControl()
Get control of this display.DisplayImpl
getDisplay()
Get current display.MouseBehavior
getMouse()
Get mouse behaviour.ProjectionControl
getProjection()
Get current projection.DisplayRenderer
getRender()
Get render of this display.double[]
getRotation()
Get the rotation angles in degrees.double
getScaling()
Get the scaling.double[]
getTranslation()
Get the translation.void
help()
ArrayList<AxisScale>
setAxes(String nameX, double minX, double maxX, String nameY, double minY, double maxY, String nameZ, double minZ, double maxZ)
Attach axes to the canvas, and snap them o the box.void
setRotation(double rotX, double rotY, double rotZ)
Set the rotation angles in degrees.void
setScaling(double scale)
Set the scaling of the box.void
setTranslation(double X, double Y, double Z)
Set the translation (0-1 values)void
update()
Update the canvasvoid
visible()
Show the canvasvoid
visible(boolean vs)
Set the canvas frame visible or notMethods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
Constructor Detail
HVisAd
public HVisAd(String title, int xsize, int ysize, boolean is3D)
Create 2D/3D canvas based on VisAd classes.- Parameters:
xsize
- size in x directionysize
- size in y directiontitle
- name of this canvas.is3D
- set to true for 3D canvas. If false, assume 2D.
HVisAd
public HVisAd(String title, int xsize, int ysize)
Create 3D canvas based on VisAd classes.- Parameters:
xsize
- size in x directionysize
- size in y directiontitle
- name of this canvas.
HVisAd
public HVisAd(String title, boolean is3D)
Create 2D/3D canvas based on VisAd classes.- Parameters:
title
- name of this canvas.is3D
- set to true for 3D canvas. If false, assume 2D.
HVisAd
public HVisAd()
Construct a 3D canvas with a plot with the default parameters. It assumes 600x600 size and 3D display.
HVisAd
public HVisAd(String title)
Construct a 3D canvas with a plot with the default parameters. It assumes 600x400 size and 3D display.- Parameters:
title
- name of this canvas.
Method Detail
getDisplay
public DisplayImpl getDisplay()
Get current display.- Returns:
- current display
setScaling
public void setScaling(double scale)
Set the scaling of the box.- Parameters:
scale
- factor
getScaling
public double getScaling()
Get the scaling.- Returns:
- scaling factor.
setRotation
public void setRotation(double rotX, double rotY, double rotZ)
Set the rotation angles in degrees.- Parameters:
rotX
- rotation in XrotY
- rotation in YrotZ
- rotation in Z
setTranslation
public void setTranslation(double X, double Y, double Z)
Set the translation (0-1 values)- Parameters:
X
- translate in XY
- translate in YZ
- translate in Z
getRotation
public double[] getRotation()
Get the rotation angles in degrees.- Returns:
- rotation in X, Y,Z
getTranslation
public double[] getTranslation()
Get the translation.- Returns:
- translation in X, Y,Z
getProjection
public ProjectionControl getProjection()
Get current projection.- Returns:
- current projection.
getMouse
public MouseBehavior getMouse()
Get mouse behaviour.- Returns:
- current behaviour of mouse.
getControl
public GraphicsModeControl getControl()
Get control of this display.- Returns:
- control
getRender
public DisplayRenderer getRender()
Get render of this display.- Returns:
- render class.
clear
public void clear()
Clear the current graph including graph settings. Note: the current graph is set by the cd() method
close
public void close()
Close the canvas (and dispose all components) Note: a memory leak is found - no time to study it. set to null all the stuff
draw
public void draw(P2D p)
Draw 3D data points.- Parameters:
p
- input array
draw
public void draw(float[][] ntuple)
Draw 3D data points.- Parameters:
p3d
- input array
draw
public void draw(float[][] ntuple, String title)
Draw 3D data points.- Parameters:
p3d
- input arraytitle
- title
setAxes
public ArrayList<AxisScale> setAxes(String nameX, double minX, double maxX, String nameY, double minY, double maxY, String nameZ, double minZ, double maxZ)
Attach axes to the canvas, and snap them o the box. You can also set min and max values for the axis.- Parameters:
nameX
- Label for X axisminX
- min value of XmaxX
- max value of XnameY
- Label for Y axisminY
- min value of YmaxY
- max value of YnameZ
- Label of Z axisminZ
- min value on ZmaxZ
- max value on Z- Returns:
- array with 3 objects, which represent AxisScale to redefine axes.
visible
public void visible(boolean vs)
Set the canvas frame visible or not- Parameters:
vs
- (boolean) true: visible, false: not visible
update
public void update()
Update the canvas
visible
public void visible()
Show the canvas
doc
public void doc()
Show online documentation.
export
public void export(String filename)
Export graph into an image file. The the image format is given by extension. "png", "jpg", "eps", "pdf", "svg". In case of "eps", "pdf" and "svg", vector graphics is used.- Parameters:
file
- name of the image
export
public void export(String filename, int width, int height)
Export graph into an image file. The the image format is given by extension. "png", "jpg", "eps", "pdf", "svg". In case of "eps", "pdf" and "svg", vector graphics is used.- Parameters:
filename
- file namewidth
- widthheight
- hight
help
public void help()
DMelt 2.7 © DataMelt by jWork.ORG