Interface SparshClient

All Known Implementing Classes:
JmolSparshClientAdapter

public interface SparshClient
The Client interface must be implemented in all clients wishing to connect to the Sparsh-UI gesture server. It requires the client to implement three methods that the gesture server will request.
Author:
Jay Roltgen
  • Method Summary

    Modifier and Type
    Method
    Description
    getAllowedGestures(int groupID)
    This method must return the allowed Gestures for the specified group.
    int
    getGroupID(Location location)
    This method must return an ID for a group of points that should be processed together.
    void
    processEvent(int groupID, Event event)
    This method processes events from the Gesture Server.
  • Method Details

    • getGroupID

      int getGroupID(Location location)
      This method must return an ID for a group of points that should be processed together. If a constant value is returned, all points will be processed together and gestures will be recognized on the entire screen. Otherwise, if a unique ID is returned, gestures will be recognized locally for each ID.
      Parameters:
      location - The location with coordinate values between 0 and 1 of the point we are requesting the groupID for.
      Returns:
      The groupID that is associated with the current location.
    • getAllowedGestures

      List<GestureType> getAllowedGestures(int groupID)
      This method must return the allowed Gestures for the specified group. Gestures IDs are given in GestureType.java. This method should construct a list of valid gesture IDs for the specified groupID and return it. The client will then begin receiving events that are appropriate to the list of allowed gestures it returned.
      Parameters:
      groupID - The groupID we wish to obtain the allowed gestures for.
      Returns:
      A list of allowed Gesture IDs
    • processEvent

      void processEvent(int groupID, Event event)
      This method processes events from the Gesture Server. It should handle each event by sending it to the appropriate group specified by groupID. If groupID == Integer.MAX_VALUE and event is null, then the server connection has been lost.
      Parameters:
      groupID - The group that this event was detected on.
      event - The event that should be processed.