|
||||||||||
| 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
jview.JNormalizedCanvas
jview.JViewportCanvas
public class JViewportCanvas
A shape canvas is used to draw shapes into a pre-defined area. The entire
space available to this component is splitted into a frame and a drawable
area. It allows saving of the component as an image file using the JDK's 1.4
javax.imageio.ImageIO package. For convenience, methods are povided
to allow adding of Shapes to the canvas which are draw in the
JComponent.paint(java.awt.Graphics) method.
| Nested Class Summary | |
|---|---|
static class |
JViewportCanvas.Test
A test class aiming for saving of the image data. |
static class |
JViewportCanvas.ViewportKey
The class that allows selecting of only a portion of an JViewport
. |
| Nested classes/interfaces inherited from class jview.JNormalizedCanvas |
|---|
JNormalizedCanvas.ShowImage |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private List<ViewportTransferring> |
attach
The list of attached ViewportTransferring objects. |
static Rectangle2D |
MAXVIEW
The maximum active viewport, which is 0,0,1,1. |
private BufferedImage |
viewground
If we set an image that should stay the background of any viewport. |
private Rectangle2D |
viewport
The current visible viewport in natural coordinates. |
static String |
VIEWPORTIMAGEPROPERTY
The name of the view port image property. |
static String |
VIEWPORTPROPERTY
The name of the view port property. |
| 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 | |
|---|---|
JViewportCanvas(ResourceSupplying prop)
Constructs a new shape canvas with the provided property container. |
|
| Method Summary | |
|---|---|
void |
addAttachedViewport(ViewportTransferring ear)
Adds a new ViewportTransferring instance to the notification list
of zoom changes. |
static void |
addZoom(JViewportCanvas jtf)
Add a zoom cursor to the data canvas. |
protected AffineTransform |
calculateShapeTransform()
Returns the affine transformation used to scale and shift shapes defined for 0,0 uper left corner and a 1x1 drawing size to the currently visible viewport and to the current size of the drawable area. |
Rectangle2D |
getViewport()
Returns the currently active viewport. |
BufferedImage |
getViewportImage()
Returns the background image. |
void |
init()
Initializes the shape canvas. |
boolean |
isMaximalViewport(Rectangle2D rec)
Returns true, if the viewport is the maximum viewport. |
boolean |
isNormalizedOnScreen(Point2D visible)
Test if this normalized pixel is related to a on-screen pixel that is within the drawable region. |
protected void |
prepareCanvas(Graphics g)
Prepares the canvas for drawing the shapes. |
void |
removeAttachedViewport(ViewportTransferring ear)
Removes a ViewportTransferring instance from the notification
list of zoom changes. |
boolean |
resetViewport()
Resets the viewport to show the entrie viewport. |
boolean |
selectArea(Rectangle cursor)
Selects an area from the screen. |
boolean |
selectViewport(Rectangle2D norm)
Selecting the viewport fires a VIEWPORTPROPERTY change. |
void |
setViewportImage(Image img)
Sets the viewport background image. |
protected boolean |
silentlySelectViewport(Rectangle2D newview)
Selecting the viewport is just setting the current viewport. |
void |
transferView(Rectangle2D newview)
Part of viewport selection that transfers the new view to the attaced viewport canvases. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String VIEWPORTPROPERTY
public static final String VIEWPORTIMAGEPROPERTY
public static final Rectangle2D MAXVIEW
private Rectangle2D viewport
private BufferedImage viewground
private List<ViewportTransferring> attach
ViewportTransferring objects.
| Constructor Detail |
|---|
public JViewportCanvas(ResourceSupplying prop)
| Method Detail |
|---|
public void init()
init in interface Initializableinit in class JNormalizedCanvaspublic void setViewportImage(Image img)
public BufferedImage getViewportImage()
public static void addZoom(JViewportCanvas jtf)
protected AffineTransform calculateShapeTransform()
calculateShapeTransform in class JNormalizedCanvaspublic boolean isNormalizedOnScreen(Point2D visible)
isNormalizedOnScreen in interface NormalizedCoordinatesisNormalizedOnScreen in class JNormalizedCanvasvisible - A point in normalized space, 0≤x,y&le1.public Rectangle2D getViewport()
getViewport in interface NormalizedCoordinatesgetViewport in class JNormalizedCanvasZoomablepublic boolean selectViewport(Rectangle2D norm)
VIEWPORTPROPERTY change. Calls
silentlySelectViewport(java.awt.geom.Rectangle2D), then fires a property change. If this
component has some ViewportTransferring instances attached to it,
the newly selected viewport is transported to them after the property
change event has been fired.
selectViewport in interface Zoomablepublic void transferView(Rectangle2D newview)
public void addAttachedViewport(ViewportTransferring ear)
ViewportTransferring instance to the notification list
of zoom changes.
public void removeAttachedViewport(ViewportTransferring ear)
ViewportTransferring instance from the notification
list of zoom changes.
protected boolean silentlySelectViewport(Rectangle2D newview)
public boolean resetViewport()
public boolean selectArea(Rectangle cursor)
selectArea in interface Zoomablepublic boolean isMaximalViewport(Rectangle2D rec)
protected void prepareCanvas(Graphics g)
prepareCanvas in class JNormalizedCanvas
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||