Examples of IMTComponent3D


Examples of org.mt4j.components.interfaces.IMTComponent3D

                      public boolean processGestureEvent(MTGestureEvent g) {
                        if (g instanceof TapEvent) {
                          TapEvent ce = (TapEvent) g;
                          switch (ce.getTapID()) {
                          case TapEvent.BUTTON_DOWN:
                            IMTComponent3D e = ce.getTargetComponent();
                            Photo foto = tagToPhoto.get(e);
                            if (foto != null){
                              SinglePhotoLoader fotoLoader = new SinglePhotoLoader(foto, 50);
                              fotoLoader.start();
                             
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

   * @param y the screen y coordinate
   *
   * @return the object at that position or this MTCanvas instance if no component was hit
   */
  public IMTComponent3D getComponentAt(float x, float y) {
    IMTComponent3D closest3DComp = null;
    try{
      long now = System.currentTimeMillis();
      if (useHitTestCache){
        if (now - lastTimeHitTest > cacheTimeDelta){ //If the time since last check surpassed => do new hit-test!
          //Benchmark the picking
//          long a = System.nanoTime();
          closest3DComp = this.pick(x, y).getNearestPickResult();
          //Benchmark the picking
//          long b = System.nanoTime();
//          System.out.println("Time for picking the scene: " + (b-a));
          /*
          for (MTBaseComponent c : pickResult.getPickList())
            System.out.println(c.getName());
          if (closest3DComp != null)
            System.out.println("Using: " + closest3DComp.getName());
          */
          if (closest3DComp == null){
            closest3DComp = this;
          }
          positionToComponent.put(new Position(x,y), closest3DComp);
        }else{
          //Check whats in the cache
          IMTComponent3D cachedComp = positionToComponent.get(new Position(x,y));
          if (cachedComp != null){ //Use cached obj
            closest3DComp = cachedComp;
            positionToComponent.put(new Position(x,y), closest3DComp);
          }else{
            closest3DComp = this.pick(x, y).getNearestPickResult();
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

      switch (posEvt.getId()) {
      case AbstractCursorInputEvt.INPUT_DETECTED:{
//        logger.debug("Finger DOWN-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPosX() + " Y:" + posEvt.getPosY() + "; Source: " + posEvt.getSource());
//        System.out.println("Finger DOWN-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPosX() + " Y:" + posEvt.getPosY() + "; Source: " + posEvt.getSource()+  " CursorID: " + m.getId() + " appInfoProv: " + appInfoProvider);
        //Check if there is an object under the cursor and save it to a hashtable with the event if so
        IMTComponent3D obj = appInfoProvider.getComponentAt(posEvt.getPosX(), posEvt.getPosY());
        if (obj != null){
          motionToObjectMap.put(m, obj);
          posEvt.setTargetComponent(obj);
          this.fireInputEvent(posEvt);
        }
      }
      break;
      case AbstractCursorInputEvt.INPUT_UPDATED:{
//        logger.debug("Finger UPDATE-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPositionX() + " Y:" + posEvt.getPositionY() + "; Source: " + posEvt.getSource());
        IMTComponent3D associatedObj = motionToObjectMap.get(m);
        if (associatedObj != null){
          posEvt.setTargetComponent(associatedObj);
          this.fireInputEvent(posEvt);
        }
      }
      break;
      case AbstractCursorInputEvt.INPUT_ENDED:{
//        logger.debug("Finger UP-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPositionX() + " Y:" + posEvt.getPositionY() + "; Source: " + posEvt.getSource());
//        IMTComponent3D associatedObj = motionToObjectMap.get(m);
        IMTComponent3D associatedObj = motionToObjectMap.remove(m);
        if (associatedObj != null){
          posEvt.setTargetComponent(associatedObj);
          this.fireInputEvent(posEvt);
//          motionToObjectMap.remove(m);
        }
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

    this.limit = maxVelocityLength;
    this.damping = damping;
  }

  public boolean processGestureEvent(MTGestureEvent ge) {
    IMTComponent3D t = ge.getTargetComponent();
    if (t instanceof MTComponent) {
      MTComponent comp = (MTComponent) t;
      DragEvent de = (DragEvent)ge;
      IMTController oldController;
      switch (de.getId()) {
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /////////////////////
 
 
  @Override
  public void cursorStarted(InputCursor newCursor, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    logger.debug(this.getName() + " INPUT_STARTED, Cursor: " + newCursor.getId());
   
    List<InputCursor> alreadyLockedCursors = getLockedCursors();
    if (alreadyLockedCursors.size() >= 2){ //gesture with 2 fingers already in progress
      //TODO get the 2 cursors which are most far away from each other
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  }


  @Override
  public void cursorUpdated(InputCursor m, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
   
//    if (lockedCursors.size() == 2 && lockedCursors.contains(m)){
    List<InputCursor> alreadyLockedCursors = getLockedCursors();
    if (rc != null && alreadyLockedCursors.size() == 2 && alreadyLockedCursors.contains(m)){
      float rotationAngleDegrees = rc.updateAndGetRotationAngle(m);
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  }


  @Override
  public void cursorEnded(InputCursor c, MTFingerInputEvt positionEvent) {
    IMTComponent3D comp = positionEvent.getTargetComponent();
    logger.debug(this.getName() + " INPUT_ENDED RECIEVED - CURSOR: " + c.getId());
   
    logger.debug("Rotate ended -> Active cursors: " + getCurrentComponentCursors().size() + " Available cursors: " + getFreeComponentCursors().size() " Locked cursors: " + getLockedCursors().size());
   
    if (getLockedCursors().contains(c)){
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

    if (availableCursors.size() >= 2){ //we can try to resume the gesture
      InputCursor firstCursor = availableCursors.get(0);
      InputCursor secondCursor = getFarthestFreeComponentCursorTo(firstCursor);

      //See if we can obtain a lock on both cursors
      IMTComponent3D comp = firstCursor.getFirstEvent().getTargetComponent();
      RotationContext newContext = new RotationContext(firstCursor, secondCursor, comp);
      if (!newContext.isGestureAborted()){ //Check if we could start gesture (ie. if fingers on component)
        rc = newContext;
        this.getLock(firstCursor, secondCursor);
        logger.debug(this.getName() + " we could lock cursors: " + firstCursor.getId() +", " + secondCursor.getId());
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  }
 
 
  @Override
  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);
     
View Full Code Here

Examples of org.mt4j.components.interfaces.IMTComponent3D

  /* (non-Javadoc)
   * @see org.mt4j.input.inputProcessors.componentProcessors.AbstractCursorProcessor#cursorStarted(org.mt4j.input.inputData.InputCursor, org.mt4j.input.inputData.MTFingerInputEvt)
   */
  @Override
  public void cursorStarted(InputCursor cursor, MTFingerInputEvt fe) {
    IMTComponent3D comp = fe.getTargetComponent();
    InputCursor[] theLockedCursors = getLockedCursorsArray();
    //if gesture isnt started and no other cursor on comp is locked by higher priority gesture -> start
    if (theLockedCursors.length == 0 && this.canLock(getCurrentComponentCursorsArray())){
      dc = new DragContext(cursor, comp);
      if (!dc.isGestureAborted()){ //See if the drag couldnt start (i.e. cursor doesent hit component anymore etc)
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.