Package com.sparshui.common

Examples of com.sparshui.common.Location


    return (events != null) ? events : new ArrayList();
  }
 
  // @override
  protected List processBirth(TouchPoint touchPoint) {
    Location location = touchPoint.getLocation();
    int id = touchPoint.getID();
    switch (_nTraces) {
    case 0:
      _traces1.clear();
      _traces1.add(Location.pixelLocation(location));
View Full Code Here


    List events = new ArrayList();
    if (!updateLocations(touchPoint))
      return events;
    if (_myType == ActionManagerMT.INVALID_GESTURE)
      checkType();
    Location locationLast = Location.screenLocation(_offsetCentroid);
    if (_myType == ActionManagerMT.INVALID_GESTURE
        || !updateParameters())
      return events;
    Location location = Location.screenLocation(_offsetCentroid);
    Event event = null;
    switch (_myType) {
    case ActionManagerMT.ZOOM_GESTURE:
      event = new ZoomEvent(_scale, location, time);
      break;
View Full Code Here

      events.add(event);
    return events;
  }

  private boolean updateLocations(TouchPoint touchPoint) {
    Location location = Location.pixelLocation(touchPoint.getLocation());
    int id = touchPoint.getID();
    // just use last three points.
    if (id == _id1) {
      if (_traces1.size() > 2) {
        while (_traces1.size() > 2) {
View Full Code Here

    }
    return (_nTraces == 2 && _traces1.size() == 3 && _traces2.size() == 3);
  }
 
  private void checkType() {
    Location loc10 = (Location) _traces1.get(0);
    Location loc20 = (Location) _traces2.get(0);
    Location loc11 = (Location) _traces1.get(_traces1.size() - 1);
    Location loc21 = (Location) _traces2.get(_traces2.size() - 1);
    Vector3f v1 = loc10.getVector(loc11);
    float d1 = v1.length();
    Vector3f v2 = loc20.getVector(loc21);
    float d2 = v2.length();
    // rooted finger --> zoom (at this position, perhaps?)
View Full Code Here

      );
*/
  }

  private boolean updateParameters() {
    Location loc10 = (Location) _traces1.get(0);
    Location loc20 = (Location) _traces2.get(0);
    Location loc11 = (Location) _traces1.get(_traces1.size() - 1);
    Location loc21 = (Location) _traces2.get(_traces2.size() - 1);
    float d1 = loc10.getDistance(loc11);
    float d2 = loc20.getDistance(loc21);
    float d12 = loc11.getDistance(loc21);
    if (d1 < 2 && d2 < 2)
      return false;
View Full Code Here

    float y = _in.readFloat();
    int state = (int) _in.readByte();
    long time = (len >= 21 ? _in.readLong() : System.currentTimeMillis());
    if (len > 21)
      _in.read(new byte[len - 21]);
    Location location = new Location(x, y);
    boolean doConsume = _gestureServer.processTouchPoint(_touchPoints, id,
        location, time, state);
    if (state == TouchState.DEATH)
      flagTouchPointForRemoval(id);
    return doConsume;
View Full Code Here

  private Location _center;
  private long _time;
 
  public RotateEvent() {
    _rotation = 0;
    _center = new Location();
  }
View Full Code Here

  public RotateEvent(byte[] data) {
    if (data.length < 12) {
      // TODO add error handling
      System.err.println("Error constructing Rotate Event.");
      _rotation = 0;
      _center = new Location(0, 0);
    } else {
      _rotation = Converter.byteArrayToFloat(data, 0);
      _center = new Location(Converter.byteArrayToFloat(data, 4),
          Converter.byteArrayToFloat(data, 8));
    }
  }
View Full Code Here

   * @throws IOException
   *             If there is a connection error.
   */
  private void handleGetGroupID(SparshClient client, byte[] data)
      throws IOException {
    _out.writeInt(client.getGroupID(new Location(Converter.byteArrayToFloat(data, 0),
        Converter.byteArrayToFloat(data, 4))));
  }
View Full Code Here

  private Location _center;
  private long _time;
 
  public ZoomEvent() {
    _scale = 1;
    _center = new Location();
  }
View Full Code Here

TOP

Related Classes of com.sparshui.common.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.