Examples of InputCursor


Examples of org.mt4j.input.inputData.InputCursor

        mouseInfo.ellipse.setPositionRelativeToParent(new Vector3D(mouseInfo.x, mouseInfo.y,0));
      }
    }

    if (mouseInfo.isButtonPressed){
      InputCursor m = ActiveCursorPool.getInstance().getActiveCursorByID(device);
      MTFingerInputEvt te = new MTFingerInputEvt(this, mouseInfo.x, mouseInfo.y, MTFingerInputEvt.INPUT_UPDATED, m);
//      m.addEvent(te);
//      System.out.println("Motion update on device: #" + device+  " X:" + mouseInfo.x + " Y:" + mouseInfo.y);
      this.enqueueInputEvent(te);
    }
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

   
    MouseInfo mouseInfo = this.getOrInitDeviceInfo(event);
    if (mouseInfo.isButtonPressed){
      mouseInfo.isButtonPressed = false;

      InputCursor m = ActiveCursorPool.getInstance().getActiveCursorByID(device);
//      System.out.println("Motion ended on device: #" + device);

      MTFingerInputEvt te;
      if (m.getCurrentEvent() != null)
        te = new MTFingerInputEvt(this, m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY(), MTFingerInputEvt.INPUT_ENDED, m);
      else
        te = new MTFingerInputEvt(this, 0,0, MTFingerInputEvt.INPUT_ENDED, m);

//      m.addEvent(te); //werden nicht hier geadded sondern synchroniesert mit dem PApplet thread in den analyzern, so dass immer nur 1
      // 1 te geadded wird und dann wieder verarbeitet, dann der n�chste
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

      unUsedCursors.add(m);
      logger.debug(this.getName() + " has already enough cursors for this gesture - adding to unused ID:" + m.getId());
    }else{ //no gesture in progress yet
      if (unUsedCursors.size() == 1){
        logger.debug(this.getName() + " has already has 1 unused cursor - we can try start gesture! used with ID:" + unUsedCursors.get(0).getId() + " and new cursor ID:" + m.getId());
        InputCursor otherCursor = unUsedCursors.get(0);
       
        //See if we can obtain a lock on both cursors
        if (this.canLock(otherCursor, m)){
          float newDistance = Vector3D.distance(
              new Vector3D(otherCursor.getCurrentEvent().getPosX(), otherCursor.getCurrentEvent().getPosY(),0),
              new Vector3D(m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY(),0));
          if (newDistance < detectRadius) {
            this.getLock(otherCursor, m);
            logger.debug(this.getName() + " we could lock both cursors! And fingers in distance! - " + newDistance);
            unUsedCursors.remove(otherCursor);
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

  }

  @Override
  public void cursorUpdated(InputCursor m, MTFingerInputEvt positionEvent) {
    if (lockedCursors.size() == 2 && lockedCursors.contains(m)){
      InputCursor firstCursor = lockedCursors.get(0);
      InputCursor secondCursor = lockedCursors.get(1);
      Vector3D distance = (m.equals(firstCursor))? getNewTranslation(positionEvent.getTargetComponent(), firstCursor, secondCursor) : getNewTranslation(positionEvent.getTargetComponent(), secondCursor, firstCursor);
//      //logger.debug("DIST: " + distance);
      this.fireGestureEvent(new PanTwoFingerEvent(this, MTGestureEvent.GESTURE_UPDATED, positionEvent.getTargetComponent(), firstCursor, secondCursor, new Vector3D(distance.getX(),distance.getY(),0), positionEvent.getTargetComponent().getViewingCamera()));
    }
  }
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

  public void cursorEnded(InputCursor m, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    logger.debug(this.getName() + " INPUT_ENDED RECIEVED - MOTION: " + m.getId());
   
    if (lockedCursors.size() == 2 && lockedCursors.contains(m)){
      InputCursor leftOverCursor = (lockedCursors.get(0).equals(m))? lockedCursors.get(1) : lockedCursors.get(0);
     
      lockedCursors.remove(m);
      if (unUsedCursors.size() > 0){ //Check if there are other cursors we could use for scaling if one was removed
        InputCursor futureCursor = unUsedCursors.get(0);
        if (this.canLock(futureCursor)){ //check if we have priority to lock another cursor and use it
          float newDistance = Vector3D.distance(
              new Vector3D(leftOverCursor.getCurrentEvent().getPosX(), leftOverCursor.getCurrentEvent().getPosY(),0),
              new Vector3D(futureCursor.getCurrentEvent().getPosX(), futureCursor.getCurrentEvent().getPosY(),0));
          if (newDistance < detectRadius) {//Check if other cursor is in distance
            this.getLock(futureCursor);
            unUsedCursors.remove(futureCursor);
            lockedCursors.add(futureCursor);
            logger.debug(this.getName() + " we could lock another cursor! (ID:" + futureCursor.getId() +")");
            logger.debug(this.getName() + " continue with different cursors (ID: " + futureCursor.getId() + ")" + " " + "(ID: " + leftOverCursor.getId() + ")");
            //TODO fire start evt?
          }else{
            this.endGesture(m, leftOverCursor, comp);
          }
        }else{ //we dont have permission to use other cursor  - End scale
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

      return;
    }
   
    if (unUsedCursors.contains(m)){ //should always be true here!?
      if (unUsedCursors.size() >= 2){ //we can try to resume the gesture
        InputCursor firstCursor = unUsedCursors.get(0);
        InputCursor secondCursor = unUsedCursors.get(1);

        //See if we can obtain a lock on both cursors
        if (this.canLock(firstCursor, secondCursor)){
          float newDistance = Vector3D.distance(
              new Vector3D(firstCursor.getCurrentEvent().getPosX(), firstCursor.getCurrentEvent().getPosY(),0),
              new Vector3D(secondCursor.getCurrentEvent().getPosX(), secondCursor.getCurrentEvent().getPosY(),0));
          if (newDistance < detectRadius) {//Check if other cursor is in distance
            this.getLock(firstCursor, secondCursor);
            unUsedCursors.remove(firstCursor);
            unUsedCursors.remove(secondCursor);
            lockedCursors.add(firstCursor);
            lockedCursors.add(secondCursor);
            logger.debug(this.getName() + " we could lock cursors: " + firstCursor.getId() +", " + secondCursor.getId());
            logger.debug(this.getName() + " continue with different cursors (ID: " + firstCursor.getId() + ")" + " " + "(ID: " + secondCursor.getId() + ")");
            //TODO fire start evt?
          }else{
            logger.debug(this.getName() + " distance was too great between cursors: " + firstCursor.getId() +", " + secondCursor.getId() + " distance: " + newDistance);
          }
        }else{
          logger.debug(this.getName() + " we could NOT lock cursors: " + firstCursor.getId() +", " + secondCursor.getId());
        }
      }
    }else{
      logger.error(this.getName() + "hmmm - investigate why is cursor not in unusedList?");
    }
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

    if (getLockedCursors().contains(c)){ //cursors was a actual gesture cursors
      dc.updateDragPosition();
      //Check if we can resume the gesture with another cursor
      InputCursor[] availableCursors = getFreeComponentCursorsArray();
      if (availableCursors.length > 0 && this.canLock(getCurrentComponentCursorsArray())){
        InputCursor otherCursor = availableCursors[0];
        DragContext newContext = new DragContext(otherCursor, comp);
        if (!newContext.isGestureAborted()){
          dc = newContext;
          this.getLock(otherCursor);
        }else{
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

    int fingerID = finger.getID();
   
    ActiveCursorPool cursorPool = ActiveCursorPool.getInstance();
    int inputID;
    Long cursorID = fingerIdToCursorId.get(fingerID);
    InputCursor cursor = (cursorID != null)? cursorPool.getActiveCursorByID(cursorID) : null;
   
    if (finger.getState() == FingerState.PRESSED) {
      if (cursor == null) { //new finger
        cursor = new InputCursor();
        fingerIdToCursorId.put(fingerID, cursor.getId());
        cursorPool.putActiveCursor(cursor.getId(), cursor);
        inputID = MTFingerInputEvt.INPUT_DETECTED;
      } else { //updated finger
        inputID = MTFingerInputEvt.INPUT_UPDATED;
      }
    } else { //removed finger
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

    float absoluteX =  cursor.getX() * windowWidth;
    float abosulteY =  cursor.getY() * windowHeight;
    long sessionID = cursor.getSessionID();
   
//    logger.info("TUIO INPUT ADD FINGER - TUIO ID: " + sessionID);
    InputCursor c = new InputCursor();
    MTFingerInputEvt touchEvt = new MTFingerInputEvt(this, absoluteX, abosulteY, MTFingerInputEvt.INPUT_DETECTED, c);
    long cursorID = c.getId();
    ActiveCursorPool.getInstance().putActiveCursor(cursorID, c);
    tuioIDToCursorID.put(sessionID, cursorID);
    this.enqueueInputEvent(touchEvt);
  }
View Full Code Here

Examples of org.mt4j.input.inputData.InputCursor

    float abosulteY =  cursor.getY() * windowHeight;
    long sessionID = cursor.getSessionID();
    Long tuioID =  (Long)tuioIDToCursorID.get(sessionID) ;
    if (tuioID != null ){
//      logger.info("TUIO INPUT UPDATE FINGER - TUIO ID: " + sessionID);
      InputCursor c = ActiveCursorPool.getInstance().getActiveCursorByID(tuioID);
      if (c != null){
        MTFingerInputEvt te = new MTFingerInputEvt(this, absoluteX, abosulteY, MTFingerInputEvt.INPUT_UPDATED, c);
        this.enqueueInputEvent(te);
      }else{
//        logger.error("CURSOR NOT IN ACTIVE CURSOR LIST! TUIO ID: " + cursor.getSessionID());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.