public abstract class View extends Object
Modifier and Type | Field and Description |
---|---|
protected Timer |
activeRepaintTimer |
static String |
ANONYMOUS
Anonymous view.
|
VCursor |
mouse
mouse glyph
|
protected String |
name
View name
|
static String |
OPENGL_VIEW
ZVTM view based on Java 5's OpenGL rendering pipeline; does accelerate rendering but requires a JVM 1.5 or later.
|
static String |
STD_VIEW
Standard ZVTM view, with no particular acceleration method
|
Constructor and Description |
---|
View() |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activating the view means that repainting will be enabled on it.
|
Location |
centerOnGlyph(Glyph g,
Camera c,
int d)
Translates and (un)zooms a camera in order to focus on glyph g
The camera must be used in this view.
|
Location |
centerOnGlyph(Glyph g,
Camera c,
int d,
boolean z)
Translates and (un)zooms a camera in order to focus on glyph g
The camera must be used in this view.
|
Location |
centerOnGlyph(Glyph g,
Camera c,
int d,
boolean z,
float mFactor)
Translates and (un)zooms a camera in order to focus on glyph g
The camera must be used in this view.
|
Location |
centerOnGlyph(Glyph g,
Camera c,
int d,
boolean z,
float mFactor,
EndAction endAction)
Translates and (un)zooms a camera in order to focus on glyph g
The camera must be used in this view.
|
Location |
centerOnRegion(Camera c,
int d,
double x1,
double y1,
double x2,
double y2)
Translates and (un)zooms a camera in order to focus on a specific rectangular region
The camera must be used in this view.
|
Location |
centerOnRegion(Camera c,
int d,
double x1,
double y1,
double x2,
double y2,
EndAction ea)
Translates and (un)zooms a camera in order to focus on a specific rectangular region
The camera must be used in this view.
|
protected void |
close()
Called from the window listener when the window is closed.
|
void |
deactivate()
Deactivating the view means that repainting will be disabled on it.
|
void |
destroyView()
Destroy this view.
|
Point2D.Double |
fromPanelToVSCoordinates(int x,
int y,
Camera c,
Point2D.Double res)
Transform coordinates from screen space (JPanel coordinates) to VirtualSpace.
|
Point |
fromVSToPanelCoordinates(double vx,
double vy,
Camera c,
Point res)
Transform coordinates from VirtualSpace to screen space (JPanel coordinates).
|
Camera |
getActiveCamera()
Get Camera corresponding to layer currently active (getting events).
|
int |
getActiveLayer()
Get index of layer (camera) currently active (getting events).
|
boolean |
getAntialiasing()
Get the value of the antialias rendering hint for this View.
|
Color |
getBackgroundColor()
Get background color of this view.
|
Camera |
getCameraNumber(int i)
Get Camera for layer i.
|
VCursor |
getCursor()
Get this View's cursor object.
|
boolean |
getDetectMultiFills()
Tells whether detection of multiple full fills in one view repaint is enabled or not for this View.
|
abstract Component |
getFrame()
Get the java.awt.Component for this View.
|
Location |
getGlobalView(Camera c)
Get the location from which a camera will see everything visible in the associated virtual space.
|
Location |
getGlobalView(Camera c,
float mFactor)
Get the location from which a camera will see all glyphs visible in the associated virtual space.
|
Location |
getGlobalView(Camera c,
int d)
Translates and (un)zooms a camera in order to see everything visible in the associated virtual space.
|
Location |
getGlobalView(Camera c,
int d,
float mFactor)
Translates and (un)zooms a camera in order to see everything visible in the associated virtual space.
|
Graphics2D |
getGraphicsContext()
Get access to the panel's AWT Graphics object.
|
BufferedImage |
getImage()
Get an image of what is visible in this view, by calling getImage on the JComponent.
|
Java2DPainter |
getJava2DPainter(short g)
Get the implementation of the paint method (containing Java2D paint instructions) that will be called each time the view is repainted.
|
int |
getLayerCount()
Get the number of layers (cameras) in this View.
|
boolean[][] |
getLayerVisibility()
Get the visibility of each layer in the context and lens regions of a view.
|
Lens |
getLens()
Get Lens currently active in this view
|
String |
getName()
Get the View's name.
|
boolean |
getNotifyCursorMoved()
Tells whether the mouseMoved callback in ViewListener is triggered when the mouse is moved.
|
ViewPanel |
getPanel()
Get the ViewPanel associated with this View.
|
static PanelFactory |
getPanelFactory(String ptID)
Two panel types/factories are available in zvtm-core:
View.STD_VIEW:double-buffered panel, drawing in an offscreen BufferedImage, supports lenses
View.OPENGL_VIEW: direct rendering on screen, works with Sun's OpenGL Java2D rendering pipeline
|
Dimension |
getPanelSize()
Get the dimensions of the ZVTM panel embedded in this View.
|
int |
getRefreshRate()
Get this View's refresh rate.
|
String |
getViewType()
Get view type.
|
int[] |
getVisibilityPadding(int layer)
Get the padding values customizing the region inside the view in which objects are actually visible.
|
double[] |
getVisibleRegion(Camera c)
Get bounds of rectangular region of the VirtualSpace seen through a camera.
|
double[] |
getVisibleRegion(Camera c,
double[] res)
Get bounds of rectangular region of the VirtualSpace seen through a camera.
|
double |
getVisibleRegionHeight(Camera c)
Get height of rectangular region of the VirtualSpace seen through a camera.
|
double |
getVisibleRegionWidth(Camera c)
Get width of rectangular region of the VirtualSpace seen through a camera.
|
Color |
isBlank()
Says whether a view is in blank mode or not.
|
abstract boolean |
isSelected() |
BufferedImage |
rasterize(int w,
int h)
Ask for a bitmap rendering of this view and return the resulting BufferedImage.
|
BufferedImage |
rasterize(int w,
int h,
Vector<Camera> layers)
Ask for a bitmap rendering of this view and return the resulting BufferedImage.
|
static boolean |
registerViewPanelFactory(String ptID,
PanelFactory pf)
Declare a new type of panel to draw on in a View.
|
void |
removeRepaintListener()
Remove the repaint listener associated with this view.
|
void |
repaint()
Ask for the view to be repainted.
|
void |
repaint(RepaintListener rl)
Ask for the view to be repainted.
|
void |
setActiveLayer(Camera cam)
Sets which layer (camera) is currently active (getting events).
|
void |
setActiveLayer(int i)
Set which layer (camera) is currently active (getting events).
|
void |
setActiveRepaintInterval(int timeMillis)
Sets the active repaint interval for this View.
|
void |
setAntialiasing(boolean b)
Set antialias rendering hint for this View.
|
void |
setBackgroundColor(Color c)
Set background color for this View.
|
void |
setBlank(Color c)
Make a view blank.
|
void |
setCursorIcon(Cursor c)
Set the cursor for this view.
|
void |
setCursorIcon(int cursorType)
Set the cursor for this View.
|
void |
setDetectMultiFills(boolean b)
Enable/disable detection of multiple full fills in one view repaint for this View.
|
void |
setJava2DPainter(Java2DPainter p,
short g)
Set a paint method (containing Java2D paint instructions) that will be called each time the view is repainted.
|
void |
setLayerVisibility(boolean[] context,
boolean[] lens)
Set the visibility of each layer in the context and lens regions of a view.
|
Lens |
setLens(Lens l)
Activate a lens in this view.
|
void |
setListener(ViewListener eh)
Set application class instance to which events are sent for all layers in this view.
|
void |
setListener(ViewListener eh,
Camera cam)
Sets the ViewListener instance to which events are sent for a
given layer.
|
void |
setListener(ViewListener eh,
int layer)
Set application class instance to which events are sent for a given layer.
|
abstract void |
setLocation(int x,
int y)
Moves this component to a new location.
|
void |
setNotifyCursorMoved(boolean b)
Sets whether the mouseMoved callback in ViewListener is triggered when the cursor moves.
|
void |
setRefreshRate(int rr)
Set this View's refresh rate.
|
abstract void |
setResizable(boolean resizable)
Sets whether this View is resizable by the user.
|
abstract void |
setSize(int width,
int height)
Resizes this component so that it has width width and height height.
|
void |
setStatusBarFont(Font f)
Set font used in status bar text.
|
void |
setStatusBarForeground(Color c)
Set color used for status bar text.
|
void |
setStatusBarText(String s)
Set status bar text.
|
abstract void |
setTitle(String t)
Sets the title for this frame to the specified string.
|
void |
setVisibilityPadding(int[] wnesPadding,
int layer)
Set the padding values customizing the region inside the view in which objects are actually visible.
|
abstract void |
setVisible(boolean b)
Shows or hides this View depending on the value of parameter b.
|
void |
updateFont()
Update default font used in this View.
|
protected final Timer activeRepaintTimer
public static final String ANONYMOUS
public static final String STD_VIEW
public static final String OPENGL_VIEW
public VCursor mouse
protected String name
public static boolean registerViewPanelFactory(String ptID, PanelFactory pf)
ptID
- unique ID identifying the new panel type. This is the ID passed to view creation methods (viewType) to specifiy the type of view.pf
- a class that can make new instances of the corresponding ViewPanel, to be included in the View.public static PanelFactory getPanelFactory(String ptID)
ptID
- unique ID identifying the new panel type. This is the ID passed to view creation methods (viewType) to specifiy the type of view.public String getViewType()
registerViewPanelFactory(String ptID, PanelFactory pf)
public void setActiveRepaintInterval(int timeMillis)
timeMillis
- active repaint interval, in milliseconds.
if <= 0, active repaint will be disabled.public VCursor getCursor()
public ViewPanel getPanel()
public void destroyView()
public abstract Component getFrame()
public void setCursorIcon(int cursorType)
cursorType
- any of the cursor type values declared in java.awt.Cursor, such as DEFAULT_CURSOR, CROSSHAIR_CURSOR HAND_CURSOR, etc. To get the ZVTM cursor, use Cursor.CUSTOM_CURSOR.setCursorIcon(Cursor c)
public void setCursorIcon(Cursor c)
c
- an AWT cursor instantiated e.g. by calling java.awt.Toolkit.createCustomCursor(Image cursor, Point hotSpot, String name)setCursorIcon(int cursorType)
public void setListener(ViewListener eh)
eh
- client application implementation of ViewListenerpublic void setListener(ViewListener eh, int layer)
eh
- client application implementation of ViewListenerlayer
- depth of layer to which the event handler should be associated.public void setListener(ViewListener eh, Camera cam)
eh
- client application implementation of ViewListenercam
- Camera to which the event handler should be associated.public void setNotifyCursorMoved(boolean b)
b
- true to be notified about cursor move events, false otherwise.public boolean getNotifyCursorMoved()
public void setStatusBarText(String s)
s
- text to be displayed.public void setStatusBarFont(Font f)
f
- font to be used.public void setStatusBarForeground(Color c)
c
- Color used to paint the status bar message.public void setDetectMultiFills(boolean b)
b
- true to enable, false to disable.getDetectMultiFills()
public boolean getDetectMultiFills()
setDetectMultiFills(boolean b)
public double[] getVisibleRegion(Camera c)
c
- camerapublic double[] getVisibleRegion(Camera c, double[] res)
c
- camerares
- array which will contain the resultpublic double getVisibleRegionWidth(Camera c)
c
- camerapublic double getVisibleRegionHeight(Camera c)
c
- camerapublic void setActiveLayer(int i)
i
- layer index. 0 is the deepest layer (first camera given in the Vector at construction time).public void setActiveLayer(Camera cam)
cam
- a Camera
that represents the active layer.public int getActiveLayer()
public int getLayerCount()
public void updateFont()
public void setAntialiasing(boolean b)
b
- true to enable, false to disable.public boolean getAntialiasing()
public Camera getCameraNumber(int i)
i
- layer index. 0 is the deepest layer (first Camera given in the Vector at construction time).public Camera getActiveCamera()
public void setBackgroundColor(Color c)
c
- background color.public Color getBackgroundColor()
public abstract boolean isSelected()
public abstract void setTitle(String t)
t
- - the title to be displayed in the frame's border. A null value is treated as an empty string, "".public abstract void setLocation(int x, int y)
x
- the x-coordinate of the new location's top-left corner in the parent's coordinate spacey
- the y-coordinate of the new location's top-left corner in the parent's coordinate spacepublic abstract void setSize(int width, int height)
width
- - the new width of this component in pixelsheight
- - the new height of this component in pixelspublic Dimension getPanelSize()
public abstract void setResizable(boolean resizable)
resizable
- - true if this frame is resizable; false otherwise.public abstract void setVisible(boolean b)
b
- true to show, false to hide.public void setRefreshRate(int rr)
rr
- refresh rate in milleseconds (positive integer).public int getRefreshRate()
public void setBlank(Color c)
c
- blank color (will fill the entire view) - pass null to exit blank mode.public Color isBlank()
public void activate()
ViewListener.viewActivated(View v)
public void deactivate()
ViewListener.viewDeactivated(View v)
protected void close()
ViewListener.viewClosing(View v)
public void repaint()
repaint(RepaintListener rl)
public void repaint(RepaintListener rl)
rl
- a repaint listener, to get notified when this repaint cycle is completed. The listener must be removed manually
if you are not interested in being notified about following repaint cycles.repaint()
,
removeRepaintListener()
public void removeRepaintListener()
repaint(RepaintListener rl)
public Graphics2D getGraphicsContext()
public BufferedImage getImage()
rasterize(int w, int h)
,
rasterize(int w, int h, Vector layers)
public BufferedImage rasterize(int w, int h)
w
- width of rendered imageh
- height of rendered imagerasterize(int w, int h, Vector layers)
,
getImage()
public BufferedImage rasterize(int w, int h, Vector<Camera> layers)
w
- width of rendered imageh
- height of rendered imagelayers
- Vector of cameras : what layers (represented by cameras) of this view should be rendered (you can pass null for all layers)rasterize(int w, int h)
,
getImage()
public void setJava2DPainter(Java2DPainter p, short g)
p
- the paint method encapsulated in an object implementing the Java2DPainter interface (pass null to unset an existing one)g
- one of Java2DPainter.BACKGROUND, Java2DPainter.FOREGROUND, Java2DPainter.AFTER_DISTORTION, Java2DPainter.AFTER_PORTALS depending on whether the method should be called before or after ZVTM glyphs have been painted, after distortion by a lens (FOREGROUND and AFTER_DISTORTION are equivalent in the absence of lens), or after portals have been paintedpublic Java2DPainter getJava2DPainter(short g)
g
- one of Java2DPainter.BACKGROUND, Java2DPainter.FOREGROUND, Java2DPainter.AFTER_DISTORTION, Java2DPainter.AFTER_PORTALS depending on whether the method should be called before or after ZVTM glyphs have been painted, after distortion by a lens (FOREGROUND and AFTER_DISTORTION are equivalent in the absence of lens), or after portals have been paintedpublic String getName()
public void setLayerVisibility(boolean[] context, boolean[] lens)
context
- an array with booleans, one for each layer from 0 to N. True (default) means that the layer will be rendered in the context region, false that it will not.lens
- an array with booleans, one for each layer from 0 to N. True (default) means that the layer will be rendered in the lens region, false that it will not.public boolean[][] getLayerVisibility()
public void setVisibilityPadding(int[] wnesPadding, int layer)
wnesPadding
- padding values in pixels for the west, north, east and south borderslayer
- the layer to which these padding settings should be applied.public int[] getVisibilityPadding(int layer)
layer
- the layer for which padding settings are requested.public Lens setLens(Lens l)
l
- the lens instance. Pass null to remove an existing lens.public Lens getLens()
public Location getGlobalView(Camera c, float mFactor)
c
- camera considered (will not be moved)mFactor
- magnification factor - 1.0 (default) means that the glyphs will occupy the whole screen. mFactor > 1 will zoom out from this default location. mFactor < 1 will do the oppositegetGlobalView(Camera c, int d)
,
getGlobalView(Camera c)
,
getGlobalView(Camera c, int d, float mFactor)
public Location getGlobalView(Camera c, int d)
c
- Camera to be moved (will actually be moved)d
- duration of the animation in msgetGlobalView(Camera c)
,
getGlobalView(Camera c, int d, float mFactor)
,
getGlobalView(Camera c, float mFactor)
public Location getGlobalView(Camera c, int d, float mFactor)
c
- Camera to be moved (will actually be moved)d
- duration of the animation in msmFactor
- magnification factor - 1.0 (default) means that the glyphs will occupy the whole screen. mFactor > 1 will zoom out from this default location. mFactor < 1 will do the oppositegetGlobalView(Camera c)
,
getGlobalView(Camera c, int d)
,
getGlobalView(Camera c, float mFactor)
public Location getGlobalView(Camera c)
c
- camera considered (will not be moved)getGlobalView(Camera c, int d)
,
getGlobalView(Camera c, int d, float mFactor)
,
getGlobalView(Camera c, float mFactor)
public Location centerOnGlyph(Glyph g, Camera c, int d, boolean z, float mFactor, EndAction endAction)
g
- Glyph of interestc
- Camera to be movedd
- duration of the animation in msz
- if false, do not (un)zoom, just translate (default is true)mFactor
- magnification factor: 1.0 (default) means that the glyph will occupy the whole screen. mFactor > 1 will make the glyph smaller (zoom out). mFactor < 1 will make the glyph appear bigger (zoom in).endAction
- end action to execute after camera reaches its final positionpublic Location centerOnGlyph(Glyph g, Camera c, int d)
g
- Glyph of interestc
- Camera to be movedd
- duration of the animation in mspublic Location centerOnGlyph(Glyph g, Camera c, int d, boolean z)
g
- Glyph of interestc
- Camera to be movedd
- duration of the animation in msz
- if false, do not (un)zoom, just translate (default is true)public Location centerOnGlyph(Glyph g, Camera c, int d, boolean z, float mFactor)
g
- Glyph of interestc
- Camera to be movedd
- duration of the animation in msz
- if false, do not (un)zoom, just translate (default is true)mFactor
- magnification factor: 1.0 (default) means that the glyph will occupy the whole screen. mFactor > 1 will make the glyph smaller (zoom out). mFactor < 1 will make the glyph appear bigger (zoom in).public Location centerOnRegion(Camera c, int d, double x1, double y1, double x2, double y2)
c
- Camera to be movedd
- duration of the animation in ms (pass 0 to go there instantanesouly)x1
- x coord of first pointy1
- y coord of first pointx2
- x coord of opposite pointy2
- y coord of opposite pointpublic Location centerOnRegion(Camera c, int d, double x1, double y1, double x2, double y2, EndAction ea)
c
- Camera to be movedd
- duration of the animation in ms (pass 0 to go there instantanesouly)x1
- x coord of first pointy1
- y coord of first pointx2
- x coord of opposite pointy2
- y coord of opposite pointea
- action to be performed at end of animationpublic Point2D.Double fromPanelToVSCoordinates(int x, int y, Camera c, Point2D.Double res)
x
- source x-coord (from upper-left corner of Swing Component)y
- source y-coord (from upper-left corner of Swing Component)c
- the camera in this view observing the corresponding VirtualSpaceres
- an instance of Point2D that will hold the transformation's resultfromVSToPanelCoordinates(double vx, double vy, Camera c, Point res)
public Point fromVSToPanelCoordinates(double vx, double vy, Camera c, Point res)
vx
- source x-coord in VirtualSpacevy
- source y-coord in VirtualSpacec
- the camera in this view observing the corresponding VirtualSpaceres
- an instance of Point that will hold the transformation's resultfromPanelToVSCoordinates(int x, int y, Camera c, Point2D.Double res)
Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2015 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.