dasher
Class CDasherInput

java.lang.Object
  extended by dasher.CDasherComponent
      extended by dasher.CDasherModule
          extended by dasher.CDasherInput
Direct Known Subclasses:
JMouseInput, NetInput

public abstract class CDasherInput
extends CDasherModule

DasherInput is the base class for all modules which provide some sort of co-ordinate input.

To serve as a co-ordinate source, a device must be able to provide synchronous or quasi-synchronous readout of its current co-ordinates, such that a call to GetCoordinates will return almost instantaneously.

Devices are free to return their co-ordinates relative to the screen, using pixels as their unit of measure, or relative to the Dasher world, using Dasher co-ordinates.

See Also:
CDasherModule

Field Summary
 
Fields inherited from class dasher.CDasherComponent
m_EventHandler, m_SettingsStore
 
Constructor Summary
CDasherInput(CEventHandler EventHandler, CSettingsStore SettingsStore, long iID, int iType, java.lang.String szName)
          Sole constructor.
 
Method Summary
 void Activate()
          Activates the input device.
 void Deactivate()
          Deactivates the device; resources should be freed at this point.
abstract  int GetCoordinateCount()
          Gets the number of co-ordinates this device returns.
abstract  int GetCoordinates(int iN, long[] Coordinates)
          Called to request that the device report the current co-ordinates.
 void SetMaxCoordinates(int iN, long[] iDasherMax)
          Sets the maximum co-ordinates which the device should return.
 
Methods inherited from class dasher.CDasherModule
GetID, GetName, GetType, Ref, Unref
 
Methods inherited from class dasher.CDasherComponent
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, HandleEvent, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDasherInput

public CDasherInput(CEventHandler EventHandler,
                    CSettingsStore SettingsStore,
                    long iID,
                    int iType,
                    java.lang.String szName)
Sole constructor. Simply recalls CDasherModule's constructor.

Parameters:
EventHandler - Event handler with which we wish to register ourselves
SettingsStore - Settings store for parameter getting/setting
iID - This device's ID
iType - This device's type number
szName - Friendly name for this device, to be used with GetModuleByName
Method Detail

SetMaxCoordinates

public void SetMaxCoordinates(int iN,
                              long[] iDasherMax)
Sets the maximum co-ordinates which the device should return. These are given as Dasher-world co-ordinates and should be translated if necessary.

Parameters:
iN - Number of co-ordinates specified
iDasherMax - Maximum co-ordinates.

GetCoordinates

public abstract int GetCoordinates(int iN,
                                   long[] Coordinates)
Called to request that the device report the current co-ordinates.

Parameters:
iN - Number of co-ordinates expected.
Coordinates - Fill with the current co-ordinates
Returns:
0 if those reported are screen co-ordinates, or 1 if they are Dasher world co-ordinates.

GetCoordinateCount

public abstract int GetCoordinateCount()
Gets the number of co-ordinates this device returns.

At present, only 1- and 2-axis devices are accepted, but this may be easily upgraded in the future.

Returns:
Number of co-ordinates supplied by this device.

Activate

public void Activate()
Activates the input device. If threads must be started to support the device, this is the place to do it.


Deactivate

public void Deactivate()
Deactivates the device; resources should be freed at this point.