Package com.aetrion.flickr.photos

Examples of com.aetrion.flickr.photos.Photo


        PhotoContext photoContext = new PhotoContext();
        while (iter.hasNext()) {
            Element element = (Element) iter.next();
            String elementName = element.getTagName();
            if (elementName.equals("prevphoto")) {
                Photo photo = new Photo();
                photo.setId(element.getAttribute("id"));
                photoContext.setPreviousPhoto(photo);
            } else if (elementName.equals("nextphoto")) {
                Photo photo = new Photo();
                photo.setId(element.getAttribute("id"));
                photoContext.setNextPhoto(photo);
            } else {
                System.err.println("unsupported element name: " + elementName);
            }
        }
View Full Code Here


        PhotoContext photoContext = new PhotoContext();
        while (iter.hasNext()) {
            Element element = (Element) iter.next();
            String elementName = element.getTagName();
            if (elementName.equals("prevphoto")) {
                Photo photo = new Photo();
                photo.setId(element.getAttribute("id"));
                photoContext.setPreviousPhoto(photo);
            } else if (elementName.equals("nextphoto")) {
                Photo photo = new Photo();
                photo.setId(element.getAttribute("id"));
                photoContext.setNextPhoto(photo);
            } else if (elementName.equals("count")) {
              // TODO: process this information
            } else {
                System.err.println("unsupported element name: " + elementName);
View Full Code Here

        User owner = new User();
        owner.setId(photosetElement.getAttribute("owner"));
        photoset.setOwner(owner);

        Photo primaryPhoto = new Photo();
        primaryPhoto.setId(photosetElement.getAttribute("primary"));
        primaryPhoto.setSecret(photosetElement.getAttribute("secret")); // TODO verify that this is the secret for the photo
        primaryPhoto.setServer(photosetElement.getAttribute("server")); // TODO verify that this is the server for the photo
        primaryPhoto.setFarm(photosetElement.getAttribute("farm"));
        photoset.setPrimaryPhoto(primaryPhoto);

        // TODO remove secret/server/farm from photoset?
        // It's rather related to the primaryPhoto, then to the photoset itself.
        photoset.setSecret(photosetElement.getAttribute("secret"));
View Full Code Here

            User owner = new User();
            owner.setId(photosetElement.getAttribute("owner"));
            photoset.setOwner(owner);

            Photo primaryPhoto = new Photo();
            primaryPhoto.setId(photosetElement.getAttribute("primary"));
            primaryPhoto.setSecret(photosetElement.getAttribute("secret")); // TODO verify that this is the secret for the photo
            primaryPhoto.setServer(photosetElement.getAttribute("server")); // TODO verify that this is the server for the photo
            primaryPhoto.setFarm(photosetElement.getAttribute("farm"));
            photoset.setPrimaryPhoto(primaryPhoto);

            photoset.setSecret(photosetElement.getAttribute("secret"));
            photoset.setServer(photosetElement.getAttribute("server"));
            photoset.setFarm(photosetElement.getAttribute("farm"));
View Full Code Here

        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }

        Element photoElement = response.getPayload();
        Photo photo = new Photo();
        photo.setId(photoElement.getAttribute("id"));

        List tags = new ArrayList();
        Element tagsElement = (Element) photoElement.getElementsByTagName("tags").item(0);
        NodeList tagElements = tagsElement.getElementsByTagName("tag");
        for (int i = 0; i < tagElements.getLength(); i++) {
            Element tagElement = (Element) tagElements.item(i);
            Tag tag = new Tag();
            tag.setId(tagElement.getAttribute("id"));
            tag.setAuthor(tagElement.getAttribute("author"));
            tag.setAuthorName(tagElement.getAttribute("authorname"));
            tag.setRaw(tagElement.getAttribute("raw"));
            tag.setValue(((Text) tagElement.getFirstChild()).getData());
            tags.add(tag);
        }
        photo.setTags(tags);
        return photo;
    }
View Full Code Here

        photos.setTotal(photosElement.getAttribute("total"));

        NodeList photoNodes = photosElement.getElementsByTagName("photo");
        for (int i = 0; i < photoNodes.getLength(); i++) {
            Element photoElement = (Element) photoNodes.item(i);
            Photo photo = PhotoUtils.createPhoto(photoElement);
            photos.add(photo);
        }
        return photos;
    }
View Full Code Here

          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);
                                  tagToPhoto.remove(tagCircle);
                                  tagCircle.destroy();
                                }

                              });
                            }
                            break;
                          default:
                            break;
                          }
                        }
                        return true;
                      }
                    });
                  }//if point is on screen
                  else{
                    System.out.println("Foto not on screen: position:" + pointOnScreen +  " Title: "+ foto.getTitle() + " id:" + id);
                  }
              }else{
                System.out.println("Foto already loaded: "+ foto.getTitle() + " id:" + id);
              }
               
                /*
                ImageCard[] images = flickrLoader.getMtFotos();
                ImageCard image = images[i];
View Full Code Here

            //pa.unregisterPre(this);
            this.setFinished(true);
            break;
          }
         
          Photo foto = (Photo) fotoList.get(i);
          String fotoName = foto.getTitle();
         
          /*
          if (foto.hasGeoData()){
            System.out.println("Foto: " + fotoName + " has geodata.");
            System.out.println(fotoName + "-> Lat:" + foto.getGeoData().getLatitude() + " Lon:" + foto.getGeoData().getLongitude() + " PlaceID: " + foto.getPlaceId());
View Full Code Here

//          PhotoList fot = g.photosForLocation(new GeoData( new Float(48.7771056f).toString(), new Float(9.1807688f).toString(), new Integer(1).toString()), null, 5, 0);
//          System.out.println("photosForLocation (location = stutgart mitte) returned fotos: " +  fot.size());
         
          //Go through all found fotos
          for (int i = 0; i < photoList.size(); i++) {
            Photo foto = (Photo) photoList.get(i);
            //Add to result list
            photos.add(foto);
           
            String id = foto.getId();
            try {
              GeoData loc = g.getLocation(id);
              if (loc != null){
                foto.setGeoData(loc);
              }
            } catch (Exception e) {
              System.err.println("Error fetching geodata for foto");
              e.printStackTrace();
            }
View Full Code Here

   */
  private String[] getFotoUrls(PhotoList list){
    //Grab all the image paths and store in String array
    String[] smallURLs = new String[list.size()];
    for (int i = 0; i < list.size(); i++) {
      Photo p = (Photo) list.get(i);
//      smallURLs[i] = p.getSmallUrl();
//      smallURLs[i] = p.getUrl();
      smallURLs[i] = p.getMediumUrl();
    }
    return smallURLs;
  }
View Full Code Here

TOP

Related Classes of com.aetrion.flickr.photos.Photo

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.