fr.inria.zvtm.engine
Class View

java.lang.Object
  extended by fr.inria.zvtm.engine.View
Direct Known Subclasses:
EView, PView

public abstract class View
extends Object

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()

Author:
Emmanuel Pietriga

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

activeRepaintTimer

protected final Timer activeRepaintTimer

ANONYMOUS

public static final String ANONYMOUS
Anonymous view. Will generate a random name (guaranteed to be unique).

See Also:
Constant Field Values

STD_VIEW

public static final String STD_VIEW
Standard ZVTM view, with no particular acceleration method

See Also:
Constant Field Values

OPENGL_VIEW

public static final String OPENGL_VIEW
ZVTM view based on Java 5's OpenGL rendering pipeline; does accelerate rendering but requires a JVM 1.5 or later. The use of OPENGL_VIEW requires the following Java property: -Dsun.java2d.opengl=true

See Also:
Constant Field Values

mouse

public VCursor mouse
mouse glyph


name

protected String name
View name

Constructor Detail

View

public View()
Method Detail

registerViewPanelFactory

public static boolean registerViewPanelFactory(String ptID,
                                               PanelFactory pf)
Declare a new type of panel to draw on in a View. Two panel types are available in zvtm-core:

Parameters:
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.
Returns:
true if the new view panel type was registered successfully

getPanelFactory

public static PanelFactory getPanelFactory(String ptID)
Two panel types/factories are available in zvtm-core:

Parameters:
ptID - unique ID identifying the new panel type. This is the ID passed to view creation methods (viewType) to specifiy the type of view.
Returns:
an instance of PanelType that can make new instances of the corresponding ViewPanel, to be included in the View.

setActiveRepaintInterval

public void setActiveRepaintInterval(int timeMillis)
Sets the active repaint interval for this View. By default, active repaint is disabled.

Parameters:
timeMillis - active repaint interval, in milliseconds. if <= 0, active repaint will be disabled.

getCursor

public VCursor getCursor()
Get this View's cursor object.


getPanel

public ViewPanel getPanel()
Get the ViewPanel associated with this View.


destroyView

public void destroyView()
Destroy this view.


getFrame

public abstract Component getFrame()
Get the java.awt.Component for this View.


setCursorIcon

public void setCursorIcon(int cursorType)
Set the cursor for this View. Either the ZVTM cursor or one of the default AWT cursors.

Parameters:
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.
See Also:
setCursorIcon(Cursor c)

setCursorIcon

public void setCursorIcon(Cursor c)
Set the cursor for this view. Replaces the ZVTM cursor by a bitmap cursor similar to the default AWT cursors.

Parameters:
c - an AWT cursor instantiated e.g. by calling java.awt.Toolkit.createCustomCursor(Image cursor, Point hotSpot, String name)
See Also:
setCursorIcon(int cursorType)

setListener

public void setListener(ViewListener eh)
Set application class instance to which events are sent for all layers in this view.

Parameters:
eh - client application implementation of ViewListener

setListener

public void setListener(ViewListener eh,
                        int layer)
Set application class instance to which events are sent for a given layer.

Parameters:
eh - client application implementation of ViewListener
layer - depth of layer to which the event handler should be associated.

setListener

public void setListener(ViewListener eh,
                        Camera cam)
Sets the ViewListener instance to which events are sent for a given layer.

Parameters:
eh - client application implementation of ViewListener
cam - Camera to which the event handler should be associated.

setNotifyCursorMoved

public void setNotifyCursorMoved(boolean b)
Sets whether the mouseMoved callback in ViewListener is triggered when the cursor moves. Set to true by default. Applications that do not care about this callback can disable notification about these events to avoid unnecessary callbacks (an event each sent each time the cursor moves).


getNotifyCursorMoved

public boolean getNotifyCursorMoved()
Tells whether the mouseMoved callback in ViewListener is triggered when the mouse is moved. Set to true by default.


setStatusBarText

public void setStatusBarText(String s)
Set status bar text.


setStatusBarFont

public void setStatusBarFont(Font f)
Set font used in status bar text.


setStatusBarForeground

public void setStatusBarForeground(Color c)
Set color used for status bar text.


setDetectMultiFills

public void setDetectMultiFills(boolean b)
Enable/disable detection of multiple full fills in one view repaint for this View. Off by default. If enabled, all glyphs below the higest glyph in the drawing stack that fills the viewport will not be painted, as they will be invisible anyway. This computation has a cost. Assess its usefulness and evaluate performance (there is tradeoff).

See Also:
getDetectMultiFills()

getDetectMultiFills

public boolean getDetectMultiFills()
Tells whether detection of multiple full fills in one view repaint is enabled or not for this View. Off by default.

See Also:
setDetectMultiFills(boolean b)

getVisibleRegion

public double[] getVisibleRegion(Camera c)
Get bounds of rectangular region of the VirtualSpace seen through a camera.

Parameters:
c - camera
Returns:
boundaries in VirtualSpace coordinates {west,north,east,south}

getVisibleRegion

public double[] getVisibleRegion(Camera c,
                                 double[] res)
Get bounds of rectangular region of the VirtualSpace seen through a camera.

Parameters:
c - camera
res - array which will contain the result
Returns:
boundaries in VirtualSpace coordinates {west,north,east,south}

getVisibleRegionWidth

public double getVisibleRegionWidth(Camera c)
Get width of rectangular region of the VirtualSpace seen through a camera.

Parameters:
c - camera
Returns:
width in VirtualSpace coordinates (from west to east boundaries)

getVisibleRegionHeight

public double getVisibleRegionHeight(Camera c)
Get height of rectangular region of the VirtualSpace seen through a camera.

Parameters:
c - camera
Returns:
width in VirtualSpace coordinates (from north to south boundaries)

setActiveLayer

public void setActiveLayer(int i)
Set which layer (camera) is currently active (getting events).

Parameters:
i - layer index. 0 is the deepest layer (first camera given in the Vector at construction time).

setActiveLayer

public void setActiveLayer(Camera cam)
Sets which layer (camera) is currently active (getting events).

Parameters:
cam - a Camera that represents the active layer.

getActiveLayer

public int getActiveLayer()
Get index of layer (camera) currently active (getting events).

Returns:
layer index. 0 is the deepest layer (first camera given in the Vector at construction time).

getLayerCount

public int getLayerCount()
Get the number of layers (cameras) in this View.


updateFont

public void updateFont()
Update default font used in this View.


setAntialiasing

public void setAntialiasing(boolean b)
Set antialias rendering hint for this View.


getAntialiasing

public boolean getAntialiasing()
Get the value of the antialias rendering hint for this View.


getCameraNumber

public Camera getCameraNumber(int i)
Get camera for layer i.

Parameters:
i - layer index. 0 is the deepest layer (first camera given in the Vector at construction time).

getActiveCamera

public Camera getActiveCamera()
Get camera corresponding to layer currently active (getting events).


setBackgroundColor

public void setBackgroundColor(Color c)
Set background color for this View.


getBackgroundColor

public Color getBackgroundColor()
Get background color of this view.


isSelected

public abstract boolean isSelected()

setTitle

public abstract void setTitle(String t)
Sets the title for this frame to the specified string.

Parameters:
t - - the title to be displayed in the frame's border. A null value is treated as an empty string, "".

setLocation

public abstract void setLocation(int x,
                                 int y)
Moves this component to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent.

Parameters:
x - the x-coordinate of the new location's top-left corner in the parent's coordinate space
y - the y-coordinate of the new location's top-left corner in the parent's coordinate space

setSize

public abstract void setSize(int width,
                             int height)
Resizes this component so that it has width width and height height.

Parameters:
width - - the new width of this component in pixels
height - - the new height of this component in pixels

getPanelSize

public Dimension getPanelSize()
Get the dimensions of the ZVTM panel embedded in this View.


setResizable

public abstract void setResizable(boolean resizable)
Sets whether this View is resizable by the user.

Parameters:
resizable - - true if this frame is resizable; false otherwise.

setVisible

public abstract void setVisible(boolean b)
Shows or hides this View depending on the value of parameter b.


setRefreshRate

public void setRefreshRate(int rr)
Set this View's refresh rate - default is 25.

Parameters:
rr - positive integer (refresh rate in milliseconds)

getRefreshRate

public int getRefreshRate()
Get this View's refresh rate - default is 25.


setBlank

public void setBlank(Color c)
Make a view blank. The view is erased and filled with a uniform color.

Parameters:
c - blank color (will fill the entire view) - pass null to exit blank mode.

isBlank

public Color isBlank()
Says whether a view is in blank mode or not.

Returns:
the fill color if in blank mode, null if not in blank mode.

activate

public void activate()
Activating the view means that repainting will be enabled on it. This triggers the viewActivated(View v) callback for the ViewListener associated with the active camera layer in this view.

See Also:
ViewListener.viewActivated(View v)

deactivate

public void deactivate()
Deactivating the view means that repainting will be disabled on it. This triggers the viewDeactivated(View v) callback for the ViewListener associated with the active camera layer in this view.

See Also:
ViewListener.viewDeactivated(View v)

close

protected void close()
Called from the window listener when the window is closed. Repainting is automatically re-enabled. This triggers the viewClosing(View v) callback for the ViewListener associated with the active camera layer in this view.

See Also:
ViewListener.viewClosing(View v)

repaint

public void repaint()
Ask for the view to be repainted. This is an asynchronous call.

See Also:
repaint(RepaintListener rl)

repaint

public void repaint(RepaintListener rl)
Ask for the view to be repainted. This is an asynchronous call.

Parameters:
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.
See Also:
repaint(), removeRepaintListener()

removeRepaintListener

public void removeRepaintListener()
Remove the repaint listener associated with this view.

See Also:
repaint(RepaintListener rl)

getGraphicsContext

public Graphics getGraphicsContext()
Get access to the panel's AWT Graphics object. This can be useful in some cases, for instance to compute the bounds of a text string that has not yet been added to any virtual space. This instance of Graphics should not be tampered with (this will be at your own risks).


getImage

public BufferedImage getImage()
Get an image of what is visible in this view, by calling getImage on the JComponent.

Returns:
a copy of the original offscreen buffer.
See Also:
rasterize(int w, int h), rasterize(int w, int h, Vector layers)

rasterize

public BufferedImage rasterize(int w,
                               int h)
Ask for a bitmap rendering of this view and return the resulting BufferedImage.

Parameters:
w - width of rendered image
h - height of rendered image
Returns:
the resulting buffered image which can then be manipulated and serialized
See Also:
rasterize(int w, int h, Vector layers), getImage()

rasterize

public BufferedImage rasterize(int w,
                               int h,
                               Vector<Camera> layers)
Ask for a bitmap rendering of this view and return the resulting BufferedImage.

Parameters:
w - width of rendered image
h - height of rendered image
layers - Vector of cameras : what layers (represented by cameras) of this view should be rendered (you can pass null for all layers)
Returns:
the resulting buffered image which can then be manipulated and serialized
See Also:
rasterize(int w, int h), getImage()

setJava2DPainter

public void setJava2DPainter(Java2DPainter p,
                             short g)
Set a paint method (containing Java2D paint instructions) that will be called each time the view is repainted.

Parameters:
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 painted

getJava2DPainter

public 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.

Parameters:
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
Returns:
p the paint method encapsulated in an object implementing the Java2DPainter interface (null if not set)

getName

public String getName()
Get the View's name.


setVisibilityPadding

public void setVisibilityPadding(int[] wnesPadding)
Set a padding for customizing the region inside the view for which objects are actually visible.

Parameters:
wnesPadding - padding values in pixels for the west, north, east and south borders

getVisibilityPadding

public int[] getVisibilityPadding()
Get the padding values customizing the region inside the view for which objects are actually visible.

Returns:
padding values in pixels for the west, north, east and south borders

setLens

public Lens setLens(Lens l)
Activate a lens in this view. This only works with regular views (not OpengGL views - GLEView).

Parameters:
l - the lens instance. Pass null to remove an existing lens.

getLens

public Lens getLens()
Get Lens currently active in this view

Returns:
null if none

getGlobalView

public Location getGlobalView(Camera c,
                              float mFactor)
Get the location from which a camera will see all glyphs visible in the associated virtual space. The camera must be used in this view. Otherwise, the method returns null and does nothing.

Parameters:
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
Returns:
the location to which the camera should go, null if the camera is not associated with this view.
See Also:
getGlobalView(Camera c, int d), getGlobalView(Camera c), getGlobalView(Camera c, int d, float mFactor)

getGlobalView

public Location getGlobalView(Camera c,
                              int d)
Translates and (un)zooms a camera in order to see everything visible in the associated virtual space. The camera must be used in this view. Otherwise, the method returns null and does nothing.

Parameters:
c - Camera to be moved (will actually be moved)
d - duration of the animation in ms
Returns:
the final camera location, null if the camera is not associated with this view.
See Also:
getGlobalView(Camera c), getGlobalView(Camera c, int d, float mFactor), getGlobalView(Camera c, float mFactor)

getGlobalView

public 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. The camera must be used in this view. Otherwise, the method returns null and does nothing.

Parameters:
c - Camera to be moved (will actually be moved)
d - duration of the animation in ms
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
Returns:
the final camera location, null if the camera is not associated with this view.
See Also:
getGlobalView(Camera c), getGlobalView(Camera c, int d), getGlobalView(Camera c, float mFactor)

getGlobalView

public Location getGlobalView(Camera c)
Get the location from which a camera will see everything visible in the associated virtual space. The camera must be used in this view. Otherwise, the method returns null and does nothing.

Parameters:
c - camera considered (will not be moved)
Returns:
the location to which the camera should go, null if the camera is not associated with this view.
See Also:
getGlobalView(Camera c, int d), getGlobalView(Camera c, int d, float mFactor), getGlobalView(Camera c, float mFactor)

centerOnGlyph

public 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. Otherwise, the method returns null and does nothing.

Parameters:
g - Glyph of interest
c - Camera to be moved
d - duration of the animation in ms
z - 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
Returns:
the final camera location, null if the camera is not associated with this view.

centerOnGlyph

public 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. Otherwise, the method returns null and does nothing.

Parameters:
g - Glyph of interest
c - Camera to be moved
d - duration of the animation in ms
Returns:
the final camera location, null if the camera is not associated with this view.

centerOnGlyph

public 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. Otherwise, the method returns null and does nothing.

Parameters:
g - Glyph of interest
c - Camera to be moved
d - duration of the animation in ms
z - if false, do not (un)zoom, just translate (default is true)
Returns:
the final camera location, null if the camera is not associated with this view.

centerOnGlyph

public 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. Otherwise, the method returns null and does nothing.

Parameters:
g - Glyph of interest
c - Camera to be moved
d - duration of the animation in ms
z - 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).
Returns:
the final camera location, null if the camera is not associated with this view.

centerOnRegion

public 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. Otherwise, the method returns null and does nothing.

Parameters:
c - Camera to be moved
d - duration of the animation in ms (pass 0 to go there instantanesouly)
x1 - x coord of first point
y1 - y coord of first point
x2 - x coord of opposite point
y2 - y coord of opposite point
Returns:
the final camera location, null if the camera is not associated with this view.

centerOnRegion

public 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. Otherwise, the method returns null and does nothing.

Parameters:
c - Camera to be moved
d - duration of the animation in ms (pass 0 to go there instantanesouly)
x1 - x coord of first point
y1 - y coord of first point
x2 - x coord of opposite point
y2 - y coord of opposite point
ea - action to be performed at end of animation
Returns:
the final camera location, null if the camera is not associated with this view.

getGlyphsInRegion

public 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. Coordinates of the mouse cursor in virtual space are available in instance variables vx and vy of class VCursor. The selection rectangle can be drawn on screen by using ViewPanel.setDrawRect(true) (e.g. call when mouse button is pressed)/ViewPanel.setDrawRect(false) (e.g. call when mouse button is released).

Parameters:
x1 - x coord of first point
y1 - y coord of first point
x2 - x coord of opposite point
y2 - y coord of opposite point
vsn - name of virtual space
wg - which glyphs in the region should be returned (among VIS_AND_SENS_GLYPHS (default), VISIBLE_GLYPHS, SENSIBLE_GLYPHS, ALL_GLYPHS)
Returns:
null if empty.


Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2011 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.