fr.inria.zvtm.engine
Class VirtualSpace

java.lang.Object
  extended by fr.inria.zvtm.engine.VirtualSpace

public class VirtualSpace
extends Object

A virtual space contains glyphs and can be observed through multiple cameras.

Author:
Emmanuel Pietriga

Field Summary
static String ANONYMOUS
          Anonymous virtual space.
 
Method Summary
 void above(Glyph g1, Glyph g2)
          Put glyph g1 just above glyph g2 in the drawing list (g1 painted after g2).
 Camera addCamera()
          Add a new camera to this virtual space.
 void addGlyph(Glyph g)
          Add glyph g to this virtual space.
 void addGlyph(Glyph g, boolean repaint)
          Add glyph g to this virtual space.
 void addGlyph(Glyph g, boolean initColors, boolean repaint)
          Add glyph g to this virtual space.
 void addGlyphs(Glyph[] glyphs)
          Add a list of glyphs to this virtual space.
 void addGlyphs(Glyph[] glyphs, boolean repaint)
          Add a list of glyphs to this virtual space.
protected  void addGlyphsToDrawingList(Glyph[] glyphs)
           
protected  void addGlyphToDrawingList(Glyph g)
           
 void atBottom(Glyph g)
          Put this glyph at bottom of the drawing list (will be drawn first).
 void atBottom(Glyph g, int z)
          Put this glyph before the first glyph that has z-index z, but after any glyph that has a z-index lower than z (if any).
 void below(Glyph g1, Glyph g2)
          Put glyph g1 just below glyph g2 in the drawing list (g1 painted before g2).
 boolean contains(Glyph g)
          Tests whether a glyph belongs to this virtual space or not.
protected  void destroy()
          Destroy this virtual space.
protected  void drewGlyph(Glyph gl, int cameraIndex)
           
 double[] findFarmostGlyphCoords()
          Get the bounding box of all glyphs visible in this virtual space.
 double[] findFarmostGlyphCoords(double[] res)
          Get the bounding box of all glyphs visible in this virtual space.
 double[] findFarmostGlyphCoords(Glyph[] gl, double[] res)
          Get the bounding box of all glyphs visible in this virtual space.
 Vector<Glyph> getAllGlyphs()
          Get all glyphs in this virtual space, visible or not, sensitive or not.
 Camera getCamera(int i)
          Get the i-th camera added to this virtual space.
 Camera[] getCameraListAsArray()
          Get a list of all cameras in this virtual space.
 Glyph[] getDrawingList()
          Get all visible glyphs (not cloned).
 Vector<Glyph> getDrawnGlyphs(int cameraIndex)
          Get all glyphs actually drawn for a given camera in this virtual space.
static Point2D.Double getGlyphSetGeometricalCenter(Glyph[] gl)
          Compute the geometrical center of a set of glyphs (takes glyph sizes into account)
 Vector<Glyph> getGlyphsOfType(String t)
          get all glyphs of type t - if t=="" then select all glyphs (means ANY type)
 String getName()
          Get name of this virtual space.
 Vector<Glyph> getSelectedGlyphs()
          Get selected glyphs.
 Glyph[] getVisibleGlyphsList()
          Get all visible glyphs (clone).
protected  int glyphIndexInDrawingList(Glyph g)
           
 void hide(Glyph g)
          hide Glyph g
- use show() and hide() to change both the visibility and sensitivity of glyphs
- use Glyph.setVisible() to only change the glyph's visibility, but not its sensitivity.
protected  void insertGlyphInDrawingList(Glyph g, int index)
           
 void onTop(Glyph g)
          Put this glyph on top of the drawing list (will be drawn last).
 void onTop(Glyph g, int z)
          Put this glyph after the last glyph that has z-index z, but before any glyph that has a z-index higher than z (if any).
 boolean registerPicker(Picker p)
          Register an external picker with this view.
 void removeAllGlyphs()
          Remove all glyphs from this virtual space.
 void removeAllGlyphs(boolean repaint)
          Remove all glyphs from this virtual space.
 void removeCamera(int i)
          Rremove camera at index i from this virtual space.
 void removeGlyph(Glyph g)
          Remove glyph g from this virtual space.
 void removeGlyph(Glyph g, boolean repaint)
          Remove this glyph from this virtual space.
protected  void removeGlyphFromDrawingList(Glyph g)
           
 void selectAllGlyphs()
          Select all glyphs
 void show(Glyph g)
          show Glyph g
- use show() and hide() to change both the visibility and sensitivity of glyphs
- use Glyph.setVisible() to only change the glyph's visibility, but not its sensitivity.
 boolean unregisterPicker(Picker p)
          Unregister an external picker from this view.
 void unselectAllGlyphs()
          unselect all glyphs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANONYMOUS

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

See Also:
Constant Field Values
Method Detail

getGlyphSetGeometricalCenter

public static Point2D.Double getGlyphSetGeometricalCenter(Glyph[] gl)
Compute the geometrical center of a set of glyphs (takes glyph sizes into account)

Parameters:
gl - a list of Glyph instances
Returns:
0,0 if list is empty

getName

public String getName()
Get name of this virtual space.


getCamera

public Camera getCamera(int i)
Get the i-th camera added to this virtual space.


getCameraListAsArray

public Camera[] getCameraListAsArray()
Get a list of all cameras in this virtual space.

Returns:
the actual list, not a copy.

addCamera

public Camera addCamera()
Add a new camera to this virtual space.


removeCamera

public void removeCamera(int i)
Rremove camera at index i from this virtual space. When a camera is destroyed, its index is not reused for another one. So if camera number #3 is removed and then a new camera is added it will be assigned number #4 even though there is no camera at index #3 any longer.

Parameters:
i - index of camera in virtual space

destroy

protected void destroy()
Destroy this virtual space.


addGlyph

public void addGlyph(Glyph g,
                     boolean initColors,
                     boolean repaint)
Add glyph g to this virtual space.


addGlyph

public void addGlyph(Glyph g)
Add glyph g to this virtual space.


addGlyph

public void addGlyph(Glyph g,
                     boolean repaint)
Add glyph g to this virtual space.

Parameters:
repaint - pass false if views should not be repainted as a consequence of this addition (default is true).

addGlyphs

public void addGlyphs(Glyph[] glyphs,
                      boolean repaint)
Add a list of glyphs to this virtual space. glyphs with lower indices in the list will be added first in the virtual space and will consequently be lower in the drawing stack.

Parameters:
repaint - pass false if views should not be repainted as a consequence of this addition (default is true).

addGlyphs

public void addGlyphs(Glyph[] glyphs)
Add a list of glyphs to this virtual space. glyphs with lower indices in the list will be added first in the virtual space and will consequently be lower in the drawing stack.


getAllGlyphs

public Vector<Glyph> getAllGlyphs()
Get all glyphs in this virtual space, visible or not, sensitive or not. IMPORTANT: Read-only. Do not temper with this data structure unless you know what you are doing. It is highly recommended to clone it if you want to add/remove elements from it for your own purposes.


contains

public boolean contains(Glyph g)
Tests whether a glyph belongs to this virtual space or not.


getDrawingList

public Glyph[] getDrawingList()
Get all visible glyphs (not cloned).

See Also:
getVisibleGlyphsList()

getVisibleGlyphsList

public Glyph[] getVisibleGlyphsList()
Get all visible glyphs (clone).

See Also:
getDrawingList()

getDrawnGlyphs

public Vector<Glyph> getDrawnGlyphs(int cameraIndex)
Get all glyphs actually drawn for a given camera in this virtual space.


drewGlyph

protected void drewGlyph(Glyph gl,
                         int cameraIndex)

getSelectedGlyphs

public Vector<Glyph> getSelectedGlyphs()
Get selected glyphs.


selectAllGlyphs

public void selectAllGlyphs()
Select all glyphs


unselectAllGlyphs

public void unselectAllGlyphs()
unselect all glyphs


getGlyphsOfType

public Vector<Glyph> getGlyphsOfType(String t)
get all glyphs of type t - if t=="" then select all glyphs (means ANY type)


removeAllGlyphs

public void removeAllGlyphs()
Remove all glyphs from this virtual space. And then repaint all views.


removeAllGlyphs

public void removeAllGlyphs(boolean repaint)
Remove all glyphs from this virtual space. If the glyphs were sticked to other glyphs, cameras or cursors, removing them from virtual space unsticks them.

Parameters:
repaint - true to repaint all views afterwards, false otherwise

removeGlyph

public void removeGlyph(Glyph g)
Remove glyph g from this virtual space. ZVTM no longer holds a reference to it. View will be updated. If the glyph was sticked to another glyph, a camera or a cursor, removing the glyph from virtual space unsticks it.


removeGlyph

public void removeGlyph(Glyph g,
                        boolean repaint)
Remove this glyph from this virtual space. ZVTM no longer holds a reference to it. If the glyph was sticked to another glyph, a camera or a cursor, removing the glyph from virtual space unsticks it.

Parameters:
repaint - should the view be updated automatically or not once the glyph has been removed. Default is true.

show

public void show(Glyph g)
show Glyph g
- use show() and hide() to change both the visibility and sensitivity of glyphs
- use Glyph.setVisible() to only change the glyph's visibility, but not its sensitivity.

See Also:
hide(Glyph g)

hide

public void hide(Glyph g)
hide Glyph g
- use show() and hide() to change both the visibility and sensitivity of glyphs
- use Glyph.setVisible() to only change the glyph's visibility, but not its sensitivity.

See Also:
show(Glyph g)

onTop

public void onTop(Glyph g)
Put this glyph on top of the drawing list (will be drawn last). Important: this might affect the glyph's z-index.


atBottom

public void atBottom(Glyph g)
Put this glyph at bottom of the drawing list (will be drawn first). Important: this might affect the glyph's z-index.


onTop

public void onTop(Glyph g,
                  int z)
Put this glyph after the last glyph that has z-index z, but before any glyph that has a z-index higher than z (if any). g will be drawn after every other glyph that has z-index z, but before any glyph that has a z-index higher than z (if any).

Parameters:
z - the considered z-index

atBottom

public void atBottom(Glyph g,
                     int z)
Put this glyph before the first glyph that has z-index z, but after any glyph that has a z-index lower than z (if any). g will be drawn before every other glyph that has z-index z, but after any glyph that has a z-index lower than z (if any).

Parameters:
z - the considered z-index

above

public void above(Glyph g1,
                  Glyph g2)
Put glyph g1 just above glyph g2 in the drawing list (g1 painted after g2). Important: this might affect the g1's z-index.


below

public void below(Glyph g1,
                  Glyph g2)
Put glyph g1 just below glyph g2 in the drawing list (g1 painted before g2). Important: this might affect the g1's z-index.


findFarmostGlyphCoords

public double[] findFarmostGlyphCoords()
Get the bounding box of all glyphs visible in this virtual space.

Returns:
boundaries in VirtualSpace coordinates {west,north,east,south}

findFarmostGlyphCoords

public double[] findFarmostGlyphCoords(double[] res)
Get the bounding box of all glyphs visible in this virtual space.

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

findFarmostGlyphCoords

public double[] findFarmostGlyphCoords(Glyph[] gl,
                                       double[] res)
Get the bounding box of all glyphs visible in this virtual space.

Parameters:
gl - list of glyphs to iterate upon (will typically be a subset of all glyphs in the virtual space)
res - array which will contain the result
Returns:
boundaries in VirtualSpace coordinates {west,north,east,south}

registerPicker

public boolean registerPicker(Picker p)
Register an external picker with this view. The picker is said to be external because it is not associated with a VCursor.

Returns:
true if the picker was not already registered with this view, false if it was.

unregisterPicker

public boolean unregisterPicker(Picker p)
Unregister an external picker from this view. The picker is said to be external because it is not associated with a VCursor.

Returns:
true if the picker was registered with this view and did get unregistered, false if it was not.

addGlyphToDrawingList

protected void addGlyphToDrawingList(Glyph g)

addGlyphsToDrawingList

protected void addGlyphsToDrawingList(Glyph[] glyphs)

insertGlyphInDrawingList

protected void insertGlyphInDrawingList(Glyph g,
                                        int index)

removeGlyphFromDrawingList

protected void removeGlyphFromDrawingList(Glyph g)

glyphIndexInDrawingList

protected int glyphIndexInDrawingList(Glyph g)


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.