Examples of IPreDrawAction


Examples of org.mt4j.sceneManagement.IPreDrawAction

       
        flickrLoader.addProgressFinishedListener(new IMTEventListener(){
      public void processMTEvent(MTEvent mtEvent) {
        System.out.println("Loading finished!");
       
        p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
          public boolean isLoop() {
            return false;
          }

          public void processAction() {
            progressBar.setVisible(false);
            Photo[] photos = flickrLoader.getPhotos();
            for (int i = 0; i < photos.length; i++) {
              Photo foto = photos[i];
              String id = foto.getId();
              //System.out.println("Foto ID:" + id);
              boolean alreadyContained = false;
              Collection<Photo> vlaues = tagToPhoto.values();
              for (Iterator<Photo> iterator = vlaues.iterator(); iterator.hasNext();) {
                Photo photo = (Photo) iterator.next();
                if (photo.getId().equalsIgnoreCase(foto.getId())){
                  alreadyContained = true;
                }
              }
             
              if (!alreadyContained/*!tagToPhoto.containsValue(foto)*/){
                String fotoName = foto.getTitle();
                if (foto.hasGeoData()){
                  GeoData geo = foto.getGeoData();
                  float lat = geo.getLatitude();
                  float lon = geo.getLongitude();
                  System.out.println("\"" + fotoName + "\"" + " Has GeoData! -> Lat:" + lat + " Lon:" + lon + " PlaceID: " + foto.getPlaceId());

                  Point2f pointOnScreen   = map.locationPoint(new Location(lat, lon));
//                  System.out.println(" -> Point on Screen: " + pointOnScreen);

                  Vector3D vecOnScreen   = new Vector3D(0,0,0f);
//                  Vector3D vecOnScreen   = new Vector3D(pointOnScreen.x , pointOnScreen.y , 0.01f);
//                  Vector3D vecOnScreen   = new Vector3D(pointOnScreen.x -p.width/2 +128, pointOnScreen.y -p.height/2 +128, 0.01f);

                  //System.out.println("-> Creating tag at: " + vecOnScreen);
                  if pointOnScreen.x >= 0 && pointOnScreen.x <= p.width
                    &&  pointOnScreen.y >= 0 && pointOnScreen.y <= p.height
                  ){
                    final MTEllipse tagCircle = new MTEllipse(p, vecOnScreen, 15, 15, 30);
                    tagCircle.setPickable(true);
                    tagCircle.setFillColor(new MTColor(90, 205, 230, 200));
                    tagCircle.setDrawSmooth(true);
                    tagCircle.setStrokeWeight(2);
                    tagCircle.setStrokeColor(new MTColor(40, 130, 220, 255));
                    tagCircle.translate(new Vector3D(pointOnScreen.x, pointOnScreen.y , 0.0f));
                    tagCircle.transform(tagContainer.getGlobalInverseMatrix());
                    tagCircle.setName(id);
                   
                    tagToPhoto.put(tagCircle, foto);
                   
                    tagContainer.addChild(tagCircle);
                   
                    tagCircle.unregisterAllInputProcessors();
                    tagCircle.registerInputProcessor(new TapProcessor(p));
                    tagCircle.addGestureListener(TapProcessor.class, new IGestureEventListener(){
                      //@Override
                      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();
                             
                              //Disable and remove the fototag
                              tagCircle.setGestureAllowance(TapProcessor.class, false);
                             
                              p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
                                public boolean isLoop() {
                                  return false;
                                }
                                public void processAction() {
//                                  fotoTagContainer.removeChild(tagCircle);
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

  public void mouseWheelMoved(MouseWheelEvent e) {
         int notches = e.getWheelRotation();
         System.out.println(notches);
         if (notches < 0) {
           p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
          public boolean isLoop() {
            return false;
          }
          public void processAction() {
            scaleMap(1.1f);
          }
           });
         } else {
           p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
          public boolean isLoop() {
            return false;
          }
          public void processAction() {
            scaleMap(0.9f);
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

        case TapEvent.BUTTON_CLICKED:
          //System.out.println("Button clicked: " + label);
          cell.setFillColor(cellFillColor);
          list.setVisible(false);
          loadingScreen.setVisible(true);
          registerPreDrawAction(new IPreDrawAction() {
            public void processAction() {
              getMTApplication().invokeLater(new Runnable() {
                public void run() {
                  loadNewPuzzle(imageName, horizontalTiles, verticalTiles);
                  loadingScreen.setVisible(false);
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

    for (int i = 0; i < tiles.length; i++) {
      final AbstractShape sh = tiles[i];
      //Delay to smooth the animation because of loading hickups
      final float x = ToolsMath.getRandom(0, MT4jSettings.getInstance().getWindowWidth());
      final float y = ToolsMath.getRandom(0, MT4jSettings.getInstance().getWindowHeight());
      registerPreDrawAction(new IPreDrawAction() {
        public void processAction() {
          getMTApplication().invokeLater(new Runnable() {
            public void run() {
              registerPreDrawAction(new IPreDrawAction() {
                public void processAction() {
                  getMTApplication().invokeLater(new Runnable() {
                    public void run() {
                      puzzleGroup.addChild(sh);
                      sh.tweenTranslateTo(x, y, 0, 400, 0f, 1.0f);
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

  public void mouseClicked(MouseEvent arg0) {
    int b = arg0.getButton();
    switch (b) {
    case MouseEvent.BUTTON2:
      map.setZoom(map.bestZoomForScale((float) map.sc));
       p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
          public boolean isLoop() {
            return false;
          }
          public void processAction() {
            updateTagContainerScale();
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

      String fotoUrl = foto.getMediumUrl(); //Get the bigger photo
      image = new MTImage(p.loadImage(fotoUrl), p);

      this.addProgressFinishedListener(new IMTEventListener(){
        public void processMTEvent(MTEvent mtEvent) {
          p.getCurrentScene().registerPreDrawAction(new IPreDrawAction(){
            public boolean isLoop() {
              return false;
            }

            public void processAction() {
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

                      //Define action when loader thread finished
                      flickrLoader.addProgressFinishedListener(new IMTEventListener(){
                    public void processMTEvent(MTEvent mtEvent) {
                      //Add the loaded fotos in the main drawing thread to
                      //avoid threading problems
                      registerPreDrawAction(new IPreDrawAction(){
                        public void processAction() {
                          MTImage[] fotos = flickrLoader.getMtFotos();
                          for (int i = 0; i < fotos.length; i++) {
                            MTImage card = fotos[i];
                            card.setUseDirectGL(true);
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

//              drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
//              pa.saveFrame();
//              clear(pa.g);
//            }
//          });
          drawingScene.registerPreDrawAction(new IPreDrawAction() {
            public void processAction() {
              //drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
              pa.saveFrame();
            }
            public boolean isLoop() {
View Full Code Here

Examples of org.mt4j.sceneManagement.IPreDrawAction

          final InputCursor m = posEvt.getCursor();
//          System.out.println("PrevPos: " + prevPos);
//          System.out.println("Pos: " + pos);

          if (posEvt.getId() != AbstractCursorInputEvt.INPUT_ENDED){
            registerPreDrawAction(new IPreDrawAction() {
              public void processAction() {
                boolean firstPoint = false;
                Vector3D lastDrawnPoint = cursorToLastDrawnPoint.get(m);
                Vector3D pos = new Vector3D(posEvt.getPosX(), posEvt.getPosY(), 0);
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.