jvx.imageDisplay
Class PvImageDisplay
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.imageDisplay.PvImageDisplay
-
- All Implemented Interfaces:
- java.awt.event.ComponentListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, PsUpdateIf, PvCameraListenerIf
public class PvImageDisplay extends PsObject implements java.awt.event.ComponentListener, PvCameraListenerIf
Wrapper of a JavaView display provides interaction with the background image. The background image will be computed in an image source and assigned to the display. Camera interaction is handled and allows zooming, translation and rect-zoom into the image.- See Also:
- Serialized Form
- Author:
- Konrad Polthier
- Version:
- 05.11.16, 1.00 revised (kp) Better integration in project handling
24.03.11, 1.00 created (kp)
-
-
Field Summary
-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
-
Constructor Summary
Constructors Constructor and Description PvImageDisplay()Constructor creates a new display and some sliders.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcomponentHidden(java.awt.event.ComponentEvent comp)Invoked when component has been hidden.voidcomponentMoved(java.awt.event.ComponentEvent comp)Invoked when component has been moved.voidcomponentResized(java.awt.event.ComponentEvent comp)When component has been resized all images must be resized.voidcomponentShown(java.awt.event.ComponentEvent comp)Invoked when component has been shown.static PdVectorcomputeDomainBounds(java.awt.Dimension size, PdVector interest, double dist)Compute new viewport in xy-plane centered at given interest and dimensions.voiddragCamera(PvCameraEvent event)Get camera position and viewing direction when a mouse drag event has occurred.doublegetDistance()Get distance of camera to z=0-plane.PvDisplayIfgetImageDisplay()Get image display.doublegetImageSize()Get image size factor, i.e. the ratio of image size to canvas size.PiImageSourcegetImageSource()Get image source.PdVectorgetInterest()Get interest of camera.voidinit()Performed default initialization.voidpickCamera(PvCameraEvent event)Get camera position and viewing direction when a mouse pressed event has occurred.voidreset()Called when project is launched by project start method.voidsetDistance(double distance)Set distance of camera to z=0-plane.voidsetImageDisplay(PvDisplayIf disp)Set image display.voidsetImageSize(double factor)Set image size factor, i.e. the ratio of image size to canvas size.voidsetImageSource(PiImageSource imageSource)Set image source.voidsetInterest(PdVector interest)Set interest of camera.voidstart()Performs further initialization of this display.booleanupdate(java.lang.Object event)Update the class whenever a child has changed.-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jv.project.PvCameraListenerIf
getName
-
-
-
-
Constructor Detail
-
PvImageDisplay
public PvImageDisplay()
Constructor creates a new display and some sliders.
-
-
Method Detail
-
start
public void start()
Performs further initialization of this display. Should be called when parent project is started by viewer.
-
reset
public void reset()
Called when project is launched by project start method.
-
update
public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.- Specified by:
updatein interfacePsUpdateIf- Overrides:
updatein classPsObject- Parameters:
event- carries a lot of information- Returns:
- true if event has been handled, otherwise false
- See Also:
PsObject.setParent(PsUpdateIf),PsObject.getFather(),PsObject.addUpdateListener(PsUpdateIf)
-
getImageDisplay
public PvDisplayIf getImageDisplay()
Get image display.
-
setImageDisplay
public void setImageDisplay(PvDisplayIf disp)
Set image display.
-
getImageSource
public PiImageSource getImageSource()
Get image source.
-
setImageSource
public void setImageSource(PiImageSource imageSource)
Set image source.
-
getInterest
public PdVector getInterest()
Get interest of camera.- Returns:
- interest of camera
-
setInterest
public void setInterest(PdVector interest)
Set interest of camera.- Parameters:
interest- interest of camera
-
getDistance
public double getDistance()
Get distance of camera to z=0-plane.- Returns:
- distance of camera to z=0-plane
-
setDistance
public void setDistance(double distance)
Set distance of camera to z=0-plane.- Parameters:
distance- distance of camera to z=0-plane
-
getImageSize
public double getImageSize()
Get image size factor, i.e. the ratio of image size to canvas size.A factor 1 means that the image has same size than the canvas, resp. a factor 0.5. means that the image is half the size of the canvas, leading to larger pixelization effects but also to a faster computation.
- Returns:
- ratio of image size to canvas size
-
setImageSize
public void setImageSize(double factor)
Set image size factor, i.e. the ratio of image size to canvas size.A factor 1 means that the image has same size than the canvas, resp. a factor 0.5. means that the image is half the size of the canvas, leading to larger pixelization effects but also to a faster computation.
- Parameters:
factor- ratio of image size to canvas size
-
componentShown
public void componentShown(java.awt.event.ComponentEvent comp)
Invoked when component has been shown.- Specified by:
componentShownin interfacejava.awt.event.ComponentListener
-
componentHidden
public void componentHidden(java.awt.event.ComponentEvent comp)
Invoked when component has been hidden.- Specified by:
componentHiddenin interfacejava.awt.event.ComponentListener
-
componentMoved
public void componentMoved(java.awt.event.ComponentEvent comp)
Invoked when component has been moved.- Specified by:
componentMovedin interfacejava.awt.event.ComponentListener
-
componentResized
public void componentResized(java.awt.event.ComponentEvent comp)
When component has been resized all images must be resized.- Specified by:
componentResizedin interfacejava.awt.event.ComponentListener
-
dragCamera
public void dragCamera(PvCameraEvent event)
Get camera position and viewing direction when a mouse drag event has occurred. No pick information about geometry is supplied.- Specified by:
dragCamerain interfacePvCameraListenerIf- Parameters:
event- Drag event issued by the display- See Also:
PvCameraListenerIf
-
pickCamera
public void pickCamera(PvCameraEvent event)
Get camera position and viewing direction when a mouse pressed event has occurred. No pick information about geometry is supplied.- Specified by:
pickCamerain interfacePvCameraListenerIf- Parameters:
event- Pick event issued by the display- See Also:
PvCameraListenerIf
-
computeDomainBounds
public static PdVector computeDomainBounds(java.awt.Dimension size, PdVector interest, double dist)
Compute new viewport in xy-plane centered at given interest and dimensions. Dimension of new viewport is computed based on given aspect ratio, interest and distance of camera.- Parameters:
size- current size of display, used to compute aspect ratiointerest- camera interest, xy-coordinates useddist- camera distance- Version:
- 16.07.13, 1.10 revised (kp) Effect of y-move inverted i.e. corrected.
-
-
"