Package com.aetrion.flickr.photos

Examples of com.aetrion.flickr.photos.PhotosInterface


        return peopleInterface;
    }

    public PhotosInterface getPhotosInterface() {
        if (photosInterface == null) {
            photosInterface = new PhotosInterface(apiKey, sharedSecret, transport);
        }
        return photosInterface;
    }
View Full Code Here


   * the list of found fotos
   */
  public PhotoList getSearchedFotoList(SearchParameters sp, int n, int startPage, boolean isGeoSearch) {
    PhotoList photoList = null;
    //Interface with Flickr photos
    PhotosInterface photoInterface = f.getPhotosInterface();
   
    try {
      //TODO was kann man damit machen?
      //GeoInterface g = photos.getGeoInterface();
      //search results for exact location, display on map
     
      /*
      //Search in a location bounding box
      sp.setBBox(
          "16.3680536232", "48.2057162608",
          "16.3760536232", "48.2111162608");
      sp.setAccuracy(1);
      sp.setHasGeo(true);
      */
     
      //Search in a location with a radius
      /*
      sp.setLatitude("48.7771056");
      sp.setLongitude("9.1807688");
      sp.setRadius(5);
      sp.setRadiusUnits("km");
      sp.setHasGeo(true);
      sp.setAccuracy(Flickr.ACCURACY_REGION);
      */
     
     
//      /*
      //Instead of taking the location, search for a nearby flickr "place"
      if (isGeoSearch && sp.getLongitude() != null && sp.getLatitude() != null
        && usePlacesForGeoSearch
      ){
        //TODO TEST DISABLE FIXME
        //Search for places at a location
        PlacesInterface p = f.getPlacesInterface();
        PlacesList placesList = null;
//        placesList = p.findByLatLon(48.7771056f,   9.1807688f, 14);
//        placesList = p.findByLatLon(40.689, -74.044, 12); //liberty islang
        placesList = p.findByLatLon(Double.parseDouble(sp.getLatitude()), Double.parseDouble(sp.getLongitude()), sp.getAccuracy());

        sp.setLatitude(null);
        sp.setLongitude(null);
       
        System.out.println("Places found: " + placesList.size());
        for (int i = 0; i < placesList.size(); i++) {
          Place place = (Place) placesList.get(i);
          String placeID = place.getPlaceId();
          //System.out.println("Place ID: " + placeID);

          sp.setPlaceId(placeID);
          sp.setWoeId(place.getWoeId());
         
//          Location placeResolved = p.resolvePlaceURL(place.getPlaceUrl());
//          System.out.println("Place: " + placeResolved);
         
//          sp.setBBox(
//          48.5129f, 2.1740f,
//          48.5130f, 2.1741f);
        }
      }
//      else if (isGeoSearch && sp.getLongitude() != null && sp.getLatitude() != null
//          && !usePlacesForGeoSearch){
//       
//      }
//      */
     
      //We're looking for n images, starting at "page" startPage
      //PhotoList
      photoList = photoInterface.search(sp, n, startPage);
     
      //Check if no fotos were found and search again with reduced accurracy
      if (isGeoSearch
        &&  photoList     != null
        ){
        System.out.println("Found " + photoList.size() + " fotos.");
       
        if (photoList.size() <= 0){
          System.out.println("Found no fotos, reducing accuracy and trying again.");
          int a = sp.getAccuracy();
         
          for (int i = 1; i < 6; i++) {
            a--;
            if (a < 1){
              a++;
              break;
            }
          }
         
          System.out.println("Using new accuracy: " + a);
          sp.setAccuracy(a);
          photoList = photoInterface.search(sp, n, startPage);
          if (photoList != null)
            System.out.println("Found " + photoList.size() + " fotos.");
        }
      }
     
      if (isGeoSearch){
        //System.out.println("Trying to attach geo information:");
        if (photoList != null){
          GeoInterface g = photoInterface.getGeoInterface();
         
          //Nullpointer error - bug in flickj library,
          //photosForLocation return aber evtl nur eigene fotos!
//          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());
View Full Code Here

TOP

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

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.