|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.inria.zvtm.engine.View
public abstract class View
A view is a window and can be composed of one or several cameras superimposed - use EView or IView
A view is repainted on a regular basis when active - for inactive views, the default is to repaint only if the mouse is inside the view (but the frame is not selected) - this can be changed to repaint the view automatically even if it is not selected and if the mouse is not inside, using setRepaintPolicy()
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
View()
|
|
| Method Summary | |
|---|---|
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. |
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. |
Vector<Glyph> |
getGlyphsInRegion(double x1,
double y1,
double x2,
double y2,
String vsn,
int wg)
Get glyphs whose hotspot is in region delimited by rectangle (x1,y1,x2,y2) in VirtualSpace vs. |
Graphics |
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. |
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 - default is 25. |
int[] |
getVisibilityPadding()
Get the padding values customizing the region inside the view for 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. |
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 - default is 25. |
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)
Set a padding for customizing the region inside the view for 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public View()
| Method Detail |
|---|
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 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 ViewListener
public 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)
public boolean getNotifyCursorMoved()
public void setStatusBarText(String s)
public void setStatusBarFont(Font f)
public void setStatusBarForeground(Color c)
public void setDetectMultiFills(boolean b)
getDetectMultiFills()public boolean getDetectMultiFills()
setDetectMultiFills(boolean b)public double[] getVisibleRegion(Camera c)
c - camera
public double[] getVisibleRegion(Camera c,
double[] res)
c - camerares - array which will contain the result
public double getVisibleRegionWidth(Camera c)
c - camera
public double getVisibleRegionHeight(Camera c)
c - camera
public 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)
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)
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 space
public 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)
public void setRefreshRate(int rr)
rr - positive integer (refresh rate in milliseconds)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 Graphics 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 image
rasterize(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 painted
public String getName()
public void setVisibilityPadding(int[] wnesPadding)
wnesPadding - padding values in pixels for the west, north, east and south borderspublic int[] getVisibilityPadding()
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 opposite
getGlobalView(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 ms
getGlobalView(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 opposite
getGlobalView(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 position
public Location centerOnGlyph(Glyph g,
Camera c,
int d)
g - Glyph of interestc - Camera to be movedd - duration of the animation in ms
public 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 point
public 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 animation
public Vector<Glyph> getGlyphsInRegion(double x1,
double y1,
double x2,
double y2,
String vsn,
int wg)
x1 - x coord of first pointy1 - y coord of first pointx2 - x coord of opposite pointy2 - y coord of opposite pointvsn - name of virtual spacewg - which glyphs in the region should be returned (among VIS_AND_SENS_GLYPHS (default), VISIBLE_GLYPHS, SENSIBLE_GLYPHS, ALL_GLYPHS)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||