fr.inria.zvtm.engine
Class VCursor

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

public class VCursor
extends Object

Glyph representing pointing device cursor. One instance per view.

Author:
Emmanuel Pietriga

Using DynaSpot

The DynaSpot behavior must be activated in VCursor, calling

In your ViewListener, simply call VCursor.dynaPick(Camera c) wherever this makes sense. Usually this will be mouseMoved(...):

This updates the list of glyphs intersected by the DynaSpot disc, and identifies the one glyph actually selected (which is returned). The method also takes care of highlighting/unhighlighting the selected glyph.

Note: dynaPick() also gets called internally when DynaSpot's size changes.


Field Summary
protected  float cx
          coord in camera space (same as jpanel coords, but conventional coord sys at center of view panel, upward)
protected  float cy
          coord in camera space (same as jpanel coords, but conventional coord sys at center of view panel, upward)
protected  int jpx
          coords in JPanel
protected  int jpy
          coords in JPanel
protected  double pvx
          previous coords in virtual space
protected  double pvy
          previous coords in virtual space
protected  double vx
          coord in virtual space
protected  double vy
          coord in virtual space
 
Method Summary
 DynaPicker getDynaPicker()
           
 Point2D.Double getLocation()
          Get the cursor's location in virtual space (for active layer/camera).
 View getOwningView()
          Get view to which this cursor belongs.
 int getPanelXCoordinate()
          Get the cursor's x-coordinate in JPanel coordinates system.
 int getPanelYCoordinate()
          Get the cursor's y-coordinate in JPanel coordinates system.
 Picker getPicker()
           
 int getSize()
          Get cursor size (crosshair length).
 Glyph[] getStickedGlyphArray()
          Get list of glyphs sticked to cursor.
 int getStickedGlyphsNumber()
          Get the number of glyphs sticked to the cursor.
 boolean getSync()
          Tells whether this ZVTM cursor is synchronized with the system cursor or not.
 Point2D.Double getVSCoordinates(Camera c)
          Get the virtual space coordinates of the cursor.
 double getVSXCoordinate()
          Get the cursor's x-coordinate in virtual space coordinates system.
 double getVSYCoordinate()
          Get the cursor's y-coordinate in virtual space coordinates system.
 boolean isSensitive()
          Tells whether entry/exit of cursor into/from glyphs is enabled or disabled.
 void propagateMove()
          Propagate cursor movements to sticked glyphs.
 void setColor(Color c)
          Set cursor color.
 void setHintColor(Color c)
          Set color of elements associated with cursor (drag segment, selection rectangle, etc.).
 void setJPanelCoordinates(int x, int y)
          Move mouse cursor (JPanel coordinates).
 void setSensitivity(boolean b)
          Enable/disable entry/exit of cursor into/from glyphs.
 void setSize(int s)
          Set cursor size (crosshair length).
 void setSync(boolean b)
          Set whether this ZVTM cursor is synchronized with the system cursor or not.
 void setVisibility(boolean b)
          Should the cursor glyph be drawn or not.
 void stickGlyph(Glyph g)
          Attach glyph g to cursor.
 void unProject(Camera c, ViewPanel v)
          Unproject the cursor from JPanel coordinates to VirtualSpace coordinates.
 Glyph unstickLastGlyph()
          Unstick glyph that was last sticked to mouse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cx

protected float cx
coord in camera space (same as jpanel coords, but conventional coord sys at center of view panel, upward)


cy

protected float cy
coord in camera space (same as jpanel coords, but conventional coord sys at center of view panel, upward)


vx

protected double vx
coord in virtual space


vy

protected double vy
coord in virtual space


pvx

protected double pvx
previous coords in virtual space


pvy

protected double pvy
previous coords in virtual space


jpx

protected int jpx
coords in JPanel


jpy

protected int jpy
coords in JPanel

Method Detail

setSize

public void setSize(int s)
Set cursor size (crosshair length).


getSize

public int getSize()
Get cursor size (crosshair length).


getLocation

public Point2D.Double getLocation()
Get the cursor's location in virtual space (for active layer/camera).


getOwningView

public View getOwningView()
Get view to which this cursor belongs.


setSync

public void setSync(boolean b)
Set whether this ZVTM cursor is synchronized with the system cursor or not.


getSync

public boolean getSync()
Tells whether this ZVTM cursor is synchronized with the system cursor or not.


setColor

public void setColor(Color c)
Set cursor color.


setHintColor

public void setHintColor(Color c)
Set color of elements associated with cursor (drag segment, selection rectangle, etc.).


setJPanelCoordinates

public void setJPanelCoordinates(int x,
                                 int y)
Move mouse cursor (JPanel coordinates).

Parameters:
x - x-coordinate, in JPanel coordinates system
y - y-coordinate, in JPanel coordinates system

propagateMove

public void propagateMove()
Propagate cursor movements to sticked glyphs.


stickGlyph

public void stickGlyph(Glyph g)
Attach glyph g to cursor.


unstickLastGlyph

public Glyph unstickLastGlyph()
Unstick glyph that was last sticked to mouse. The glyph is automatically made sensitive to mouse events. The number of glyphs sticked to the mouse can be obtained by calling VCursor.getStickedGlyphsNumber().


getStickedGlyphsNumber

public int getStickedGlyphsNumber()
Get the number of glyphs sticked to the cursor.


getStickedGlyphArray

public Glyph[] getStickedGlyphArray()
Get list of glyphs sticked to cursor.

Returns:
the actual list, not a copy.

setVisibility

public void setVisibility(boolean b)
Should the cursor glyph be drawn or not.


setSensitivity

public void setSensitivity(boolean b)
Enable/disable entry/exit of cursor into/from glyphs.


isSensitive

public boolean isSensitive()
Tells whether entry/exit of cursor into/from glyphs is enabled or disabled.


unProject

public void unProject(Camera c,
                      ViewPanel v)
Unproject the cursor from JPanel coordinates to VirtualSpace coordinates.


getPicker

public Picker getPicker()

getDynaPicker

public DynaPicker getDynaPicker()

getVSCoordinates

public Point2D.Double getVSCoordinates(Camera c)
Get the virtual space coordinates of the cursor. Unprojected w.r.t Camera c.


getPanelXCoordinate

public int getPanelXCoordinate()
Get the cursor's x-coordinate in JPanel coordinates system.


getPanelYCoordinate

public int getPanelYCoordinate()
Get the cursor's y-coordinate in JPanel coordinates system.


getVSXCoordinate

public double getVSXCoordinate()
Get the cursor's x-coordinate in virtual space coordinates system.


getVSYCoordinate

public double getVSYCoordinate()
Get the cursor's y-coordinate in virtual space coordinates system.



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.